Commit Graph

366 Commits (d4caa86aba35b51dc1adda3ee3a5bae677420082)

Author SHA1 Message Date
tpgxyz 7dbadcc749 add support for Zstandard 2017-09-05 01:23:38 +02:00
Ziyue Yang bd93e9287d dracut.sh: disable lsinitrd logging when quiet
Currently in Fedora/RedHat dracut installs its fedora.conf.example
as the default config file, in which sysloglvl is set 5. This leads
to maxloglvl=5 in dracut calls, making unnecessary lsinitrd calls
during initramfs builds by kdump.

This patch disables lsinitrd logging when --quiet option is given,
which is controlled by maxloglvl only before. This will speed up
dracut image building as the following if --quiet is used in kdump:

1) Before this patch
$ kdumpctl stop; touch /etc/kdump.conf; time kdumpctl start
kexec: unloaded kdump kernel
Stopping kdump: [OK]
Detected change(s) in the following file(s):
  /etc/kdump.conf
Rebuilding /boot/initramfs-4.13.0-0.rc1.git4.1.fc27.x86_64kdump.img
kexec: loaded kdump kernel
Starting kdump: [OK]
real    0m26.824s
user    0m9.958s
sys     0m15.106s

2) After this patch
$ kdumpctl stop; touch /etc/kdump.conf; time kdumpctl start
kexec: unloaded kdump kernel
Stopping kdump: [OK]
Detected change(s) in the following file(s):
  /etc/kdump.conf
Rebuilding /boot/initramfs-4.13.0-0.rc1.git4.1.fc27.x86_64kdump.img
kexec: loaded kdump kernel
Starting kdump: [OK]
real    0m20.420s
user    0m8.385s
sys     0m10.468s

Signed-off-by: Ziyue Yang <ziyang@redhat.com>
2017-08-23 11:23:34 +08:00
Xunlei Pang 5634a31156 rootfs-block/module-setup.sh: check root_devs in cmdline_rootfs()
In case of "--no-hostonly-default-device", we do not need
the root device, thus add this check.

Also fixed the stale "root_dev" export.

Signed-off-by: Xunlei Pang <xlpang@redhat.com>
2017-08-18 14:44:19 +08:00
Xunlei Pang 37f2fe55d1 dracut.sh: introduce "--no-hostonly-default-device" argument
Kdump doesn't need default host devices like root, swap, fstab, etc,
we only care about the dump target which can be added via "--mount"
or "--add-device". We met several issues that kdump kernel failed
due to one of those host devices added by dracut, additionally, the
needless devices(e.g. LVM) consume some appreciable amount of memory
which is more likely to cause OOM under memory-limited kdump.

So this patch introduced "--no-hostonly-default-device" to avoid
adding those default devices as host_devs.

Signed-off-by: Xunlei Pang <xlpang@redhat.com>
2017-08-18 09:58:08 +08:00
Ankit Kumar e316ae0e43 Sync initramfs after creation
If we trigger crash just after creating initramfs, sometimes it is
observed that initramfs is not written to disk causing the subsequent
boot to fail. A sync should resolve this.

Signed-off-by: Ankit Kumar <ankit@linux.vnet.ibm.com>
2017-08-09 12:04:16 +02:00
Harald Hoyer ae989390a1 dracut.sh: --nofscks does not take parameters
fixes: https://github.com/dracutdevs/dracut/issues/264
2017-08-07 11:39:45 +02:00
Daniel Molkentin 76dd870bfd Do generate error when hostonly_cmdline is set to "no"
Reference: bsc#1048748
2017-07-17 17:01:07 +02:00
Harald Hoyer 106255afd4 bail out if module directory does not exist
this basically reverts commit 05214a0bed

if people want to build the initramfs without kernel modules,
then --no-kernel should be specified
2017-06-29 17:09:50 +02:00
Harald Hoyer 940169e8d8 check for CONFIG_ACPI_TABLE_UPGRADE
additionally as for CONFIG_ACPI_INITRD_TABLE_OVERRIDE
config parameter got renamed
2017-06-27 12:29:07 +02:00
Daniel Molkentin 8b6d136e62 Make binutils optional when elfutils are available
This is intended for minimum host OSes where 36 MB used by binutils
are deemed too expensive. We only need "strip", which exists as eu-strip
in elfutils, which in turn is < 1 MB in size.

Note that the tests (TEST-04-FULL-SYSTEMD/test.sh) still depend on
strip from binutils. It could use sstrip in the future.
2017-04-10 11:28:04 +02:00
Harald Hoyer f0bfada399 dracut.sh: strip NUL bytes in stream before push in string
seems like bash-4.4 does not like NUL bytes in variables
2017-03-30 12:52:11 +02:00
Harald Hoyer 53475faa81 Correct path for UEFI stub
respect any $prefix given to the systemd installation

https://github.com/dracutdevs/dracut/pull/196
2017-03-20 11:43:04 +01:00
Harald Hoyer 647b521fc7 dracut: check for EUID instead of UID 2017-01-18 11:04:36 +01:00
Harald Hoyer 83a6d6f928 dracut.sh: add /dev/random and /dev/urandom to static device nodes
otherwise libgcrypt might complain

