1747 Commits

Author SHA1 Message Date
Paul Aurich
13b88ca8ee scripts/functions: Don't die if configure_networking times out
If configuring the network times out, there will be no /run/net-*.conf
files present, and the attempt to source any interface config file will
fail. In this failure mode, dash (or 'bash --posix') immediately exits,
regardless of 'set -e' or not.

This precludes a caller from (cleanly) handling network bring-up
failure, particularly if the caller cares about the variables set from
sourcing the ipconfig config file.

    paul@haley ~ % cat repro.sh
    #!/bin/sh

    . /nonexistent
    echo hello
    paul@haley ~ % dash ./repro.sh
    ./repro.sh: 3: .: cannot open /nonexistent: No such file
    paul@haley ~ % sh ./repro.sh
    ./repro.sh: 3: .: cannot open /nonexistent: No such file
    paul@haley ~ % bash ./repro.sh
    ./repro.sh: line 3: /nonexistent: No such file or directory
    hello
    paul@haley ~ % bash --posix ./repro.sh
    ./repro.sh: line 3: /nonexistent: No such file or directory
    paul@haley ~ %

Co-authored-by: Pierre Neyron <pierre.neyron@imag.fr>
Closes: #1025730
2024-05-17 19:51:39 -07:00
Ben Hutchings
15311e6282 Merge branch 'install_in_lib' into 'master'
Check for the kconfig in /lib/modules/ too

See merge request kernel-team/initramfs-tools!67
2024-05-17 16:27:09 +00:00
Ben Hutchings
b25074acb8 Merge branch 'set-eu' into 'master'
Support "set -u"

See merge request kernel-team/initramfs-tools!44
2024-05-17 15:28:36 +00:00
Benjamin Drung
78b408c85a Support "set -u"
To support using `set -eu` in initramfs-tools script (e.g. in
kdump-tools), the functions in `scripts/functions` need to support
`set -u` as well.

Signed-off-by: Benjamin Drung <bdrung@debian.org>
2024-05-16 00:26:15 +02:00
Ben Hutchings
8014f4459f Merge branch 'resolv.conf' into 'master'
Configure /etc/resolv.conf and persist hostname

See merge request kernel-team/initramfs-tools!45
2024-05-15 17:05:22 +00:00
Ben Hutchings
cedf1435e1 Merge branch 'master' into 'master'
Respect fw_path_para and compressed firmware in add_firmware()

