Commit Graph

166 Commits (d9b5a98532b6823adb35f7c68766f4df9db8a3c9)

Author SHA1 Message Date
Colin Guthrie 589b4e61e2 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

(cherry picked from commit 3e3ed34f03)
2015-07-03 14:06:29 +02:00
Harald Hoyer 1211a10b95 splitup dracut-init.sh from dracut-functions.sh
other tools want to source dracut-functions.sh without any mkdir side
effects.

(cherry picked from commit 777f2db037)
2015-07-02 19:47:46 +02:00
Chao Fan a218f3253c 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>
(cherry picked from commit 3586a7aa77)
2015-07-02 19:47:46 +02:00
Harald Hoyer 90b5b48734 dracut.sh: add devices with x-initrd.mount in /etc/fstab to host_devs
otherwise dracut might not even be able to mount those.

(cherry picked from commit 916559e073)
2015-07-02 15:16:06 +02:00
Harald Hoyer cf3098064c dracut.sh: add $tmpfilesdir to install files to /usr/lib/tmpfiles.d
(cherry picked from commit 3a04bddeed)
2015-04-02 16:13:24 +02:00
Harald Hoyer 9eb6db5b9a 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.

(cherry picked from commit 99d4fd6bb7)
2015-04-02 16:11:31 +02:00
Harald Hoyer 6914b67545 dracut: fixed module dependency handling
Fail for "--modules" and "--force-add" dracut modules, if they or their
dependencies cannot be included.

(cherry picked from commit ab2f95e45e)
2015-01-14 11:46:39 +01:00
Hari Bathini f2c5c5c961 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'.

(cherry picked from commit 659dc319d9)
2014-09-04 12:57:43 +02:00
Hannes Reinecke 81a6e87f0f Make logfile configurable
Add '--logfile' option to make the log file configurable during
runtime.

Signed-off-by: Hannes Reinecke <hare@suse.de>
(cherry picked from commit ee54b8404c)
2014-09-04 12:47:36 +02:00
Harald Hoyer 52923f5f2a dracut-functions.sh: do not force require modules.builtin*
(cherry picked from commit b29cb51654)
2014-09-04 12:47:31 +02:00
Harald Hoyer c46be83492 dracut.sh: no need to make subdirs in run
(cherry picked from commit 8d89fc6bb1)
2014-09-04 12:47:27 +02:00
Harald Hoyer c2ce987e38 dracut.sh: also mkdir /run/lock, which is copied to
(cherry picked from commit 68b736b50f)
2014-09-04 12:47:23 +02:00
Harald Hoyer bb232c88fa dracut.sh: always copy prelink files in FIPS mode
regardless of the the prelink={yes|no} switch

(cherry picked from commit 6cd7001b35)
2014-07-29 12:06:13 +02:00
Harald Hoyer a2a9a17cc6 Do not log to kmsg/syslog and files for "--print-cmdline"
(cherry picked from commit 535f61ca4a)
2014-07-29 11:59:33 +02:00
Alexander Tsoy 07c4a2fce5 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-07-29 11:52:07 +02:00
Harald Hoyer 84c66ac857 Do not wait_for_dev if hostonly_cmdline not set 2014-07-29 11:52:07 +02:00
WANG Chao e2e32cd02f 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-07-29 11:52:06 +02:00
Dave Young d52c4a761a 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-07-29 11:52:06 +02:00
Harald Hoyer 81c9e22482 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-07-29 11:52:06 +02:00
Harald Hoyer 6381b94459 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-07-29 11:52:06 +02:00
Colin Guthrie 361eaeaf07 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-07-29 11:52:06 +02:00
Harald Hoyer 286fbebdaf 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-07-29 11:52:05 +02:00
Harald Hoyer eb7c58eced dracut.sh: add early_cpio marker file to the early cpio 2014-07-29 11:52:05 +02:00
Harald Hoyer 87862728da dracut.sh: set file owners of early cpio files to 0:0 2014-07-29 11:52:05 +02:00
Harald Hoyer 0d4bb7ce89 dracut.sh: create early cpio dir for acpi tables 2014-07-29 11:52:05 +02:00
Koen Kooi dfaeee7341 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-07-29 11:52:05 +02:00
Harald Hoyer cb97abc7bb 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-07-29 11:52:04 +02:00
Harald Hoyer 82286609c9 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-07-29 11:52:04 +02:00
Harald Hoyer ea9b961e8c dracut.sh: add missing piece for option --add-device 2014-07-29 11:52:04 +02:00
Harald Hoyer 8d7bd6af19 dracut.sh: fixed PATH shortener 2014-07-29 11:52:03 +02:00
Vratislav Podzimek 90441c4476 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]
2014-07-29 11:52:03 +02:00
Harald Hoyer 7f61e2c895 dracut.sh: skip crypt swaps with password files 2014-07-29 11:52:03 +02:00
Harald Hoyer fb67162559 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
2014-07-29 11:52:03 +02:00
Harald Hoyer ee916b72cc 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.
2014-07-29 11:52:03 +02:00
P J P 123feea1fa 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]
2014-07-29 11:52:02 +02:00
Harald Hoyer f0df0f3fcd dracut.sh: do not bail out, if kernel modules dir is missing
and only print a warning message
2014-07-29 11:52:02 +02:00
Harald Hoyer cf9f56be9c dracut.sh: bail out early, if destination dir is not writeable 2014-07-29 11:52:02 +02:00
Thomas Renninger ebc7f823c0 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>
2014-07-29 11:52:02 +02:00
Thomas Renninger ff33b57676 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>
2014-07-29 11:52:02 +02:00
Thomas Renninger 4b1aa19fa0 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>
2014-07-29 11:52:02 +02:00
Harald Hoyer 96f48da50c Add option to turn on/off prelinking
--prelink, --noprelink

do_prelink=[yes|no]
2014-07-29 11:52:02 +02:00
Harald Hoyer 72ce014bc7 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.
2014-07-29 11:52:02 +02:00
Harald Hoyer af34b26047 dracut.sh: also search uevent's for MODALIAS 2014-07-29 11:52:02 +02:00
Harald Hoyer ffecc45232 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
2014-07-29 11:52:02 +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