https://bugzilla.redhat.com/show_bug.cgi?id=1401444
2017-01-18 10:37:10 +01:00
Harald Hoyer 8a32bf6107 dracut: unset LC_* after setting LANG and LC_ALL
otherwise bash/glibc might complain verbosely about not finding locales
2017-01-18 10:35:41 +01:00
Harald Hoyer 7e51a94f5b Do not "cp" the selinux context
replace "cp -a" with $DRACUT_CP, so in case the selinux policy disallows
root to set the selinux context in /var/tmp, dracut does not fail.
2017-01-16 14:27:39 +01:00
Harald Hoyer 5c57209ba5 dracut.sh: add default path for --uefi
The default output filename for --uefi is
<EFI>/EFI/Linux/linux-$kernel$-<MACHINE_ID>-<BUILD_ID>.efi.
<EFI> might be /efi, /boot or /boot/efi depending on where the ESP partition
is mounted. The <BUILD_ID> is taken from BUILD_ID in /usr/lib/os-release or
if it exists /etc/os-release and is left out, if BUILD_ID is non-existant or
empty.

Also a new option --no-machineid was added, which affects the default output
filename of --uefi and will discard the <MACHINE_ID> part.
2017-01-16 14:27:39 +01:00
Harald Hoyer 39c725dc4e Merge pull request #157 from ddiss/fix_relative_tmpdir
dracut.sh: support --tmpdir as a relative path
2017-01-09 10:42:40 +01:00
Andreas Stieger 0db98910a1 dracut.sh: create the initramfs non-world readable also if early cpio is used
Fixes: 5f2c30d9bc
Previously fixed CVE-2012-4453: e1b48995c2

Signed-off-by: Andreas Stieger <astieger@suse.com>
2016-11-07 10:41:38 +01:00
David Disseldorp bafc82e732 dracut.sh: support --tmpdir as a relative path
Dracut changes working directory before attempting to output files under
$DRACUT_TMPDIR , resulting in an IO failure if $DRACUT_TMPDIR is a path
relative to the working directory when dracut was started.

Fixes: https://github.com/dracutdevs/dracut/issues/156

Signed-off-by: David Disseldorp <ddiss@suse.de>
2016-10-10 16:27:47 +02:00
Harald Hoyer f367b73852 dracut.sh: document --hostonly-i18n and --no-hostonly-i18n
show description in --help

https://bugzilla.redhat.com/show_bug.cgi?id=1266448
(cherry picked from commit 91896ab68e)
2016-08-19 15:49:33 +02:00
Harald Hoyer 3889234f71 dracut.sh: make tmp dirs after the trap function is installed
otherwise a good timed ctrl-c will leave the tmp dir around
2016-06-29 17:32:31 +02:00
Colin Guthrie 55b99a0e4c dracut.sh: fix $tmpfilesdir fallback when systemd-devel is not installed.
Bug introduced in 3a04bddeed in Dec 2014.
2016-06-07 10:48:49 +02:00
Harald Hoyer 3f60444ec1 removed obsolete kernel module functions and host_modules variable
module_is_host_only()
find_kernel_modules_by_path()
find_kernel_modules()
2016-04-15 16:48:13 +02:00
Harald Hoyer 0297fdcb3e Merge pull request #123 from dracut-mailing-devs/40374262.eB5p3XdtTH@linux-lm3i.site
Correctly handle module aliases
2016-04-15 12:05:44 +02:00
Harald Hoyer 794b2d2c75 Use dracut-install to install kernel modules
dracut-install can now install kernel modules and their corresponding
firmware files.
2016-04-11 16:32:10 +02:00
Harald Hoyer f7f5b82b43 dracut.sh: call dracut-install with "-f" in FIPS mode
in fips mode, dracut-install was called with "-H" instead of "-f" in
FIPS mode

missed conversion of commit 26cd262a6a
2016-04-11 11:57:30 +02:00
Fabian Vogt 43819af68c Correctly handle module aliases
Handle module aliases correctly to not generate unbootable
initrds with different kernel versions when modules were renamed
or replaced.

Signed-off-by: Fabian Vogt <fvogt@suse.com>
2016-01-21 18:02:40 +01:00
Harald Hoyer b019952f6d dracut.sh: fail hard, if we find modules and modules.dep is missing
If modules are present in /lib/modules/<kernelversion> and modules.dep
is empty, depmod was not run most likely.
2016-01-13 09:32:24 +01:00
Harald Hoyer 60928f36b6 dracut.sh: restorecon final image file
Instead of "mv" use "cp --reflink=auto" and restorecon the final image
2016-01-08 11:37:25 +01:00
Harald Hoyer 62c00a8896 dracut.sh: only create one TMPDIR
use DRACUT_TMPDIR subdirs for everything
2015-11-25 14:21:33 +01:00
Harald Hoyer c44d2252bb dracut.sh: for microcode generation, skip gpg files
skip all ".asc" files for the AMD microcode generation
2015-11-18 10:58:54 +01:00
Harald Hoyer 27d7936f0e dracut.sh: save systemdutildir env
even, if no systemd is used, we need that variable for systemd-udevd
2015-11-17 09:45:29 +01:00
Harald Hoyer 2da041d672 Check for systemd before installing systemd specific files
https://bugzilla.redhat.com/show_bug.cgi?id=1282010
2015-11-16 09:41:26 +01:00
Harald Hoyer 63a44c8dc3 dracut.sh: add back host_modules part
host_modules was removed accidently while remove host_modaliases
2015-11-16 09:26:51 +01:00
Harald Hoyer 07a081f352 dracut.sh: remove the concept of host_modalias
We can never gather enough information about compiled in modules, so
don't pretend to know and do smart decisions.
2015-11-13 13:40:38 +01:00
Fabian edbd9ca058 dracut.sh: Support --mount with just mountpoint as parameter
Right now the --mount parameter of dracut expects a rather long fstab-like
line. This makes it possible to invoke dracut with e.g. --mount /boot.
2015-11-13 13:21:43 +01:00
Harald Hoyer 10f8df1bdf add --no-reproducible to turn off reproducible mode
Also warn about cpio not supporting it and turn it on by default for
fedora.
2015-11-13 11:53:36 +01:00
Harald Hoyer b44156c6fc dracut.sh: fixed typo in microcode generation
(cherry picked from commit a594b4e357)
2015-11-11 16:47:48 +01:00
Harald Hoyer efba549a26 dracut.sh: no microcode, if get_ucode_file returns empty file
check, if get_ucode_file() returned an empty string.

