Try to make mksquashfs follow --compress option if squash module is
included, if not specified or invalid, fall back to use mksquashfs's
default compressor.
No function change, decide which compressor to use right before
compressing the initramfs.
This may delay the print of this message:
"dracut: no compression tool available. Initramfs image is going to be big."
but should be OK, this message is not an error.
Simplify the squash mount layout. Instead of overlay on each top
directory (/etc, /usr), just mount and switch_root into the squash
image, with a overlay on top of it.
Also install the binaries and setup scripts separately, so the squash
setup code and the squash image content is independent of each other,
all squash setup script and binaries can be deleted safely upon
switch_root.
With this change, previous squash clean up service and other tricky
implementations are all gone.
This commit depends on systemd commits from:
https://github.com/systemd/systemd/pull/18124
Previouly systemd doesn't recognize non-ramfs initramfs, now this is
doable with SYSTEMD_IN_INITRD=lenient
Signed-off-by: Kairui Song <kasong@redhat.com>
When a GZIP environment variable is set, this leads to various breakage:
In case 'pigz' is installed and GZIP is defined as a path, e.g.
/usr/local/bin/gzip, then dracut will fail with the following message:
"
pigz: abort: cannot provide files in GZIP environment variable
"
In case 'pigz' isn't installed and regular 'gzip' is used and GZIP is
defined as a path, e.g. /usr/local/bin/gzip, then the path will be
zipped and dracut will fail for no obvious reason. Trying again, dracut
will then fail with following message:
"
gzip: /usr/local/bin/gzip.gz already exists; not overwritten
"
In any case, GZIP environment should be unset to avoid breakage or
unwanted behaviour. This variable is anyway obsolescent, from gzip(1)
manpage.
Signed-off-by: Renaud Métrich <rmetrich@redhat.com>
There is no `fstab_lines_l` variable used before.
The `--include` option was turned into `++include` and therefore the
switch option is not reachable anymore.
If SIGWHATEVER will be processed after fsfreeze -f, but before fsfreeze
-u we will end up with /boot/ never unfrozen, let's try to minimize risk of this.
Previously with `no_kernel` the `for` loop errored on the modules
wildcard. By checking, if the file exists, this is mitigated.
"mv" asked interactively, if aliased in the user session, so a "--force"
was added.
Allow overriding the systemctl command for sysroot with $SYSTEMCTL
Modified every modules' module-setup.sh to use the envvar instead
of the hardcoded command name.
Signed-off-by: Zoltán Böszörményi <zboszor@pr.hu>
Commit de3cb0e321 moved libpthread workaround after the code that runs
ldconfig. As a result, if installed in a non-default path, libgcc_s.so.1
could not be found by dynamic linker.
The kernel does not allow the cmdline to be overridden if one is defined
in the uefi image. This means that bootloaders like systemd-boot or
grub cannot manage boot options (editing at boot for debug being a use
case). This patchset allows for no cmdline to be set (instead of force
setting one if none is provided).
Fixes: https://github.com/dracutdevs/dracut/issues/1012
Signed-off-by: Matthew Thode <mthode@mthode.org>
Currently when network is enabled, dracut will install all network
drivers that are currently loaded, but some time only one NIC is needed
for the initramfs.
So for strict hostonly mode, add a --hostonly-nics option, user can
provide a list of NICs to be enabled, and only needed drivers for
specifed NICs will be installed so save space.
Signed-off-by: Kairui Song <kasong@redhat.com>
- use [ ] instead of calling test manually, as most of the script is
doing.
- use quotes in hostonly_cmdline blocks, specially when dealing with the
conf files, whose names are set by users/system administrators
- uefi_splash_image was being assigned set to `${dracutsysroot}...`, which
is a variable that doesn't exist.
- we don't want the conditional to run the output of fsfreeze as
commands. Instead, we just need to know if any of the fsfreeze commands
failed.
The kernel command line was being written both into
/etc/cmdline.d/01-default.conf and the UEFI executable.
During boot, getcmdline would concatenate these two
resulting in all arguments being duplicated. Some
args, such as ip=, are sensitive to the number of
times they are specified.
The new dracutsysrootdir could be used to replace the shell function
required_in_root, so drop it and also simplify the code.
Signed-off-by: Kairui Song <kasong@redhat.com>
This fixes two issues:
1) on non-x86 systems in non-hostonly config this would cause
an annoying warning on every initramfs generation
2) on non-x86 systems in hostonly config this would result in
early microcode not getting disabled
On Fedora/RHEL, libcryto will verify both itself and libssl on start, if
libssl is missing, FIPS self test will fail. However libssl is not a
dependency of libcryto so dracut will not install it, unless some other
binary or library pulls it in. Systemd requires libssl, so in most cases
it just worked, but could fail in some corner cases where systemd is not
used.
Signed-off-by: Kairui Song <kasong@redhat.com>
Emit a warning about possible misconfigured configuration files, where
the spaces around values are missing for +=""
Better report a possible source of problems. We can fix annoying false
positives later.
Ability to use `$TMPDIR` was introduced in bc1e69b but
causes the `--tmpdir` option on the command line to be
ignored. Switch to only using `$TMPDIR` if `--tmpdir`
wasn't specified.
Use environment variable TMPDIR (typically /run/user/$UID) as default
temporary directory, if available. This should be more private
location than /var/tmp. Path specified with --tmpdir is takes
precedence over TMPDIR and /var/tmp is still used as last resort if
neither TMPDIR is set nor --tmpdir is used.
Signed-off-by: Topi Miettinen <toiwoton@gmail.com>
dracut.sh already doesn't call fsfreeze if the output file is on
the root file system. For btrfs, however, this is not sufficient.
Because fsfreeze is a superblock operation, and all btrfs subvolumes
share the same superblock, fsfreeze may freeze the entire system
if the subvolume on which the output file is written and / are
subvolumes of the same file system. Avoid this by comparing file
system UUIDs for btrfs.
Fixes: de576db3c2 ("call fsfreeze(8) on /boot to flush initramfs data & metadata to media")
If the temporary directory for images is mounted with 'noexec', dracut
would construct unbootable images because most dynamic libraries
aren't installed. Avoid this by not resolving library dependencies
lazily if the temporary directory is mounted with 'noexec'.
Signed-off-by: Topi Miettinen <toiwoton@gmail.com>
Checks if `uefi_splash_image` exists in `dracutsysroot` if not unset
`uefi_splash_image`. Alternate Value parameter expansion adds section-vma
for splash image to EFI stub loader when the path to image is valid and
not an empty file.
I did not test on other distributions, but on Arch Linux the `systemd`
package includes a splash image at the path
`/usr/share/systemd/bootctl/splash-arch.bmp`. Perhaps, if this is a
common practice, a default image could be gathered from that directory.
It is required that the image be in bitmap (`.bmp`) format according to
`splash.c`.
The code for `stub.c` and `splash.c` can be found at:
https://github.com/systemd/systemd/blob/master/src/boot/efi/stub.chttps://github.com/systemd/systemd/blob/master/src/boot/efi/splash.c