See merge request kernel-team/initramfs-tools!61
2024-05-15 16:23:20 +00:00
Ben Hutchings
754d70a508 Merge branch 'zfs' into 'master'
hook-functions: return from dep_add_modules_mount() for zfs [#934736]

See merge request kernel-team/initramfs-tools!90
2024-05-15 11:21:59 +00:00
Ben Hutchings
b26108ae01 Merge branch 'master' into 'master'
unmkinitramfs: add count_bytes iflag in a dd call

See merge request kernel-team/initramfs-tools!92
2024-05-15 10:46:48 +00:00
Ben Hutchings
8801fda185 debian/tests/test-common: Update klibc.so installation for /usr-move
The test-common script constructs a trivial root filesytem including
klibc.so and the klibc commands.  Since the filename of klibc.so
contains a hash, it uses dpkg to list files in libklibc and greps
through that list.

Since klibc 2.0.13-3, the canonical location of klibc.so is in
/usr/lib rather than /lib and the regex used no longer matches.
Change the regex to ignore the directory part of the filename.

The interpreter path in klibc binaries now also uses /usr/lib, so we
need to install it in /usr/lib rather than /lib.  To be compatible
with both old and new klibc, usr-merge our trivial root filesystem.
2024-05-14 21:29:43 +02:00
Ben Hutchings
748601087b Merge branch 'szubersk-silence' into 'master'
Silence unnecessary `ln -f` warning

See merge request kernel-team/initramfs-tools!72
2024-05-14 15:25:53 +00:00
Adam Vodopjan
fbc178e4ba unmkinitramfs: add count_bytes iflag in a dd call
When using just iflag=skip_bytes, dd does not treat N as bytes in count=N,
explicit count_bytes iflag is required.
2024-02-27 17:26:25 +02:00
szubersk
9da9969318 Silence unnecessary ln -f warning
Since `cp -a` serves as fallback, there's no need to clutter
the output.

Before:
```
$ sudo update-initramfs -u
ln: failed to create hard link '/boot/initrd.img-6.1.0-3-amd64.dpkg-bak' => '/boot/initrd.img-6.1.0-3-amd64': Operation not permitted
update-initramfs: Generating /boot/initrd.img-6.1.0-3-amd64
```

After:
```
$ sudo update-initramfs -u
update-initramfs: Generating /boot/initrd.img-6.1.0-3-amd64
```

Signed-off-by: szubersk <szuberskidamian@gmail.com>
2024-01-26 04:02:32 +00:00
Aron Xu
d7b6cec37a
hook-functions: return from dep_add_modules_mount() for zfs
zfs presents mount points in /proc/mounts as a virtual one named
by the underlying dataset, while current implementation of
dep_add_modules_mount() wants a real mount point.

Users who run zfs as rootfs is required to install zfs-initramfs
to handle more details so there is no potential risk for not
handling kernel modules here until we have built-in zfs support.

Signed-off-by: Aron Xu <aron@debian.org>
[наб: fix whitespace error, subject typo]

Closes: #934736
2024-01-10 16:36:02 +01:00
Alper Nebi Yasak
1eb6511c71 hook-functions: dep_add_modules: Properly include panel drivers
With MODULES=dep, we try to walk the /sys/devices/platform/edp-panel
device to include panel drivers because they are needed get a display
output on some devices. This is a bit wrong, because the "edp-panel"
here is the name of a device-tree node that is not necessarily a panel.

Instead, walk the devices bound under the panel drivers for modules to
add to initramfs. Check not only for panel-edp, but panel-simple and
those available over dp-aux bus as well.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2023-11-13 23:29:11 +03:00
Ben Hutchings
cf964bfb43 Merge branch 'maintscripts-no-oldoldstable' into 'master'
d/initramfs-tools.maintscripts: Remove code for ancient versions

See merge request kernel-team/initramfs-tools!65
2023-08-20 20:51:58 +00:00
Alper Nebi Yasak
88dc0919a9 hook-functions: Don't walk graphics modules if corebootfb is available
Support for coreboot framebuffer is currently built-in on Debian kernel.
If it's available on the system we don't need other graphics-related
modules when MODULES=dep. Add it to the list of devices we check to
disable adding those modules.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2023-07-01 11:47:45 +03:00
Ben Hutchings
193dfbb792 Merge branch 'szubersk-shellcheck' into 'master'
Fix/ignore ShellCheck findings

See merge request kernel-team/initramfs-tools!73
2023-03-06 01:12:58 +00:00
szubersk
67bddc4d8b
Fix/ignore ShellCheck findings
Signed-off-by: szubersk <szuberskidamian@gmail.com>
2023-02-27 22:29:35 +10:00
Luca Boccassi
90addd04bc Check for the kconfig in /lib/modules/ too
Supporting kernel packages shipping files in /lib/ instead of
/boot.
2022-10-31 00:09:09 +00:00
Benjamin Drung
5339f2575d Add unit tests for netinfo_to_resolv_conf
Use shunit2 for adding some unit tests to cover the functionality of
`_generate_hosts_content` and `netinfo_to_resolv_conf`.

Signed-off-by: Benjamin Drung <bdrung@debian.org>
2022-10-21 10:55:43 +02:00
Benjamin Drung
3d29bf9098 Configure /etc/resolv.conf and persist hostname
live-boot generates `/etc/hostname`, `/etc/hosts`, and
`/etc/resolv.conf` in `do_netsetup` from `9990-networking.sh`.
kdump-tools needs similar code for generating a self-contained initrd
for dumping a crashed kernel via network.

Ubuntu carries a patch for initramfs-tools that adds
`netinfo_to_resolv_conf` to configure `/etc/resolv.conf` which is more
complex than the code from live-boot.

To prevent code duplication, implement `netinfo_to_resolv_conf` and
`persist_hostname` as helper functions and let `configure_networking`
call these functions.

Let `netinfo_to_resolv_conf` support multiple `/run/net-<device>` style
files to allow Ubuntu to reuse this code.

Signed-off-by: Benjamin Drung <bdrung@debian.org>
2022-10-21 10:55:43 +02:00
наб
1aa61184f9
Support ZSTD-compressed firmware in add_firmware()
Since 5.19, .zst-suffixed firmware is be supported with precedence over
.xz, cf:
  https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git/commit/?h=driver-core-next&id=23cfbc6ec44e5e80d5522976ff45ffcdcddfb230
2022-09-08 22:15:14 +02:00
наб
c9fa06411d
Handle compressed firmware in add_firmware()
With CONFIG_FW_LOADER_COMPRESS, Linux additionally tries the normal
search path but suffixed with .xz, and decompresses it in-kernel, cf.
  https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/base/firmware_loader/main.c?h=v5.17#n754
2022-09-08 22:14:25 +02:00
наб
5774cc330c
Respect fw_path_para in add_firmware()
/sys/module/firmware_class/parameters/path, if any, is added before
anything else in the module loading path:
  https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/base/firmware_loader/main.c?h=v5.17#n406
2022-09-08 22:14:23 +02:00
Gioele Barabucci
4ae8280c09 d/initramfs-tools.maintscripts: Remove code for ancient versions
Various maintscripts contain code related to adjustments to be done
when upgrading from versions older than 0.123 or 0.126.

This code has not been run for a long time, considering that
old-old-stable (Debian 9, 2017) shipped with version 0.130.
It can thus be removed.
2022-07-30 00:06:20 +02:00
Ben Hutchings
dd16eade69 Releasing version 0.142.
Signed-off-by: Ben Hutchings <benh@debian.org>
v0.142
2022-07-12 23:53:08 +02:00
Ben Hutchings
230a6bfae5 Merge branch 'bug-1014319' into 'master'
Copy modules.builtin.modinfo into initramfs

See merge request kernel-team/initramfs-tools!64
2022-07-12 19:03:45 +00:00
Sven Joachim
c064b9e936 Copy modules.builtin.modinfo into initramfs
As of kmod version 30, depmod issues a warning if this file is
missing.

Closes: #1014319
2022-07-09 17:48:32 +02:00
Ben Hutchings
9a4d579050 hook-functions: auto_add_modules: Include UFS drivers from drivers/ufs/
UFS is SCSI-like and its drivers used to be built under
drivers/scsi/ufs, but in 5.19 they're moving to drivers/ufs.  Keep
including them in the "scsi" module class.

Signed-off-by: Ben Hutchings <benh@debian.org>
2022-06-20 22:54:17 +02:00
Ben Hutchings
5bf479d557 hook-functions: Remove support for ieee1394 and i2o
These are long obsolete:

- ieee1394 was replaced by firewire, and removed in Linux 2.6.37
- i2o was removed in Linux 4.2

The ide subsystem has also been removed in Linux 5.14 and most of its
drivers were replaced with libata-based drivers long ago.  But some
ia64 and m68k machines still needed ide-based drivers until quite
recently, so I will give their users some more time to upgrade the
kernel.

Signed-off-by: Ben Hutchings <benh@debian.org>
2022-06-20 22:54:17 +02:00
Ben Hutchings
65bd9634f5 Merge branch 'compresslevel' into 'master'
Add support for specifying compression level

See merge request kernel-team/initramfs-tools!52
2022-06-20 17:40:05 +00:00
Rich Ercolani
50d945acb8 Add support for specifying compression level
Added a COMPRESSLEVEL parameter to initramfs.conf, a -l flag to
mkinitramfs, and updated initramfs.conf.5 and mkinitramfs.8 to match.

Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
2022-06-20 12:38:33 -04:00
Ben Hutchings
befc76e682 Merge branch 'always_include_fsck' into 'master'
hooks/fsck: always include fsck binary

See merge request kernel-team/initramfs-tools!49
2022-06-20 14:00:26 +00:00
Ben Hutchings
599c0cdf6d Merge branch 'decompress-modules' into 'master'
mkinitramfs: decompress compressed kernel modules

See merge request kernel-team/initramfs-tools!51
2022-06-20 13:48:01 +00:00
Vagrant Cascadian
6b632f9521 Merge branch 'reform2-di-modules' into 'master'
hook-functions: Add pwm-imx27, nwl-dsi, ti-sn65dsi86, imx-dcss, mxsfb,...

See merge request kernel-team/initramfs-tools!63
2022-06-06 17:48:07 +00:00
Johannes Schauer Marin Rodrigues
834d01d41f
hook-functions: Add pwm-imx27, nwl-dsi, ti-sn65dsi86, imx-dcss, mxsfb, mux-mmio and imx8mq-interconnect for MNT Reform 2 panel/backlight. 2022-05-31 23:35:20 +02:00
Ben Hutchings
9b3a06991f Merge branch 'szubersk-resume' into 'master'
resume: Don't resume from a swap device on a ZVOL

See merge request kernel-team/initramfs-tools!60
2022-04-24 21:03:57 +00:00
szubersk
e447e91bfb
resume: Don't resume from a swap device on a ZVOL
OpenZFS currently doesn't support resuming from swap devices
backed by ZVOL. Without this correction boot process hangs at
initramfs stage.

Signed-off-by: szubersk <szuberskidamian@gmail.com>
2022-04-22 01:23:37 +02:00
Ben Hutchings
6f2963f292 Releasing version 0.141.
Signed-off-by: Ben Hutchings <benh@debian.org>
v0.141
2022-04-10 23:40:09 +02:00
Ben Hutchings
eaf8bf7e05 Revert "d/salsa-ci.yml: Suppress groff-message warnings caused by bug #973313"
This reverts commit d61ac8ab4b3a255b916b1b87d3fbde0e3f7a9d47.
The salsa-ci images no longer exhibit this problem.

Gbp-Dch: ignore
2022-04-10 23:15:31 +02:00
Ben Hutchings
ea71f927c7 Merge branch 'benh/config-net-generalise-wait' into 'master'
scripts/functions: Make configure_networking wait for device specified any way

See merge request kernel-team/initramfs-tools!39
2022-04-10 20:59:35 +00:00
Ben Hutchings
80eddcf6c1 scripts/functions: Make configure_networking wait for device specified any way
configure_networking can now wait for a named net device, but the net
device may be specified by hardware (MAC) address or not at all.

* Factor out the hardware-address-to-device lookup into a function
* Add a function to check whether any suitable device exists
* Change the wait loop to use the appropriate check for device
  existence
* Update the IP variable after the wait loop, so it follows the
  hardware-address-to-device lookup

Closes: #911727
Signed-off-by: Ben Hutchings <benh@debian.org>
2022-04-10 21:59:31 +02:00
Ben Hutchings
ec5c6c7602 scripts/functions: Refactor device name logic in configure_networking
Make the order of precedence for setting device name explicit.

Split _handle_device_vs_ip into two functions, one to update DEVICE
and one to update IP.  This allows setting the device name in a way
that obviously follows the order of precedence, and also enables
improvements to the device wait loop.

Signed-off-by: Ben Hutchings <benh@debian.org>
2022-04-10 21:59:31 +02:00
Ben Hutchings
31e444e1fa Merge branch 'fix_modules_list_error' into 'master'
hook-functions: check for dir before running find on it

See merge request kernel-team/initramfs-tools!48
2022-04-10 19:11:06 +00:00
Ben Hutchings
e856af46ea hook-functions: Support network boot via USB Ethernet adapters
Many devices do not have any built-in Ethernet support, or have
built-in USB Ethernet adapters.

Remove the exclusion of the drivers/net/usb directory, and instead
exclude only the specific modules that are known to be non-Ethernet
(e.g. WWAN or USB-to-USB cables).

Closes: #980788
2022-04-10 20:45:00 +02:00
Ben Hutchings
5a69a46ff0 Merge branch 'fix-zstd-thread-option' into 'master'
Consider SOURCE_DATE_EPOCH option for zstd

See merge request kernel-team/initramfs-tools!57
2022-04-10 17:45:21 +00:00
Ben Hutchings
5c5afe8a18 Merge branch 'modprobe-fullpath' into 'master'
Fully-qualify modprobe calls to avoid busybox

See merge request kernel-team/initramfs-tools!58
2022-04-10 17:43:50 +00:00
Ben Hutchings
12eef1451d Merge branch 'wip/adalessandro/imx8m-fec-nvmem-module' into 'master'
hook-functions: Add nvmem-imx-ocotp driver module to network boot

See merge request kernel-team/initramfs-tools!59
2022-04-10 17:18:03 +00:00
Ariel D'Alessandro
8a6f73cfc9 hook-functions: Add nvmem-imx-ocotp driver module to network boot
This driver module is required to initialize Ethernet (FEC) on ARM64
iMX8M devices.

Signed-off-by: Ariel D'Alessandro <ariel.dalessandro@collabora.com>
2022-04-05 10:12:02 -03:00
Ben Love
02dc65f9db Fully-qualify modprobe calls to avoid busybox
If the busybox-static package is installed, the modprobe implementation
used will be the one from busybox, which behaves slightly differently.
Specifically, the busybox implementation does not support `install`
commands from modprobe.d conf files:

https://git.busybox.net/busybox/tree/modutils/modprobe.c?h=1_31_stable#n279

Since mkinitramfs already ensures that /sbin/modprobe is copied into
/sbin for the initrd, it is safe to fully-qualify the modprobe call and
never invoke the busybox version.
2022-02-05 19:32:53 -05:00