(cherry picked from commit 327d765512)
2015-11-11 16:47:03 +01:00
Harald Hoyer 583fb23199 dracut.sh: do not create microcode, if no firmware is available
(cherry picked from commit 13b5c1d09e)
2015-11-11 16:46:16 +01:00
Harald Hoyer b73e00aff7 dracut.sh: add command line option for install_i18_all
--no-hostonly-i18n -> install_i18n_all=yes
--hostonly-i18n -> install_i18n_all=no

(cherry picked from commit 34b551a1c4)
2015-11-11 16:45:48 +01:00
Harald Hoyer 2cc5e92e21 dracut.sh: quote $outfile on error removal 2015-11-11 11:49:34 +01:00
Harald Hoyer 875426f2fc dracut.sh: remove "_EARLY" from CONFIG_MICROCODE_* checks
EARLY is merged in the main driver
2015-11-11 11:48:32 +01:00
Harald Hoyer 3177d12d2b Merge pull request #91 from dracut-mailing-devs/1437470322-992-1-git-send-email-cfan@redhat.com
remove the incomplete .img file
2015-11-11 11:48:21 +01:00
Lidong Zhong aa169b3bd3 dracut.sh: remove duplicate call of push_host_devs
There is no way exit between the two places that call push_host_devs
2015-08-24 18:27:54 +08:00
Harald Hoyer 3c00189988 dracut.sh: remove quotes from install_items and install_optional_items
Unfortunately these are lists with whitespaces.
2015-08-10 14:05:15 +02:00
Harald Hoyer 96d694c0b5 dracut.sh: simplify modalias reading 2015-07-30 12:11:42 +02:00
Harald Hoyer 693b7a3283 Cleanup compressor handling
If no compressor is specified, try to find a suitable one.

Check if kernel modules can be uncompressed.
2015-07-22 11:35:28 +02:00
Chao Fan 7eeaa4ab14 remove the incomplete .img file
If the directory where the .img file is saved has no enough space, or in
other wrong conditions, dracut will get an incomplete file xxx.img. But
sometimes this .img file will be loaded when rebooting the system. And then
some bugs will happen because this .img file is wrong.

So I think dracut should remove the incomplete file because this .img file
with problems was made by dracut. And then the wrong file will not be loaded
anymore.

Signed-off-by: Chao Fan <cfan@redhat.com>
2015-07-21 12:05:42 +02:00
Harald Hoyer e50f91e600 use mktemp "-p" instead of "--tmpdir" for busybox 2015-07-15 11:47:43 +02:00
Harald Hoyer ee44f62972 dracut.sh: early check for bash version 2015-07-09 19:44:30 +02:00
Harald Hoyer e8f19bcf26 dracut.sh: remember $0 for --regenerate-all 2015-07-09 18:22:15 +02:00
Harald Hoyer cb0913db0d dracut.sh: reduce code 2015-07-09 18:06:55 +02:00
Harald Hoyer 3721635b2c guard ${arrays[@]} with "" 2015-07-09 15:36:25 +02:00
Harald Hoyer 694725abf0 dracut.sh: remove pop() 2015-07-09 15:36:25 +02:00
Harald Hoyer 5a66d51102 dracut.sh: remove push()
can be done with var+=(val)
2015-07-09 15:36:25 +02:00
Harald Hoyer 1cadc26fd4 Add all btrfs devices
We have to find them with "btrfs usage", which is cumbersome.
2015-07-09 15:36:25 +02:00
Harald Hoyer 777f2db037 splitup dracut-init.sh from dracut-functions.sh
other tools want to source dracut-functions.sh without any mkdir side
effects.
2015-07-02 16:04:05 +02:00
Harald Hoyer 916559e073 dracut.sh: add devices with x-initrd.mount in /etc/fstab to host_devs
otherwise dracut might not even be able to mount those.
2015-07-02 14:55:31 +02:00
Dimitri John Ledkov 80dab03a7d Fix default udev & systemd dir detection, in usr-merge configurations.
Test that /lib is not a symlink, before using split-usr paths.
2015-06-22 11:56:28 +01:00
Christian Rodrigues b52cfbeaa5 Correct paths for openSUSE
openSUSE has things stored in different places, so fixup the
paths here.

