Pavel Valena [Wed, 12 Jun 2024 04:06:32 +0000 (06:06 +0200)]
feat(systemd*): include systemd config files from /usr/lib/systemd
and also use proper variables for the paths.
--
The new systemd reads from both /etc and /usr/, so to accomodate this,
I've added new paths to install configs from (I probably haven't covered
all). This changes only hostonly behaviour; uses global variables:
Philipp Rudo [Wed, 14 Aug 2024 14:33:23 +0000 (16:33 +0200)]
fix(squash-erofs): properly exclude $squashdir
Option --exclude-path from mkfs.erofs requires a path relative to the
source of the image. Otherwise the path won't be excluded resulting in a
slightly larger (~1M) initrd.
Fixes: ebc9e84d ("feat(squash): add module 95squash-erofs") Signed-off-by: Philipp Rudo <prudo@redhat.com>
dracut-install calls ldd to resolve dependencies, but when the `--sysroot`
option is used, ldd is not performing the search within the sysroot directory.
To fix this issue, the `LD_LIBRARY_PATH` variable needs to be properly set to
the directories containing shared libraries within the specified sysroot
directory.
E.g., running dracut with `--sysroot` produces an initrd without the required
systemd shared libraries when the version between the host system and the
sysroot directory differs:
```
localhost:~ # ldd /.snapshots/9/snapshot/usr/lib/systemd/systemd | grep libsystemd
libsystemd-core-256.so => not found
libsystemd-shared-256.so => not found
localhost:~ # export LD_LIBRARY_PATH=/.snapshots/9/snapshot/usr/lib64/systemd
localhost:~ # ldd /.snapshots/9/snapshot/usr/lib/systemd/systemd | grep libsystemd
libsystemd-core-256.so => /.snapshots/9/snapshot/usr/lib64/systemd/libsystemd-core-256.so (0x00007f817b600000)
libsystemd-shared-256.so => /.snapshots/9/snapshot/usr/lib64/systemd/libsystemd-shared-256.so (0x00007f817b000000)
```
Fabian Vogt [Mon, 5 Aug 2024 09:28:32 +0000 (11:28 +0200)]
fix(dracut-functions.sh): only return block devices from get_persistent_dev
With udev 256, there are now directories such as
/dev/disk/by-path/pci-0000:02:00.0-nvme-1-part/ which match here.
In case a nonexisting file/device was passed to get_persistent_dev, it
returned the first directory it looked at because both have maj:min 0:0.
This accidental conversion from garbage to a sensible looking path leads
to weird behaviour later.
Instead of filtering out directories explicitly switch the check to only
return block devices, which also takes care of the character special
/dev/mapper/control.
Philipp Rudo [Tue, 30 Jul 2024 11:44:32 +0000 (13:44 +0200)]
fix(squash): use 99busybox instead of installing it manually
Make use of 99busybox in 99squash rather than installing it manually.
This not only removes duplicate code but allows mixing of busybox with
tools from coreutils. This requires a small change in 99busybox to
remove the hard coded use of $initdir.
Suggested-by: Laszlo Gombos <laszlo.gombos@gmail.com> Signed-off-by: Philipp Rudo <prudo@redhat.com>
At the moment 99squash relies on dracut-install to create the required
directories it later links to. This approach is error prone and will
cause problems when switching to use 99busybox later on, which tries to
add a link to /usr/sbin that hasn't been created. Thus explicitly
create the expected directories before installing the minimal initrd.
Philipp Rudo [Tue, 23 Jul 2024 16:33:37 +0000 (18:33 +0200)]
feat(lsinitrd): add support for erofs images
Add support to handle erofs images in lsinitrd. Unfortunately the erofs
tooling is missing some functionality of unsquashfs, esp. the ability to
extract single files and list the content of the image. Work around this
deficiency by always extracting the full image and emulate the missing
functionality as close as possible.
While at it also handle the rename of the squashfs image to
squashfs-root.img.
Philipp Rudo [Tue, 23 Jul 2024 15:42:33 +0000 (17:42 +0200)]
feat(squash): add module 95squash-erofs
Allow squashing the image in 99squash using erofs. Keep squashfs as
default to not change existing systems. I.e. only use erofs if the user
explicitly include 95squash-erofs or when the prereqs for squashfs are
missing.
Philipp Rudo [Tue, 23 Jul 2024 14:39:13 +0000 (16:39 +0200)]
feat(squash): split 95squash-squashfs from 99squash
99squash only allows squashing the files using squashfs. In order to
make the implementation for different filesystems easier split out the
squashfs specific parts into 95squash-squashfs.
While at it rename the root image contained in the initrd to
squashfs-root.img. This allows tools like lsinitrd to detect the
filesystem used later on.
Philipp Rudo [Mon, 22 Jul 2024 14:30:50 +0000 (16:30 +0200)]
feat(squash): move mksquashfs to 99squash/modules-setup
When using 99squash dracut actually builds two separat initrds. The
"normal" one, that gets squashed into a squashfs image, and a
"minimalistic" one, whose only task is to mount and switch_root to the
squashfs image.
For that 99squash currently requires a lot of special handling in
dracut.sh. Move most of this special handling into 99squash itself. This
requires a new approach when building the "minimalistic" initrd. The new
approach works the following way
1. During the installation phase install the "normal" initrd into
$initdir and the "minimalistic" initrd into $squashdir.
2. Strip the binaries in $initdir.
3. Trigger a special postinstall hook in 99squash that squashes the
content of $initdir (excluding $squashdir) into the squashfs image,
removes the content of $intidir (excluding $suqashdir) and, moves the
content of $squashdir into $initdir.
Philipp Rudo [Thu, 25 Jul 2024 10:47:00 +0000 (12:47 +0200)]
fix(dracut-init.sh): add module to mods_to_load before checking dependencies
When implementing erofs support for 99squash we end up with three
modules 99squash, 95squash-squashfs and 95squash-erofs. Where 99squash
contains the common code for filesystem images and
95squash-{squashfs,erofs} the special handing depending on the
filesystem used. This leads to a dependency cycle as we want to allow
users both to choose 99squash, when the exact filesystem doesn't matter,
as well as 95squash-{squashfs,erofs} when a specific filesystem is
required.
But when 99squash is added as a dependency calling
dracut_module_included fails in its depends() function. This lead to
cases where both handlers, 95squash-squashfs and 95squash-erofs, were
added to the initrd.
Reason for the failure is that a module only is marked to be loaded
after all it's dependencies have been checked as well. Thus a child
module cannot detect which parent module wants it to be included. Fix
this by marking modules to be loaded before checking its dependencies in
check_module. Do the same change in check_mount for consistency.
Philipp Rudo [Mon, 22 Jul 2024 14:46:47 +0000 (16:46 +0200)]
feat(dracut-init.sh): allow changing the destination directory for inst et al
When using 99squash dracut actually builds two separate initrds. The
"normal" one, that gets squashed into a squashfs image, and a
"minimalistic" one, whose only task is to mount and switch_root to the
squashfs image.
This is currently done the following way:
1. Skipp install() for 99squash during the "normal" installation phase.
2. Trigger a special postinstall hook in 99squash that moves the content
of $initdir to $squashdir and installs the "minimalistic" initrd to
$initdir.
3. Strip the binaries in $initdir (of which $squashdir is a sub
directory of).
4. Squash the content of $squashdir into the squashfs image and remove
$squashdir.
The problem with this approach is that the steps 2 and 4 specific to
99squash but need to be done in dracut.sh. Thus a lot of special
handling for 99squash is needed in dracut.sh. This will get even more
complex once support for different filesystem images, e.g. erofs, are
implemented.
In order to be able to move most of the functionality into 99squash
itself a new approach will be chosen, i.e.
1. During the installation phase install the "normal" initrd into
$initdir and the "minimalistic" initrd into $squashdir.
2. Strip the binaries in $initdir.
3. Trigger a special postinstall hook in 99squash that squashes the
content of $initdir (excluding $squashdir) into the squashfs image,
removes the content of $intidir (excluding $suqashdir) and, moves the
content of $squashdir into $initdir.
With that the only special handling remaining in dracut.sh is triggering
the postinstall hook.
However, in inst et al. the destination directory is hard coded to
$initdir. Thus allow setting a different destination directory in inst
et al. to get the new approach to work. For the time being only do that
for the functions required by 99squash.
feat(busybox): use busybox --install to install itself
Previous commits in this PR exposed a bug whereby some utilities
(e.g. dd) had both a busybox applet version and a coreutils version.
The busybox dracut module should not enforce taking always the
busybox version. The `busybox --install` command is safer option
that does not overwrite an existing binary of already exists.
By using a GitHub team for the CODEOWNERS file, we can
easily add and remove people through the interface for
global committers and avoid unnecessary churn.
Add new version commit number to the commit message.
Lock clog version to a version that is working well.
Allow clog to be installed in the user home as well.
Martin Wilck [Tue, 16 Jul 2024 14:55:03 +0000 (16:55 +0200)]
fix(multipath): include module with "find_multipaths strict"
The previous commits 377d52c and 4957ffa excluded the multipath module in
non-hostonly mode, with the purpose of avoiding to start multipath in the
initramfs on systems that don't use multipath. This is against the idea of
non-hostonly, which is to build an initramfs with all kernel modules and tools
that may be necessary to bring up the system.
This patch takes a different approach. In non-hostonly mode, if there are no
multipath devices and no multipath.conf, include the multipath module, but
require "find_multipaths strict" policy. This will ensure that users that don't
use dm-multipath won't be surprised by finding their root device under
multipath control. But the multipath tools will still be included in the
initramfs, allowing users to set up multipathing e.g. on the emergency shell if
necessary. Also, if /etc/multipath/wwids exists, it will be included in the
initramfs and will cause the WWIDs listed in that file to be multipathed.
Note that in multipath-tools upstream and many Linux distributions,
"find_multipaths strict" is the default anyway. Users of distributions with
different defaults (e.g. openSUSE) would just need to create
/etc/multipath.conf (possibly with empty contents) to override this behavior if
they intend to activate multipath in the initramfs.
Fixes: 377d52c ("fix(multipath): omit module if included with no multipath devices") Fixes: 4957ffa ("fix(multipath): omit module if included with no multipath devices")
Brian C. Lane [Fri, 12 Jul 2024 22:43:12 +0000 (15:43 -0700)]
test(DMSQUASH): add test for part of erofs support
This adds a test for using erofs on a bare partition by
creating a new disk image, root_erofs, and writing the erofs compressed
/source directory directly to partition 1 and then booting the image
with root=live:/dev/disk/by-label/dracut_erofs
This doesn't quite test the anaconda-dracut use case of calling
dmsquash-live-root with the path of an erofs compressed file, but it is
close enough for now.
Brian C. Lane [Wed, 10 Jul 2024 23:30:09 +0000 (16:30 -0700)]
feat(dmdquash-live): add support for using erofs
This adds support for rootfs compressed with erofs. Either as a plain
erofs image or a LiveOS/rootfs.img ext4 filesystem compressed with
erofs.
This patch does not make any attempt to change the squashfs directory
naming (or variable names) in order to make these changes as small as
possible and easy to review. It also does not make any attempt to
support the multitude of available options other than what is needed by
anaconda-dracut calling this script to setup the boot.iso root
filesystem.
(which isn't to say it doesn't work, it just hasn't been tested and is
outside the scope of this change).
feat(kernel-modules): install platform/chrome modules on ARM/RISC-V
Most ARM Chromebooks need the ChromiumOS Embedded Controller drivers
located under kernel/drivers/platform/chrome for essential functionality
like keyboard, USB, and display backlight. Add them to the non-hostonly
initramfs by adding them to the ARM/RISC-V-specific instmods call.
Huaxin Lu [Thu, 20 Jun 2024 05:38:26 +0000 (13:38 +0800)]
fix(dracut-install): copy xattr when use clone ioctl
When use clone ioctl to copy a file, the extended attributes of files are
missing, which is inconsistent with the result by using the cp command.
This commit add the process to copy extended attributes after clone_file().