Frederick Grose [Wed, 8 Nov 2023 18:08:19 +0000 (13:08 -0500)]
fix(check_live_ram): increase /run tmpfs size, if needed
Check the size and available space in /run to enlarge it,
if needed.
Introduce the check_meminfo() function to dracut-lib.sh
to replace a less versatile sed call.
Also, use local variables,
use parameter expansion to assign a default value,
use test exit logic directly, where possible,
tweak comments,
and move the check_live_ram() function to img-lib.sh.
fix(dracut.sh): do not add device if `find_block_device` returns an error
If `find_block_device` returns an error, the device must not be added to the
list of host devices. E.g., a system with /etc mounted as overlay is pushing
the empty string '' as host device.
Dusty Mabe [Wed, 22 Feb 2023 03:21:35 +0000 (22:21 -0500)]
feat(network): include 98-default-mac-none.link if it exists
In Fedora Linux there was a new 98-default-mac-none.link file added
to set the MACAddressPolicy=none for bond/bridge/team devices. We'd
like for this policy to apply in the initramfs as well. See
fix(dracut): correct regression with multiple `rd.break=` options
Since the introduction of the `dracut-util` binary to parse kernel command line
arguments, if the user inputs multiple `rd.break=` options, dracut only stops
the boot process at the last one.
fix(dracut-util): do not call `strcmp` if the `value` argument is NULL
The behavior of `strcmp` is undefined if any of its arguments is NULL, which
can lead to a segfault depending on the implementation. So, this check is
required to be able to use `getargs` with options where the value is optional,
e.g., with `rd.break`.
Jonathan Lebon [Fri, 29 Sep 2023 13:39:15 +0000 (09:39 -0400)]
fix(45ifcfg): mark as deprecated and strictly opt-in
The `45ifcfg` module should be considered deprecated now since
ifcfg files themselves are deprecated. They've been replaced by e.g.
NetworkManager keyfiles or systemd-networkd files.
Currently, the `45ifcfg` module checks if the `/etc/sysconfig/network-
scripts` directory exists to know if to automatically get pulled in.
However, on systems with NetworkManager, this directory always exists
even if the functionality to read ifcfg files is disabled by default (NM
kindly ships a README in there to ease migrating to keyfiles).
Since almost everyone should've already migrated to a more modern
alternative, let's make this module purely opt-in now.
Henrik Gombos [Sun, 29 Oct 2023 11:42:20 +0000 (07:42 -0400)]
test: skip test 50,60 if ifcfg dracut module can not be installed
Test 50 and 60 have a dependency on the ifcfg dracut module.
If ifcfg dracut module is not available, than the preconditions
for these tests are not met.
Since ifcfg dracut module is not available in many Linux enviroments
(such as Arch or Debian), it make sense to explicitelly skip these
tests instead of failing them as they are simply not applicable
to many Linux distributions in their current form.
Instead of disabling the tests, they should be reimplement
so that they do not require ifcfg dracut module in the future.
Benjamin Drung [Tue, 14 Nov 2023 16:53:31 +0000 (17:53 +0100)]
fix(90kernel-modules): add surface_aggregator_registry for Surface Laptop 4
The help text for the kernel module `surface_aggregator_registry` says:
"Device-registry for Surface System Aggregator Module (SSAM) devices.
Provides a module and driver which act as a device-registry for SSAM
client devices that cannot be detected automatically, e.g. via ACPI.
Such devices are instead provided and managed via this registry. Devices
provided via this registry are:
- Platform profile (performance-/cooling-mode) device (5th- and later
generations).
- Battery/AC devices (7th-generation).
- HID input devices (7th-generation)."
This kernel module is needed on the Surface Laptop 4 for the keyboard.
Bug-Ubuntu: https://launchpad.net/bugs/2007050
Bug-linux-surface: https://github.com/linux-surface/linux-surface/issues/839 Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
Sam James [Sun, 12 Nov 2023 03:56:41 +0000 (03:56 +0000)]
fix(install): handle new -Walloc-size for GCC 14
GCC 14 introduces a new -Walloc-size included in -Wextra which gives:
```
src/install/hashmap.c: In function ‘hashmap_new’:
src/install/hashmap.c:83:11: warning: allocation of insufficient size ‘1’ for type ‘Hashmap’ with size ‘40’ [-Walloc-size]
83 | h = malloc0(size);
| ^
```
malloc0 is a macro deifned by Dracut (and systemd, see below):
```
malloc0(n) (calloc((n), 1))
```
The calloc prototype is:
```
void *calloc(size_t nmemb, size_t size);
```
So, just swap the number of members and size arguments to match the prototype, as
we're initialising 1 struct of size `sizeof(...)`. GCC then sees we're not
doing anything wrong.
- Leftover `grep`s used when `chown` was perfomed after them.
- `$initdir/var/lib/rpcbind` already created with `mkdir -m 0770`, it is not
necessary to `chmod 770` again.
fix(90multipath): drop unneeded dependencies from configure service
multipathd-configure.service previously had the same "After"
dependencies as the multipathd.service, with the idea of running
immediately before it. Multipathd now supports being started much
earlier, but the dependencies in multipathd-configure.service stop it
from being able to.
Since all multipathd-configure.service does is write out a configuration
file, it doesn't need any of its "After" udev dependencies. Remove them,
and clean up some other unneeded dependencies.
fix(dracut.sh): skip README for AMD microcode generation
This file was added in https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/commit/amd-ucode/README?id=89ec6198f13d1007563ff87aae5de209e993be07
and it should be skipped.
Made this a bit more explicit with if/else so it is more clear what is going
on. The in-line ||/&& makes the line really long and makes it more difficult
to understand what is going on.
Bug: https://github.com/dracutdevs/dracut/issues/924 Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
Benjamin Drung [Tue, 14 Nov 2023 16:14:17 +0000 (17:14 +0100)]
feat(kernel-modules): Install SPMI modules on ARM/RISC-V
MediaTek's PCIe (pcie-mediatek-gen3) and the PHY driver depends on
`spmi-mtk-pmif` which is related to power domain. Power domain relate
driver `spmi-mtk-pmif` must be included in the initramfs for supporting
PCIe if user want to access peripherals during boot, for example, NVMe
disks.
So install all System Power Management Interface (SPMI) modules on
ARM/RISC-V.
Bug-openSUSE: https://bugzilla.suse.com/show_bug.cgi?id=1216767
Bug-Ubuntu: https://launchpad.net/bugs/2038512 Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
fix(livenet): split `imgsize` calculation to avoid misleading error message
If `curl` fails to reach the URL of the live image, or if the header received
does not provide `Content-Length`, the error message displayed is misleading.
Jeremy Linton [Fri, 6 Oct 2023 15:33:22 +0000 (10:33 -0500)]
feat(kernel-modules): add Qualcomm IPC router to enable USB
The x13s, and possibly other Qualcomm based devices need the QC
IPC router driver in order to enable USB. Without it, its not
possible to boot from USB-C attached disks.
IPC in this case is Inter _Processor_ Communication and forms
the message bus used to communicate between differing processing
elements in a given system/SoC running and managing various
hardware devices. This means that while it appears this driver
should be in the dracut network modules that is incorrect
because its not for enabling host networking in the initrd,
but rather for communicating with other hardware blocks.
Those other blocks aren't limited to modems, but any SMD (shared
memory device), which on QC based machines includes the audio DSPs,
RPM (resource power manager) and of course the application
processor cores linux is running on.
So explicitly include `intel_lpss_pci` to support the keyboard.
Bug-Ubuntu: https://launchpad.net/bugs/2042710
fixes: df381b7e0cd95f78e40ac70f0f3c96a2fa8dd189 ("feat(kernel-modules): driver support for macbook keyboards") Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
fix(resume): add new systemd-hibernate-resume.service
Since https://github.com/systemd/systemd/commit/a628d933, the generator only
does the initial validation of the system info and then enables the new
`systemd-hibernate-resume.service`.
Since we are using `actions/labeler@main`, its format changed, displaying the
following error with every new PR:
```
Run actions/labeler@main
The configuration file (path: .github/labeler.yml) was not found locally, fetching via the api
Error: Error: found unexpected type for label 'repository' (should be array of config options)
Error: found unexpected type for label 'repository' (should be array of config options)
```
Nothing in dracut appears to define the '$libdir' environment
variable when module scripts are being run. As a result when
the 01-systemd-repart module script runs, it fails to copy any
of the config files into the initrd. Replace it with '/usr/lib'
which reflects where systemd-repart expects its global config
files.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
David Cassany [Fri, 22 Sep 2023 14:28:48 +0000 (16:28 +0200)]
fix(overlayfs): split overlayfs mount in two steps
This commit splits the creation of required overlayfs underlaying
directories and the actual overlayfs mount. This way it is still
possible to mount the overlayfs with the generated sysroot.mount that
dmsquash-live creates.
The overlayfs tree is created in a pre-mount hook so it is executed
before sysroot.mount is started. Otherwise sysroot.mount starts and
fails before mount hooks are executed.
fix(install.d): do not create initramfs if the supplied image is UKI
When the supplied kernel image is a UKI, there's no point in creating
initramfs as the UKI has it built-in already. This is the situation when
dracut.install is called for a distro shipped UKI.
Note, KERNEL_INSTALL_IMAGE_TYPE == "uki" is different from
KERNEL_INSTALL_LAYOUT == "uki", the later can be used to create UKI upon
installing a standard kernel image.
Frantisek Sumsal [Sat, 14 Oct 2023 21:45:57 +0000 (23:45 +0200)]
feat(systemd): install systemd-executor
In [0] systemd gained a new binary - systemd-executor - that's used to
spawn processes forked off systemd. Let's copy it into the initrd if
it's available.
fix(dracut.sh): remove microcode check based on CONFIG_MICROCODE_[AMD|INTEL]
`CONFIG_MICROCODE_AMD` and `CONFIG_MICROCODE_INTEL` are hidden since
https://lore.kernel.org/all/20230810160805.081212701@linutronix.de/, therefore
this check is wrong and early microcode is always disabled.
Benjamin Drung [Sat, 19 Aug 2023 14:34:52 +0000 (16:34 +0200)]
docs: set KVERSION for running test suite
Running the test suite in podman will most likely require setting
`KVERSION` because the running Linux kernel version will most likely be
different to the kernel version in the container.
Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
Andrew Ammerlaan [Sun, 20 Aug 2023 10:19:10 +0000 (12:19 +0200)]
feat(install.d): allow using dracut in combination with ukify
This can be simply accomplished with the KERNEL_INSTALL_INITRD_GENERATOR
and KERNEL_INSTALL_UKI_GENERATOR variables. `60-ukify.install` looks for
the initrd in the KERNEL_INSTALL_STAGING_AREA and then takes care of building
the uki.
This change makes it possible to use a configuration like this:
/etc/kernel/install.conf
layout=uki
uki_generator=ukify
initrd_generator=dracut
Without this change this configuration will fail since dracut would also
generate an uki instead of initrd, which will cause a problem in
`60-ukify.install` since it can't find an initrd to use.
Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
Benjamin Drung [Wed, 16 Aug 2023 11:56:41 +0000 (13:56 +0200)]
test: skip test 98 if dracut-util is not available
Building `dracut-util` requires the source code to be present and
prevents running the test against the installed system. Check that
`dracut-util` and rely on the test environment to build `dracut-util`
beforehand.
Benjamin Drung [Wed, 16 Aug 2023 11:50:47 +0000 (13:50 +0200)]
test: make package libdir configurable
Make the package libdir configurable to allow running the test suite
out-of-tree. `PKGLIBDIR` can be pointed to the installed dracut libdir.
Use `PKGLIBDIR` for the location of `dracut-init.sh`, `dracut-install`,
`dracut-util`, `dracut-cpio`, and `modules.d`.
This change is used to run the test suite against the installed dracut
in an autopkgtest for the Debian/Ubuntu package.
Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
fix(systemd): add new systemd-tmpfiles-setup-dev-early.service
`systemd-tmpfiles-setup-dev.service`, `kmod-static-nodes.service` and
`systemd-sysusers.service` have an ordering dependency on this new service since
https://github.com/systemd/systemd/commit/353c849
fix(dracut-install): protect against broken links pointing to themselves
`readlink` does not return an error if a symbolic link points to itself, which
can cause a stack overflow due to infinite recursion in the `get_real_file`
function.
Although this type of recursive links should not exist, we discovered this
issue on a real system. It can be reproduced as follows:
fix(dracut.sh): exit if resolving executable dependencies fails
We came across an issue where, when resolving executable dependencies, a call to
a buggy glib function in `dracut-install` was causing a termination with
SIGSEGV, but dracut didn't stop the build process, which resulted in an
unbootable initrd, due to missing required libraries.
feat(dracut): add --sbat option to add sbat policy to UKI
Take existing .sbat section from the uefi stub and merge it
with vmlinux .sbat (if it exists) and user-provided .sbat parameters
using the new --sbat option.
For some reasons, --update-section in objcopy does not resize the
.sbat section, so remove the section from the stub and add it
to the UKI as new one, to avoid having incomplete SBAT strings.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>