Signed-off-by: Christian Rodrigues <crrodriguez@opensuse.org>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Thomas Renninger <trenn@suse.de>
2015-06-02 12:24:59 +02:00
Harald Hoyer b562bc55a8 Merge pull request #67 from dracut-mailing-devs/1432116434-18050-1-git-send-email-cfan@redhat.com
Change the fs_passno of nfs to 0
2015-06-02 11:57:58 +02:00
Harald Hoyer dfec3c2d8b Merge pull request #68 from dracut-mailing-devs/1431698021-16626-3-git-send-email-colin@mageia.org
dracut: Make host only mode more resilient to missing swaps.
This patch set allows swap devices to disappear without cocking up a
host-only initramfs boot.
2015-06-02 11:54:07 +02:00
Harald Hoyer e409c9e8f8 Merge pull request #65 from scop/comment
Fix stale comment about required bash version
2015-06-02 11:10:59 +02:00
Harald Hoyer 0e5c01f8b8 Merge pull request #66 from scop/lbzip2
Use lbzip2 instead of bzip2 if available
2015-06-02 11:10:29 +02:00
Harald Hoyer 3ac9cdb1c5 dracut.sh: fall back to /usr/lib/os-release, if /etc/os-release missing 2015-05-28 19:47:37 +02:00
Ville Skyttä ee84640963 Use lbzip2 instead of bzip2 if available 2015-05-24 22:29:20 +03:00
Ville Skyttä f8139a8b28 Fix stale comment about required bash version 2015-05-24 22:26:20 +03:00
Chao Fan 3586a7aa77 Change the fs_passno of nfs to 0
There is a bug that kdump-initrd contains entry requesting nfs dump
filesystem to get filesystemchecked. And there is an erro message said
that nfs need be checked. But there's no fsck for nfs utility, e.g
fsck.nfs like other file system. Whatever fs_passno 0 or 2 are passed,
no fsck is executed at all for nfs mount.But in dracut, set it to be 2
always, so the erro message appear and it should be set to 0.

In the fstab,the sixth variable fs_passno stands for that the device need
checked or not,and dracut set it to "2".To fix this issue, it should
be "0" when the device is nfs.The third variable stands for the type of
the filesystem and we can use it to judge whether the device is nfs.
So when the third variable of fstab contains "nfs", the sixth variable
fs_passno should be set to "0".

Signed-off-by: Chao Fan <cfan@redhat.com>
2015-05-20 12:07:57 +02:00
Colin Guthrie 3e3ed34f03 base: Don't wait for swap devices in host-only mode.
The only reason we add swap devices to host-only mode (added in
dd5875499e) is to allow us to process
resume= arguments passed on the kernel command line when the swap
partition lives on something slightly more complex than a normal
partion (e.g. in an LVM or RAID setup).

By adding the device to host_devs, the necessary LVM and RAID hooks
are added and thus the underlying storage will be initialised OK, and
the 95resume module handles the waiting for the device (via udev rules
creating the /dev/resume symlink).

So ultimately, we do not need to hard-code the waiting for the swap
devices into the initramfs at build time as the waiting part can be
dynamic.

This makes things more resiliant to swap partitions disappearing and
being reformatted etc.

Inspired by a patch by Martin Whitaker on Mageia bug:
https://bugs.mageia.org/show_bug.cgi?id=12305
2015-05-15 16:01:41 +02:00
Harald Hoyer 6d58fa27a4 change "while read x" to cope with EOF without newline
while read x || [ -n "$x" ]

should do the trick
2015-04-28 11:39:15 +02:00
Harald Hoyer 2bc5054a64 Merge pull request #35 from enovance/fix_include_variables_name
dracut: Ajusting variables name for --include
2015-03-24 20:46:06 +01:00
Harald Hoyer 6f92423c89 dracut.sh: create /var/tmp 2015-03-24 16:03:11 +01:00
Harald Hoyer 636d2d46a5 dracut.sh: add support for creating a UEFI boot executable
With an EFI stub, the kernel, the initramfs and a kernel cmdline can be
glued together to a single UEFI executable, which can be booted by a
UEFI BIOS.
2015-03-20 14:31:23 +01:00
Harald Hoyer 21a209735a dracut.sh: only print cmdline from modules, which would be included 2015-03-20 14:31:22 +01:00
Harald Hoyer bee086532f dracut.sh: simplify module install loop 2015-03-20 14:31:22 +01:00
Harald Hoyer 9119059723 dracut.sh: factor out do_print_cmdline() 2015-03-19 11:04:02 +01:00
Harald Hoyer 6ac2c83570 dracut.sh: call bash with --norc
We don't want any user aliases or functions to be defined in dracut.
2015-02-19 09:55:12 +01:00
Harald Hoyer f182cb9599 dracut.sh: simplify the "find" for files with the x bit
'(' -perm -0100 -or -perm -0010 -or -perm -0001 ')'
is the same as
-perm /0111
2015-01-22 15:58:20 +01:00
Harald Hoyer 496e3d962d dracut.sh: handle empty $initrd/etc/cmdline.d 2015-01-21 09:32:20 +01:00
Erwan Velu c9364f6ea2 dracut: Ajusting variables name for --include
When reading the --include part of the script, we had the following
issues to make the code easy to read:
- src & tgt were extract for the original options
- i variable was a file or a directory from src
- s variable was the directory name in case $i was a directory

"s" sounds very close to "src" while "s" is on the "tgt" side. Very
confusing.

"s" was defined before the "if it's a directory" statement while it's
only used inside the "if".

"i" was commit from the "src" but wasn't really explicit.

Having some lines mixing "i" and "s" takes a little time to get read
properly.

This patch offer the following changes:
- "i" is renamed to "objectname" as we don't know if its a file or a
  directory

- "s" is renamed to "object_destdir" as the object name becomes a
  directory on the destdir

- "object_destdir" (former "s") is moved inside the "if" statement as it's
  only used here

- tgt is finally renamed to "target" to be more explicit. We are not all
  native english ;o)

My 2 (semantic) cents,
2014-12-19 14:49:00 +01:00
Erwan Velu 332ecaa900 dracut: Don't fail at copying files when including directories
When including a directory, the files were considered in the directory
name which lead to messages like :

cp: failed to access '/var/tmp/initramfs.L9s2zO///init-func': No such file or directory

This patch does make the destdir more explicit and copy files into the
destination directory instead of destdir/filename/
2014-12-19 13:42:57 +01:00
Harald Hoyer a17d5cf494 Revert "95rootfs-block: Correctly terminate commandline parameter"
This reverts commit 4b6b46bb2a.

$ ./dracut.sh -l --print-cmdline
root=UUID=d5e53483-30bc-4119-8c0c-841d47a2f76brootflags=rw,noatime,compress=lzo,ssd,discard,space_cache,autodefrag,inode_cacherootfstype=btrfs

instead of:

$ ./dracut.sh -l --print-cmdline
 root=UUID=d5e53483-30bc-4119-8c0c-841d47a2f76b
rootflags=rw,noatime,compress=lzo,ssd,discard,space_cache,autodefrag,inode_cache
rootfstype=btrfs

and also

$ make testimage
…
 *** Store current command line parameters ***
Stored kernel commandline:
root=UUID=d5e53483-30bc-4119-8c0c-841d47a2f76brootflags=rw,noatime,compress=lzo,ssd,discard,space_cache,autodefrag,inode_cacherootfstype=btrfs
…
2014-12-17 11:44:18 +01:00
Hannes Reinecke 4b6b46bb2a 95rootfs-block: Correctly terminate commandline parameter
95rootfs-block would not terminate the commandline parameter with
a space or newline, instead it'll rely on the main routine from
dracut.sh to do this.
Which will cause unexpected problems for any modules called
after this.

So terminate the commandline parameters correctly here and remove
the newline from dracut.sh.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Thomas Renninger <trenn@suse.de>
2014-12-16 13:29:37 +01:00
Thomas Renninger 6df523517f dracut.sh: Fix UUID= fstab parsing in case --mount option is passed
Dracut parses /etc/fstab when --mount is option is passed (e.g. kdump).

In host_devs variable the real block device must be stored, not UUID=
There are other /etc/fstab syntax possibilities we now warn that they
are not correctly parsed. This will be fixed by another patch
when there is time to test this properly.

Signed-off-by: Thomas Renninger <trenn@suse.de>
2014-12-16 13:29:36 +01:00
Thomas Renninger 118ca9ecfc dracut.sh: Avoid duplicate devices in host_devs
Signed-off-by: Thomas Renninger <trenn@suse.de>
2014-12-16 13:29:36 +01:00
jloeser 3838dc47c3 Check for logfile (--logfile option) and create it if necessary
If a logfile is passed to dracut via --logfile option and doesn't
exist, dracut doesn't create it and logs nothing. Instead, dracut
should try to touch the file and print a warning if creating fails.

References: bnc#892191
Signed-off-by: Thomas Renninger <trenn@suse.de>
2014-12-16 13:29:36 +01:00
Hannes Reinecke fe273e3901 Print stored dracut commandline during initramfs build
When generating the initramfs we should be printing out the
generated dracut commandline used for booting.
This will simplify debugging.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Thomas Renninger <trenn@suse.de>
2014-12-16 13:29:36 +01:00
Harald Hoyer 99d4fd6bb7 do not symlink /var/log to /run/log
some programs e.g. systemd-journald expect a directory in /var/log as
the marker to do some actions. Here journald tries to flush
/run/log/journal to /var/log/journal, if the directory is seen.

/var/log is now a symlink to /run/initramfs/log.
2014-12-01 12:36:20 +01:00
Harald Hoyer 3a04bddeed dracut.sh: add $tmpfilesdir to install files to /usr/lib/tmpfiles.d 2014-12-01 12:34:54 +01:00
Harald Hoyer 66fd7e4329 dracut.sh: don't check gzip for --rsyncable, if pigz is available 2014-10-29 14:18:34 +01:00
Vasiliy Tolstov 3c90cc2f48 fix gzip compress then it not supports rsyncable option
dracut fail to create initramfs when compressor gzip and
it not have rsyncable option

Signed-off-by: Vasiliy Tolstov <v.tolstov@selfip.ru>
2014-10-27 13:43:13 +03:00
Harald Hoyer ab2f95e45e dracut: fixed module dependency handling
Fail for "--modules" and "--force-add" dracut modules, if they or their
dependencies cannot be included.
2014-10-24 13:19:58 +02:00
Harald Hoyer 37383f7123 add "--loginstall <DIR>" and loginstall="<DIR>" options
loginstall specifies a directory, in which dracut-install records all
files, which were installed from the host system to the initramfs.

Use case is e.g. to create a list of packages to watch for updates, to
maybe trigger a recreation of the initramfs.
2014-09-11 16:42:36 +02:00
Thomas Renninger cea907f6bf dracut: Introduce --force-drivers parameter and force_drivers=+ config option
Which will not only add listed drivers, but also enforce that they are
tried to be loaded at early boot time.

This is needed if drivers which are not autoloaded (e.g. loop and a lot
others) shall get loaded via initramfs.
2014-09-08 12:37:52 +02:00
Harald Hoyer 5f2baf7dc6 dracut.sh: change the PATH we search for our binaries
/sbin /bin versions should be used over /usr/sbin and /usr/bin versions,
because non-usr is meant for early boot.

See also https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=755271
2014-09-05 16:42:59 +02:00
Harald Hoyer 967cc19ab1 remove all vim and emacs code format comments 2014-08-29 13:38:47 +02:00
Harald Hoyer e27ecc9ae8 dracut.sh: source dracut-version.sh earlier than dracut-functions.sh
Otherwise dracut-logger.sh outputs an empty version on journal testing.

Aug 20 10:15:49 lenovo dracut[11144]: dracut-
Aug 20 10:15:49 lenovo dracut[11148]: Executing: /sbin/dracut
2014-08-20 10:21:43 +02:00
Harald Hoyer 8e3f653749 Check kernel config for early microcode and ACPI override
Disable early microcode and ACPI override, if the kernel does not
support it.
2014-08-20 10:13:55 +02:00
Harald Hoyer 80626ded3e Generate reproducible initramfs images
With the same source of files, it should be possible to generate the
same image file with every dracut run.

To accomplish this, we modify the timestamps of the files we generate at
runtime, call gzip with "-n" and cpio with "--reproducible".

The cpio --reproducible option is not yet upstream though, so if you
feel like it should be then please nag at the cpio mailing list.
http://lists.gnu.org/archive/html/bug-cpio/2014-08/msg00000.html
2014-08-15 13:52:02 +02:00
Harald Hoyer eab9b75c8a dracut.sh: add DRACUT_PATH
DRACUT_PATH can now be used to specify the PATH used by dracut
to search for binaries instead of the default
/usr/sbin:/sbin:/usr/bin:/bin

This should be set in the distribution config file
/usr/lib/dracut/dracut.conf.d/01-dist.conf
2014-07-22 15:09:02 +02:00
Harald Hoyer 54b68829b6 add "--install-optional" and install_optional_items 2014-07-22 14:09:06 +02:00
Harald Hoyer 6cd7001b35 dracut.sh: always copy prelink files in FIPS mode
regardless of the the prelink={yes|no} switch
2014-07-08 11:50:04 +02:00
Harald Hoyer 30f6c80d7a default to hostonly_cmdline=yes, if hostonly
if hostonly_cmdline is not yet set, set it to "yes", if in hostonly
mode.
2014-06-30 12:03:12 +02:00
Harald Hoyer 8dcc483053 dracut.sh: add libgcc_s, if libpthread is installed
workaround the fact, that pthread_cancel() wants to
dlopen libgcc_s.so.1
2014-06-20 11:19:49 +02:00
Harald Hoyer 535f61ca4a Do not log to kmsg/syslog and files for "--print-cmdline" 2014-05-07 14:59:13 +02:00
Harald Hoyer ee4b74fb9c Do not wait_for_dev if hostonly_cmdline not set 2014-03-06 09:55:19 +01:00
WANG Chao 646e0506f6 Add -[-no]-hostonly-cmdline option handling for getopt
commit ab9457e introduce such new options but it missed to add these
options to getopt arguments.

Signed-off-by: WANG Chao <chaowang@redhat.com>
2014-03-03 12:41:28 +01:00
Dave Young 5f6a495bf4 add default values in fstab_lines
It's useful for passing a full fstab line including like fs_passno so fsck
can take effect.

Previously it's assumed that there's no fs_freq and fs_passno in fstab lines
so original code just append "0 0" at the end of each fstab lines.

Improve this issue by assign default value in case they are not passed in.
Three field are handled here:
fs_mntops: default to "defaults"
fs_freq: default to "0"
fs_passno: default to "2"

Signed-off-by: Dave Young <dyoung@redhat.com>
2014-02-28 12:10:47 +01:00
Harald Hoyer ab9457efd7 Add flag to toggle hostonly cmdline storing in the initramfs
--hostonly-cmdline:
    Store kernel command line arguments needed in the initramfs

--no-hostonly-cmdline:
    Do not store kernel command line arguments needed in the initramfs
2014-02-26 15:01:55 +01:00
Amadeusz Żołnowski 4eec1a2276 Added missing quotes
See bug report at https://bugs.gentoo.org/show_bug.cgi?id=502064
2014-02-26 14:55:54 +01:00
Alexander Tsoy 8a2db478de Add legacy flag (-l) to lz4 and update magic number
Linux kernel does not support the new default lz4 format.

https://bugs.gentoo.org/show_bug.cgi?id=502102
2014-02-26 14:55:54 +01:00
Harald Hoyer dc4c1ee39d dracut.sh: write directly to the output file
Because we already remove the output file before writing to it, we don't
have to play games and write to a temporary file first.
2014-02-19 15:22:39 +01:00
Colin Guthrie 8da51857f0 dracut.sh: Fix variable name typo.
This caused the root_dev variable not to be set which in turn meant that
the root device was not whitelisted in 99base/module-setup.sh when injecting
compile-time devexists hooks in hostonly initrds. This ties the generated
initrd to the root fs device (typically the UUID) rather than relying solely
only the root= kernel command line.

While it is hostonly, not hardcoding e.g. UUIDs is still desirable. Any
swap partition on the host device is still added however.
2014-02-07 18:05:48 +01:00
Harald Hoyer c8a9a6b4a7 dracut.sh: only set the owner of files to 0:0, if generated as non-root
If the root user generates the initramfs image, preserve the ownership
of the files. This of course cannot be done for non-root users
generating an initramfs image.
2014-01-30 16:18:04 +01:00
Harald Hoyer b9909e3341 dracut.sh: add early_cpio marker file to the early cpio 2014-01-24 15:29:24 +01:00
Harald Hoyer 8e5db363e8 dracut.sh: set file owners of early cpio files to 0:0 2014-01-24 15:27:15 +01:00
Harald Hoyer cd08059f49 dracut.sh: create early cpio dir for acpi tables 2014-01-24 15:26:43 +01:00
Harald Hoyer f49ec88a3f dracut.sh: s#\"#'# for error messages 2014-01-24 12:49:17 +01:00
Hari Bathini 659dc319d9 Dracut: Add a new argument "--rebuild"
Add "rebuild" option to dracut to  append the current  arguments
to those with  which the input initramfs image was  built.  This
option helps in incrementally building initramfs for testing.

    Usage: dracut [output_file] --rebuild input_file

If optional output file  is not provided, input file provided to
rebuild will be used as output file.

This patch alters  the creation of the initramfs image by adding
the file "/tmp/params.txt" to the image. Command line parameters
excluding "--rebuild",  input  &  output image names and "kernel
version" are stored in this file.  In case "--rebuild" parameter
is specified, "/tmp/params.txt" file, if present in input image,
is read and its contents "prepend"ed to the current command line
parameters, that is if such a file is already present. Also,  it
stores the  cumulative parameters to the file "/tmp/params.txt",
in the  new image. This patch  has been tested successfully on a
PowerBox with f19. It does not alter the behaviour of any of the
existing  options.

Signed-off-by: Manik Bajpai <manibajp@linux.vnet.ibm.com>
Signed-off-by: Hari Bathini <hbathini@linux.vnet.ibm.com>

[Edited-by: Harald Hoyer]
Simplified the cpio extraction process by using 'lsinitrd'.
2014-01-24 12:49:17 +01:00
Koen Kooi a76a22b779 Use builtin xz/lzma option to use all cores for multihreaded compression
This removes the dependency on 'getconf' as well, which is not installed by default on my embedded systems.

Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
2014-01-24 12:49:16 +01:00
Harald Hoyer 45404a2ad8 dracut-install,dracut: fix ldd output parsing
dracut-install could not handle output like:
	/lib/$LIB/liblsp.so => /lib/lib64/liblsp.so (0x00007faf00727000)

also unset LD_PRELOAD, so we get a clean environment
2014-01-17 14:52:01 +01:00
Harald Hoyer a956a464ef dracut.sh: add /boot/efi to device paths
Add /boot/efi to device paths, so the filesystem driver is included
and it can be repaired in the initramfs.
2014-01-13 09:51:04 +01:00
Harald Hoyer 87483405a0 dracut.sh: add missing piece for option --add-device 2014-01-13 09:51:04 +01:00
Hannes Reinecke ee54b8404c Make logfile configurable
Add '--logfile' option to make the log file configurable during
runtime.

Signed-off-by: Hannes Reinecke <hare@suse.de>
2013-12-05 15:13:29 +01:00
Harald Hoyer b29cb51654 dracut-functions.sh: do not force require modules.builtin* 2013-12-05 15:13:29 +01:00
Harald Hoyer 64ae4e07a4 dracut.sh: skip crypt swaps with password files 2013-12-03 16:21:04 +01:00
Harald Hoyer e41f3f9025 dracut.sh:_get_fs_type() if block device exists return early
even, if no ID_FS_TYPE was found, return if the block device exists
2013-12-03 16:21:04 +01:00
Vratislav Podzimek a3bfaa1919 Run 'xz' and 'lzma' with multiple threads
This speeds up compression a lot on multicore systems.

https://bugzilla.redhat.com/show_bug.cgi?id=1029786

[Edited-by: Harald Hoyer: use getconf for cpu_count]
2013-11-13 13:20:39 +01:00
Harald Hoyer cf3fd99e72 dracut.sh: fixed PATH shortener 2013-11-02 13:14:40 +01:00
Harald Hoyer 4d7c18c7c0 Handle crypto modules with and without modaliases
If new kernels have modules split out, handle the case, where modules
have to modalias and just install them.

Also add the crypto drivers and names to host_modalias.
2013-10-30 12:24:37 +01:00
Harald Hoyer 8d89fc6bb1 dracut.sh: no need to make subdirs in run 2013-10-16 11:39:17 +02:00
Harald Hoyer 68b736b50f dracut.sh: also mkdir /run/lock, which is copied to 2013-10-16 11:31:54 +02:00
P J P 871c8e40d1 Add lzo, lz4 compression and read INITRD_COMPRESS
This patch adds support for lzop(1) & lz4(1) compression
algorithms to compress iniramfs image file. Both are supported
by the Linux kernel.

Linux kernel exports user's choice of initramfs compression
algorithm as a shell environment variable: INITRD_COMPRESS.
This patch adds support to read this variable and duly compress
the initramfs image file.

Environment variable INITRD_COMPRESS has less precedence than the
command line options --gzip, etc. Ie. command line options could
override the compression algorithm defined by $INITRD_COMPRESS.

Signed-off-by: P J P <ppandit@redhat.com>

[Edited-by: Harald Hoyer: add documentation about lzo and lz4]
2013-10-14 09:38:06 +02:00
Harald Hoyer 05214a0bed dracut.sh: do not bail out, if kernel modules dir is missing
and only print a warning message
2013-10-08 15:05:21 +02:00
Harald Hoyer 96cf7270da dracut.sh: bail out early, if destination dir is not writeable 2013-10-02 12:48:11 +02:00
Thomas Renninger f3b14c2b6a dracut: Implement ACPI table overriding
An example config file for this feature could be:

/etc/dracut.conf.d/03-acpi-override.conf

with this content:
acpi_override="yes"
acpi_table_dir="/etc/dracut.conf.d/acpi_tables"

Then all files ending with *.aml will be put into the early cpio
(kernel/firmware/acpi) and will be used to replace the BIOS provided tables
if the kernel supports this feature.

Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Thomas Renninger <trenn@suse.de>
2013-10-02 12:47:11 +02:00
Thomas Renninger d8b04dc184 dracut: Do not create early_cpio if no suitable microcode exist in hostonly case
Intel microcodes only exist for very specific family/model/stepping CPUs.
If no microcode gets added, there is no need to create an empty
(only directories) cpio later that gets glued to the initrd.

This also fixes:

*** Constructing GenuineIntel.bin ****
cat: /lib/firmware/intel-ucode/06-3c-03: No such file or directory

in hostonly mode if there is no suitable microcode for the CPU.

Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Thomas Renninger <trenn@suse.de>
2013-10-02 12:47:11 +02:00
Thomas Renninger b5b608e44a dracut: Generlize microcode early cpio usage
ACPI early table override also may need to place files into an early cpio.
Reflect this in variable and file names.
This change is renaming only and does not introduce any real change.

Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Thomas Renninger <trenn@suse.de>
2013-10-02 12:47:11 +02:00
Harald Hoyer f4a942783a Add option to turn on/off prelinking
--prelink, --noprelink

do_prelink=[yes|no]
2013-09-17 12:25:29 -05:00
Harald Hoyer 3b9aaaab42 dracut.sh: we don't need to read the modalias files
udev does only parse the uevent MODALIAS line, so whatever is in the
modalias files would not trigger any module load.
2013-09-13 18:05:48 +02:00
Harald Hoyer fc68c87afa dracut.sh: also search uevent's for MODALIAS 2013-09-13 17:34:18 +02:00
Harald Hoyer 57f90974f9 dracut.sh: harden host_modalias reading
Some weird PPC driver make their modulias unreadable

$ cat /sys/devices/vio/4000/modalias
cat: /sys/devices/vio/4000/modalias: No such device
2013-09-13 16:33:01 +02:00
Colin Walters 36b2e5e2c2 dracut.sh: Fixup previous commit to only read /sys and /proc in hostonly mode
The gnome-ostree build system generates dracut initramfs images on the
build server, therefore not in hostonly mode.  The build system at the
moment doesn't mount /sys, and the previous commit caused a hard
failure due to lack of /sys/devices.

Because we only want /sys/devices in hostonly mode, just move those
bits inside the hostonly conditional above.
2013-09-11 22:50:22 +02:00
Harald Hoyer 3c4315fa13 dracut-functions.sh: extend module_is_host_only()
If the currently running kernel is not present in the installer root,
fall back to modalias checking.
2013-09-11 12:53:50 +02:00
Harald Hoyer 540a5169b9 dracut.sh: reorder things to let "--print-cmdline" work 2013-09-09 16:52:19 +02:00
Harald Hoyer ffc68f357e use ${var:+val} rather than ${var+val}
${var:+val} also catches var=""
2013-08-22 11:24:01 +02:00
Harald Hoyer c82a11334d dracut-functions.sh: add expand_persistent_dev()
also fixes missing '{' for LABEL=... swaps
2013-08-20 16:03:17 +02:00
Harald Hoyer 546d5dacf5 dracut.sh: recognize swap entries in fstab with mountpoint "none" 2013-08-20 12:01:17 +02:00