From 34bf2504e94916f7b4086877737ef2a482cd8db3 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 16 Aug 2017 16:39:38 +0100 Subject: [PATCH 001/213] debian/control: Remove maximilian attems and Adam Conrad from Uploaders field maks is no longer interested and Adam hasn't worked on the Debian branches for a long time. --- debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/control b/debian/control index 3395477..cc7c32d 100644 --- a/debian/control +++ b/debian/control @@ -1,7 +1,7 @@ Source: initramfs-tools Section: utils Priority: optional -Uploaders: maximilian attems , Michael Prokop , Adam Conrad , Ben Hutchings +Uploaders: Michael Prokop , Ben Hutchings Maintainer: Debian kernel team Build-Depends: debhelper (>= 9), bash-completion Standards-Version: 3.9.8 -- GitLab From 5ad3976c162d1378db81a8e7c09a6f3470eacc6f Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Thu, 7 Dec 2017 01:12:06 +0000 Subject: [PATCH 002/213] hooks/resume: Generalise logic to replace dev name with UUID when RESUME=auto We need to handle some devices differently. Signed-off-by: Ben Hutchings --- hooks/resume | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/hooks/resume b/hooks/resume index 1032f7b..ad1e02c 100755 --- a/hooks/resume +++ b/hooks/resume @@ -46,11 +46,15 @@ else # Try to autodetect the RESUME partition, using biggest swap? resume_auto=$(grep ^/dev/ /proc/swaps | sort -rnk3 | head -n 1 | cut -d " " -f 1) if [ -n "$resume_auto" ]; then - UUID=$(blkid -s UUID -o value "$resume_auto" || true) + if UUID=$(blkid -s UUID -o value "$resume_auto"); then + resume_auto_canon="UUID=$UUID" + else + resume_auto_canon= + fi report_auto "The initramfs will attempt to resume from $resume_auto" - if [ -n "$UUID" ]; then - report_auto "(UUID=$UUID)" - resume_auto="UUID=$UUID" + if [ -n "$resume_auto_canon" ]; then + report_auto "($resume_auto_canon)" + resume_auto="$resume_auto_canon" fi report_auto "Set the RESUME variable to override this." fi -- GitLab From 0170b7ffecb51cfc75b4b0eb580cf9a7c6dec370 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Thu, 7 Dec 2017 01:15:39 +0000 Subject: [PATCH 003/213] hooks/resume: Store /dev/mapper path for swap if possible when RESUMEauto LVs will only be found at boot if identified by the /dev/mapper/VG-LV or /dev/VG/LV path, as that triggers lvm2 to activate the containing VG. So when RESUME=auto, we should store a /dev/mapper device path rather than UUID if possible. Closes: #883735 Signed-off-by: Ben Hutchings --- hooks/resume | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hooks/resume b/hooks/resume index ad1e02c..3c0bef5 100755 --- a/hooks/resume +++ b/hooks/resume @@ -46,7 +46,9 @@ else # Try to autodetect the RESUME partition, using biggest swap? resume_auto=$(grep ^/dev/ /proc/swaps | sort -rnk3 | head -n 1 | cut -d " " -f 1) if [ -n "$resume_auto" ]; then - if UUID=$(blkid -s UUID -o value "$resume_auto"); then + if dm_name="$(dmsetup info -c --noheadings -o name "$resume_auto" 2>/dev/null)"; then + resume_auto_canon="/dev/mapper/$dm_name" + elif UUID=$(blkid -s UUID -o value "$resume_auto"); then resume_auto_canon="UUID=$UUID" else resume_auto_canon= -- GitLab From 72b6419606c11d8ba76436dd3efce2157f990d6f Mon Sep 17 00:00:00 2001 From: Riku Voipio Date: Thu, 2 Nov 2017 11:30:52 +0200 Subject: [PATCH 004/213] auto_add_modules: add mfd for MODULES==most Multi Function Devices may carry essential functions on arm/arm64 platforms. For example in 96boards HiKey some regulators. In this case it's picked up with MODULES=dep /sys/class/regulator enumaeration, but not when generating generic initrd on offline with MODULES=most. Since mfd is quite small (284K on arm64), just add it to most. This may also open the road to make some currently built-in CONFIG_MFD drivers modules. Closes: #880584 Signed-off-by: Riku Voipio --- hook-functions | 1 + 1 file changed, 1 insertion(+) diff --git a/hook-functions b/hook-functions index 679e11d..4b49391 100644 --- a/hook-functions +++ b/hook-functions @@ -537,6 +537,7 @@ auto_add_modules() copy_modules_dir kernel/drivers/gpio copy_modules_dir kernel/drivers/i2c/busses copy_modules_dir kernel/drivers/i2c/muxes + copy_modules_dir kernel/drivers/mfd copy_modules_dir kernel/drivers/phy copy_modules_dir kernel/drivers/pinctrl copy_modules_dir kernel/drivers/regulator -- GitLab From 7ca4d0dd8598c0b300609ebefe9a45ce64d5b7a2 Mon Sep 17 00:00:00 2001 From: Benjamin Drung Date: Wed, 9 Aug 2017 19:24:03 +0200 Subject: [PATCH 005/213] Add mlx4 and mlx5 InfiniBand modules to hidden_dep_add_modules Mellanox ConnectX architecture is: mlx4_core is the lower level PCI driver which register on the PCI id, and protocol specific drivers are depended on it: mlx4_en - for Ethernet and mlx4_ib for Infiniband. NIC could have multiple ports which can change their type dynamically. We use the request_module() call to load the relevant protocol driver when needed: on loading time or at port type change event. The mlx4_core and mlx5_core modules are included in the initrd, but not mlx4_ib and mlx5_ib. Thus the request_module() call will not find these modules and fail load them. The mlx*_ib module loading will not be retried. Therefore add the mlx4_ib and mlx5_ib dependency to the hidden_dep_add_modules function. Closes: #871595 Signed-off-by: Benjamin Drung --- hook-functions | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hook-functions b/hook-functions index 4b49391..5f862a8 100644 --- a/hook-functions +++ b/hook-functions @@ -604,7 +604,9 @@ hidden_dep_add_modules() local modules= for dep in "lib/libcrc32c crc32c" \ "fs/ubifs/ubifs deflate zlib lzo" \ - "fs/btrfs/btrfs crc32c"; do + "fs/btrfs/btrfs crc32c" \ + "drivers/net/ethernet/mellanox/mlx4/mlx4_core mlx4_ib" \ + "drivers/net/ethernet/mellanox/mlx5/core/mlx5_core mlx5_ib"; do set -- $dep if [ -f "${DESTDIR}/lib/modules/${version}/kernel/$1.ko" ]; then shift -- GitLab From df7d7e8a80489dfb05492a2f7040b1b6b1bb31f3 Mon Sep 17 00:00:00 2001 From: Benjamin Drung Date: Mon, 6 Mar 2017 11:39:05 +0100 Subject: [PATCH 006/213] Add option to clear screen at the beginning When using the initramfs for kdump, the screen might already contain text. Without clearing the screen, the output of the initramfs will overwrite the screen only partially with old text staying on the screen. Thus add a kernel option 'initramfs.clear' to clear the screen at the beginning. Closes: #856929 Signed-off-by: Benjamin Drung --- init | 20 +++++++++++++------- initramfs-tools.8 | 4 ++++ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/init b/init index 1334dca..c136c27 100755 --- a/init +++ b/init @@ -13,15 +13,21 @@ mkdir -p /var/lock mount -t sysfs -o nodev,noexec,nosuid sysfs /sys mount -t proc -o nodev,noexec,nosuid proc /proc -case " $(cat /proc/cmdline) " in -*\ quiet\ *) - quiet=y - ;; -*) +for x in $(cat /proc/cmdline); do + case $x in + initramfs.clear) + clear + ;; + quiet) + quiet=y + ;; + esac +done + +if [ "$quiet" != "y" ]; then quiet=n echo "Loading, please wait..." - ;; -esac +fi export quiet # Note that this only becomes /dev on the real filesystem if udev's scripts diff --git a/initramfs-tools.8 b/initramfs-tools.8 index 0eee050..7609a45 100644 --- a/initramfs-tools.8 +++ b/initramfs-tools.8 @@ -23,6 +23,10 @@ mount the partition with that UUID as the root filesystem. \fB\fI init= "" the binary to hand over execution to on the root fs after the initramfs scripts are done. +.TP +\fB\fI initramfs.clear +clear screen at the beginning + .TP \fB\fI root= "" the device node to mount as the root file system. -- GitLab From a33cb62ed8f3a146c302a3c4b49e0ae5730445b6 Mon Sep 17 00:00:00 2001 From: Benjamin Drung Date: Mon, 12 Jun 2017 15:31:58 +0200 Subject: [PATCH 007/213] Fix indentation (spaces to tabs) Signed-off-by: Benjamin Drung --- init | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init b/init index c136c27..e51b4e6 100755 --- a/init +++ b/init @@ -87,7 +87,7 @@ for x in $(cat /proc/cmdline); do if [ -z "${BOOT}" ] && [ "$ROOT" = "/dev/nfs" ]; then BOOT=nfs fi - ;; + ;; rootflags=*) ROOTFLAGS="-o ${x#rootflags=}" ;; @@ -117,7 +117,7 @@ for x in $(cat /proc/cmdline); do resume=*) RESUME="${x#resume=}" case $RESUME in - UUID=*) + UUID=*) RESUME="/dev/disk/by-uuid/${RESUME#UUID=}" esac ;; -- GitLab From 3962c4fc999edf0109b10b0b0e48fd10be6b028b Mon Sep 17 00:00:00 2001 From: Benjamin Drung Date: Thu, 2 Mar 2017 18:01:33 +0100 Subject: [PATCH 008/213] Fix config directory in error message /etc/kernel/postinst.d/kdump-tools calls mkinitramfs with -d /var/lib/kdump/initramfs-tools. This call might fail, but the recommended grep command points to the wrong directory: $ sudo /etc/kernel/postinst.d/kdump-tools $(uname -r) kdump-tools: Generating /var/lib/kdump/initrd.img-4.4.36-2 mkinitramfs: failed to determine device for / mkinitramfs: workaround is MODULES=most, check: grep -r MODULES /etc/initramfs-tools/ Error please report bug on initramfs-tools Include the output of 'mount' and 'cat /proc/mounts' update-initramfs: failed for with 1. Closes: #856589 Signed-off-by: Benjamin Drung --- hook-functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hook-functions b/hook-functions index 5f862a8..060f200 100644 --- a/hook-functions +++ b/hook-functions @@ -381,7 +381,7 @@ dep_add_modules_mount() || ! [ -b "$dev_node" ]; then echo "mkinitramfs: failed to determine device for $dir" >&2 echo "mkinitramfs: workaround is MODULES=most, check:" >&2 - echo "grep -r MODULES /etc/initramfs-tools/" >&2 + echo "grep -r MODULES ${CONFDIR}" >&2 echo "" >&2 echo "Error please report bug on initramfs-tools" >&2 echo "Include the output of 'mount' and 'cat /proc/mounts'" >&2 -- GitLab From be2b91c3760f70869eaeb79980039b84d29ee012 Mon Sep 17 00:00:00 2001 From: Benjamin Drung Date: Tue, 15 May 2018 12:22:32 +0200 Subject: [PATCH 009/213] Double quote to prevent globbing and word splitting shellcheck complained about missing double quotes. Signed-off-by: Benjamin Drung --- init | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/init b/init index e51b4e6..9aeb749 100755 --- a/init +++ b/init @@ -72,7 +72,7 @@ export fsckfix= # Bring in the main config . /conf/initramfs.conf for conf in conf/conf.d/*; do - [ -f ${conf} ] && . ${conf} + [ -f "${conf}" ] && . "${conf}" done . /scripts/functions @@ -229,7 +229,7 @@ log_begin_msg "Mounting root file system" . /scripts/local . /scripts/nfs . /scripts/${BOOT} -parse_numeric ${ROOT} +parse_numeric "${ROOT}" maybe_break mountroot mount_top mount_premount @@ -309,6 +309,6 @@ mount -n -o move /sys ${rootmnt}/sys mount -n -o move /proc ${rootmnt}/proc # Chain to real filesystem -exec run-init ${drop_caps} ${rootmnt} ${init} "$@" <${rootmnt}/dev/console >${rootmnt}/dev/console 2>&1 +exec run-init ${drop_caps} "${rootmnt}" "${init}" "$@" <${rootmnt}/dev/console >${rootmnt}/dev/console 2>&1 echo "Something went badly wrong in the initramfs." panic "Please file a bug on initramfs-tools." -- GitLab From ae339ffd5ed924c1489ad1fec17af2eff612770d Mon Sep 17 00:00:00 2001 From: Benjamin Drung Date: Tue, 15 May 2018 12:12:56 +0200 Subject: [PATCH 010/213] Make size of /run configurable Using 10% of RAM for /run is a good default, but not suitable for all systems. 10% might be too small for system with less memory (e.g. virtual machine with 160 MiB RAM) or too big (VM host with 256/512 GiB RAM). A too small /run partition leads to not enough space on it. If the /run partition is huge, systemd's journald will consume lot of memory, because it defaults to using at most 15% of the respective file system of /run/log/journal. Adjusting the size of /run via an entry in /etc/fstab is not sufficient since journald calculates it limits before systemd remounts /run with the small size. Therefore journald could occupy the full /run partition with its logs. Allow specifying the size of /run by adding a RUNSIZE configuration variable and a initramfs.ramsize= boot argument. Mounting /run must be done after reading the configuration. Closes: #862013 Signed-off-by: Benjamin Drung --- conf/initramfs.conf | 8 ++++++++ init | 19 ++++++++++++++----- initramfs-tools.8 | 8 ++++++++ initramfs.conf.5 | 9 +++++++++ 4 files changed, 39 insertions(+), 5 deletions(-) diff --git a/conf/initramfs.conf b/conf/initramfs.conf index f0f5071..1319536 100644 --- a/conf/initramfs.conf +++ b/conf/initramfs.conf @@ -62,3 +62,11 @@ DEVICE= NFSROOT=auto +# +# RUNSIZE: ... +# +# The size of the /run tmpfs mount point, like 256M or 10% +# Overridden by optional initramfs.runsize= bootarg +# + +RUNSIZE=10% diff --git a/init b/init index 9aeb749..3f59c07 100755 --- a/init +++ b/init @@ -35,8 +35,6 @@ export quiet mount -t devtmpfs -o nosuid,mode=0755 udev /dev mkdir /dev/pts mount -t devpts -o noexec,nosuid,gid=5,mode=0620 devpts /dev/pts || true -mount -t tmpfs -o "noexec,nosuid,size=10%,mode=0755" tmpfs /run -mkdir -m 0755 /run/initramfs # Export the dpkg architecture export DPKG_ARCH= @@ -105,6 +103,9 @@ for x in $(cat /proc/cmdline); do nfsroot=*) NFSROOT="${x#nfsroot=}" ;; + initramfs.runsize=*) + RUNSIZE="${x#initramfs.runsize=}" + ;; ip=*) IP="${x#ip=}" ;; @@ -148,9 +149,9 @@ for x in $(cat /proc/cmdline); do debug=y quiet=n if [ -n "${netconsole}" ]; then - exec >/dev/kmsg 2>&1 + log_output=/dev/kmsg else - exec >/run/initramfs/initramfs.debug 2>&1 + log_output=/run/initramfs/initramfs.debug fi set -x ;; @@ -170,7 +171,7 @@ for x in $(cat /proc/cmdline); do ;; netconsole=*) netconsole=${x#netconsole=} - [ "x$debug" = "xy" ] && exec >/dev/kmsg 2>&1 + [ "x$debug" = "xy" ] && log_output=/dev/kmsg ;; BOOTIF=*) BOOTIF=${x#BOOTIF=} @@ -202,6 +203,14 @@ else resume=${RESUME:-} fi +mount -t tmpfs -o "noexec,nosuid,size=${RUNSIZE:-10%},mode=0755" tmpfs /run +mkdir -m 0755 /run/initramfs + +if [ -n "$log_output" ]; then + exec >$log_output 2>&1 + unset log_output +fi + maybe_break top # Don't do log messages here to avoid confusing graphical boots diff --git a/initramfs-tools.8 b/initramfs-tools.8 index 7609a45..32cce2d 100644 --- a/initramfs-tools.8 +++ b/initramfs-tools.8 @@ -27,6 +27,14 @@ the binary to hand over execution to on the root fs after the initramfs scripts \fB\fI initramfs.clear clear screen at the beginning +.TP +\fB\fI initramfs.runsize +The size of the \fI/run\fP tmpfs mount point in bytes (suffixes are supported) +or as percentage of your physical RAM. This parameter is used as the value of +the size mount option to tmpfs. See +\fBhttps://www.kernel.org/doc/Documentation/filesystems/tmpfs.txt\fR for +details. The default is 10%. + .TP \fB\fI root= "" the device node to mount as the root file system. diff --git a/initramfs.conf.5 b/initramfs.conf.5 index b4eea70..569834c 100644 --- a/initramfs.conf.5 +++ b/initramfs.conf.5 @@ -74,6 +74,15 @@ Allows one to use an nfs drive as the root of the drive. The default is to boot from \fIlocal\fP media (hard drive, USB stick). Set to \fInfs\fP for an NFS root share. +.TP +\fB RUNSIZE +The size of the \fI/run\fP tmpfs mount point in bytes (suffixes are supported) +or as percentage of your physical RAM. This parameter is used as the value of +the size mount option to tmpfs. See +\fBhttps://www.kernel.org/doc/Documentation/filesystems/tmpfs.txt\fR for +details. Can be overridden by an optional \fBinitramfs.runsize=\fR bootarg. +The default is 10%. + .SH VARIABLES FOR LOCAL BOOT .TP \fB RESUME -- GitLab From c198331bccaba8fb53ae1653e41fbd433c4d3db7 Mon Sep 17 00:00:00 2001 From: Steve Langasek Date: Tue, 24 Apr 2018 12:19:04 +0100 Subject: [PATCH 011/213] Skip dmsetup resume devices if they are randomly encrypted. Signed-off-by: Steve Langasek --- hooks/resume | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/hooks/resume b/hooks/resume index 3c0bef5..1869119 100755 --- a/hooks/resume +++ b/hooks/resume @@ -46,7 +46,17 @@ else # Try to autodetect the RESUME partition, using biggest swap? resume_auto=$(grep ^/dev/ /proc/swaps | sort -rnk3 | head -n 1 | cut -d " " -f 1) if [ -n "$resume_auto" ]; then - if dm_name="$(dmsetup info -c --noheadings -o name "$resume_auto" 2>/dev/null)"; then + dm_name="$(dmsetup info -c --noheadings -o name "$resume_auto" 2>/dev/null)" + fi + if [ -n "$dm_name" ] && [ -e /etc/crypttab ]; then + while read cryptdev srcdev keyfile junk; do + if [ "$cryptdev" = "$dm_name" ] && [ "$keyfile" = /dev/urandom ]; then + resume_auto= + fi + done < /etc/crypttab + fi + if [ -n "$resume_auto" ]; then + if [ -n "$dm_name" ]; then resume_auto_canon="/dev/mapper/$dm_name" elif UUID=$(blkid -s UUID -o value "$resume_auto"); then resume_auto_canon="UUID=$UUID" -- GitLab From e28b865426e016b19f8588bc2a2fb95c9b7edec3 Mon Sep 17 00:00:00 2001 From: Paul Menzel Date: Tue, 19 Jun 2018 10:29:49 +0200 Subject: [PATCH 012/213] mkinitramfs: Add LZ4 support LZ4 creates bigger archives than XZ, but decompression time is only half as long on a ASRock E350M1 with an SSD, shaving off half a second from the overall boot time of four seconds. The patch is taken from Ubuntu [1] and has the change-log entries below. > initramfs-tools (0.130ubuntu4) bionic; urgency=medium > > [ Benjamin Tegge ] > * mkinitramfs: support lz4 as compress method (LP: #1488620) > > [ Balint Reczey ] > * unmkinitramfs: support lz4 as compress method > > -- Balint Reczey Wed, 11 Apr 2018 23:37:21 +0200 [1]: https://bugs.launchpad.net/ubuntu/+source/initramfs-tools/+bug/1488620 Closes: https://bugs.debian.org/893845 Signed-off-by: Paul Menzel --- conf/initramfs.conf | 2 +- debian/control | 2 +- mkinitramfs | 1 + unmkinitramfs | 2 ++ 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/conf/initramfs.conf b/conf/initramfs.conf index 1319536..971cea4 100644 --- a/conf/initramfs.conf +++ b/conf/initramfs.conf @@ -38,7 +38,7 @@ BUSYBOX=auto KEYMAP=n # -# COMPRESS: [ gzip | bzip2 | lzma | lzop | xz ] +# COMPRESS: [ gzip | bzip2 | lz4 | lzma | lzop | xz ] # COMPRESS=gzip diff --git a/debian/control b/debian/control index cc7c32d..d21fce2 100644 --- a/debian/control +++ b/debian/control @@ -12,7 +12,7 @@ Package: initramfs-tools Architecture: all Multi-Arch: foreign Depends: initramfs-tools-core (= ${binary:Version}), linux-base, ${misc:Depends} -Suggests: bash-completion +Suggests: bash-completion, liblz4-tool Provides: linux-initramfs-tool Conflicts: linux-initramfs-tool, usplash (<< 0.5.50) Breaks: cryptsetup (<< 2:1.6.6-4~), elilo (<< 3.12-3.1~), lilo (<< 22.8-8.2~), s390-tools (<< 1.8.3-2~), console-setup (<< 1.72), systemd-sysv (<< 186), lvm2 (<< 2.02.111-2.1~), initscripts (<< 2.88dsf-59.3~), upstart, e2fsprogs (<< 1.42.13) diff --git a/mkinitramfs b/mkinitramfs index 24715d5..44930b8 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -151,6 +151,7 @@ if dpkg --compare-versions "${version}" lt "2.6.38" 2>/dev/null; then echo "linux-2.6 likely misses ${COMPRESS} support, using gzip" fi +[ "${compress}" = lz4 ] && compress="lz4 -9 -l" [ "${compress}" = lzop ] && compress="lzop -9" [ "${compress}" = xz ] && compress="xz --check=crc32" diff --git a/unmkinitramfs b/unmkinitramfs index d1446d8..7e3d977 100755 --- a/unmkinitramfs +++ b/unmkinitramfs @@ -18,6 +18,8 @@ xcpio() zcat "$archive" elif xzcat -t "$archive" >/dev/null 2>&1 ; then xzcat "$archive" + elif lz4cat -t "$archive" >/dev/null 2>&1 ; then + lz4cat "$archive" elif bzip2 -t "$archive" >/dev/null 2>&1 ; then bzip2 -c -d "$archive" elif lzop -t "$archive" >/dev/null 2>&1 ; then -- GitLab From b4804ddacf4082feb263d83b1b5c99be27850fc4 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Fri, 22 Jun 2018 00:17:49 +0100 Subject: [PATCH 013/213] Only sync the filesystem containing the initramfs This avoids update-initramfs taking an unnecessarily long time if there is lots of activity on a different filesystem, or even hanging in cases such as a stale NFS mount. Based on a patch by Jukka Tastula . Closes: #882380 LP: #1667512 Signed-off-by: Colin Watson --- debian/control | 2 +- update-initramfs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/control b/debian/control index cc7c32d..18d0684 100644 --- a/debian/control +++ b/debian/control @@ -25,7 +25,7 @@ Package: initramfs-tools-core Architecture: all Multi-Arch: foreign Recommends: ${busybox:Recommends} -Depends: klibc-utils (>= 2.0.4-8~), cpio, kmod | module-init-tools, udev, ${misc:Depends} +Depends: klibc-utils (>= 2.0.4-8~), cpio, kmod | module-init-tools, udev, coreutils (>= 8.24), ${misc:Depends} Suggests: bash-completion Breaks: initramfs-tools (<< 0.121~), ${busybox:Breaks} Replaces: initramfs-tools (<< 0.121~) diff --git a/update-initramfs b/update-initramfs index 04145c5..d98aaa4 100755 --- a/update-initramfs +++ b/update-initramfs @@ -158,7 +158,7 @@ generate_initramfs() mv -f "${initramfs}.new" "${initramfs}" set_sha1 # Guard against an unclean shutdown - sync + sync -f "${initramfs}" else mkinitramfs_return="$?" remove_initramfs_bak -- GitLab From 5091a5e51f29b2ba78d9d5ca7e4e65198962b376 Mon Sep 17 00:00:00 2001 From: Paul Menzel Date: Sat, 23 Jun 2018 15:51:04 +0200 Subject: [PATCH 014/213] control: Remove suggestion of *lz4-tools* No other compression tools are suggested, so do not do it for LZ4 either. Also, [*liblz4-tool* was renamed to *lz4* in version 1.8.0-1][1]. [1]: http://metadata.ftp-master.debian.org/changelogs/main/l/lz4/lz4_1.8.2-1_changelog --- debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/control b/debian/control index d21fce2..cc7c32d 100644 --- a/debian/control +++ b/debian/control @@ -12,7 +12,7 @@ Package: initramfs-tools Architecture: all Multi-Arch: foreign Depends: initramfs-tools-core (= ${binary:Version}), linux-base, ${misc:Depends} -Suggests: bash-completion, liblz4-tool +Suggests: bash-completion Provides: linux-initramfs-tool Conflicts: linux-initramfs-tool, usplash (<< 0.5.50) Breaks: cryptsetup (<< 2:1.6.6-4~), elilo (<< 3.12-3.1~), lilo (<< 22.8-8.2~), s390-tools (<< 1.8.3-2~), console-setup (<< 1.72), systemd-sysv (<< 186), lvm2 (<< 2.02.111-2.1~), initscripts (<< 2.88dsf-59.3~), upstart, e2fsprogs (<< 1.42.13) -- GitLab From 5bf4c29af2276e722e36672993e15b03ad2781ab Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Sun, 11 Mar 2018 17:53:43 +0000 Subject: [PATCH 015/213] debian/control: Point Vcs URLs to Salsa --- debian/control | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/control b/debian/control index 18d0684..dd31aaf 100644 --- a/debian/control +++ b/debian/control @@ -5,8 +5,8 @@ Uploaders: Michael Prokop , Ben Hutchings Maintainer: Debian kernel team Build-Depends: debhelper (>= 9), bash-completion Standards-Version: 3.9.8 -Vcs-Browser: https://anonscm.debian.org/cgit/kernel/initramfs-tools.git -Vcs-Git: https://anonscm.debian.org/git/kernel/initramfs-tools.git +Vcs-Browser: https://salsa.debian.org/kernel-team/initramfs-tools +Vcs-Git: https://salsa.debian.org/kernel-team/initramfs-tools.git Package: initramfs-tools Architecture: all -- GitLab From e8377b3c5f59097de9b22eb69db980e49fc2bd07 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 18 Jul 2018 00:59:46 +0100 Subject: [PATCH 016/213] hooks/fsck: Fix invocation of fstype at build time get_fstab prefers to use the fstype utility (from klibc) and then falls back to blkid. Since klibc utilities are not in $PATH at build time, get_fsck_type_fstab defines fstype as an alias for its full filename before calling get_fstab. This never actually worked, because aliases are expanded during function definition, not execution. Replacing the alias and unalias with a shell function definition and an 'unset -f' solves the problem. Thanks: Simon Tatham Closes: #865691 Signed-off-by: Ben Hutchings --- hooks/fsck | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hooks/fsck b/hooks/fsck index 86d0dde..e4779fc 100755 --- a/hooks/fsck +++ b/hooks/fsck @@ -59,9 +59,9 @@ get_fsck_type_fstab () { # therefore never used at boot time if [ "${MNT_DIR}" = "/" ] || [ "${MNT_TYPE}" = "auto" ]; then MNT_FSNAME="$(resolve_device "${MNT_FSNAME}")" - alias fstype="/usr/lib/klibc/bin/fstype" + fstype() { "/usr/lib/klibc/bin/fstype" "$@"; } get_fstype "${MNT_FSNAME}" - unalias fstype + unset -f fstype else echo "${MNT_TYPE}" fi -- GitLab From 281ad9a69f523211172719554f268fa38a8682f3 Mon Sep 17 00:00:00 2001 From: Karsten Merker Date: Thu, 29 Jun 2017 20:51:03 +0200 Subject: [PATCH 017/213] Include the axp20x_usb_power module in the base modules list for MODULES=most With newer kernels (including kernel 4.9 as used in stretch), initializing the USB host controllers on a number of armhf systems is not possible without having the "axp20x_usb_power" power supply driver module available. To be able to have the rootfs on a USB mass storage device on such systems it is therefore necessary to include this module in the initramfs. Closes: #866521 Signed-off-by: Ben Hutchings --- hook-functions | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hook-functions b/hook-functions index 060f200..03d81ff 100644 --- a/hook-functions +++ b/hook-functions @@ -513,6 +513,10 @@ auto_add_modules() copy_modules_dir kernel/drivers/usb/renesas_usbhs # and any extcon drivers for USB modules="$modules extcon-usb-gpio" + # Add the axp20x_usb_power power supply driver, + # required to initialize the USB host controllers + # on a number of armhf systems + modules="$modules axp20x_usb_power" # Include all HID drivers unless we're sure they # don't support keyboards. hid-*ff covers various -- GitLab From 492763a80d5c239fdd9a085baf23d1756602605c Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 18 Jul 2018 02:37:53 +0100 Subject: [PATCH 018/213] docs: Convert maintainer notes to Markdown format Alioth's gitweb installation used to serve up the maintainer notes as text/html, and we linked to that. Gitlab, however, is written with some more concern for web security, and won't do that except through explicitly exporting "pages" to be hosted on a per-team domain. It doesn't really seem worth the trouble of doing that for the one HTML file in initramfs-tools. Instead, convert it to Markdown format which Gitlab will happily render inline on its repository view. This will also make the document substantially easier to edit in future. Signed-off-by: Ben Hutchings --- docs/maintainer-notes.html | 371 ------------------------------------- docs/maintainer-notes.md | 234 +++++++++++++++++++++++ 2 files changed, 234 insertions(+), 371 deletions(-) delete mode 100644 docs/maintainer-notes.html create mode 100644 docs/maintainer-notes.md diff --git a/docs/maintainer-notes.html b/docs/maintainer-notes.html deleted file mode 100644 index f3eecc7..0000000 --- a/docs/maintainer-notes.html +++ /dev/null @@ -1,371 +0,0 @@ - - - - -Maintainer documentation for initramfs-tools - - - - - -
-
- -

Maintainer documentation for initramfs-tools

- -
- -

Table of Contents

- - - -
- -

NOTE: The most recent version of this document is available at -docs/maintainer-notes.html in the the git repository -or online at git.debian.org.

- -
- -

1. Definitions

- - - - - - -
$mailaddress:mailaddress of the user
$username:name of the alioth account
$version:version string
$yourname:your fullname
- - -
- -

2. Preparations

- -
    - -
  1. Install required software (notice: git is named git-core on Debian/oldstable): -
    -# apt-get install git git-buildpackage dpkg-dev
    -
    -
  2. - -
  3. Set environment variables (e.g. through your ~/.bashrc or ~/.zshrc) for devscripts (gbp dch): -
    -export DEBEMAIL=$mailaddress
    -export DEBFULLNAME=$yourname
    -
    -
  4. - -
  5. Set user name and email address for git (drop the --global option to use configuration per-repo basis): -
    -% git config --global user.name  "$yourname"
    -% git config --global user.email "$mailaddress"
    -
    -
  6. - -
  7. Checkout repository (anonymous): -
    -% git clone git://git.debian.org/git/kernel/initramfs-tools.git
    -% cd initramfs-tools
    -
    -
  8. - -
  9. Checkout repository (with developer access): -
    -% git clone ssh://$username@git.debian.org/git/kernel/initramfs-tools.git
    -% cd initramfs-tools
    -
    -
  10. - -
- - -
- -

3. Workflow for daily work

- -

3.1 Implement new features

- -
    - -
  1. Checkout new branch and switch to it: -
    -% git checkout -b $username/short-descr-of-new-feature
    -
    -
  2. - -
  3. Hack and commit work: -
    -% $EDITOR $somefile
    -% git add $somefile
    -% git commit -s
    -
    - -NOTE: Use 'Closes: #BUGID' for closing a bugreport and 'Thanks: Fullname -<mailaddress>' for giving credits in your commit message. gbp dch will use -this information for generating the changelog using the --meta option later -on. - -
  4. - -
  5. Finally push your branch to alioth: -
    -% git push origin $username/short-descr-of-new-feature
    -
    -
  6. - -
- -

3.2 Merge branches

- -
    - -
  1. Switch to the branch you want to merge: -
    -% git checkout $username/new-feature
    -
    -
  2. - -
  3. Rebase to master: -
    -% git rebase master
    -
    -
  4. - -
  5. Switch to master branch and merge: -
    -% git checkout master
    -% git merge $username/new-feature
    -
    -
  6. - -
  7. Push: -
    -% git push
    -
    -
  8. - -
  9. After branch is merged delete branch on server and locally: -
    -% git push origin :$username/short-descr-of-new-feature
    -% git branch -d $username/short-descr-of-new-feature
    -
    -
  10. - -
  11. If a branch is removed from the server it will stay locally. You can get of -any stale remote branches locally by executing: -
    -% git remote prune origin
    -
    -
  12. - -
- -

3.3 Test specific branch

- -
    - -
  1. Checkout a specific branch iff branch is not already present locally: -
    -% git checkout -b somename/short-descr-of-new-feature origin/somename/short-descr-of-new-feature
    -
    -
  2. - -
  3. Checkout a specific branch iff branch is already present locally: -
    -% git checkout -b somename/short-descr-of-new-feature
    -
    -
  4. - -
  5. Adjust debian/changelog accordingly: -
    -% gbp dch --debian-branch="$(git branch | awk -F\*\   '/^* / { print $2}' )" \
    -  --since="v$(dpkg-parsechangelog | awk '/^Version:/ {print $2}')" -S --id-length=7 --meta --multimaint-merge
    -
    -
  6. - -
  7. Build package: -
    -% gbp buildpackage --git-ignore-new --git-debian-branch="$(git branch | awk -F\*\  '/^* / { print $2}' )" --post-clean
    -
    -
  8. - -
- - -
- -

3.4 Build snapshot version

- -
    - -
  1. Adjust debian/changelog accordingly: -
    -% gbp dch --debian-branch="$(git branch | awk -F\*\   '/^* / { print $2}' )" \
    -  --since="v$(dpkg-parsechangelog | awk '/^Version:/ {print $2}')" -S --id-length=7 --meta --multimaint-merge
    -
    -
  2. - -
  3. Build package: -
    -% gbp buildpackage --git-debian-branch="$(git branch | awk -F\*\  '/^* / { print $2}' )" --post-clean [-us -uc]
    -
    -
  4. - -
- - -
- -

4. Contribute

- -
    -
  1. Create patch: -
    -% git format-patch -s -p origin/master
    -
    -
  2. - -
  3. Send patch file(s) to maintainers via mail (requires Debian package git-email): -
    -% git send-email --to=initramfs-tools@packages.debian.org $PATCHFILE[S]
    -
    -
  4. - -
  5. The development mailinglists are debian-kernel@lists.debian.org -and initramfs@vger.kernel.org. -Discussion of features, bugs and patches are more than welcome on one -of these lists.
  6. - -
- - -
- -

5. Release new version

- -
    - -
  1. Creating changelog: - -
    -% gbp dch --debian-branch master --release --since HASH
    -
    - -or more dynamically: - -
    -% gbp dch --meta --release --since v$(dpkg-parsechangelog | awk '/^Version:/ {print $2}') --debian-branch="$(git branch | awk -F\*\  '/^* / { print $2}' )" --id-length=7 --meta --multimaint-merge
    -
    - -NOTE: we do not use history based sorting for the changelog entries but -sort them by author. - -
  2. - -
  3. Releasing: -
    -% git commit -a -s -m "Releasing version $version."
    -
    -
  4. - -
  5. Tagging: -
    -% git tag -s v"$version" -m "release $version"
    -
    -
  6. - -
  7. Pushing: -
    -% git push
    -% git push --tags
    -
    -
  8. - -
  9. Build in chroot and upload to ftp-master.
  10. - -
  11. Send mail announcing the new initramfs-tools version with subject -"initramfs-tools $VERSION release" to initramfs@vger.kernel.org, -debian-kernel@lists.debian.org + kernel-team@lists.ubuntu.com - including a -shortlog (generated through "git shortlog $TAG..").
  12. - -
- - -
- -

6. Resources

- - - - -
- -

7. Credits

- - - - -
- -

8. License

- -
    -
  • This document is licensed under GPL v2 or any later version.
  • -
- - -
- -

--- Michael Prokop <mika@debian.org> -

- -
- -
- - diff --git a/docs/maintainer-notes.md b/docs/maintainer-notes.md new file mode 100644 index 0000000..677bece --- /dev/null +++ b/docs/maintainer-notes.md @@ -0,0 +1,234 @@ +*** + +# Maintainer documentation for initramfs-tools + +*** + +## Table of Contents + +* [1. Definitions](#definitions) +* [2. Preparations](#preparations) +* [3. Workflow for daily work](#workflow) + * [3.1 Implement new features](#newfeature) + * [3.2 Merge branches](#merge) + * [3.3 Test specific branch](#test) + * [3.4 Build snapshot version](#snapshot) +* [4. Contribute](#contribute) +* [5. Release new version](#release) +* [6. Resources](#resources) +* [7. Credits](#credits) +* [8. License](#license) + +*** + +**NOTE:** The most recent version of this document is available at +docs/maintainer-notes.html in the [the git repository](#checkout) +or online at [git.debian.org](http://git.debian.org/?p=kernel/initramfs-tools.git;a=blob_plain;f=docs/maintainer-notes.html;hb=HEAD). + +*** + +## 1. Definitions + + + + + + +
$mailaddress:mailaddress of the user
$username:name of the alioth account
$version:version string
$yourname:your fullname
+ +*** + +## 2. Preparations + +1. Install required software (notice: git is named git-core on Debian/oldstable): + + # apt-get install git git-buildpackage dpkg-dev + +1. Set environment variables (e.g. through your ~/.bashrc or ~/.zshrc) for devscripts (gbp dch): + + export DEBEMAIL=$mailaddress + export DEBFULLNAME=$yourname + +1. Set user name and email address for git (drop the --global option to use configuration per-repo basis): + + % git config --global user.name "$yourname" + % git config --global user.email "$mailaddress" + +1. Checkout repository (anonymous): + + % git clone git://git.debian.org/git/kernel/initramfs-tools.git + % cd initramfs-tools + +1. Checkout repository (with developer access): + + % git clone ssh://$username@git.debian.org/git/kernel/initramfs-tools.git + % cd initramfs-tools + +*** + +## 3. Workflow for daily work + +### 3.1 Implement new features + +1. Checkout new branch and switch to it: + + % git checkout -b $username/short-descr-of-new-feature + +1. Hack and commit work: + + % $EDITOR $somefile + % git add $somefile + % git commit -s + + **NOTE:** Use 'Closes: #BUGID' for closing a bugreport and 'Thanks: Fullname + <mailaddress>' for giving credits in your commit message. gbp dch will use + this information for generating the changelog using the --meta option later + on. + +1. Finally push your branch to alioth: + + % git push origin $username/short-descr-of-new-feature + +### 3.2 Merge branches + +1. Switch to the branch you want to merge: + + % git checkout $username/new-feature + +1. Rebase to master: + + % git rebase master + +1. Switch to master branch and merge: + + % git checkout master + % git merge $username/new-feature + +1. Push: + + % git push + +1. After branch is merged delete branch on server and locally: + + % git push origin :$username/short-descr-of-new-feature + % git branch -d $username/short-descr-of-new-feature + +1. If a branch is removed from the server it will stay locally. You can get of +any stale remote branches locally by executing: + + % git remote prune origin + +### 3.3 Test specific branch + +1. Checkout a specific branch iff branch is not already present locally: + + % git checkout -b somename/short-descr-of-new-feature origin/somename/short-descr-of-new-feature + +1. Checkout a specific branch iff branch is already present locally: + + % git checkout -b somename/short-descr-of-new-feature + +1. Adjust debian/changelog accordingly: + + % gbp dch --debian-branch="$(git branch | awk -F\*\ '/^* / { print $2}' )" \ + --since="v$(dpkg-parsechangelog | awk '/^Version:/ {print $2}')" -S --id-length=7 --meta --multimaint-merge + +1. Build package: + + % gbp buildpackage --git-ignore-new --git-debian-branch="$(git branch | awk -F\*\ '/^* / { print $2}' )" --post-clean + +*** + +### 3.4 Build snapshot version + +1. Adjust debian/changelog accordingly: + + % gbp dch --debian-branch="$(git branch | awk -F\*\ '/^* / { print $2}' )" \ + --since="v$(dpkg-parsechangelog | awk '/^Version:/ {print $2}')" -S --id-length=7 --meta --multimaint-merge + +1. Build package: + + % gbp buildpackage --git-debian-branch="$(git branch | awk -F\*\ '/^* / { print $2}' )" --post-clean [-us -uc] + +*** + +## 4. Contribute + +1. Create patch: + + % git format-patch -s -p origin/master + +1. Send patch file(s) to maintainers via mail (requires Debian package git-email): + + % git send-email --to=initramfs-tools@packages.debian.org $PATCHFILE[S] + +1. The development mailinglists are [debian-kernel@lists.debian.org](mailto:debian-kernel@lists.debian.org) + and [initramfs@vger.kernel.org](mailto:initramfs@vger.kernel.org). + Discussion of features, bugs and patches are more than welcome on one + of these lists. + +*** + +## 5. Release new version + +1. Creating changelog: + + % gbp dch --debian-branch master --release --since HASH + + or more dynamically: + + % gbp dch --meta --release --since v$(dpkg-parsechangelog | awk '/^Version:/ {print $2}') --debian-branch="$(git branch | awk -F\*\ '/^* / { print $2}' )" --id-length=7 --meta --multimaint-merge + + **NOTE:** we do not use history based sorting for the changelog entries but + sort them by author. + +1. Releasing: + + % git commit -a -s -m "Releasing version $version." + +1. Tagging: + + % git tag -s v"$version" -m "release $version" + +1. Pushing: + + % git push + % git push --tags + +1. Build in chroot and upload to ftp-master. + +1. Send mail announcing the new initramfs-tools version with subject + "initramfs-tools $VERSION release" to initramfs@vger.kernel.org, + debian-kernel@lists.debian.org + kernel-team@lists.ubuntu.com - including a + shortlog (generated through "git shortlog $TAG.."). + +*** + +## 6. Resources + +* [initramfs-tools git web interface](http://git.debian.org/?p=kernel/initramfs-tools.git) +* [initramfs @ debian-wiki](http://wiki.debian.org/initramfs) +* [bugreports](http://bugs.debian.org/cgi-bin/pkgreport.cgi?pkg=initramfs-tools;dist=unstable) +* [initramfs-tools @ PTS](http://packages.qa.debian.org/i/initramfs-tools.html) +* [popcon graph](http://qa.debian.org/popcon.php?package=initramfs-tools) +* [bugcount for initramfs-tools](http://people.debian.org/~glandium/bts/i/initramfs-tools.png) +* [bugreports @ ubuntu](https://launchpad.net/ubuntu/+source/initramfs-tools) +* [qa page @ ubuntu](http://status.qa.ubuntu.com/qapkgstatus/initramfs-tools) + +*** + +## 7. Credits + +* Thanks to Daniel Baumann for his "[Debian Packaging with Git](http://documentation.debian-projects.org/other/debian-packaging-git/)" which inspired this document. + +*** + +## 8. License + +* This document is licensed under GPL v2 or any later version. + +*** + +*-- Michael Prokop <[mika@debian.org](mailto:mika@debian.org)>* + +*** -- GitLab From 0214976a9f335937753a0ac4eeabc39cbe70dda1 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 18 Jul 2018 02:51:08 +0100 Subject: [PATCH 019/213] docs/maintainer-notes.md: Update references to Alioth, to Salsa Signed-off-by: Ben Hutchings --- docs/maintainer-notes.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/maintainer-notes.md b/docs/maintainer-notes.md index 677bece..e88c935 100644 --- a/docs/maintainer-notes.md +++ b/docs/maintainer-notes.md @@ -23,7 +23,7 @@ **NOTE:** The most recent version of this document is available at docs/maintainer-notes.html in the [the git repository](#checkout) -or online at [git.debian.org](http://git.debian.org/?p=kernel/initramfs-tools.git;a=blob_plain;f=docs/maintainer-notes.html;hb=HEAD). +or online at [salsa.debian.org](https://salsa.debian.org/kernel-team/initramfs-tools/blob/master/docs/maintainer-notes.md). *** @@ -31,7 +31,7 @@ or online at [git.debian.org](http://git.debian.org/?p=kernel/initramfs-tools.gi - +
$mailaddress:mailaddress of the user
$username:name of the alioth account
$username:name of the Salsa account
$version:version string
$yourname:your fullname
@@ -56,12 +56,12 @@ or online at [git.debian.org](http://git.debian.org/?p=kernel/initramfs-tools.gi 1. Checkout repository (anonymous): - % git clone git://git.debian.org/git/kernel/initramfs-tools.git + % git clone https://salsa.debian.org/kernel-team/initramfs-tools.git % cd initramfs-tools 1. Checkout repository (with developer access): - % git clone ssh://$username@git.debian.org/git/kernel/initramfs-tools.git + % git clone ssh://git@salsa.debian.org/kernel-team/initramfs-tools.git % cd initramfs-tools *** @@ -85,7 +85,7 @@ or online at [git.debian.org](http://git.debian.org/?p=kernel/initramfs-tools.gi this information for generating the changelog using the --meta option later on. -1. Finally push your branch to alioth: +1. Finally push your branch to Salsa: % git push origin $username/short-descr-of-new-feature @@ -206,7 +206,7 @@ any stale remote branches locally by executing: ## 6. Resources -* [initramfs-tools git web interface](http://git.debian.org/?p=kernel/initramfs-tools.git) +* [initramfs-tools git web interface](https://salsa.debian.org/kernel-team/initramfs-tools) * [initramfs @ debian-wiki](http://wiki.debian.org/initramfs) * [bugreports](http://bugs.debian.org/cgi-bin/pkgreport.cgi?pkg=initramfs-tools;dist=unstable) * [initramfs-tools @ PTS](http://packages.qa.debian.org/i/initramfs-tools.html) -- GitLab From b71c6c9ca9cdc0cad28f5ca233a49e0cc74e4848 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 18 Jul 2018 02:53:08 +0100 Subject: [PATCH 020/213] docs/maintainer-notes.md: Delete mention of git-core package git is in the git package in all supported releases. Signed-off-by: Ben Hutchings --- docs/maintainer-notes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/maintainer-notes.md b/docs/maintainer-notes.md index e88c935..5b4e568 100644 --- a/docs/maintainer-notes.md +++ b/docs/maintainer-notes.md @@ -40,7 +40,7 @@ or online at [salsa.debian.org](https://salsa.debian.org/kernel-team/initramfs-t ## 2. Preparations -1. Install required software (notice: git is named git-core on Debian/oldstable): +1. Install required software: # apt-get install git git-buildpackage dpkg-dev -- GitLab From 89daebfdc85abd23bfdbed094348cbb99ac21853 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 18 Jul 2018 03:01:09 +0100 Subject: [PATCH 021/213] docs/maintainer-notes.md: Change BTS link to specify source package The existing link specifies the package name initramfs-tools, so the resulting list won't include bugs assigned to initramfs-tools-core. We have to specify source package name (src query parameter) to get everything. Signed-off-by: Ben Hutchings --- docs/maintainer-notes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/maintainer-notes.md b/docs/maintainer-notes.md index 5b4e568..e1c4681 100644 --- a/docs/maintainer-notes.md +++ b/docs/maintainer-notes.md @@ -208,7 +208,7 @@ any stale remote branches locally by executing: * [initramfs-tools git web interface](https://salsa.debian.org/kernel-team/initramfs-tools) * [initramfs @ debian-wiki](http://wiki.debian.org/initramfs) -* [bugreports](http://bugs.debian.org/cgi-bin/pkgreport.cgi?pkg=initramfs-tools;dist=unstable) +* [bugreports](https://bugs.debian.org/cgi-bin/pkgreport.cgi?src=initramfs-tools;dist=unstable) * [initramfs-tools @ PTS](http://packages.qa.debian.org/i/initramfs-tools.html) * [popcon graph](http://qa.debian.org/popcon.php?package=initramfs-tools) * [bugcount for initramfs-tools](http://people.debian.org/~glandium/bts/i/initramfs-tools.png) -- GitLab From 8e539dc19d248f9dd14c510aba3ed7ab1f4fabe6 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 18 Jul 2018 03:03:50 +0100 Subject: [PATCH 022/213] docs/maintainer-notes.md: Link to tracker.debian.org instead of PTS I think tracker.debian.org shows all the information on the old PTS, and more. Signed-off-by: Ben Hutchings --- docs/maintainer-notes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/maintainer-notes.md b/docs/maintainer-notes.md index e1c4681..0a2ed1a 100644 --- a/docs/maintainer-notes.md +++ b/docs/maintainer-notes.md @@ -209,7 +209,7 @@ any stale remote branches locally by executing: * [initramfs-tools git web interface](https://salsa.debian.org/kernel-team/initramfs-tools) * [initramfs @ debian-wiki](http://wiki.debian.org/initramfs) * [bugreports](https://bugs.debian.org/cgi-bin/pkgreport.cgi?src=initramfs-tools;dist=unstable) -* [initramfs-tools @ PTS](http://packages.qa.debian.org/i/initramfs-tools.html) +* [initramfs-tools @ tracker](https://tracker.debian.org/pkg/initramfs-tools) * [popcon graph](http://qa.debian.org/popcon.php?package=initramfs-tools) * [bugcount for initramfs-tools](http://people.debian.org/~glandium/bts/i/initramfs-tools.png) * [bugreports @ ubuntu](https://launchpad.net/ubuntu/+source/initramfs-tools) -- GitLab From 3f271974c7eb4db7c38c4cc9a6896d32e94f2f09 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 18 Jul 2018 03:05:21 +0100 Subject: [PATCH 023/213] docs/maintainer-notes.md: Remove stale link to Debian bug count graph Signed-off-by: Ben Hutchings --- docs/maintainer-notes.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/maintainer-notes.md b/docs/maintainer-notes.md index 0a2ed1a..7a1a170 100644 --- a/docs/maintainer-notes.md +++ b/docs/maintainer-notes.md @@ -211,7 +211,6 @@ any stale remote branches locally by executing: * [bugreports](https://bugs.debian.org/cgi-bin/pkgreport.cgi?src=initramfs-tools;dist=unstable) * [initramfs-tools @ tracker](https://tracker.debian.org/pkg/initramfs-tools) * [popcon graph](http://qa.debian.org/popcon.php?package=initramfs-tools) -* [bugcount for initramfs-tools](http://people.debian.org/~glandium/bts/i/initramfs-tools.png) * [bugreports @ ubuntu](https://launchpad.net/ubuntu/+source/initramfs-tools) * [qa page @ ubuntu](http://status.qa.ubuntu.com/qapkgstatus/initramfs-tools) -- GitLab From 7dece273554837682a1479e791964d8d334c387b Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 18 Jul 2018 03:07:47 +0100 Subject: [PATCH 024/213] docs/maintainer-notes.md: Use HTTP-S for Debian wiki and popcon links Signed-off-by: Ben Hutchings --- docs/maintainer-notes.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/maintainer-notes.md b/docs/maintainer-notes.md index 7a1a170..13bdc60 100644 --- a/docs/maintainer-notes.md +++ b/docs/maintainer-notes.md @@ -207,10 +207,10 @@ any stale remote branches locally by executing: ## 6. Resources * [initramfs-tools git web interface](https://salsa.debian.org/kernel-team/initramfs-tools) -* [initramfs @ debian-wiki](http://wiki.debian.org/initramfs) +* [initramfs @ debian-wiki](https://wiki.debian.org/initramfs) * [bugreports](https://bugs.debian.org/cgi-bin/pkgreport.cgi?src=initramfs-tools;dist=unstable) * [initramfs-tools @ tracker](https://tracker.debian.org/pkg/initramfs-tools) -* [popcon graph](http://qa.debian.org/popcon.php?package=initramfs-tools) +* [popcon graph](https://qa.debian.org/popcon.php?package=initramfs-tools) * [bugreports @ ubuntu](https://launchpad.net/ubuntu/+source/initramfs-tools) * [qa page @ ubuntu](http://status.qa.ubuntu.com/qapkgstatus/initramfs-tools) -- GitLab From 838b6ecb45445b00be785e6c4017281a9771d6c5 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 18 Jul 2018 03:08:13 +0100 Subject: [PATCH 025/213] docs/maintainer-notes.md: Link directly to Ubuntu bug list Currently the "bugreports @ ubuntu" link goes to the Launchpad package overview for initramfs-tools, not the bug list. Signed-off-by: Ben Hutchings --- docs/maintainer-notes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/maintainer-notes.md b/docs/maintainer-notes.md index 13bdc60..9dbd62f 100644 --- a/docs/maintainer-notes.md +++ b/docs/maintainer-notes.md @@ -211,7 +211,7 @@ any stale remote branches locally by executing: * [bugreports](https://bugs.debian.org/cgi-bin/pkgreport.cgi?src=initramfs-tools;dist=unstable) * [initramfs-tools @ tracker](https://tracker.debian.org/pkg/initramfs-tools) * [popcon graph](https://qa.debian.org/popcon.php?package=initramfs-tools) -* [bugreports @ ubuntu](https://launchpad.net/ubuntu/+source/initramfs-tools) +* [bugreports @ ubuntu](https://bugs.launchpad.net/ubuntu/+source/initramfs-tools) * [qa page @ ubuntu](http://status.qa.ubuntu.com/qapkgstatus/initramfs-tools) *** -- GitLab From eaa61d43189a22cc0a7420cbf1faa6c89bc324b6 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 18 Jul 2018 03:09:58 +0100 Subject: [PATCH 026/213] docs/maintainer-notes.md: Add myself as co-author Signed-off-by: Ben Hutchings --- docs/maintainer-notes.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/maintainer-notes.md b/docs/maintainer-notes.md index 9dbd62f..f481bbb 100644 --- a/docs/maintainer-notes.md +++ b/docs/maintainer-notes.md @@ -228,6 +228,7 @@ any stale remote branches locally by executing: *** -*-- Michael Prokop <[mika@debian.org](mailto:mika@debian.org)>* +*-- Michael Prokop <[mika@debian.org](mailto:mika@debian.org)>, +Ben Hutchings <[ben@decadent.org.uk](mailto:ben@decadent.org.uk)>* *** -- GitLab From fa7df8f001697520c9c437ffa7a28222d748a4e7 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 18 Jul 2018 04:38:34 +0100 Subject: [PATCH 027/213] hook-functions: Correct the comment above hidden_dep_add_modules Signed-off-by: Ben Hutchings --- hook-functions | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/hook-functions b/hook-functions index 03d81ff..935ce27 100644 --- a/hook-functions +++ b/hook-functions @@ -599,10 +599,11 @@ auto_add_modules() manual_add_modules $modules } -# 'depmod' only looks at symbol dependencies; there is no way for -# modules to declare explicit dependencies through module information, -# so dependencies on e.g. crypto providers are hidden. Until this is -# fixed, we need to handle those hidden dependencies. +# 'depmod' only looks at symbol dependencies and the 'softdep' module +# information field; there is no way for modules to declare weaker +# dependencies (modules that *might* be needed at run-time) through +# module information, Until this is fixed, we need to handle those +# hidden dependencies. hidden_dep_add_modules() { local modules= -- GitLab From 0ffbeb9ceeee890b25f256530f0a84e83a5c5243 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 18 Jul 2018 04:39:11 +0100 Subject: [PATCH 028/213] hook-functions: Remove directory information from hidden_dep_add_modules Module installation directories reflect their source directory, and since the kernel source is sometimes reorganised it isn't very future-proof to hard-code directories here. Rewrite the file tests as an iteration over all modules already installed. Signed-off-by: Ben Hutchings --- hook-functions | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/hook-functions b/hook-functions index 935ce27..0b31ac7 100644 --- a/hook-functions +++ b/hook-functions @@ -606,19 +606,30 @@ auto_add_modules() # hidden dependencies. hidden_dep_add_modules() { - local modules= - for dep in "lib/libcrc32c crc32c" \ - "fs/ubifs/ubifs deflate zlib lzo" \ - "fs/btrfs/btrfs crc32c" \ - "drivers/net/ethernet/mellanox/mlx4/mlx4_core mlx4_ib" \ - "drivers/net/ethernet/mellanox/mlx5/core/mlx5_core mlx5_ib"; do - set -- $dep - if [ -f "${DESTDIR}/lib/modules/${version}/kernel/$1.ko" ]; then - shift - modules="$modules $@" - fi - done - manual_add_modules $modules + manual_add_modules $( + find "${DESTDIR}/lib/modules/${version}/kernel" -name '*.ko' | + while read module; do + module="${module##*/}" + module="${module%.ko}" + case "$module" in + libcrc32c) + echo crc32c + ;; + ubifs) + echo deflate zlib lzo + ;; + btrfs) + echo crc32c + ;; + mlx4_core) + echo mlx4_ib + ;; + mlx5_core) + echo mlx5_ib + ;; + esac + done + ) } # mkinitramfs help message -- GitLab From 78e95c1ee7e623d125b9bcfdf09f6147e2558500 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 18 Jul 2018 04:46:28 +0100 Subject: [PATCH 029/213] hook-functions: Check modules.builtin in hidden_dep_add_modules Built-in "modules" can have weak dependencies on modules, and we will need to handle that here. Signed-off-by: Ben Hutchings --- hook-functions | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hook-functions b/hook-functions index 0b31ac7..79cedec 100644 --- a/hook-functions +++ b/hook-functions @@ -607,7 +607,10 @@ auto_add_modules() hidden_dep_add_modules() { manual_add_modules $( - find "${DESTDIR}/lib/modules/${version}/kernel" -name '*.ko' | + { + cat "${DESTDIR}/lib/modules/${version}/modules.builtin" + find "${DESTDIR}/lib/modules/${version}/kernel" -name '*.ko' + } | while read module; do module="${module##*/}" module="${module%.ko}" -- GitLab From 976aeb9e8dbc39c5f118d0eb41d57dee3d8f7f63 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 18 Jul 2018 04:48:01 +0100 Subject: [PATCH 030/213] hook-functions: Handle i8042 hidden dependency on psmouse On some systems the keyboard controller doesn't behave properly until psmouse has also done its initialisation. We already include psmouse in MODULES=most builds for this reason. Close: #878829 Signed-off-by: Ben Hutchings --- hook-functions | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hook-functions b/hook-functions index 79cedec..8691688 100644 --- a/hook-functions +++ b/hook-functions @@ -630,6 +630,9 @@ hidden_dep_add_modules() mlx5_core) echo mlx5_ib ;; + i8042) + echo psmouse + ;; esac done ) -- GitLab From 211e0507a80c2ede3bfbc78fa222be363561fe85 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 18 Jul 2018 04:52:42 +0100 Subject: [PATCH 031/213] hook-functions: Handle nvme hidden dependency on vmd Include vmd in the block drivers group, and add the dependency to hidden_dep_add_modules. Thanks: Mario Limonciello Closes: #886349 Signed-off-by: Ben Hutchings --- hook-functions | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hook-functions b/hook-functions index 8691688..25cd344 100644 --- a/hook-functions +++ b/hook-functions @@ -574,6 +574,7 @@ auto_add_modules() block) copy_modules_dir kernel/drivers/block copy_modules_dir kernel/drivers/nvme + modules="$modules vmd" ;; ubi) modules="$modules deflate zlib lzo ubi ubifs" @@ -633,6 +634,9 @@ hidden_dep_add_modules() i8042) echo psmouse ;; + nvme) + echo vmd + ;; esac done ) -- GitLab From 28536f665ccbef9a76d775fde557d0902426df49 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 18 Jul 2018 05:25:13 +0100 Subject: [PATCH 032/213] unmkinitramfs, lsinitramfs: Split multiple early initramfs sections It is possible for the early initramfs to consist of multiple sections, each a valid uncompressed cpio archive, for example if amd64-microcode and intel-microcode are both installed and explicitly enabled. Each cpio archive ends with an EOF marker consisting of four zero bytes and possibly additional zero padding. The kernel's early microcode loader simply skips the zero bytes, but cpio will stop. So whenever we find such a group of zero bytes, we need to stop parsing cpio headers, run cpio over what we found, and then repeat the process on the following bytes. Closes: #886424 Signed-off-by: Ben Hutchings --- unmkinitramfs | 68 ++++++++++++++++++++++++++++++++++----------------- 1 file changed, 45 insertions(+), 23 deletions(-) diff --git a/unmkinitramfs b/unmkinitramfs index 7e3d977..bd7bacf 100755 --- a/unmkinitramfs +++ b/unmkinitramfs @@ -55,42 +55,64 @@ splitinitramfs() dir="$2" shift 2 - # There may be a prepended uncompressed archive. cpio - # won't tell us the true size of this so we have to - # parse the headers and padding ourselves. This is - # very roughly based on linux/lib/earlycpio.c - offset=0 + count=0 + start=0 while true; do - if checkzero "$initramfs" $offset; then - offset=$((offset + 4)) - continue + # There may be prepended uncompressed archives. cpio + # won't tell us the true size of these so we have to + # parse the headers and padding ourselves. This is + # very roughly based on linux/lib/earlycpio.c + end=$start + while true; do + if checkzero "$initramfs" $end; then + # This is the EOF marker. There might + # be more zero padding before the next + # archive, so read through all of it. + end=$((end + 4)) + while checkzero "$initramfs" $end; do + end=$((end + 4)) + done + break + fi + magic="$(readhex "$initramfs" $end 6)" || break + test $magic = 070701 || test $magic = 070702 || break + namesize=0x$(readhex "$initramfs" $((end + 94)) 8) + filesize=0x$(readhex "$initramfs" $((end + 54)) 8) + end=$(((end + 110))) + end=$(((end + $namesize + 3) & ~3)) + end=$(((end + $filesize + 3) & ~3)) + done + if [ $end -eq $start ]; then + break fi - magic="$(readhex "$initramfs" $offset 6)" || break - test $magic = 070701 || test $magic = 070702 || break - namesize=0x$(readhex "$initramfs" $((offset + 94)) 8) - filesize=0x$(readhex "$initramfs" $((offset + 54)) 8) - offset=$(((offset + 110))) - offset=$(((offset + $namesize + 3) & ~3)) - offset=$(((offset + $filesize + 3) & ~3)) - done - if [ $offset -ne 0 ]; then - # uncompressed archive + # Extract to early, early2, ... subdirectories + count=$((count + 1)) + if [ $count -eq 1 ]; then + subdir=early + else + subdir=early$count + fi + dd < "$initramfs" skip=$start count=$((end - start)) iflag=skip_bytes 2> /dev/null | ( if [ -n "$dir" ]; then - mkdir -p -- "$dir/early" - cd -- "$dir/early" + mkdir -p -- "$dir/$subdir" + cd -- "$dir/$subdir" fi cpio -i "$@" - ) < "$initramfs" + ) + start=$end + done - # main archive + if [ $end -gt 0 ]; then + # Extract to main subdirectory subarchive=$(mktemp ${TMPDIR:-/var/tmp}/unmkinitramfs_XXXXXX) trap "rm -f '$subarchive'" EXIT - dd < "$initramfs" bs="$offset" skip=1 2> /dev/null \ + dd < "$initramfs" skip=$end iflag=skip_bytes 2> /dev/null \ > $subarchive xcpio "$subarchive" "${dir:+$dir/main}" -i "$@" else + # Don't use subdirectories (for backward compatibility) xcpio "$initramfs" "$dir" -i "$@" fi } -- GitLab From 2a9d97d3d176fc7b8b507ce332c62c10b8b2353f Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 18 Jul 2018 05:54:54 +0100 Subject: [PATCH 033/213] debian/control: Add e2fsprogs to Depends for initramfs-tools-core Closes: #887211 Signed-off-by: Ben Hutchings --- debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/control b/debian/control index dd31aaf..71a7dd3 100644 --- a/debian/control +++ b/debian/control @@ -25,7 +25,7 @@ Package: initramfs-tools-core Architecture: all Multi-Arch: foreign Recommends: ${busybox:Recommends} -Depends: klibc-utils (>= 2.0.4-8~), cpio, kmod | module-init-tools, udev, coreutils (>= 8.24), ${misc:Depends} +Depends: klibc-utils (>= 2.0.4-8~), cpio, kmod | module-init-tools, udev, coreutils (>= 8.24), e2fsprogs, ${misc:Depends} Suggests: bash-completion Breaks: initramfs-tools (<< 0.121~), ${busybox:Breaks} Replaces: initramfs-tools (<< 0.121~) -- GitLab From 54367c04c56cec71bda6e13fd10f8c2d9a1b4493 Mon Sep 17 00:00:00 2001 From: Ivan Kozik Date: Wed, 6 Dec 2017 09:35:36 +0000 Subject: [PATCH 034/213] init: export DEVICE so that when configured, it is actually set in configure_networking [bwh: Also unset it before invoking init] Closes: #883664 Signed-off-by: Ben Hutchings --- init | 2 ++ 1 file changed, 2 insertions(+) diff --git a/init b/init index 3f59c07..5d10622 100755 --- a/init +++ b/init @@ -49,6 +49,7 @@ export ROOTDELAY= export ROOTFLAGS= export ROOTFSTYPE= export IP= +export DEVICE= export BOOT= export BOOTIF= export UBIMTD= @@ -300,6 +301,7 @@ unset ROOT unset IP unset BOOT unset BOOTIF +unset DEVICE unset UBIMTD unset blacklist unset break -- GitLab From 577c94e98829cacee5f10cc80482c17c81477f68 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 18 Jul 2018 20:52:24 +0100 Subject: [PATCH 035/213] initramfs.conf: Update documentation of the DEVICE variable Signed-off-by: Ben Hutchings --- conf/initramfs.conf | 2 +- initramfs.conf.5 | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/conf/initramfs.conf b/conf/initramfs.conf index 971cea4..dd76996 100644 --- a/conf/initramfs.conf +++ b/conf/initramfs.conf @@ -51,7 +51,7 @@ COMPRESS=gzip # DEVICE: ... # # Specify a specific network interface, like eth0 -# Overridden by optional ip= bootarg +# Overridden by optional ip= or BOOTIF= bootarg # DEVICE= diff --git a/initramfs.conf.5 b/initramfs.conf.5 index 569834c..2a61796 100644 --- a/initramfs.conf.5 +++ b/initramfs.conf.5 @@ -96,7 +96,8 @@ Set it to \fInone\fP to disable resume from disk. .SH VARIABLES FOR NFS BOOT .TP \fB DEVICE -Specifies the network interface, like eth0. +Specifies the default network interface to use, like eth0. The \fIip\fP or +\fIBOOTIF\fP bootargs may override this. .TP \fB ROOT -- GitLab From f1cbe6f18c925cffd8529f04b3e71bbb26270dcc Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 18 Jul 2018 21:07:06 +0100 Subject: [PATCH 036/213] mkinitramfs: Build reproducible images when SOURCE_DATE_EPOCH is set [bwh: Resolved conflicts with lz4 support and updated Depends] Closes: #845034 Thanks: Chris Lamb Signed-off-by: Ben Hutchings --- debian/control | 2 +- mkinitramfs | 17 +++++++++++++++-- mkinitramfs.8 | 6 ++++++ 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/debian/control b/debian/control index 71a7dd3..001bb32 100644 --- a/debian/control +++ b/debian/control @@ -25,7 +25,7 @@ Package: initramfs-tools-core Architecture: all Multi-Arch: foreign Recommends: ${busybox:Recommends} -Depends: klibc-utils (>= 2.0.4-8~), cpio, kmod | module-init-tools, udev, coreutils (>= 8.24), e2fsprogs, ${misc:Depends} +Depends: klibc-utils (>= 2.0.4-8~), cpio (>= 2.12), kmod | module-init-tools, udev, coreutils (>= 8.24), e2fsprogs, ${misc:Depends} Suggests: bash-completion Breaks: initramfs-tools (<< 0.121~), ${busybox:Breaks} Replaces: initramfs-tools (<< 0.121~) diff --git a/mkinitramfs b/mkinitramfs index 44930b8..ab7bde4 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -151,6 +151,7 @@ if dpkg --compare-versions "${version}" lt "2.6.38" 2>/dev/null; then echo "linux-2.6 likely misses ${COMPRESS} support, using gzip" fi +[ "${compress}" = gzip ] && [ -n "${SOURCE_DATE_EPOCH}" ] && compress="gzip -n" [ "${compress}" = lz4 ] && compress="lz4 -9 -l" [ "${compress}" = lzop ] && compress="lzop -9" [ "${compress}" = xz ] && compress="xz --check=crc32" @@ -373,8 +374,18 @@ fi # preserve permissions if root builds the image, see #633582 [ "$(id -ru)" != 0 ] && cpio_owner_root="-R 0:0" +# if SOURCE_DATE_EPOCH is set, try and create a reproducible image +if [ -n "${SOURCE_DATE_EPOCH}" ]; then + # ensure that no timestamps are newer than $SOURCE_DATE_EPOCH + find "${DESTDIR}" -newermt "@${SOURCE_DATE_EPOCH}" -print0 | \ + xargs -0r touch --no-dereference --date="@${SOURCE_DATE_EPOCH}" + + # --reproducible requires cpio >= 2.12 + cpio_reproducible="--reproducible" +fi + # work around lack of "set -o pipefail" for the following pipe: -# cd "${DESTDIR}" && find . | cpio --quiet $cpio_owner_root -o -H newc | gzip >>"${outfile}" || exit 1 +# cd "${DESTDIR}" && find . | LC_ALL=C sort | cpio --quiet $cpio_owner_root $cpio_reproducible -o -H newc | gzip >>"${outfile}" || exit 1 exec 3>&1 eval ` # http://cfaj.freeshell.org/shell/cus-faq-2.html @@ -383,7 +394,9 @@ eval ` { find . 4>&-; echo "ec1=$?;" >&4 } | { - cpio --quiet $cpio_owner_root -o -H newc 4>&-; echo "ec2=$?;" >&4 + LC_ALL=C sort + } | { + cpio --quiet $cpio_owner_root $cpio_reproducible -o -H newc 4>&-; echo "ec2=$?;" >&4 } | ${compress} >>"${outfile}" echo "ec3=$?;" >&4 ` diff --git a/mkinitramfs.8 b/mkinitramfs.8 index 4c8bae5..b61fdeb 100644 --- a/mkinitramfs.8 +++ b/mkinitramfs.8 @@ -105,6 +105,12 @@ should not be mounted with the .B noexec mount option. +If +.B SOURCE_DATE_EPOCH +is set, +.B mkinitramfs +attempts to generate a reproducible ramdisk. + .SH FILES .TP .I /etc/initramfs-tools/initramfs.conf -- GitLab From 717e6bdac030be1ae01ff1b7c13d6c5c6ea36639 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 18 Jul 2018 22:06:50 +0100 Subject: [PATCH 037/213] mkinitramfs: Exclude ldconfig auxiliary cache from initramfs image Kristian Klausen pointed out in #845034 that even after the preceding commit /var/cache/ldconfig/aux-cache is unreproducible. ldconfig creates this file if /var/cache already exists. The reason that it's unreproducible is that it's an associative array keyed by file attributes including device and inode number, which will change on each build. They will also be different when the initramfs image is unpacked, making the cache useless at boot time. Kristian's proposal was to disable ldconfig creating caches. But /etc/ld.so.cache is useful and seems to be reproducible. Therefore, keep running ldconfig but always remove the aux-cache file. Thanks: Kristian Klausen Signed-off-by: Ben Hutchings --- mkinitramfs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mkinitramfs b/mkinitramfs index ab7bde4..89a61a3 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -338,6 +338,10 @@ if ! ldconfig -r "$DESTDIR" ; then [ $(id -u) != "0" ] \ && echo "ldconfig might need uid=0 (root) for chroot()" >&2 fi +# The auxiliary cache is not reproducible and is always invalid at boot +# (see #845034) +rm -f "${DESTDIR}"/var/cache/ldconfig/aux-cache +rmdir --ignore-fail-on-non-empty "${DESTDIR}"/var/cache/ldconfig # Apply DSDT to initramfs if [ -e "${CONFDIR}/DSDT.aml" ]; then -- GitLab From 8bddfe46b484e4941b5809a26c6a6b42a0e46844 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 18 Jul 2018 21:14:10 +0100 Subject: [PATCH 038/213] mkinitramfs(8): Remove description of nonexistent options The --supported-{host,target}-version option were only supported by mkinitramfs-kpkg, which was removed in version 0.99. Signed-off-by: Ben Hutchings --- mkinitramfs.8 | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/mkinitramfs.8 b/mkinitramfs.8 index b61fdeb..1aeb1fc 100644 --- a/mkinitramfs.8 +++ b/mkinitramfs.8 @@ -82,16 +82,6 @@ Set the verbose mode output. Set the kernel version of the initramfs image (defaults to the running kernel). -.TP -\fB\-\-supported-host-version=\fIhversion -This option queries if mkinitramfs can create ramdisks on a running kernel of version -.IR hversion . - -.TP -\fB\-\-supported-target-version=\fItversion -This option queries if mkinitramfs can create ramdisks for kernel version -.IR tversion . - .SH ENVIRONMENT .B mkinitramfs honours the -- GitLab From ecd6ce233f37bd5e3f2470209a3f20766dbec88c Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 18 Jul 2018 21:17:18 +0100 Subject: [PATCH 039/213] mkinitramfs(8), hook-functions: Correct references to "ramdisk" An initramfs image is not a ramdisk, even though it is passed to the kernel in the same way as an initrd. Signed-off-by: Ben Hutchings --- hook-functions | 8 ++++---- mkinitramfs.8 | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/hook-functions b/hook-functions index 25cd344..c18652e 100644 --- a/hook-functions +++ b/hook-functions @@ -109,8 +109,8 @@ manual_add_modules() } # $1 = file type (for logging) -# $2 = file to copy to ramdisk -# $3 (optional) Name for the file on the ramdisk +# $2 = file to copy to initramfs +# $3 (optional) Name for the file on the initramfs # Location of the image dir is assumed to be $DESTDIR # If the target exists, we leave it and return 1. # On any other error, we return >1. @@ -158,8 +158,8 @@ copy_file() { cp -pP "${src}" "${DESTDIR}/${target}" || return $(($? + 1)) } -# $1 = executable to copy to ramdisk, with library dependencies -# $2 (optional) Name for the file on the ramdisk +# $1 = executable to copy to initramfs, with library dependencies +# $2 (optional) Name for the file on the initramfs # Location of the image dir is assumed to be $DESTDIR # We never overwrite the target if it exists. copy_exec() { diff --git a/mkinitramfs.8 b/mkinitramfs.8 index 1aeb1fc..78bfdae 100644 --- a/mkinitramfs.8 +++ b/mkinitramfs.8 @@ -99,7 +99,7 @@ If .B SOURCE_DATE_EPOCH is set, .B mkinitramfs -attempts to generate a reproducible ramdisk. +attempts to generate a reproducible initramfs image. .SH FILES .TP -- GitLab From 63cec7bb02791fff8c3c48d66d9de38d0050f691 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 18 Jul 2018 22:49:03 +0100 Subject: [PATCH 040/213] docs: Move initramfs-tools man page to section 7 Manual pages that describe a general topic belong in section 7, not 8. Signed-off-by: Ben Hutchings --- debian/initramfs-tools-core.manpages | 2 +- docs/example_hook | 2 +- docs/example_script | 2 +- initramfs-tools.8 => initramfs-tools.7 | 2 +- initramfs.conf.5 | 2 +- lsinitramfs.8 | 2 +- mkinitramfs.8 | 2 +- unmkinitramfs.8 | 2 +- update-initramfs.8 | 2 +- update-initramfs.conf.5 | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) rename initramfs-tools.8 => initramfs-tools.7 (99%) diff --git a/debian/initramfs-tools-core.manpages b/debian/initramfs-tools-core.manpages index 431ff99..0f56b02 100644 --- a/debian/initramfs-tools-core.manpages +++ b/debian/initramfs-tools-core.manpages @@ -1,5 +1,5 @@ lsinitramfs.8 -mkinitramfs.8 +mkinitramfs.7 unmkinitramfs.8 initramfs.conf.5 initramfs-tools.8 diff --git a/docs/example_hook b/docs/example_hook index 1f35352..85ff6c6 100644 --- a/docs/example_hook +++ b/docs/example_hook @@ -13,7 +13,7 @@ # # DESTDIR -- The staging directory where we are building the image. # -# see initramfs-tools(8) +# see initramfs-tools(7) # # List the soft prerequisites here. This is a space separated list of diff --git a/docs/example_script b/docs/example_script index 5e9153b..accab37 100644 --- a/docs/example_script +++ b/docs/example_script @@ -6,7 +6,7 @@ # The # package that owns it may opt to install it in an appropriate # location under "/usr/share/initramfs-tools/scripts/". # -# see initramfs-tools(8) for more details. +# see initramfs-tools(7) for more details. # # List the soft prerequisites here. This is a space separated list of diff --git a/initramfs-tools.8 b/initramfs-tools.7 similarity index 99% rename from initramfs-tools.8 rename to initramfs-tools.7 index 32cce2d..f980f10 100644 --- a/initramfs-tools.8 +++ b/initramfs-tools.7 @@ -1,4 +1,4 @@ -.TH INITRAMFS-TOOLS 8 "2010/09/23" "Linux" "mkinitramfs script overview" +.TH INITRAMFS-TOOLS 7 "2010/09/23" "Linux" "mkinitramfs script overview" .SH NAME initramfs-tools \- an introduction to writing scripts for mkinitramfs diff --git a/initramfs.conf.5 b/initramfs.conf.5 index 2a61796..9c05685 100644 --- a/initramfs.conf.5 +++ b/initramfs.conf.5 @@ -120,6 +120,6 @@ Loosely based on mkinitrd.conf by Herbert Xu. .SH SEE ALSO .BR -.IR initramfs-tools (8), +.IR initramfs-tools (7), .IR mkinitramfs (8), .IR update-initramfs (8). diff --git a/lsinitramfs.8 b/lsinitramfs.8 index ff1e420..cfa2e9a 100644 --- a/lsinitramfs.8 +++ b/lsinitramfs.8 @@ -48,7 +48,7 @@ and numerous others. .SH SEE ALSO .BR -.IR initramfs-tools (8), +.IR initramfs-tools (7), .IR mkinitramfs (8), .IR unmkinitramfs (8), .IR update-initramfs (8). diff --git a/mkinitramfs.8 b/mkinitramfs.8 index 78bfdae..2e583d7 100644 --- a/mkinitramfs.8 +++ b/mkinitramfs.8 @@ -149,7 +149,7 @@ Jeff Bailey and numerous others. .SH SEE ALSO .BR .IR initramfs.conf (5), -.IR initramfs-tools (8), +.IR initramfs-tools (7), .IR update-initramfs (8), .IR lsinitramfs (8), .IR unmkinitramfs (8). diff --git a/unmkinitramfs.8 b/unmkinitramfs.8 index 1aeb55a..708f9cc 100644 --- a/unmkinitramfs.8 +++ b/unmkinitramfs.8 @@ -48,7 +48,7 @@ and numerous others. .SH SEE ALSO .BR -.IR initramfs-tools (8), +.IR initramfs-tools (7), .IR lsinitramfs (8), .IR mkinitramfs (8), .IR update-initramfs (8). diff --git a/update-initramfs.8 b/update-initramfs.8 index 31f225d..38780b8 100644 --- a/update-initramfs.8 +++ b/update-initramfs.8 @@ -94,6 +94,6 @@ Jeff Bailey and numerous others. .SH SEE ALSO .BR .IR initramfs.conf (5), -.IR initramfs-tools (8), +.IR initramfs-tools (7), .IR mkinitramfs (8), .IR lsinitramfs (8). diff --git a/update-initramfs.conf.5 b/update-initramfs.conf.5 index bd41132..ca5821a 100644 --- a/update-initramfs.conf.5 +++ b/update-initramfs.conf.5 @@ -30,6 +30,6 @@ Jeff Bailey and numerous others. .SH SEE ALSO .BR .IR initramfs.conf (5), -.IR initramfs-tools (8), +.IR initramfs-tools (7), .IR mkinitramfs (8), .IR update-initramfs (8). -- GitLab From 562d86ef33342dfdb8bfe950fed309524f6afb49 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 18 Jul 2018 22:56:31 +0100 Subject: [PATCH 041/213] docs: Update man page header dates Set each page's date to the date of the last substantive change, i.e. excluding cross-reference updates and spelling fixes. Signed-off-by: Ben Hutchings --- initramfs-tools.7 | 2 +- initramfs.conf.5 | 2 +- lsinitramfs.8 | 2 +- mkinitramfs.8 | 2 +- unmkinitramfs.8 | 2 +- update-initramfs.8 | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/initramfs-tools.7 b/initramfs-tools.7 index f980f10..bb788df 100644 --- a/initramfs-tools.7 +++ b/initramfs-tools.7 @@ -1,4 +1,4 @@ -.TH INITRAMFS-TOOLS 7 "2010/09/23" "Linux" "mkinitramfs script overview" +.TH INITRAMFS-TOOLS 7 "2018/07/18" "Linux" "mkinitramfs script overview" .SH NAME initramfs-tools \- an introduction to writing scripts for mkinitramfs diff --git a/initramfs.conf.5 b/initramfs.conf.5 index 9c05685..fe86ed9 100644 --- a/initramfs.conf.5 +++ b/initramfs.conf.5 @@ -1,4 +1,4 @@ -.TH INITRAMFS.CONF 5 "2010/11/22" "Linux" "initramfs.conf manual" +.TH INITRAMFS.CONF 5 "2018/07/18" "Linux" "initramfs.conf manual" .SH NAME initramfs.conf \- configuration file for mkinitramfs diff --git a/lsinitramfs.8 b/lsinitramfs.8 index cfa2e9a..3b9ba1b 100644 --- a/lsinitramfs.8 +++ b/lsinitramfs.8 @@ -1,4 +1,4 @@ -.TH LSINITRAMFS 8 "2010/06/16" "Linux" "lsinitramfs manual" +.TH LSINITRAMFS 8 "2015/12/09" "Linux" "lsinitramfs manual" .SH NAME lsinitramfs \- list content of an initramfs image diff --git a/mkinitramfs.8 b/mkinitramfs.8 index 2e583d7..68ac139 100644 --- a/mkinitramfs.8 +++ b/mkinitramfs.8 @@ -1,4 +1,4 @@ -.TH MKINITRAMFS 8 "2010/04/07" "Linux" "mkinitramfs manual" +.TH MKINITRAMFS 8 "2018/07/18" "Linux" "mkinitramfs manual" .SH NAME mkinitramfs \- low-level tool for generating an initramfs image diff --git a/unmkinitramfs.8 b/unmkinitramfs.8 index 708f9cc..0556557 100644 --- a/unmkinitramfs.8 +++ b/unmkinitramfs.8 @@ -1,4 +1,4 @@ -.TH UNMKINITRAMFS 8 "2016/02/09" "Linux" "unmkinitramfs manual" +.TH UNMKINITRAMFS 8 "2016/12/15" "Linux" "unmkinitramfs manual" .SH NAME unmkinitramfs \- extract content from an initramfs image diff --git a/update-initramfs.8 b/update-initramfs.8 index 38780b8..2a7042c 100644 --- a/update-initramfs.8 +++ b/update-initramfs.8 @@ -1,4 +1,4 @@ -.TH UPDATE-INITRAMFS 8 "2008/12/19" "Linux" "update\-initramfs manual" +.TH UPDATE-INITRAMFS 8 "2014/10/16" "Linux" "update\-initramfs manual" .SH NAME update\-initramfs \- generate an initramfs image -- GitLab From 9bd960e4d737462a09a407a5c2f72975b3719e22 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 18 Jul 2018 23:31:03 +0100 Subject: [PATCH 042/213] docs: Set man page header source and manual parameters correctly Set the .TH source parameter for all pages to "initramfs-tools". Set the .TH manual parameter to a commonly used name for the man page section. Signed-off-by: Ben Hutchings --- initramfs-tools.7 | 2 +- initramfs.conf.5 | 2 +- lsinitramfs.8 | 2 +- mkinitramfs.8 | 2 +- unmkinitramfs.8 | 2 +- update-initramfs.8 | 2 +- update-initramfs.conf.5 | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/initramfs-tools.7 b/initramfs-tools.7 index bb788df..271c7aa 100644 --- a/initramfs-tools.7 +++ b/initramfs-tools.7 @@ -1,4 +1,4 @@ -.TH INITRAMFS-TOOLS 7 "2018/07/18" "Linux" "mkinitramfs script overview" +.TH INITRAMFS-TOOLS 7 "2018/07/18" "initramfs\-tools" "Linux Programmer's Manual" .SH NAME initramfs-tools \- an introduction to writing scripts for mkinitramfs diff --git a/initramfs.conf.5 b/initramfs.conf.5 index fe86ed9..e227151 100644 --- a/initramfs.conf.5 +++ b/initramfs.conf.5 @@ -1,4 +1,4 @@ -.TH INITRAMFS.CONF 5 "2018/07/18" "Linux" "initramfs.conf manual" +.TH INITRAMFS.CONF 5 "2018/07/18" "initramfs\-tools" "File Formats Manual" .SH NAME initramfs.conf \- configuration file for mkinitramfs diff --git a/lsinitramfs.8 b/lsinitramfs.8 index 3b9ba1b..eb07fa6 100644 --- a/lsinitramfs.8 +++ b/lsinitramfs.8 @@ -1,4 +1,4 @@ -.TH LSINITRAMFS 8 "2015/12/09" "Linux" "lsinitramfs manual" +.TH LSINITRAMFS 8 "2015/12/09" "initramfs\-tools" "System Administration" .SH NAME lsinitramfs \- list content of an initramfs image diff --git a/mkinitramfs.8 b/mkinitramfs.8 index 68ac139..241ab7d 100644 --- a/mkinitramfs.8 +++ b/mkinitramfs.8 @@ -1,4 +1,4 @@ -.TH MKINITRAMFS 8 "2018/07/18" "Linux" "mkinitramfs manual" +.TH MKINITRAMFS 8 "2018/07/18" "initramfs\-tools" "System Administration" .SH NAME mkinitramfs \- low-level tool for generating an initramfs image diff --git a/unmkinitramfs.8 b/unmkinitramfs.8 index 0556557..45ffd40 100644 --- a/unmkinitramfs.8 +++ b/unmkinitramfs.8 @@ -1,4 +1,4 @@ -.TH UNMKINITRAMFS 8 "2016/12/15" "Linux" "unmkinitramfs manual" +.TH UNMKINITRAMFS 8 "2016/12/15" "initramfs\-tools" "System Administration" .SH NAME unmkinitramfs \- extract content from an initramfs image diff --git a/update-initramfs.8 b/update-initramfs.8 index 2a7042c..4bcf756 100644 --- a/update-initramfs.8 +++ b/update-initramfs.8 @@ -1,4 +1,4 @@ -.TH UPDATE-INITRAMFS 8 "2014/10/16" "Linux" "update\-initramfs manual" +.TH UPDATE-INITRAMFS 8 "2014/10/16" "initramfs\-tools" "System Administration" .SH NAME update\-initramfs \- generate an initramfs image diff --git a/update-initramfs.conf.5 b/update-initramfs.conf.5 index ca5821a..cd1f4ea 100644 --- a/update-initramfs.conf.5 +++ b/update-initramfs.conf.5 @@ -1,4 +1,4 @@ -.TH UPDATE-INITRAMFS.CONF 5 "2010/04/05" "Linux" "update-initramfs.conf manual" +.TH UPDATE-INITRAMFS.CONF 5 "2010/04/05" "initramfs\-tools" "File Formats Manual" .SH NAME update-initramfs.conf \- configuration file for update-initramfs -- GitLab From 97cc7e7f292a674c75027d4246bd67d9caa8bc63 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 18 Jul 2018 22:42:41 +0100 Subject: [PATCH 043/213] docs: Don't package maintainer documentation in initramfs-tools-core maintainer-notes.md (formerly .html) is only useful for those working on the source package. HACKING might be slightly useful to maintainers of other packages, but initramfs-tools(7) is much more useful. Signed-off-by: Ben Hutchings --- debian/initramfs-tools-core.docs | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 debian/initramfs-tools-core.docs diff --git a/debian/initramfs-tools-core.docs b/debian/initramfs-tools-core.docs deleted file mode 100644 index a592331..0000000 --- a/debian/initramfs-tools-core.docs +++ /dev/null @@ -1,2 +0,0 @@ -HACKING -docs/maintainer-notes.html -- GitLab From 4e19a6fcc5f75331c0a191b281e04e7dd3e51efa Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 18 Jul 2018 22:46:26 +0100 Subject: [PATCH 044/213] docs: Remove outdated "HACKING" documentation file The initramfs-tools(7) manual page is far more useful. Signed-off-by: Ben Hutchings --- HACKING | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 HACKING diff --git a/HACKING b/HACKING deleted file mode 100644 index d171c56..0000000 --- a/HACKING +++ /dev/null @@ -1,18 +0,0 @@ -> I am not sure how to modify mkinitramfs to do this automatically, maybe you know? - -I need to document this more clearly, but the initramfs-tools have a collection of hooks that will solve your problem. While there's no way that Breezy could do this in the install, we could certainly include the scripts in the package (Especially if you're willing to test them to make sure they work! *g*) - -There are two phases that need to be accounted for. The first is the install phase for generating the initramfs, the second is run-time phase for actually doing the needed magic. - -To install the components you need, look at the scripts in /usr/share/initramfs-tools/hooks. evms and acpid are good choices. You can see a bunch of header stuff at the top that basically guarantees that things are run in the right order if they need to be. Two functions that will interest you: - -copy_exec copies a binary and any libraries it depends on -manual_add_modules takes bareword module names (like fan, thermal, etc) and installs those modules and any of their dependancies into the initramfs. - -The runtime phase is handled by scripts in /usr/share/initramfs-tools/scripts/ you probably want to start up at about the same point as lvm, md, and evms do, so local-top is a good directory to look in. -You can see the same sort of magic at the top of the script, although lvm and evms each require that md run first. - -I hope this helps. I'll paste this text into a HACKING file on the hopes that someone will see fit to improve it. That person will probably be me, mind you... =) - -Tks, -Jeff Bailey -- GitLab From dfc8af2b8f5ca0e87dea9e89f594bb28051a73cd Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 18 Jul 2018 23:44:21 +0100 Subject: [PATCH 045/213] debian/initramfs-tools-core.manpages: Fix filenames I updated the wrong filename here when moving the initramfs-tools man page. Gbp-Dch: ignore Signed-off-by: Ben Hutchings --- debian/initramfs-tools-core.manpages | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/initramfs-tools-core.manpages b/debian/initramfs-tools-core.manpages index 0f56b02..cb4fc51 100644 --- a/debian/initramfs-tools-core.manpages +++ b/debian/initramfs-tools-core.manpages @@ -1,5 +1,5 @@ lsinitramfs.8 -mkinitramfs.7 +mkinitramfs.8 unmkinitramfs.8 initramfs.conf.5 -initramfs-tools.8 +initramfs-tools.7 -- GitLab From 6c026224a3ac5441ae01833aade85b4e75e0a92b Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 18 Jul 2018 23:51:53 +0100 Subject: [PATCH 046/213] debian/control: Remove obsolete Breaks and Depends relations The broken cryptsetup, elilo, lilo, s390-tools, console-setup, systemd-sysv, and lvm2 versions are all older than jessie (current oldstable). We can assume that they will have been upgraded without an explicit Breaks. kmod replaced module-init-tools in wheezy (current oldoldstable) so there is no need to allow the latter as an alternative. Signed-off-by: Ben Hutchings --- debian/control | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/control b/debian/control index 001bb32..534edfb 100644 --- a/debian/control +++ b/debian/control @@ -15,7 +15,7 @@ Depends: initramfs-tools-core (= ${binary:Version}), linux-base, ${misc:Depends} Suggests: bash-completion Provides: linux-initramfs-tool Conflicts: linux-initramfs-tool, usplash (<< 0.5.50) -Breaks: cryptsetup (<< 2:1.6.6-4~), elilo (<< 3.12-3.1~), lilo (<< 22.8-8.2~), s390-tools (<< 1.8.3-2~), console-setup (<< 1.72), systemd-sysv (<< 186), lvm2 (<< 2.02.111-2.1~), initscripts (<< 2.88dsf-59.3~), upstart, e2fsprogs (<< 1.42.13) +Breaks: initscripts (<< 2.88dsf-59.3~), upstart, e2fsprogs (<< 1.42.13) Description: generic modular initramfs generator (automation) This package builds a bootable initramfs for Linux kernel packages. The initramfs is loaded along with the kernel and is responsible for @@ -25,7 +25,7 @@ Package: initramfs-tools-core Architecture: all Multi-Arch: foreign Recommends: ${busybox:Recommends} -Depends: klibc-utils (>= 2.0.4-8~), cpio (>= 2.12), kmod | module-init-tools, udev, coreutils (>= 8.24), e2fsprogs, ${misc:Depends} +Depends: klibc-utils (>= 2.0.4-8~), cpio (>= 2.12), kmod, udev, coreutils (>= 8.24), e2fsprogs, ${misc:Depends} Suggests: bash-completion Breaks: initramfs-tools (<< 0.121~), ${busybox:Breaks} Replaces: initramfs-tools (<< 0.121~) -- GitLab From 749751ce3104bd369b3aa33db15d60f4e09d30aa Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Thu, 19 Jul 2018 00:03:44 +0100 Subject: [PATCH 047/213] debian/control: Update Standards-Version to 4.1.5 Set Rules-Requires-Root: no. No other policy changes seem to be relevant. Signed-off-by: Ben Hutchings --- debian/control | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/debian/control b/debian/control index 534edfb..5598ac8 100644 --- a/debian/control +++ b/debian/control @@ -4,7 +4,8 @@ Priority: optional Uploaders: Michael Prokop , Ben Hutchings Maintainer: Debian kernel team Build-Depends: debhelper (>= 9), bash-completion -Standards-Version: 3.9.8 +Rules-Requires-Root: no +Standards-Version: 4.1.5 Vcs-Browser: https://salsa.debian.org/kernel-team/initramfs-tools Vcs-Git: https://salsa.debian.org/kernel-team/initramfs-tools.git -- GitLab From 5d318217c7de5f6aab0087c3c507a3a0e4241f06 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Thu, 19 Jul 2018 00:35:33 +0100 Subject: [PATCH 048/213] debian/initramfs-tools-core.doc-base: Remove The document it refers to is no longer packaged. Gbp-Dch: ignore Signed-off-by: Ben Hutchings --- debian/initramfs-tools-core.doc-base | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 debian/initramfs-tools-core.doc-base diff --git a/debian/initramfs-tools-core.doc-base b/debian/initramfs-tools-core.doc-base deleted file mode 100644 index e2817c3..0000000 --- a/debian/initramfs-tools-core.doc-base +++ /dev/null @@ -1,10 +0,0 @@ -Document: initramfs-maintainer -Title: Maintainer documentation for initramfs-tools -Author: Michael Prokop -Abstract: This document describes the workflow of - the initramfs-tools maintainers. -Section: Debian - -Format: HTML -Index: /usr/share/doc/initramfs-tools-core/maintainer-notes.html -Files: /usr/share/doc/initramfs-tools-core/maintainer-notes.html -- GitLab From db469f074c0ffc5b1701d6928859559170d69072 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Thu, 19 Jul 2018 00:37:22 +0100 Subject: [PATCH 049/213] initramfs-tools: Override lintian warning "breaks-without-version upstart" upstart will never be fixed, so it is correct to not specify a version. Signed-off-by: Ben Hutchings --- debian/initramfs-tools.lintian-overrides | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 debian/initramfs-tools.lintian-overrides diff --git a/debian/initramfs-tools.lintian-overrides b/debian/initramfs-tools.lintian-overrides new file mode 100644 index 0000000..6fd7456 --- /dev/null +++ b/debian/initramfs-tools.lintian-overrides @@ -0,0 +1,2 @@ +# upstart will never be fixed, so it is correct to not specify a version +initramfs-tools: breaks-without-version upstart -- GitLab From 9fe0e8b18ea804016a01bd95ce1709661305b133 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Thu, 19 Jul 2018 01:05:17 +0100 Subject: [PATCH 050/213] docs/maintainer-notes.md: Update the name of this file Gbp-Dch: ignore Signed-off-by: Ben Hutchings --- docs/maintainer-notes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/maintainer-notes.md b/docs/maintainer-notes.md index f481bbb..0f961ad 100644 --- a/docs/maintainer-notes.md +++ b/docs/maintainer-notes.md @@ -22,7 +22,7 @@ *** **NOTE:** The most recent version of this document is available at -docs/maintainer-notes.html in the [the git repository](#checkout) +docs/maintainer-notes.md in the [the git repository](#checkout) or online at [salsa.debian.org](https://salsa.debian.org/kernel-team/initramfs-tools/blob/master/docs/maintainer-notes.md). *** -- GitLab From 01e2d7011c52231f3fb919d9d83ab228a2cee1c2 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Thu, 19 Jul 2018 01:07:14 +0100 Subject: [PATCH 051/213] Releasing version 0.131. Signed-off-by: Ben Hutchings --- debian/changelog | 89 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) diff --git a/debian/changelog b/debian/changelog index d51bf0e..67203f4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,92 @@ +initramfs-tools (0.131) unstable; urgency=medium + + [ Ben Hutchings ] + * [34bf250] debian/control: Remove maximilian attems and Adam Conrad from + Uploaders field + * [5ad3976] hooks/resume: Generalise logic to replace dev name with UUID when + RESUME=auto + * [0170b7f] hooks/resume: Store /dev/mapper path for swap if possible when + RESUMEauto (Closes: #883735) + * [5bf4c29] debian/control: Point Vcs URLs to Salsa + * [e8377b3] hooks/fsck: Fix invocation of fstype at build time. + Thanks to Simon Tatham (Closes: #865691) + * [492763a] docs: Convert maintainer notes to Markdown format + * [0214976] docs/maintainer-notes.md: Update references to Alioth, to Salsa + * [b71c6c9] docs/maintainer-notes.md: Delete mention of git-core package + * [89daebf] docs/maintainer-notes.md: Change BTS link to specify source + package + * [8e539dc] docs/maintainer-notes.md: Link to tracker.debian.org instead of + PTS + * [3f27197] docs/maintainer-notes.md: Remove stale link to Debian bug count + graph + * [7dece27] docs/maintainer-notes.md: Use HTTP-S for Debian wiki and popcon + links + * [838b6ec] docs/maintainer-notes.md: Link directly to Ubuntu bug list + * [eaa61d4] docs/maintainer-notes.md: Add myself as co-author + * [fa7df8f] hook-functions: Correct the comment above hidden_dep_add_modules + * [0ffbeb9] hook-functions: Remove directory information from + hidden_dep_add_modules + * [78e95c1] hook-functions: Check modules.builtin in hidden_dep_add_modules + * [976aeb9] hook-functions: Handle i8042 hidden dependency on psmouse + (Closes: #878829) + * [211e050] hook-functions: Handle nvme hidden dependency on vmd. + Thanks to Mario Limonciello (Closes: #886349) + * [28536f6] unmkinitramfs, lsinitramfs: Split multiple early initramfs + sections (Closes: #886424) + * [2a9d97d] debian/control: Add e2fsprogs to Depends for initramfs-tools-core + (Closes: #887211) + * [577c94e] initramfs.conf: Update documentation of the DEVICE variable + * [f1cbe6f] mkinitramfs: Build reproducible images when SOURCE_DATE_EPOCH is + set. Thanks to Chris Lamb (Closes: #845034) + * [717e6bd] mkinitramfs: Exclude ldconfig auxiliary cache from initramfs + image. Thanks to Kristian Klausen + * [8bddfe4] mkinitramfs(8): Remove description of nonexistent options + * [ecd6ce2] mkinitramfs(8), hook-functions: Correct references to "ramdisk" + * [63cec7b] docs: Move initramfs-tools man page to section 7 + * [562d86e] docs: Update man page header dates + * [9bd960e] docs: Set man page header source and manual parameters correctly + * [97cc7e7] docs: Don't package maintainer documentation in + initramfs-tools-core + * [4e19a6f] docs: Remove outdated "HACKING" documentation file + * [6c02622] debian/control: Remove obsolete Breaks and Depends relations + * [749751c] debian/control: Update Standards-Version to 4.1.5 + - Set Rules-Requires-Root: no + * [db469f0] initramfs-tools: Override lintian warning "breaks-without-version + upstart" + + [ Riku Voipio ] + * [72b6419] auto_add_modules: add mfd for MODULES==most (Closes: #880584) + + [ Benjamin Drung ] + * [7ca4d0d] Add mlx4 and mlx5 InfiniBand modules to hidden_dep_add_modules + (Closes: #871595) + * [df7d7e8] Add option to clear screen at the beginning (Closes: #856929) + * [a33cb62] Fix indentation (spaces to tabs) + * [3962c4f] Fix config directory in error message (Closes: #856589) + * [be2b91c] Double quote to prevent globbing and word splitting + * [ae339ff] Make size of /run configurable (Closes: #862013) + + [ Steve Langasek ] + * [c198331] Skip dmsetup resume devices if they are randomly encrypted. + + [ Paul Menzel ] + * [e28b865] mkinitramfs: Add LZ4 support (Closes: #893845) + * [5091a5e] control: Remove suggestion of *lz4-tools* + + [ Colin Watson ] + * [b4804dd] Only sync the filesystem containing the initramfs + (Closes: #882380) (LP: #1667512) + + [ Karsten Merker ] + * [281ad9a] Include the axp20x_usb_power module in the base modules list for + MODULES=most (Closes: #866521) + + [ Ivan Kozik ] + * [54367c0] init: export DEVICE so that when configured, it is actually set + in configure_networking (Closes: #883664) + + -- Ben Hutchings Thu, 19 Jul 2018 01:06:01 +0100 + initramfs-tools (0.130) unstable; urgency=medium * [5b7c092] hooks/resume: Fix validation of resume devices specified by -- GitLab From 4e1f80ede95f4ea51996f31b6646fa9eed07658c Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Thu, 19 Jul 2018 16:44:06 +0100 Subject: [PATCH 052/213] mkinitramfs: Don't try to remove nonexistent /var/cache/ldconfig "rmdir --ignore-fail-on-non-empty" won't report an error if there is ever another file in /var/cache/ldconfig, but it will report an error if the directory doesn't exist at all. "rm -df" has the opposite problem. Add a test for directory existence around the aux-cache removal. Closes: #904065 Signed-off-by: Ben Hutchings --- mkinitramfs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mkinitramfs b/mkinitramfs index 89a61a3..58a9ff7 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -340,8 +340,10 @@ if ! ldconfig -r "$DESTDIR" ; then fi # The auxiliary cache is not reproducible and is always invalid at boot # (see #845034) -rm -f "${DESTDIR}"/var/cache/ldconfig/aux-cache -rmdir --ignore-fail-on-non-empty "${DESTDIR}"/var/cache/ldconfig +if [ -d "${DESTDIR}"/var/cache/ldconfig ]; then + rm -f "${DESTDIR}"/var/cache/ldconfig/aux-cache + rmdir --ignore-fail-on-non-empty "${DESTDIR}"/var/cache/ldconfig +fi # Apply DSDT to initramfs if [ -e "${CONFDIR}/DSDT.aml" ]; then -- GitLab From d0212d3e3b548e70f715e1d82077c53d9cbc1245 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 25 Jul 2018 13:34:34 +0800 Subject: [PATCH 053/213] hook-functions: Quote exclusions in copy_modules_dir Exclusions may include wildcards, which should be matched by find and not the shell. Change the argument processing to manipulate the argument array, instead of building a single variable which cannot maintain quoting. (This would be easier in bash - we could use a named array variable.) Signed-off-by: Ben Hutchings --- hook-functions | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/hook-functions b/hook-functions index c18652e..e96c70c 100644 --- a/hook-functions +++ b/hook-functions @@ -197,7 +197,7 @@ copy_exec() { # Copy entire subtrees to the initramfs copy_modules_dir() { - local kmod exclude + local kmod first exclude local modules= local dir="$1" shift @@ -211,11 +211,16 @@ copy_modules_dir() echo "(excluding $*)" fi fi - while [ $# -ge 1 ]; do - exclude="${exclude:-} -name $1 -prune -o " - shift + + # Build up an expression for find + first=true + for exclude in "$@"; do + $first && set -- + set -- "$@" -name "${exclude}" -prune -o + first=false done - for kmod in $(find "${MODULESDIR}/${dir}" ${exclude:-} -name '*.ko' -printf '%f\n'); do + + for kmod in $(find "${MODULESDIR}/${dir}" "$@" -name '*.ko' -printf '%f\n'); do modules="$modules ${kmod%.ko}" done manual_add_modules $modules -- GitLab From 8c806b446fab5f5807651a5c7869141837592ecd Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 25 Jul 2018 14:09:41 +0800 Subject: [PATCH 054/213] hook-functions: Add support for compressed module files Change filename matching in manual_add_modules, copy_modules_dir, hidden_dep_add_modules to allow a compression suffix after '.ko' in filenames. kmod is responsible for decompressing modules, and Debian's kmod currently only supports xz compression. We allow any compression suffix here, so if kmod is rebuilt with gzip/zlib support enabled then initramfs-tools should automatically support it too. Closes: #891560 Signed-off-by: Ben Hutchings --- hook-functions | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/hook-functions b/hook-functions index e96c70c..58f9e63 100644 --- a/hook-functions +++ b/hook-functions @@ -91,9 +91,9 @@ manual_add_modules() fi kmod_modname="${kmod##*/}" - kmod_modname="${kmod_modname%.ko}" + kmod_modname="${kmod_modname%%.*}" if grep -q "^$kmod_modname\\>" /proc/modules "${CONFDIR}/modules"; then - echo "W: Possible missing firmware /lib/firmware/${firmware} for module $(basename ${kmod} .ko)" >&2 + echo "W: Possible missing firmware /lib/firmware/${firmware} for module ${kmod_modname}" >&2 fi continue fi @@ -215,13 +215,17 @@ copy_modules_dir() # Build up an expression for find first=true for exclude in "$@"; do + # Change .ko suffix in exclusion to .ko* + if [ "${exclude%.ko}" != "${exclude}" ]; then + exclude="${exclude}*" + fi $first && set -- set -- "$@" -name "${exclude}" -prune -o first=false done - for kmod in $(find "${MODULESDIR}/${dir}" "$@" -name '*.ko' -printf '%f\n'); do - modules="$modules ${kmod%.ko}" + for kmod in $(find "${MODULESDIR}/${dir}" "$@" -name '*.ko*' -printf '%f\n'); do + modules="$modules ${kmod%%.*}" done manual_add_modules $modules } @@ -615,11 +619,11 @@ hidden_dep_add_modules() manual_add_modules $( { cat "${DESTDIR}/lib/modules/${version}/modules.builtin" - find "${DESTDIR}/lib/modules/${version}/kernel" -name '*.ko' + find "${DESTDIR}/lib/modules/${version}/kernel" -name '*.ko*' } | while read module; do module="${module##*/}" - module="${module%.ko}" + module="${module%%.*}" case "$module" in libcrc32c) echo crc32c -- GitLab From ea88876e87364edfa155d4c7ba37c7bd9686bea9 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 25 Jul 2018 14:34:28 +0800 Subject: [PATCH 055/213] Update debian/.gitignore Gbp-Dch: ignore Signed-off-by: Ben Hutchings --- debian/.gitignore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/debian/.gitignore b/debian/.gitignore index cf18842..bc79963 100644 --- a/debian/.gitignore +++ b/debian/.gitignore @@ -1,5 +1,7 @@ -/files +/*.debhelper /*.debhelper.log /*.substvars +/.debhelper +/files /initramfs-tools/ /initramfs-tools-core/ -- GitLab From 71f5d615a2c9f970375b129719b76471d60af97b Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 25 Jul 2018 17:03:06 +0800 Subject: [PATCH 056/213] mkinitramfs: Create usr-merged filesystem layout On a usr-merged filesystem /bin, /lib*, /sbin are symlinks to the corresponding subdirectories of /usr. When the host filesystem looks like this, copy_file may be asked to copy both /lib/foo and /usr/lib/foo. It's too late at this point to make /lib a symlink in the initramfs, and copy_file isn't general enough to do that. Avoid this by setting up the initramfs as usr-merged. This could possibly cause file conflicts, but it's unlikely because: * Policy forbids such conflicts on the host filesystem * Few executables and libraries that go into the initramfs are explicitly installed in /usr on the host filesystem, because of historical support for having the init system mount /usr * mkinitramfs never used to create /usr/bin or /usr/lib Closes: #874523 Signed-off-by: Ben Hutchings --- mkinitramfs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mkinitramfs b/mkinitramfs index 58a9ff7..4394a3c 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -215,7 +215,13 @@ export __TMPCPIOGZ # Private, used by 'prepend_earlyinitramfs'. export __TMPEARLYCPIO -for d in bin conf/conf.d etc lib/modules run sbin scripts ${MODULESDIR}; do +# Create usr-merged filesystem layout, to avoid duplicates if the host +# filesystem is usr-merged. +for d in /bin /lib* /sbin; do + mkdir -p "${DESTDIR}/usr${d}" + ln -s "usr${d}" "${DESTDIR}${d}" +done +for d in conf/conf.d etc run scripts ${MODULESDIR}; do mkdir -p "${DESTDIR}/${d}" done -- GitLab From 4c0d86c4e9357f1d25cc0e9b3842240c8fc8b8e1 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 25 Jul 2018 17:36:36 +0800 Subject: [PATCH 057/213] hooks/resume: Loop over all swap devices when selecting automatically If we reject the largest swap device then we should look at any other swap devices too. This is unlikely to make a difference by itself, since we only reject swap devices encrypted with a random key, and there are unlikely to be other swap devices configured differently. Signed-off-by: Ben Hutchings --- hooks/resume | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/hooks/resume b/hooks/resume index 1869119..1662c66 100755 --- a/hooks/resume +++ b/hooks/resume @@ -39,23 +39,27 @@ report_auto() test "$RESUME" = auto || echo >&2 "I: $*" } -# We need to be able to read the listed swap partitions -if ischroot || [ ! -r /proc/swaps ]; then - resume_auto= -else - # Try to autodetect the RESUME partition, using biggest swap? - resume_auto=$(grep ^/dev/ /proc/swaps | sort -rnk3 | head -n 1 | cut -d " " -f 1) - if [ -n "$resume_auto" ]; then +# Try to autodetect the RESUME partition, using biggest swap device that +# is not ephemeral. We need to be able to read the listed swap partitions. +resume_auto= +if ! ischroot && [ -r /proc/swaps ]; then + for resume_auto in $(grep ^/dev/ /proc/swaps | sort -rnk3 | cut -d " " -f 1); do + ephemeral=false dm_name="$(dmsetup info -c --noheadings -o name "$resume_auto" 2>/dev/null)" - fi - if [ -n "$dm_name" ] && [ -e /etc/crypttab ]; then - while read cryptdev srcdev keyfile junk; do - if [ "$cryptdev" = "$dm_name" ] && [ "$keyfile" = /dev/urandom ]; then - resume_auto= - fi - done < /etc/crypttab - fi - if [ -n "$resume_auto" ]; then + + # dm-crypt is ephemeral if the key file is /dev/urandom + if [ -n "$dm_name" ] && [ -e /etc/crypttab ]; then + while read cryptdev srcdev keyfile junk; do + if [ "$cryptdev" = "$dm_name" ] && [ "$keyfile" = /dev/urandom ]; then + ephemeral=true + fi + done < /etc/crypttab + fi + + $ephemeral || break + done + + if [ -n "$resume_auto" ] && ! $ephemeral; then if [ -n "$dm_name" ]; then resume_auto_canon="/dev/mapper/$dm_name" elif UUID=$(blkid -s UUID -o value "$resume_auto"); then -- GitLab From 312393b0cf1231125eeff3d1a2b6b778a935c21d Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 25 Jul 2018 17:43:05 +0800 Subject: [PATCH 058/213] hooks/resume: Reject zram swap devices when selecting automatically zram is ephemeral (it's a compressed RAM disk) so we must not use it. Closes: #861228 Signed-off-by: Ben Hutchings --- hooks/resume | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hooks/resume b/hooks/resume index 1662c66..df6cde8 100755 --- a/hooks/resume +++ b/hooks/resume @@ -56,6 +56,13 @@ if ! ischroot && [ -r /proc/swaps ]; then done < /etc/crypttab fi + # zram is ephemeral + case "$resume_auto" in + /dev/zram*) + ephemeral=true + ;; + esac + $ephemeral || break done -- GitLab From c0ae42ba8eda4be9e416a43ee9ee7fd32cf37725 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 25 Jul 2018 20:25:12 +0800 Subject: [PATCH 059/213] update-initramfs: Always take over other initramfs images In Debian, update-initramfs has always refused to overwrite or delete an initramfs image that it didn't create, unless the -t option is used. On Ubuntu, this check is apparently disabled. The commit log doesn't provide much of a clue as to why. Looking at the the state of Debian and the linux-2.6 package at the time, I think the reasoning must have been something like: (1) Multiple initramfs/initrd generators were available and could be coinstalled. The configuration file /etc/kernel-img.conf specified which one kernel packages should invoke ("ramdisk" variable). (2) Packages that hooked into initramfs-tools would always run update- initramfs if it existed, and it would immediately update the initramfs, because triggers hadn't yet been invented. (3) To keep the alternate initramfs generators working, update- initramfs therefore had to either (a) check the configuration file to find out whether initramfs-tools was meant to be used, or (b) keep track of which initramfs images it created and therefore "owned". At this point, (1) is no longer true; the "ramdisk" variable is not honoured and the initramfs generator to be invoked is chosen by installing one of several conflicting packages. I think this means that (3) no longer follows, and whichever of the automatic initramfs generator packages is currently installed should be considered to "own" /boot/initrd.img- for all kernel versions. This commit only disables the checks. The state directory and the state updates are retained for now, in case it becomes necessary to revert this change. Closes: #765750, #804295 Signed-off-by: Ben Hutchings --- update-initramfs | 58 +--------------------------------------------- update-initramfs.8 | 4 ---- 2 files changed, 1 insertion(+), 61 deletions(-) diff --git a/update-initramfs b/update-initramfs index d98aaa4..da39588 100755 --- a/update-initramfs +++ b/update-initramfs @@ -47,7 +47,6 @@ Options: -c Create a new initramfs -u Update an existing initramfs -d Remove an existing initramfs - -t Take over a custom initramfs with this one -b directory Set alternate boot directory -v Be verbose -h This message @@ -79,12 +78,6 @@ verbose() fi } -version_exists() -{ - [ -e "${STATEDIR}/${1}" ] && [ -e "${initramfs}" ] - return $? -} - set_initramfs() { initramfs="${BOOTDIR}/initrd.img-${version}" @@ -179,12 +172,6 @@ run_bootloader() fi } -compare_sha1() -{ - sha1sum "${initramfs}" | diff "${STATEDIR}/${version}" - >/dev/null 2>&1 - return $? -} - # Note that this must overwrite so that updates work. set_sha1() { @@ -264,16 +251,6 @@ create() set_initramfs - if [ "${takeover}" = 0 ]; then - if version_exists "${version}"; then - panic "Cannot create version ${version}: already exists" - fi - - if [ -e "${initramfs}" ]; then - panic "${initramfs} already exists, cannot create." - fi - fi - generate_initramfs run_bootloader @@ -307,8 +284,6 @@ update() ro_boot_check - altered_check - backup_initramfs generate_initramfs @@ -326,18 +301,6 @@ delete() set_initramfs - if [ "${takeover}" = 0 ]; then - if [ ! -e "${initramfs}" ]; then - panic "Cannot delete ${initramfs}, doesn't exist." - fi - - if ! version_exists "${version}"; then - panic "Cannot delete version ${version}: Not created by this utility." - fi - fi - - altered_check - echo "update-initramfs: Deleting ${initramfs}" delete_sha1 @@ -345,25 +308,9 @@ delete() rm -f "${initramfs}" "${initramfs}.bak" } -# Check for update mode on existing and modified initramfs -altered_check() -{ - # No check on takeover - [ "${takeover}" = 1 ] && return 0 - if [ ! -e "${initramfs}" ]; then - mild_panic "${initramfs} does not exist. Cannot update." - fi - if ! compare_sha1; then - echo "update-initramfs: ${initramfs} has been altered." >&2 - mild_panic "update-initramfs: Cannot update. Override with -t option." - fi -} - # Defaults verbose=0 yes=0 -# We default to takeover=1 in Ubuntu, but not Debian -takeover=0 ## @@ -388,7 +335,7 @@ while getopts "k:cudyvtb:h?" flag; do yes="1" ;; t) - takeover="1" + # accepted for compatibility, but ignored ;; b) BOOTDIR="${OPTARG}" @@ -428,9 +375,6 @@ if [ "${version}" = "all" ] \ if [ "${verbose}" = "1" ]; then OPTS="${OPTS} -v" fi - if [ "${takeover}" = "1" ]; then - OPTS="${OPTS} -t" - fi if [ "${yes}" = "1" ]; then OPTS="${OPTS} -y" fi diff --git a/update-initramfs.8 b/update-initramfs.8 index 4bcf756..bb88499 100644 --- a/update-initramfs.8 +++ b/update-initramfs.8 @@ -53,10 +53,6 @@ This mode updates an existing initramfs. \fB \-d This mode removes an existing initramfs. -.TP -\fB \-t -Allows one to take over an custom initramfs with a newer one. - .TP \fB \-v This option increases the amount of information you are given during -- GitLab From f39625afd6ba6c1aa2027286dc3ef1c933da14e0 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 25 Jul 2018 20:28:32 +0800 Subject: [PATCH 060/213] update-initramfs: Make "-k all" take over other initramfs images Now that we assume ownership of /boot/initrd.img- for all installed kernel versions, an update or deletion command with "-k all" should be applied to all such files, even if we didn't create them. Signed-off-by: Ben Hutchings --- update-initramfs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/update-initramfs b/update-initramfs index da39588..e3136dc 100755 --- a/update-initramfs +++ b/update-initramfs @@ -202,8 +202,13 @@ ro_boot_check() get_sorted_versions() { - version_list="$(ls -1 "${STATEDIR}" | linux-version sort --reverse)" - + version_list="$( + linux-version list | + while read version; do + test -e "${BOOTDIR}/initrd.img-$version" && echo "$version" + done | + linux-version sort --reverse + )" verbose "Available versions: ${version_list}" } -- GitLab From f273172beb41326c8dc81e5b734e3ee00b0930b5 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 25 Jul 2018 23:33:15 +0800 Subject: [PATCH 061/213] scripts/functions: Fix parsing of device name from ip parameter Parameter expansion is not useful for parsing delimited lists of arbitrary length. Instead, set IFS=:, disable wildcard expansion, and use "set". Use a separate function, as this makes it easy to change $IFS temporarily. Also do the parsing earlier, so we can avoid a redundant invocation of ipconfig. This was mentioned in #721088, but it's not the main bug reported. Signed-off-by: Ben Hutchings --- scripts/functions | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/scripts/functions b/scripts/functions index 0b7ca10..997269c 100644 --- a/scripts/functions +++ b/scripts/functions @@ -180,6 +180,20 @@ get_fstype () return ${RET} } +_handle_device_vs_ip() +{ + # If the ip= parameter is present and is a colon-separated list + # that specifies a device, use that in preference to any device + # name we already have. + local IFS=: + set -f + set -- ${IP} + set +f + if [ -n "$6" ]; then + DEVICE="$6" + fi +} + configure_networking() { if [ -n "${BOOTIF}" ]; then @@ -218,6 +232,8 @@ configure_networking() done fi + _handle_device_vs_ip + # networking already configured thus bail out [ -n "${DEVICE}" ] && [ -e /run/net-"${DEVICE}".conf ] && return 0 @@ -249,18 +265,6 @@ configure_networking() ;; *) ipconfig -t ${ROUNDTTT} -d $IP - - # grab device entry from ip option - NEW_DEVICE=${IP#*:*:*:*:*:*} - if [ "${NEW_DEVICE}" != "${IP}" ]; then - NEW_DEVICE=${NEW_DEVICE%%:*} - else - # wrong parse, possibly only a partial string - NEW_DEVICE= - fi - if [ -n "${NEW_DEVICE}" ]; then - DEVICE="${NEW_DEVICE}" - fi ;; esac done -- GitLab From abae8968403eeb1fa7a5e6908555a1dece6e5ec3 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 25 Jul 2018 23:26:31 +0800 Subject: [PATCH 062/213] scripts/functions: Merge information from BOOTIF/DEVICE and ip parameters If the BOOTIF parameter or the DEVICE configuration parameter is set, and the ip parameter is also set but does not specify a device name, we need to convey the device name to ipconfig as well as the ip parameter value. Previously we didn't do this if the value was a colon-separated list. But now that we can parse the list correctly, it's easy to substitute the device name into it. Closes: #721088 Signed-off-by: Ben Hutchings --- scripts/functions | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/scripts/functions b/scripts/functions index 997269c..7c6f8aa 100644 --- a/scripts/functions +++ b/scripts/functions @@ -182,15 +182,21 @@ get_fstype () _handle_device_vs_ip() { - # If the ip= parameter is present and is a colon-separated list - # that specifies a device, use that in preference to any device - # name we already have. + # If the ip= parameter is present and is a colon-separated list, + # then: + # - If it specifies a device, use that in preference to any + # device name we already have + # - Otherwise, substitute in any device name we already have local IFS=: set -f set -- ${IP} set +f if [ -n "$6" ]; then DEVICE="$6" + elif [ $# -ge 2 ] && [ -n "${DEVICE}" ]; then + IP="$1:$2:$3:$4:$5:${DEVICE}" + shift 6 || shift $# + IP="${IP}:$*" fi } -- GitLab From d1e206661c18cf381a259e6c86492b54385179e0 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Thu, 26 Jul 2018 01:20:09 +0800 Subject: [PATCH 063/213] Releasing version 0.132. Signed-off-by: Ben Hutchings --- debian/changelog | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/debian/changelog b/debian/changelog index 67203f4..df85442 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,25 @@ +initramfs-tools (0.132) unstable; urgency=medium + + * [4e1f80e] mkinitramfs: Don't try to remove nonexistent /var/cache/ldconfig + (Closes: #904065) + * [d0212d3] hook-functions: Quote exclusions in copy_modules_dir + * [8c806b4] hook-functions: Add support for compressed module files + (Closes: #891560) + * [71f5d61] mkinitramfs: Create usr-merged filesystem layout + (Closes: #874523) + * [4c0d86c] hooks/resume: Loop over all swap devices when selecting + automatically + * [312393b] hooks/resume: Reject zram swap devices when selecting + automatically (Closes: #861228) + * [c0ae42b] update-initramfs: Always take over other initramfs images + (Closes: #765750, #804295) + * [f39625a] update-initramfs: Make "-k all" take over other initramfs images + * [f273172] scripts/functions: Fix parsing of device name from ip parameter + * [abae896] scripts/functions: Merge information from BOOTIF/DEVICE and ip + parameters (Closes: #721088) + + -- Ben Hutchings Thu, 26 Jul 2018 01:18:39 +0800 + initramfs-tools (0.131) unstable; urgency=medium [ Ben Hutchings ] -- GitLab From 942f1d2d175b3b4f355554835f576adfb98cdc94 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Mon, 30 Jul 2018 14:35:08 +0800 Subject: [PATCH 064/213] unmkinitramfs, lsinitramfs: Avoid zcat compatibility issue by running gzip zutils provides an alternate implementation of zcat which has a different interpretation of the -t option. This has been fixed in Debian unstable by installing its zcat under a different name. However, we can avoid this problem even on systems with the older version by running gzip instead of zcat. Closes: #903931 Signed-off-by: Ben Hutchings --- unmkinitramfs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/unmkinitramfs b/unmkinitramfs index bd7bacf..910558b 100755 --- a/unmkinitramfs +++ b/unmkinitramfs @@ -14,8 +14,8 @@ xcpio() dir="$2" shift 2 - if zcat -t "$archive" >/dev/null 2>&1 ; then - zcat "$archive" + if gzip -t "$archive" >/dev/null 2>&1 ; then + gzip -c -d "$archive" elif xzcat -t "$archive" >/dev/null 2>&1 ; then xzcat "$archive" elif lz4cat -t "$archive" >/dev/null 2>&1 ; then -- GitLab From 94683ef5c2c67ab05283fbc8ecbad820a347a0f9 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Mon, 30 Jul 2018 14:44:41 +0800 Subject: [PATCH 065/213] mkinitramfs: Remove check for kernel version < 2.6.38 I don't see any need to support such old versions any more, and I certainly never test with them. Signed-off-by: Ben Hutchings --- mkinitramfs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/mkinitramfs b/mkinitramfs index 4394a3c..f68a297 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -131,7 +131,6 @@ case "${version}" in ;; esac -# Check userspace and kernel support for compressed initramfs images if [ -z "${compress:-}" ]; then compress=${COMPRESS} else @@ -145,12 +144,6 @@ if ! command -v "${compress}" >/dev/null 2>&1; then COMPRESS=gzip fi -if dpkg --compare-versions "${version}" lt "2.6.38" 2>/dev/null; then - compress=gzip - [ "${verbose}" = y ] && \ - echo "linux-2.6 likely misses ${COMPRESS} support, using gzip" -fi - [ "${compress}" = gzip ] && [ -n "${SOURCE_DATE_EPOCH}" ] && compress="gzip -n" [ "${compress}" = lz4 ] && compress="lz4 -9 -l" [ "${compress}" = lzop ] && compress="lzop -9" -- GitLab From 40fb032afa9d2855b9ba59295d630452eff6070e Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Mon, 30 Jul 2018 15:05:56 +0800 Subject: [PATCH 066/213] mkinitramfs; Stop setting both compress and COMPRESS variables After we ensure both the compress and COMPRESS variables are initialised, we only use ${COMPRESS} in a single error message, and at that point it's equal to ${compress}. Unset COMPRESS as redundant after we've (possibly) copied it to compress, and use ${compress} in the error message. Signed-off-by: Ben Hutchings --- mkinitramfs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/mkinitramfs b/mkinitramfs index f68a297..c6548a8 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -133,15 +133,13 @@ esac if [ -z "${compress:-}" ]; then compress=${COMPRESS} -else - COMPRESS=${compress} fi +unset COMPRESS if ! command -v "${compress}" >/dev/null 2>&1; then compress=gzip [ "${verbose}" = y ] && \ - echo "No ${COMPRESS} in ${PATH}, using gzip" - COMPRESS=gzip + echo "No ${compress} in ${PATH}, using gzip" fi [ "${compress}" = gzip ] && [ -n "${SOURCE_DATE_EPOCH}" ] && compress="gzip -n" -- GitLab From 01af7579180273dad1364d2aab7e8592eaf3b77a Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Fri, 3 Aug 2018 20:54:54 +0800 Subject: [PATCH 067/213] initramfs-tools: Change trigger declaration to "interest-await" dpkg will only put a triggering package in the triggers-awaited state if both it and the triggered package used "await". To allow for packages that really need to await the initramfs update, explicitly declare our trigger as "interest-await". (This is equivalent to the old "interest", but fixes a lintian warning for the old name.) Related-to: #822730 Signed-off-by: Ben Hutchings --- debian/initramfs-tools.triggers | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/initramfs-tools.triggers b/debian/initramfs-tools.triggers index 860c664..c3d4146 100644 --- a/debian/initramfs-tools.triggers +++ b/debian/initramfs-tools.triggers @@ -1 +1 @@ -interest update-initramfs +interest-await update-initramfs -- GitLab From 2bb6a9cc480b11d13b529b5793a3b02f3b53842b Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Fri, 3 Aug 2018 21:07:30 +0800 Subject: [PATCH 068/213] update-initramfs: Remove test for working dpkg-trigger dpkg-trigger was added in dpkg 1.14.17, thus in Debian lenny and Ubuntu intrepid. Signed-off-by: Ben Hutchings --- update-initramfs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/update-initramfs b/update-initramfs index e3136dc..4909454 100755 --- a/update-initramfs +++ b/update-initramfs @@ -23,8 +23,7 @@ linux-image-*) ;; ?*) if [ $# = 1 ] \ - && [ x"$1" = x-u ] \ - && dpkg-trigger --check-supported 2>/dev/null + && [ x"$1" = x-u ] then if dpkg-trigger --no-await update-initramfs; then echo "update-initramfs: deferring update (trigger activated)" -- GitLab From 1f105591ea842a75962e42a9921be4f6d6f49ea8 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Fri, 3 Aug 2018 22:16:03 +0800 Subject: [PATCH 069/213] kernel hooks: Remove use of update-initramfs -t option This option no longer does anything since version 0.132. Signed-off-by: Ben Hutchings --- kernel/postinst.d/initramfs-tools | 2 +- kernel/postrm.d/initramfs-tools | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/postinst.d/initramfs-tools b/kernel/postinst.d/initramfs-tools index 0d463f4..81b9aee 100755 --- a/kernel/postinst.d/initramfs-tools +++ b/kernel/postinst.d/initramfs-tools @@ -32,4 +32,4 @@ if [ -n "$DEB_MAINT_PARAMS" ]; then fi # we're good - create initramfs. update runs do_bootloader -INITRAMFS_TOOLS_KERNEL_HOOK=1 update-initramfs -c -t -k "${version}" ${bootopt} >&2 +INITRAMFS_TOOLS_KERNEL_HOOK=1 update-initramfs -c -k "${version}" ${bootopt} >&2 diff --git a/kernel/postrm.d/initramfs-tools b/kernel/postrm.d/initramfs-tools index d58fa61..98740ee 100755 --- a/kernel/postrm.d/initramfs-tools +++ b/kernel/postrm.d/initramfs-tools @@ -32,4 +32,4 @@ if [ -n "$DEB_MAINT_PARAMS" ]; then fi # delete initramfs -INITRAMFS_TOOLS_KERNEL_HOOK=1 update-initramfs -d -t -k "${version}" ${bootopt} >&2 +INITRAMFS_TOOLS_KERNEL_HOOK=1 update-initramfs -d -k "${version}" ${bootopt} >&2 -- GitLab From 1343b682c4c491c66fcc7fb8516a1d303c53291f Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Sun, 5 Aug 2018 15:58:22 +0800 Subject: [PATCH 070/213] update-initramfs: Remove undocumented -y option This was never documented, doesn't do anything, and doesn't appear to be used by any other package. Remove it completely. Signed-off-by: Ben Hutchings --- update-initramfs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/update-initramfs b/update-initramfs index 4909454..2ef3a45 100755 --- a/update-initramfs +++ b/update-initramfs @@ -314,11 +314,10 @@ delete() # Defaults verbose=0 -yes=0 ## -while getopts "k:cudyvtb:h?" flag; do +while getopts "k:cudvtb:h?" flag; do case "${flag}" in k) version="${OPTARG}" @@ -335,9 +334,6 @@ while getopts "k:cudyvtb:h?" flag; do v) verbose="1" ;; - y) - yes="1" - ;; t) # accepted for compatibility, but ignored ;; @@ -368,7 +364,6 @@ fi if [ "${version}" = "all" ] \ || ( [ "${update_initramfs}" = "all" ] && [ -z "${version}" ] ); then - : FIXME check for --yes, and if not ask are you sure get_sorted_versions if [ -z "${version_list}" ]; then verbose "Nothing to do, exiting." @@ -379,9 +374,6 @@ if [ "${version}" = "all" ] \ if [ "${verbose}" = "1" ]; then OPTS="${OPTS} -v" fi - if [ "${yes}" = "1" ]; then - OPTS="${OPTS} -y" - fi for u_version in ${version_list}; do verbose "Execute: ${0} -${mode} -k \"${u_version}\" ${OPTS}" "${0}" -${mode} -k "${u_version}" ${OPTS} -- GitLab From e0d4024d2931826e7ee63dce1a8f70ddc7700033 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Fri, 3 Aug 2018 20:08:35 +0800 Subject: [PATCH 071/213] mkinitramfs: Warn if the compression command is not recognised Signed-off-by: Ben Hutchings --- mkinitramfs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/mkinitramfs b/mkinitramfs index c6548a8..c1fc5fc 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -142,10 +142,13 @@ if ! command -v "${compress}" >/dev/null 2>&1; then echo "No ${compress} in ${PATH}, using gzip" fi -[ "${compress}" = gzip ] && [ -n "${SOURCE_DATE_EPOCH}" ] && compress="gzip -n" -[ "${compress}" = lz4 ] && compress="lz4 -9 -l" -[ "${compress}" = lzop ] && compress="lzop -9" -[ "${compress}" = xz ] && compress="xz --check=crc32" +case "${compress}" in +gzip) [ -n "${SOURCE_DATE_EPOCH}" ] && compress="gzip -n" +lz4) compress="lz4 -9 -l" ;; +lzop) compress="lzop -9" ;; +xz) compress="xz --check=crc32" ;; +*) echo "W: Unknown compression command ${compress}" >&2 ;; +esac if [ -d "${outfile}" ]; then echo "${outfile} is a directory" >&2 -- GitLab From 806c757439a1627e2ca97ca8f5e1eff81abeb52a Mon Sep 17 00:00:00 2001 From: Benjamin Drung Date: Mon, 10 Dec 2018 16:49:33 +0100 Subject: [PATCH 072/213] scripts/functions: Fix syntax error: unexpected "(" on panic When the IFS is set (e.g. to ",") the reading of /proc/consoles might not correctly split the line into `console` and `rest`. Running ``` IFS="," panic "error message" ``` will show: ``` Spawning shell within the initramfs as requested sh: syntax error: unexpected "(" ``` Therefore explicitly unset IFS in the panic function. Signed-off-by: Benjamin Drung --- scripts/functions | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/functions b/scripts/functions index 7c6f8aa..aeccb85 100644 --- a/scripts/functions +++ b/scripts/functions @@ -33,7 +33,7 @@ log_end_msg() panic() { - local console rest + local console rest IFS if command -v chvt >/dev/null 2>&1; then chvt 1 @@ -53,6 +53,7 @@ panic() # Try to use setsid, which will enable job control in the shell # and paging in more if command -v setsid >/dev/null 2>&1; then + unset IFS read console rest Date: Mon, 10 Dec 2018 16:49:45 +0100 Subject: [PATCH 073/213] mkinitramfs: Fix termination of gzip compression case The gzip case for the compression misses its termination ";;". shellcheck aborts with an error on this file: ``` In mkinitramfs line 145: case "${compress}" in ^-- SC1009: The mentioned parser error was in this case expression. In mkinitramfs line 146: gzip) [ -n "${SOURCE_DATE_EPOCH}" ] && compress="gzip -n" ^-- SC1073: Couldn't parse this case item. In mkinitramfs line 147: lz4) compress="lz4 -9 -l" ;; ^-- SC1072: Fix any mentioned problems and try again. ^-- SC1074: Did you forget the ;; after the previous case item? ``` Signed-off-by: Benjamin Drung --- mkinitramfs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkinitramfs b/mkinitramfs index c1fc5fc..2ce863d 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -143,7 +143,7 @@ if ! command -v "${compress}" >/dev/null 2>&1; then fi case "${compress}" in -gzip) [ -n "${SOURCE_DATE_EPOCH}" ] && compress="gzip -n" +gzip) [ -n "${SOURCE_DATE_EPOCH}" ] && compress="gzip -n" ;; lz4) compress="lz4 -9 -l" ;; lzop) compress="lzop -9" ;; xz) compress="xz --check=crc32" ;; -- GitLab From 5438f310e8beb82bd8e533b757455041cc2733e0 Mon Sep 17 00:00:00 2001 From: Benjamin Drung Date: Mon, 10 Dec 2018 16:49:53 +0100 Subject: [PATCH 074/213] scripts/functions: Drop render function Commit bf238f6aceb206e25969d64f5b496eb5d051f481 removed the code that was using the render function. The render function is not used any more and can be removed. Signed-off-by: Benjamin Drung --- scripts/functions | 5 ----- 1 file changed, 5 deletions(-) diff --git a/scripts/functions b/scripts/functions index aeccb85..a954a93 100644 --- a/scripts/functions +++ b/scripts/functions @@ -93,11 +93,6 @@ maybe_break() esac } -render() -{ - eval "echo -n \${$@}" -} - # For boot time only; this is overridden at build time in hook-functions run_scripts() { -- GitLab From 3c8b4c30945ae19529afae398084cfee79b771cf Mon Sep 17 00:00:00 2001 From: Benjamin Drung Date: Mon, 17 Dec 2018 13:34:44 +0100 Subject: [PATCH 075/213] Remove trailing newline from debian/changelog Fix lintian's complain file-contains-trailing-whitespace. --- debian/changelog | 1 - 1 file changed, 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index df85442..3b75bf8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4493,4 +4493,3 @@ initramfs-tools (0.1) unstable; urgency=low * Initial Release. -- Jeff Bailey Thu, 27 Jan 2005 15:23:52 -0500 - -- GitLab From f277309e0b6b57ff2f8f9411c026394b7635f3d6 Mon Sep 17 00:00:00 2001 From: Benjamin Drung Date: Mon, 10 Dec 2018 16:50:01 +0100 Subject: [PATCH 076/213] Fix (nearly) all issues found by shellcheck shellcheck found more issues than SC1074. Address most of these issues. You can check the shell code by running: ``` shellcheck -e SC1090,SC1091 -s dash hook-functions $(find * -type f \( -executable ! -name rules -o -regex '.*\.\(post\|pre\).*' -o -regex "^\(docs\|scripts\)/.*" ! -name '*.md' \)) ``` Signed-off-by: Benjamin Drung --- debian/initramfs-tools.preinst | 7 +-- docs/framebuffer | 6 +-- hook-functions | 82 ++++++++++++++++---------------- hooks/fsck | 14 ++---- hooks/keymap | 8 ++-- hooks/resume | 4 +- hooks/thermal | 2 +- init | 2 +- lsinitramfs | 4 +- mkinitramfs | 49 ++++++++++--------- scripts/functions | 70 +++++++++++++-------------- scripts/init-top/all_generic_ide | 2 +- scripts/init-top/blacklist | 2 +- scripts/init-top/keymap | 2 +- scripts/local | 24 +++++----- scripts/local-premount/resume | 10 ++-- scripts/nfs | 16 +++---- unmkinitramfs | 14 +++--- update-initramfs | 22 ++++----- 19 files changed, 168 insertions(+), 172 deletions(-) diff --git a/debian/initramfs-tools.preinst b/debian/initramfs-tools.preinst index 99144bb..3084c4a 100755 --- a/debian/initramfs-tools.preinst +++ b/debian/initramfs-tools.preinst @@ -20,9 +20,10 @@ prepare_rm_conffile() { [ -e "$CONFFILE" ] || return 0 ensure_package_owns_file "$PACKAGE" "$CONFFILE" || return 0 - local md5sum="$(md5sum $CONFFILE | sed -e 's/ .*//')" - local old_md5sum="$(dpkg-query -W -f='${Conffiles}' $PACKAGE | \ - sed -n -e "\' $CONFFILE ' { s/ obsolete$//; s/.* //; p }")" + local md5sum old_md5sum + md5sum="$(md5sum "$CONFFILE" | sed -e 's/ .*//')" + old_md5sum="$(dpkg-query -W -f='${Conffiles}' "$PACKAGE" | \ + sed -n -e "\\' $CONFFILE ' { s/ obsolete$//; s/.* //; p }")" if [ "$md5sum" != "$old_md5sum" ]; then mv $mvverbose -f "$CONFFILE" "$CONFFILE.dpkg-backup" else diff --git a/docs/framebuffer b/docs/framebuffer index 47d8302..bc1f335 100644 --- a/docs/framebuffer +++ b/docs/framebuffer @@ -103,9 +103,9 @@ if [ -n "${FB}" ]; then fi if [ -e /proc/fb ]; then - while read fbno desc; do - if [ $(($fbno < 32)) ]; then - mknod -m 0640 /dev/fb${fbno} c 29 ${fbno} + while read -r fbno desc; do + if [ $((fbno < 32)) ]; then + mknod -m 0640 "/dev/fb${fbno}" c 29 "${fbno}" fi done < /proc/fb else diff --git a/hook-functions b/hook-functions index 58f9e63..941f6be 100644 --- a/hook-functions +++ b/hook-functions @@ -44,7 +44,7 @@ add_modules_from_file() return fi - grep '^[^#]' ${1} | while read module args; do + grep '^[^#]' "${1}" | while read -r module args; do [ -n "$module" ] || continue force_load "${module}" "${args}" done @@ -64,9 +64,9 @@ manual_add_modules() # module.ko' as we want. However it also means that 'softdep' # configuration lines and embedded softdep information is not # processed. So we run twice, with and without this option. - { modprobe --all --set-version="${version}" --ignore-install --quiet --show-depends "$@"; + { modprobe --all --set-version="${version?}" --ignore-install --quiet --show-depends "$@"; modprobe --all --set-version="${version}" --quiet --show-depends "$@"; } | - while read prefix kmod options ; do + while read -r prefix kmod options ; do if [ "${prefix}" != "insmod" ]; then continue fi @@ -139,7 +139,7 @@ copy_file() { link_target="$(readlink -f "${src}")" || return $(($? + 1)) if [ "${link_target}" != "${target}" ]; then - [ "${verbose}" = "y" ] && echo "Adding ${type}-link ${src}" + [ "${verbose?}" = "y" ] && echo "Adding ${type}-link ${src}" # Create a relative link so it always points # to the right place @@ -246,15 +246,15 @@ sys_walk_mod_add() fi # current driver module - driver_path="$(readlink -f ${device_path}/driver/module)" + driver_path="$(readlink -f "${device_path}/driver/module")" if [ -e "$driver_path" ]; then - module="$(basename $(readlink -f $driver_path))" + module="$(basename "$(readlink -f "$driver_path")")" if [ -n "${module}" ]; then manual_add_modules "${module}" fi fi - device_path="$(dirname ${device_path})" + device_path="$(dirname "${device_path}")" done } @@ -273,11 +273,11 @@ block_dev_sys_walk_mod_add() fi # Iterate over component of a layered device - ls -1 "$disk_sys_path/slaves" | while read component; do - block_dev_sys_walk_mod_add "$disk_sys_path/slaves/$component" + find "$disk_sys_path/slaves" -mindepth 1 -maxdepth 1 | while read -r component; do + block_dev_sys_walk_mod_add "$component" done - sys_walk_mod_add ${dev_sys_path} + sys_walk_mod_add "${dev_sys_path}" } block_dev_mod_add() @@ -308,22 +308,22 @@ block_dev_mod_add() add_loaded_modules() { local pattern="$1" - local module - local builtin=/lib/modules/$(uname -r)/modules.builtin + local module builtin + builtin="/lib/modules/$(uname -r)/modules.builtin" for module in /sys/module/$pattern; do if [ -d "$module" ]; then - manual_add_modules $(basename $module) + manual_add_modules "$(basename "$module")" fi done - if [ -f $builtin ]; then - while read module; do + if [ -f "$builtin" ]; then + while read -r module; do case "$module" in */$pattern.ko) - manual_add_modules $(basename $module .ko) + manual_add_modules "$(basename "$module" .ko)" ;; esac - done < $builtin + done < "$builtin" fi } @@ -341,9 +341,9 @@ dep_add_modules_mount() fi # find out block device + fstype - eval "$(while read dev mp fs opts rest ; do \ + eval "$(while read -r dev mp fs opts rest ; do \ [ "$mp" = "$dir" ] && [ "$fs" != "rootfs" ] \ - && printf "dev_node=$dev\nFSTYPE=$fs"\ + && printf "dev_node=%s\\nFSTYPE=%s" "$dev" "$fs"\ && break; done < /proc/mounts)" # Only the root mountpoint has to exist; do nothing if any other @@ -362,7 +362,7 @@ dep_add_modules_mount() if [ "$dir" = / ] && [ "${dev_node}" = "/dev/root" ] ; then if [ -b "${dev_node}" ]; then # Match it to the canonical device name by UUID - dev_node="/dev/disk/by-uuid/"$(blkid -o value -s UUID ${dev_node}) 2>/dev/null + dev_node="/dev/disk/by-uuid/"$(blkid -o value -s UUID "${dev_node}") 2>/dev/null else # Does not exist in our namespace, so look at the # kernel command line @@ -386,7 +386,7 @@ dep_add_modules_mount() fi # recheck device - if [ -z "$dev_node" ] || ! dev_node="$(readlink -f ${dev_node})" \ + if [ -z "$dev_node" ] || ! dev_node="$(readlink -f "${dev_node}")" \ || ! [ -b "$dev_node" ]; then echo "mkinitramfs: failed to determine device for $dir" >&2 echo "mkinitramfs: workaround is MODULES=most, check:" >&2 @@ -398,7 +398,7 @@ dep_add_modules_mount() fi # do not trust mount, check superblock - eval "$(/usr/lib/klibc/bin/fstype ${dev_node})" + eval "$(/usr/lib/klibc/bin/fstype "${dev_node}")" # check that fstype fs recognition if [ "${FSTYPE}" = "unknown" ]; then @@ -412,7 +412,7 @@ dep_add_modules_mount() fi # Add filesystem - manual_add_modules ${FSTYPE} + manual_add_modules "${FSTYPE}" block_dev_mod_add "$dev_node" } @@ -434,7 +434,7 @@ dep_add_modules() # sys walk some important device classes for class in gpio phy regulator rtc; do - for device in /sys/class/$class/*; do + for device in "/sys/class/$class"/*; do device="$(readlink -f "$device")" \ && sys_walk_mod_add "$device" done @@ -621,7 +621,7 @@ hidden_dep_add_modules() cat "${DESTDIR}/lib/modules/${version}/modules.builtin" find "${DESTDIR}/lib/modules/${version}/kernel" -name '*.ko*' } | - while read module; do + while read -r module; do module="${module##*/}" module="${module%%.*}" case "$module" in @@ -688,7 +688,7 @@ get_source() set_initlist() { unset initlist - for si_x in ${initdir}/*; do + for si_x in "${initdir}"/*; do # skip empty dirs without warning [ "${si_x}" = "${initdir}/*" ] && return @@ -702,7 +702,7 @@ set_initlist() esac # skip directories - if [ -d ${si_x} ]; then + if [ -d "${si_x}" ]; then [ "${verbose}" = "y" ] \ && echo "$si_x ignored: a directory" >&2 continue @@ -711,14 +711,14 @@ set_initlist() si_x="$(get_source "${si_x#${initdir}/}")" # skip non executable scripts - if [ ! -x ${si_x} ]; then + if [ ! -x "${si_x}" ]; then [ "${verbose}" = "y" ] \ && echo "$si_x ignored: not executable" >&2 continue fi # skip bad syntax - if ! sh -n ${si_x} ; then + if ! sh -n "${si_x}" ; then [ "${verbose}" = "y" ] \ && echo "$si_x ignored: bad syntax" >&2 continue @@ -732,11 +732,11 @@ get_prereq_pairs() { set_initlist for gp_x in ${initlist:-}; do - echo ${gp_x} ${gp_x} - gp_src="$(get_source $gp_x)" + echo "${gp_x} ${gp_x}" + gp_src="$(get_source "$gp_x")" prereqs=$("${gp_src}" prereqs) for prereq in ${prereqs}; do - echo ${prereq} ${gp_x} + echo "${prereq} ${gp_x}" done done } @@ -747,14 +747,14 @@ cache_run_scripts() DESTDIR=${1} scriptdir=${2} initdir=${DESTDIR}${scriptdir} - [ ! -d ${initdir} ] && return + [ ! -d "${initdir}" ] && return - > ${initdir}/ORDER + true > "${initdir}/ORDER" runlist=$(get_prereq_pairs | tsort) for crs_x in ${runlist}; do - [ -f ${initdir}/${crs_x} ] || continue - echo "${scriptdir}/${crs_x} \"\$@\"" >> ${initdir}/ORDER - echo "[ -e /conf/param.conf ] && . /conf/param.conf" >> ${initdir}/ORDER + [ -f "${initdir}/${crs_x}" ] || continue + echo "${scriptdir}/${crs_x} \"\$@\"" >> "${initdir}/ORDER" + echo "[ -e /conf/param.conf ] && . /conf/param.conf" >> "${initdir}/ORDER" done } @@ -762,12 +762,12 @@ call_scripts() { set -e for cs_x in ${runlist}; do - [ -f ${initdir}/${cs_x} ] || continue + [ -f "${initdir}/${cs_x}" ] || continue # mkinitramfs verbose output if [ "${verbose}" = "y" ]; then echo "Calling hook ${cs_x}" fi - ${initdir}/${cs_x} && ec=$? || ec=$? + "${initdir}/${cs_x}" && ec=$? || ec=$? # allow hooks to abort build: if [ "$ec" -ne 0 ]; then echo "E: ${initdir}/${cs_x} failed with return $ec." @@ -786,8 +786,8 @@ run_scripts() { scriptdir=${2:-} initdir=${1} - [ ! -d ${initdir} ] && return + [ ! -d "${initdir}" ] && return runlist=$(get_prereq_pairs | tsort) - call_scripts $scriptdir + call_scripts "$scriptdir" } diff --git a/hooks/fsck b/hooks/fsck index e4779fc..58b4110 100755 --- a/hooks/fsck +++ b/hooks/fsck @@ -7,14 +7,6 @@ prereqs() echo "$PREREQ" } -fstab_files() -{ - echo /etc/fstab - if [ -d /etc/fstab.d ]; then - ls -1 /etc/fstab.d | grep '\.fstab$' | sed -e 's;^;/etc/fstab.d/;' - fi -} - # Find a specific fstab entry # $1=mountpoint # $2=fstype (optional) @@ -24,9 +16,9 @@ _read_fstab_entry () { echo "MNT_DIR=" echo "MNT_TYPE=" - fstab_files | while read file; do + for file in /etc/fstab /etc/fstab.d/*.fstab; do if [ -f "$file" ]; then - while read MNT_FSNAME MNT_DIR MNT_TYPE MNT_OPTS MNT_FREQ MNT_PASS MNT_JUNK; do + while read -r MNT_FSNAME MNT_DIR MNT_TYPE MNT_OPTS MNT_FREQ MNT_PASS MNT_JUNK; do case "$MNT_FSNAME" in ""|\#*) continue; @@ -102,7 +94,7 @@ for type in $fsck_types; do continue fi - if prog="$(command -v fsck.${type})"; then + if prog="$(command -v "fsck.${type}")"; then copy_exec "$prog" else echo "Warning: /sbin/fsck.${type} doesn't exist, can't install to initramfs, ignoring." diff --git a/hooks/keymap b/hooks/keymap index b88d95c..75703ba 100755 --- a/hooks/keymap +++ b/hooks/keymap @@ -34,9 +34,9 @@ fi . /usr/share/initramfs-tools/hook-functions copy_exec /bin/loadkeys /bin -if ! setupcon --save-keyboard ${DESTDIR}/etc/boottime.kmap.gz ; then +if ! setupcon --save-keyboard "${DESTDIR}/etc/boottime.kmap.gz"; then echo "Warning: error while trying to store keymap file - ignoring request to install /etc/boottime.kmap.gz" - rm -f ${DESTDIR}/etc/boottime.kmap.gz + rm -f "${DESTDIR}/etc/boottime.kmap.gz" exit 0 fi @@ -54,8 +54,8 @@ else fi for var in LANG LC_ALL LC_CTYPE; do - value=$(egrep "^[^#]*${var}=" $env | tail -n1 | cut -d= -f2) - eval $var=$value + value=$(grep -E "^[^#]*${var}=" $env | tail -n1 | cut -d= -f2) + eval $var="$value" done charmap=$(LANG=$LANG LC_ALL=$LC_ALL LC_CTYPE=$LC_CTYPE locale charmap) diff --git a/hooks/resume b/hooks/resume index df6cde8..1ac24f9 100755 --- a/hooks/resume +++ b/hooks/resume @@ -49,7 +49,7 @@ if ! ischroot && [ -r /proc/swaps ]; then # dm-crypt is ephemeral if the key file is /dev/urandom if [ -n "$dm_name" ] && [ -e /etc/crypttab ]; then - while read cryptdev srcdev keyfile junk; do + while read -r cryptdev srcdev keyfile junk; do if [ "$cryptdev" = "$dm_name" ] && [ "$keyfile" = /dev/urandom ]; then ephemeral=true fi @@ -90,5 +90,5 @@ if [ "$RESUME" = auto ] || [ -n "$resume_auto" ]; then if [ -z "$resume_auto" ]; then echo >&2 "W: initramfs-tools failed to select a resume device" fi - echo "RESUME=${resume_auto}" > ${DESTDIR}/conf/conf.d/zz-resume-auto + echo "RESUME=${resume_auto}" > "${DESTDIR}/conf/conf.d/zz-resume-auto" fi diff --git a/hooks/thermal b/hooks/thermal index 93f5100..5807386 100755 --- a/hooks/thermal +++ b/hooks/thermal @@ -28,7 +28,7 @@ powerpc|ppc64) [ -r /proc/cpuinfo ] || exit 0 - MODEL="`grep model /proc/cpuinfo`" + MODEL="$(grep model /proc/cpuinfo)" MODEL="${MODEL##*: }" case "$MODEL" in diff --git a/init b/init index 5d10622..e4174cd 100755 --- a/init +++ b/init @@ -320,6 +320,6 @@ mount -n -o move /sys ${rootmnt}/sys mount -n -o move /proc ${rootmnt}/proc # Chain to real filesystem -exec run-init ${drop_caps} "${rootmnt}" "${init}" "$@" <${rootmnt}/dev/console >${rootmnt}/dev/console 2>&1 +exec run-init ${drop_caps} "${rootmnt}" "${init}" "$@" <"${rootmnt}/dev/console" >"${rootmnt}/dev/console" 2>&1 echo "Something went badly wrong in the initramfs." panic "Please file a bug on initramfs-tools." diff --git a/lsinitramfs b/lsinitramfs index a96308d..4f91a6c 100755 --- a/lsinitramfs +++ b/lsinitramfs @@ -4,7 +4,7 @@ set -eu usage() { - echo "Usage: $(basename $0) [-l] " + echo "Usage: $(basename "$0") [-l] " } if [ "$#" -eq 0 ] ; then @@ -14,7 +14,7 @@ fi umi_opts="--list" -OPTIONS=`getopt -o hl --long help,long -n "$0" -- "$@"` +OPTIONS=$(getopt -o hl --long help,long -n "$0" -- "$@") # Check for non-GNU getopt if [ $? != 0 ] ; then echo "W: non-GNU getopt" >&2 ; exit 1 ; fi diff --git a/mkinitramfs b/mkinitramfs index 2ce863d..1b15c36 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -11,7 +11,7 @@ verbose="n" BUSYBOXDIR= export BUSYBOXDIR -OPTIONS=`getopt -o c:d:ko:r:v -n "$0" -- "$@"` +OPTIONS=$(getopt -o c:d:ko:r:v -n "$0" -- "$@") # Check for non-GNU getopt if [ $? != 0 ] ; then echo "W: non-GNU getopt" >&2 ; exit 1 ; fi @@ -65,19 +65,19 @@ done . "${CONFDIR}/initramfs.conf" EXTRA_CONF='' -for i in /usr/share/initramfs-tools/conf.d/* ${CONFDIR}/conf.d/*; do - [ -e $i ] && EXTRA_CONF="${EXTRA_CONF} $(basename $i \ +for i in /usr/share/initramfs-tools/conf.d/* "${CONFDIR}"/conf.d/*; do + [ -e "$i" ] && EXTRA_CONF="${EXTRA_CONF} $(basename "$i" \ | grep '^[[:alnum:]][[:alnum:]\._-]*$' | grep -v '\.dpkg-.*$')"; done # FIXME: deprecated those settings on mkinitramfs run # these conf dirs are for boot scripts and land on initramfs for i in ${EXTRA_CONF}; do - if [ -d ${CONFDIR}/conf.d/${i} ]; then + if [ -d "${CONFDIR}/conf.d/${i}" ]; then echo "Warning: ${CONFDIR}/conf.d/${i} is a directory instead of file, ignoring." - elif [ -e ${CONFDIR}/conf.d/${i} ]; then - . ${CONFDIR}/conf.d/${i} - elif [ -e /usr/share/initramfs-tools/conf.d/${i} ]; then - . /usr/share/initramfs-tools/conf.d/${i} + elif [ -e "${CONFDIR}/conf.d/${i}" ]; then + . "${CONFDIR}/conf.d/${i}" + elif [ -e "/usr/share/initramfs-tools/conf.d/${i}" ]; then + . "/usr/share/initramfs-tools/conf.d/${i}" fi done @@ -132,7 +132,7 @@ case "${version}" in esac if [ -z "${compress:-}" ]; then - compress=${COMPRESS} + compress=${COMPRESS?} fi unset COMPRESS @@ -162,7 +162,7 @@ if [ ! -e "${MODULESDIR}" ]; then echo "Ensure all necessary drivers are built into the linux image!" fi if [ ! -e "${MODULESDIR}/modules.dep" ]; then - depmod ${version} + depmod "${version}" fi # Prepare to clean up temporary files on exit @@ -183,12 +183,12 @@ trap "exit 1" INT TERM # makes the EXIT trap effective even when killed # Create temporary directory and files for initramfs contents [ -n "${TMPDIR}" ] && [ ! -w "${TMPDIR}" ] && unset TMPDIR -DESTDIR="$(mktemp -d ${TMPDIR:-/var/tmp}/mkinitramfs_XXXXXX)" || exit 1 +DESTDIR="$(mktemp -d "${TMPDIR:-/var/tmp}/mkinitramfs_XXXXXX")" || exit 1 chmod 755 "${DESTDIR}" -__TMPCPIOGZ="$(mktemp ${TMPDIR:-/var/tmp}/mkinitramfs-OL_XXXXXX)" || exit 1 -__TMPEARLYCPIO="$(mktemp ${TMPDIR:-/var/tmp}/mkinitramfs-FW_XXXXXX)" || exit 1 +__TMPCPIOGZ="$(mktemp "${TMPDIR:-/var/tmp}/mkinitramfs-OL_XXXXXX")" || exit 1 +__TMPEARLYCPIO="$(mktemp "${TMPDIR:-/var/tmp}/mkinitramfs-FW_XXXXXX")" || exit 1 -DPKG_ARCH=`dpkg --print-architecture` +DPKG_ARCH=$(dpkg --print-architecture) # Export environment for hook scripts. # @@ -259,7 +259,7 @@ esac hidden_dep_add_modules # First file executed by linux -cp -p /usr/share/initramfs-tools/init ${DESTDIR}/init +cp -p /usr/share/initramfs-tools/init "${DESTDIR}/init" # add existant boot scripts for b in $(cd /usr/share/initramfs-tools/scripts/ && find . \ @@ -277,8 +277,8 @@ for b in $(cd "${CONFDIR}/scripts" && find . -maxdepth 2 -name '.?*' -prune -o \ cp -p "${CONFDIR}/scripts/${b}" "${DESTDIR}/scripts/$(dirname "${b}")/" done -echo "DPKG_ARCH=${DPKG_ARCH}" > ${DESTDIR}/conf/arch.conf -cp -p "${CONFDIR}/initramfs.conf" ${DESTDIR}/conf +echo "DPKG_ARCH=${DPKG_ARCH}" > "${DESTDIR}/conf/arch.conf" +cp -p "${CONFDIR}/initramfs.conf" "${DESTDIR}/conf" for i in ${EXTRA_CONF}; do if [ -e "${CONFDIR}/conf.d/${i}" ]; then copy_file config "${CONFDIR}/conf.d/${i}" /conf/conf.d @@ -290,7 +290,7 @@ done # ROOT hardcoding if [ -n "${ROOT:-}" ]; then - echo "ROOT=${ROOT}" > ${DESTDIR}/conf/conf.d/root + echo "ROOT=${ROOT}" > "${DESTDIR}/conf/conf.d/root" fi if ! command -v ldd >/dev/null 2>&1 ; then @@ -329,13 +329,13 @@ for b in $(cd "${DESTDIR}/scripts" && find . -mindepth 1 -type d); do done # generate module deps -depmod -a -b "${DESTDIR}" ${version} +depmod -a -b "${DESTDIR}" "${version}" rm -f "${DESTDIR}/lib/modules/${version}"/modules.*map # make sure that library search path is up to date cp -ar /etc/ld.so.conf* "$DESTDIR"/etc/ if ! ldconfig -r "$DESTDIR" ; then - [ $(id -u) != "0" ] \ + [ "$(id -u)" != "0" ] \ && echo "ldconfig might need uid=0 (root) for chroot()" >&2 fi # The auxiliary cache is not reproducible and is always invalid at boot @@ -373,7 +373,7 @@ if [ -s "${__TMPEARLYCPIO}" ]; then cat "${__TMPEARLYCPIO}" >"${outfile}" || exit 1 else # truncate - > "${outfile}" + true > "${outfile}" fi ( @@ -392,8 +392,11 @@ fi # work around lack of "set -o pipefail" for the following pipe: # cd "${DESTDIR}" && find . | LC_ALL=C sort | cpio --quiet $cpio_owner_root $cpio_reproducible -o -H newc | gzip >>"${outfile}" || exit 1 +ec1=1 +ec2=1 +ec3=1 exec 3>&1 -eval ` +eval "$( # http://cfaj.freeshell.org/shell/cus-faq-2.html exec 4>&1 >&3 3>&- cd "${DESTDIR}" @@ -405,7 +408,7 @@ eval ` cpio --quiet $cpio_owner_root $cpio_reproducible -o -H newc 4>&-; echo "ec2=$?;" >&4 } | ${compress} >>"${outfile}" echo "ec3=$?;" >&4 -` +)" if [ "$ec1" -ne 0 ]; then echo "E: mkinitramfs failure find $ec1 cpio $ec2 $compress $ec3" exit "$ec1" diff --git a/scripts/functions b/scripts/functions index a954a93..ae14eba 100644 --- a/scripts/functions +++ b/scripts/functions @@ -2,33 +2,33 @@ _log_msg() { - if [ "$quiet" = "y" ]; then return; fi - printf "$@" + if [ "${quiet?}" = "y" ]; then return; fi + echo -n "$*" } log_success_msg() { - _log_msg "Success: $@\n" + _log_msg "Success: $*\\n" } log_failure_msg() { - _log_msg "Failure: $@\n" + _log_msg "Failure: $*\\n" } log_warning_msg() { - _log_msg "Warning: $@\n" + _log_msg "Warning: $*\\n" } log_begin_msg() { - _log_msg "Begin: $@ ... " + _log_msg "Begin: $* ... " } log_end_msg() { - _log_msg "done.\n" + _log_msg "done.\\n" } panic() @@ -41,9 +41,9 @@ panic() echo "$@" # Disallow console access - if [ -n "${panic}" ]; then + if [ -n "${panic?}" ]; then echo "Rebooting automatically due to panic= boot argument" - sleep ${panic} + sleep "${panic}" reboot exit # in case reboot fails, force kernel panic fi @@ -54,22 +54,22 @@ panic() # and paging in more if command -v setsid >/dev/null 2>&1; then unset IFS - read console rest /dev/${console} 1>&0 2>&1" + REASON="$*" PS1='(initramfs) ' setsid sh -c "exec sh -i <>/dev/${console} 1>&0 2>&1" else - REASON="$@" PS1='(initramfs) ' sh -i /dev/console 2>&1 + REASON="$*" PS1='(initramfs) ' sh -i /dev/console 2>&1 fi } maybe_break() { - case ",$break," in + case ",${break?}," in *,$1,*) if [ "$1" = "top" ]; then # udev is not yet running, so load keyboard drivers @@ -84,7 +84,7 @@ maybe_break() sleep 2 for modalias in /sys/bus/hid/devices/*/modalias; do if [ -f "${modalias}" ]; then - modprobe ${opts} -b "$(cat ${modalias})" + modprobe ${opts} -b "$(cat "${modalias}")" fi done fi @@ -97,17 +97,17 @@ maybe_break() run_scripts() { initdir=${1} - [ ! -d ${initdir} ] && return + [ ! -d "${initdir}" ] && return shift - . ${initdir}/ORDER + . "${initdir}/ORDER" } # Load custom modules first load_modules() { if [ -e /conf/modules ]; then - cat /conf/modules | while read m; do + while read -r m; do # Skip empty lines if [ -z "$m" ]; then continue @@ -118,7 +118,7 @@ load_modules() continue fi modprobe $m - done + done < /conf/modules fi } @@ -143,8 +143,8 @@ parse_numeric() { *) # [A-Fa-f0-9]* value=$(( 0x${1} )) - minor=$(( (${value} & 0xff) | (${value} >> 12) & 0xfff00 )) - major=$(( (${value} >> 8) & 0xfff )) + minor=$(( (value & 0xff) | (value >> 12) & 0xfff00 )) + major=$(( (value >> 8) & 0xfff )) ;; esac @@ -156,13 +156,13 @@ parse_numeric() { # Return value: indicates if an fs could be recognized get_fstype () { - local FS FSTYPE FSSIZE RET + local FS FSTYPE RET FS="${1}" # blkid has a more complete list of file systems, # but fstype is more robust FSTYPE="unknown" - eval $(fstype "${FS}" 2> /dev/null) + eval "$(fstype "${FS}" 2> /dev/null)" if [ "$FSTYPE" = "unknown" ]; then FSTYPE=$(blkid -o value -s TYPE "${FS}") fi @@ -263,10 +263,10 @@ configure_networking() ipconfig -t ${ROUNDTTT} "${DEVICE}" ;; dhcp|bootp|rarp|both) - ipconfig -t ${ROUNDTTT} -c ${IP} -d "${DEVICE}" + ipconfig -t ${ROUNDTTT} -c "${IP}" -d "${DEVICE}" ;; *) - ipconfig -t ${ROUNDTTT} -d $IP + ipconfig -t ${ROUNDTTT} -d "$IP" ;; esac done @@ -274,7 +274,7 @@ configure_networking() # source ipconfig output if [ -n "${DEVICE}" ]; then # source specific bootdevice - . /run/net-${DEVICE}.conf + . "/run/net-${DEVICE}.conf" else # source any interface... # ipconfig should have quit after first response @@ -297,9 +297,9 @@ read_fstab_entry() { # Not found by default. found=1 - for file in ${rootmnt}/etc/fstab; do + for file in ${rootmnt?}/etc/fstab; do if [ -f "$file" ]; then - while read MNT_FSNAME MNT_DIR MNT_TYPE MNT_OPTS MNT_FREQ MNT_PASS MNT_JUNK; do + while read -r MNT_FSNAME MNT_DIR MNT_TYPE MNT_OPTS MNT_FREQ MNT_PASS MNT_JUNK; do case "$MNT_FSNAME" in ""|\#*) continue; @@ -357,22 +357,22 @@ _checkfs_once() log_warning_msg "fsck not present, so skipping $NAME file system" return fi - if [ "$fastboot" = "y" ] ; then + if [ "${fastboot?}" = "y" ] ; then log_warning_msg "Fast boot enabled, so skipping $NAME file system check." return fi - if [ "$forcefsck" = "y" ] + if [ "${forcefsck?}" = "y" ] then force="-f" else force="" fi - if [ "$fsckfix" = "y" ] + if [ "${fsckfix?}" = "y" ] then fix="-y" - elif [ "$fsckfix" = "n" ] + elif [ "${fsckfix?}" = "n" ] then fix="-n" else @@ -380,19 +380,19 @@ _checkfs_once() fi spinner="" - if [ -z "${debug}" ]; then + if [ -z "${debug?}" ]; then spinner="-C" fi if [ "${quiet}" = n ] then log_begin_msg "Will now check $NAME file system" - logsave -a -s $FSCK_LOGFILE fsck $spinner $force $fix -V -t $TYPE $DEV + logsave -a -s $FSCK_LOGFILE fsck $spinner $force $fix -V -t "$TYPE" "$DEV" FSCKCODE=$? log_end_msg else log_begin_msg "Checking $NAME file system" - logsave -a -s $FSCK_LOGFILE fsck $spinner $force $fix -T -t $TYPE $DEV + logsave -a -s $FSCK_LOGFILE fsck $spinner $force $fix -T -t "$TYPE" "$DEV" FSCKCODE=$? log_end_msg fi @@ -414,7 +414,7 @@ _checkfs_once() log_warning_msg "File system check failed but did not detect errors" sleep 5 else - > $FSCK_STAMPFILE + true > $FSCK_STAMPFILE fi return 0 } diff --git a/scripts/init-top/all_generic_ide b/scripts/init-top/all_generic_ide index e9539d8..120901a 100755 --- a/scripts/init-top/all_generic_ide +++ b/scripts/init-top/all_generic_ide @@ -19,7 +19,7 @@ for x in $(cat /proc/cmdline); do modprobe ata_generic all_generic_ide=1 ;; all_generic_ide=*) - if [ ${x#all_generic_ide=} ]; then + if [ -n "${x#all_generic_ide=}" ]; then modprobe ata_generic all_generic_ide=1 fi ;; diff --git a/scripts/init-top/blacklist b/scripts/init-top/blacklist index 2164906..d860603 100755 --- a/scripts/init-top/blacklist +++ b/scripts/init-top/blacklist @@ -16,7 +16,7 @@ prereqs) esac # sanity check -[ -z "${blacklist}" ] && exit 0 +[ -z "${blacklist?}" ] && exit 0 # write blacklist to modprobe.d IFS=',' diff --git a/scripts/init-top/keymap b/scripts/init-top/keymap index f011abf..00578ce 100755 --- a/scripts/init-top/keymap +++ b/scripts/init-top/keymap @@ -22,6 +22,6 @@ if [ -x /bin/kbd_mode ]; then fi # Load custom keymap -if [ -x /bin/loadkeys -a -r /etc/boottime.kmap.gz ]; then +if [ -x /bin/loadkeys ] && [ -r /etc/boottime.kmap.gz ]; then loadkeys ${OPTS} /etc/boottime.kmap.gz fi diff --git a/scripts/local b/scripts/local index 4ec926c..06d93de 100644 --- a/scripts/local +++ b/scripts/local @@ -3,7 +3,7 @@ local_top() { if [ "${local_top_used}" != "yes" ]; then - [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/local-top" + [ "${quiet?}" != "y" ] && log_begin_msg "Running /scripts/local-top" run_scripts /scripts/local-top [ "$quiet" != "y" ] && log_end_msg fi @@ -20,7 +20,7 @@ local_top() local_block() { - [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/local-block" + [ "${quiet?}" != "y" ] && log_begin_msg "Running /scripts/local-block" run_scripts /scripts/local-block "$@" [ "$quiet" != "y" ] && log_end_msg } @@ -28,7 +28,7 @@ local_block() local_premount() { if [ "${local_premount_used}" != "yes" ]; then - [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/local-premount" + [ "${quiet?}" != "y" ] && log_begin_msg "Running /scripts/local-premount" run_scripts /scripts/local-premount [ "$quiet" != "y" ] && log_end_msg fi @@ -38,7 +38,7 @@ local_premount() local_bottom() { if [ "${local_premount_used}" = "yes" ] || [ "${local_top_used}" = "yes" ]; then - [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/local-bottom" + [ "${quiet?}" != "y" ] && log_begin_msg "Running /scripts/local-bottom" run_scripts /scripts/local-bottom [ "$quiet" != "y" ] && log_end_msg fi @@ -65,7 +65,7 @@ local_device_setup() # Load ubi with the correct MTD partition and return since fstype # doesn't work with a char device like ubi. if [ -n "$UBIMTD" ]; then - modprobe ubi mtd=$UBIMTD + modprobe ubi "mtd=$UBIMTD" DEV="${dev_id}" return fi @@ -88,7 +88,7 @@ local_device_setup() # Timeout is max(30, rootdelay) seconds (approximately) slumber=30 - if [ ${ROOTDELAY:-0} -gt $slumber ]; then + if [ "${ROOTDELAY:-0}" -gt $slumber ]; then slumber=$ROOTDELAY fi @@ -125,7 +125,7 @@ local_device_setup() log_end_msg 0 break fi - if [ ${time_elapsed} -ge ${slumber} ]; then + if [ ${time_elapsed} -ge "${slumber}" ]; then log_end_msg 1 || true break fi @@ -167,23 +167,23 @@ local_mount_root() local_premount - if [ "${readonly}" = "y" ]; then + if [ "${readonly?}" = "y" ]; then roflag=-r else roflag=-w fi # FIXME This has no error checking - modprobe ${FSTYPE} + modprobe "${FSTYPE}" - checkfs ${ROOT} root "${FSTYPE}" + checkfs "${ROOT}" root "${FSTYPE}" # FIXME This has no error checking # Mount root if [ "${FSTYPE}" != "unknown" ]; then - mount ${roflag} -t ${FSTYPE} ${ROOTFLAGS} ${ROOT} ${rootmnt} + mount ${roflag} -t "${FSTYPE}" ${ROOTFLAGS} "${ROOT}" "${rootmnt?}" else - mount ${roflag} ${ROOTFLAGS} ${ROOT} ${rootmnt} + mount ${roflag} ${ROOTFLAGS} "${ROOT}" "${rootmnt}" fi } diff --git a/scripts/local-premount/resume b/scripts/local-premount/resume index 4cafcaa..88abd86 100755 --- a/scripts/local-premount/resume +++ b/scripts/local-premount/resume @@ -15,20 +15,20 @@ prereqs) ;; esac -if [ -z "${resume}" ] || [ ! -e /sys/power/resume ]; then +if [ -z "${resume?}" ] || [ ! -e /sys/power/resume ]; then exit 0 fi . /scripts/functions . /scripts/local -if ! local_device_setup ${resume} "suspend/resume device" false; then +if ! local_device_setup "${resume}" "suspend/resume device" false; then exit 0 fi # hardcode path, uswsusp ships an resume binary too -if [ -n "${resume_offset}" ]; then - /bin/resume ${DEV} ${resume_offset} +if [ -n "${resume_offset?}" ]; then + /bin/resume "${DEV}" "${resume_offset}" else - /bin/resume ${DEV} + /bin/resume "${DEV}" fi diff --git a/scripts/nfs b/scripts/nfs index 359bd46..275e2e4 100644 --- a/scripts/nfs +++ b/scripts/nfs @@ -5,7 +5,7 @@ nfs_top() { if [ "${nfs_top_used}" != "yes" ]; then - [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/nfs-top" + [ "${quiet?}" != "y" ] && log_begin_msg "Running /scripts/nfs-top" run_scripts /scripts/nfs-top [ "$quiet" != "y" ] && log_end_msg fi @@ -15,7 +15,7 @@ nfs_top() nfs_premount() { if [ "${nfs_premount_used}" != "yes" ]; then - [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/nfs-premount" + [ "${quiet?}" != "y" ] && log_begin_msg "Running /scripts/nfs-premount" run_scripts /scripts/nfs-premount [ "$quiet" != "y" ] && log_end_msg fi @@ -25,7 +25,7 @@ nfs_premount() nfs_bottom() { if [ "${nfs_premount_used}" = "yes" ] || [ "${nfs_top_used}" = "yes" ]; then - [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/nfs-bottom" + [ "${quiet?}" != "y" ] && log_begin_msg "Running /scripts/nfs-bottom" run_scripts /scripts/nfs-bottom [ "$quiet" != "y" ] && log_end_msg fi @@ -65,13 +65,13 @@ nfs_mount_root_impl() nfs_premount - if [ ${readonly} = y ]; then + if [ "${readonly?}" = y ]; then roflag="-o ro" else roflag="-o rw" fi - nfsmount -o nolock ${roflag} ${NFSOPTS} ${NFSROOT} ${rootmnt} + nfsmount -o nolock ${roflag} ${NFSOPTS} "${NFSROOT}" "${rootmnt?}" } # NFS root mounting @@ -92,13 +92,13 @@ nfs_mount_root() nfs_mount_root_impl ret=$? nfs_retry_count=0 - while [ ${nfs_retry_count} -lt ${delay} ] \ + while [ ${nfs_retry_count} -lt "${delay}" ] \ && [ $ret -ne 0 ] ; do [ "$quiet" != "y" ] && log_begin_msg "Retrying nfs mount" /bin/sleep 1 nfs_mount_root_impl ret=$? - nfs_retry_count=$(( ${nfs_retry_count} + 1 )) + nfs_retry_count=$(( nfs_retry_count + 1 )) [ "$quiet" != "y" ] && log_end_msg done } @@ -113,7 +113,7 @@ nfs_mount_fs_impl() nfs_premount - if [ ${readonly} = y ]; then + if [ "${readonly}" = y ]; then roflag="-o ro" else roflag="-o rw" diff --git a/unmkinitramfs b/unmkinitramfs index 910558b..a49ab7f 100755 --- a/unmkinitramfs +++ b/unmkinitramfs @@ -75,12 +75,12 @@ splitinitramfs() break fi magic="$(readhex "$initramfs" $end 6)" || break - test $magic = 070701 || test $magic = 070702 || break + test "$magic" = 070701 || test "$magic" = 070702 || break namesize=0x$(readhex "$initramfs" $((end + 94)) 8) filesize=0x$(readhex "$initramfs" $((end + 54)) 8) end=$(((end + 110))) - end=$(((end + $namesize + 3) & ~3)) - end=$(((end + $filesize + 3) & ~3)) + end=$(((end + namesize + 3) & ~3)) + end=$(((end + filesize + 3) & ~3)) done if [ $end -eq $start ]; then break @@ -106,10 +106,10 @@ splitinitramfs() if [ $end -gt 0 ]; then # Extract to main subdirectory - subarchive=$(mktemp ${TMPDIR:-/var/tmp}/unmkinitramfs_XXXXXX) - trap "rm -f '$subarchive'" EXIT + subarchive=$(mktemp "${TMPDIR:-/var/tmp}/unmkinitramfs_XXXXXX") + trap 'rm -f "$subarchive"' EXIT dd < "$initramfs" skip=$end iflag=skip_bytes 2> /dev/null \ - > $subarchive + > "$subarchive" xcpio "$subarchive" "${dir:+$dir/main}" -i "$@" else # Don't use subdirectories (for backward compatibility) @@ -117,7 +117,7 @@ splitinitramfs() fi } -OPTIONS=`getopt -o hv --long help,list,verbose -n "$0" -- "$@"` +OPTIONS=$(getopt -o hv --long help,list,verbose -n "$0" -- "$@") # Check for non-GNU getopt if [ $? != 0 ] ; then echo "W: non-GNU getopt" >&2 ; exit 1 ; fi diff --git a/update-initramfs b/update-initramfs index 2ef3a45..632c9de 100755 --- a/update-initramfs +++ b/update-initramfs @@ -36,7 +36,7 @@ esac usage() { if [ -n "${1:-}" ]; then - printf "${*}\n\n" >&2 + printf "%s\\n\\n" "${*}" >&2 fi cat >&2 << EOF Usage: ${0} [OPTION]... @@ -57,7 +57,7 @@ EOF mild_panic() { if [ -n "${1:-}" ]; then - printf "${*}\n" >&2 + printf "%s\\n" "${*}" >&2 fi exit 0 } @@ -65,7 +65,7 @@ mild_panic() panic() { if [ -n "${1:-}" ]; then - printf "${*}\n" >&2 + printf "%s\\n" "${*}" >&2 fi exit 1 } @@ -73,7 +73,7 @@ panic() verbose() { if [ "${verbose}" = 1 ]; then - printf "${*}\n" + printf "%s\\n" "${*}" fi } @@ -119,7 +119,7 @@ backup_booted_initramfs() boot_initramfs= uptime_days=$(awk '{printf "%d", $1 / 3600 / 24}' /proc/uptime) if [ -n "$uptime_days" ]; then - boot_initramfs=$(find "${initramfs}.bak" -mtime +${uptime_days}) + boot_initramfs=$(find "${initramfs}.bak" -mtime "+${uptime_days}") fi if [ -n "${boot_initramfs}" ]; then mv -f "${initramfs_bak}" "${initramfs}.bak" @@ -203,7 +203,7 @@ get_sorted_versions() { version_list="$( linux-version list | - while read version; do + while read -r version; do test -e "${BOOTDIR}/initrd.img-$version" && echo "$version" done | linux-version sort --reverse @@ -213,8 +213,8 @@ get_sorted_versions() set_current_version() { - if [ -f /boot/initrd.img-`uname -r` ]; then - version=`uname -r` + if [ -f "/boot/initrd.img-$(uname -r)" ]; then + version=$(uname -r) fi } @@ -350,10 +350,10 @@ while getopts "k:cudvtb:h?" flag; do esac done -shift $((${OPTIND} - 1)) +shift $((OPTIND - 1)) if [ $# -ne 0 ]; then - printf "Extra argument '%s'\n\n" "$1" >&2 + printf "Extra argument '%s'\\n\\n" "$1" >&2 usage fi @@ -363,7 +363,7 @@ if [ -z "${mode}" ]; then fi if [ "${version}" = "all" ] \ - || ( [ "${update_initramfs}" = "all" ] && [ -z "${version}" ] ); then + || { [ "${update_initramfs}" = "all" ] && [ -z "${version}" ]; }; then get_sorted_versions if [ -z "${version_list}" ]; then verbose "Nothing to do, exiting." -- GitLab From 2bab73b939f196c3dd86988d4d95f71152f18f4c Mon Sep 17 00:00:00 2001 From: Benjamin Drung Date: Mon, 10 Dec 2018 16:52:36 +0100 Subject: [PATCH 077/213] Disable shellcheck for desired behaviour Sometimes globbing and word splitting is wanted. Therefore explicitly disable the check for these line. Signed-off-by: Benjamin Drung --- docs/framebuffer | 3 +++ hook-functions | 8 ++++++++ hooks/fsck | 1 + hooks/resume | 2 ++ init | 4 ++++ kernel/postinst.d/initramfs-tools | 1 + kernel/postrm.d/initramfs-tools | 1 + lsinitramfs | 1 + mkinitramfs | 3 +++ scripts/functions | 4 ++++ scripts/init-top/all_generic_ide | 1 + scripts/init-top/keymap | 1 + scripts/local | 2 ++ scripts/nfs | 2 ++ unmkinitramfs | 2 ++ update-initramfs | 4 ++++ 16 files changed, 40 insertions(+) diff --git a/docs/framebuffer b/docs/framebuffer index bc1f335..508fc51 100644 --- a/docs/framebuffer +++ b/docs/framebuffer @@ -64,6 +64,7 @@ parse_video_opts() FB="" OPTS="" +# shellcheck disable=SC2013 for x in $(cat /proc/cmdline); do case ${x} in vga=*) @@ -99,10 +100,12 @@ esac if [ -n "${FB}" ]; then unset MODPROBE_OPTIONS modprobe -q fbcon + # shellcheck disable=SC2086 modprobe -q ${FB} ${OPTS} fi if [ -e /proc/fb ]; then + # shellcheck disable=SC2034 while read -r fbno desc; do if [ $((fbno < 32)) ]; then mknod -m 0640 "/dev/fb${fbno}" c 29 "${fbno}" diff --git a/hook-functions b/hook-functions index 941f6be..d6d66f4 100644 --- a/hook-functions +++ b/hook-functions @@ -64,6 +64,7 @@ manual_add_modules() # module.ko' as we want. However it also means that 'softdep' # configuration lines and embedded softdep information is not # processed. So we run twice, with and without this option. + # shellcheck disable=SC2034 { modprobe --all --set-version="${version?}" --ignore-install --quiet --show-depends "$@"; modprobe --all --set-version="${version}" --quiet --show-depends "$@"; } | while read -r prefix kmod options ; do @@ -224,9 +225,11 @@ copy_modules_dir() first=false done + # shellcheck disable=SC2044 for kmod in $(find "${MODULESDIR}/${dir}" "$@" -name '*.ko*' -printf '%f\n'); do modules="$modules ${kmod%%.*}" done + # shellcheck disable=SC2086 manual_add_modules $modules } @@ -341,6 +344,7 @@ dep_add_modules_mount() fi # find out block device + fstype + # shellcheck disable=SC2034 eval "$(while read -r dev mp fs opts rest ; do \ [ "$mp" = "$dir" ] && [ "$fs" != "rootfs" ] \ && printf "dev_node=%s\\nFSTYPE=%s" "$dev" "$fs"\ @@ -367,6 +371,7 @@ dep_add_modules_mount() # Does not exist in our namespace, so look at the # kernel command line dev_node= + # shellcheck disable=SC2013 for arg in $(cat /proc/cmdline); do case "$arg" in root=*) @@ -487,6 +492,7 @@ dep_add_modules() modules="$modules sunvnet sunvdc" fi + # shellcheck disable=SC2086 manual_add_modules $modules } @@ -606,6 +612,7 @@ auto_add_modules() esac done + # shellcheck disable=SC2086 manual_add_modules $modules } @@ -616,6 +623,7 @@ auto_add_modules() # hidden dependencies. hidden_dep_add_modules() { + # shellcheck disable=SC2046 manual_add_modules $( { cat "${DESTDIR}/lib/modules/${version}/modules.builtin" diff --git a/hooks/fsck b/hooks/fsck index 58b4110..6301b9b 100755 --- a/hooks/fsck +++ b/hooks/fsck @@ -18,6 +18,7 @@ _read_fstab_entry () { for file in /etc/fstab /etc/fstab.d/*.fstab; do if [ -f "$file" ]; then + # shellcheck disable=SC2034 while read -r MNT_FSNAME MNT_DIR MNT_TYPE MNT_OPTS MNT_FREQ MNT_PASS MNT_JUNK; do case "$MNT_FSNAME" in ""|\#*) diff --git a/hooks/resume b/hooks/resume index 1ac24f9..97226fa 100755 --- a/hooks/resume +++ b/hooks/resume @@ -43,12 +43,14 @@ report_auto() # is not ephemeral. We need to be able to read the listed swap partitions. resume_auto= if ! ischroot && [ -r /proc/swaps ]; then + # shellcheck disable=SC2013 for resume_auto in $(grep ^/dev/ /proc/swaps | sort -rnk3 | cut -d " " -f 1); do ephemeral=false dm_name="$(dmsetup info -c --noheadings -o name "$resume_auto" 2>/dev/null)" # dm-crypt is ephemeral if the key file is /dev/urandom if [ -n "$dm_name" ] && [ -e /etc/crypttab ]; then + # shellcheck disable=SC2034 while read -r cryptdev srcdev keyfile junk; do if [ "$cryptdev" = "$dm_name" ] && [ "$keyfile" = /dev/urandom ]; then ephemeral=true diff --git a/init b/init index e4174cd..4b6c6a9 100755 --- a/init +++ b/init @@ -13,6 +13,7 @@ mkdir -p /var/lock mount -t sysfs -o nodev,noexec,nosuid sysfs /sys mount -t proc -o nodev,noexec,nosuid proc /proc +# shellcheck disable=SC2013 for x in $(cat /proc/cmdline); do case $x in initramfs.clear) @@ -76,6 +77,7 @@ done . /scripts/functions # Parse command line options +# shellcheck disable=SC2013 for x in $(cat /proc/cmdline); do case $x in init=*) @@ -102,6 +104,7 @@ for x in $(cat /proc/cmdline); do esac ;; nfsroot=*) + # shellcheck disable=SC2034 NFSROOT="${x#nfsroot=}" ;; initramfs.runsize=*) @@ -320,6 +323,7 @@ mount -n -o move /sys ${rootmnt}/sys mount -n -o move /proc ${rootmnt}/proc # Chain to real filesystem +# shellcheck disable=SC2086,SC2094 exec run-init ${drop_caps} "${rootmnt}" "${init}" "$@" <"${rootmnt}/dev/console" >"${rootmnt}/dev/console" 2>&1 echo "Something went badly wrong in the initramfs." panic "Please file a bug on initramfs-tools." diff --git a/kernel/postinst.d/initramfs-tools b/kernel/postinst.d/initramfs-tools index 81b9aee..5d02e57 100755 --- a/kernel/postinst.d/initramfs-tools +++ b/kernel/postinst.d/initramfs-tools @@ -32,4 +32,5 @@ if [ -n "$DEB_MAINT_PARAMS" ]; then fi # we're good - create initramfs. update runs do_bootloader +# shellcheck disable=SC2086 INITRAMFS_TOOLS_KERNEL_HOOK=1 update-initramfs -c -k "${version}" ${bootopt} >&2 diff --git a/kernel/postrm.d/initramfs-tools b/kernel/postrm.d/initramfs-tools index 98740ee..471da86 100755 --- a/kernel/postrm.d/initramfs-tools +++ b/kernel/postrm.d/initramfs-tools @@ -32,4 +32,5 @@ if [ -n "$DEB_MAINT_PARAMS" ]; then fi # delete initramfs +# shellcheck disable=SC2086 INITRAMFS_TOOLS_KERNEL_HOOK=1 update-initramfs -d -k "${version}" ${bootopt} >&2 diff --git a/lsinitramfs b/lsinitramfs index 4f91a6c..1235e4d 100755 --- a/lsinitramfs +++ b/lsinitramfs @@ -16,6 +16,7 @@ umi_opts="--list" OPTIONS=$(getopt -o hl --long help,long -n "$0" -- "$@") # Check for non-GNU getopt +# shellcheck disable=SC2181 if [ $? != 0 ] ; then echo "W: non-GNU getopt" >&2 ; exit 1 ; fi eval set -- "$OPTIONS" diff --git a/mkinitramfs b/mkinitramfs index 1b15c36..c372c20 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -14,6 +14,7 @@ export BUSYBOXDIR OPTIONS=$(getopt -o c:d:ko:r:v -n "$0" -- "$@") # Check for non-GNU getopt +# shellcheck disable=SC2181 if [ $? != 0 ] ; then echo "W: non-GNU getopt" >&2 ; exit 1 ; fi eval set -- "$OPTIONS" @@ -321,6 +322,7 @@ run_scripts /usr/share/initramfs-tools/hooks run_scripts "${CONFDIR}"/hooks # Avoid double sleep when using older udev scripts +# shellcheck disable=SC2016 sed -i 's/^\s*sleep \$ROOTDELAY$/:/' "${DESTDIR}/scripts/init-top/udev" # cache boot run order @@ -405,6 +407,7 @@ eval "$( } | { LC_ALL=C sort } | { + # shellcheck disable=SC2086 cpio --quiet $cpio_owner_root $cpio_reproducible -o -H newc 4>&-; echo "ec2=$?;" >&4 } | ${compress} >>"${outfile}" echo "ec3=$?;" >&4 diff --git a/scripts/functions b/scripts/functions index ae14eba..57ebd0d 100644 --- a/scripts/functions +++ b/scripts/functions @@ -117,6 +117,7 @@ load_modules() if [ "$com" = "#" ]; then continue fi + # shellcheck disable=SC2086 modprobe $m done < /conf/modules fi @@ -148,6 +149,7 @@ parse_numeric() { ;; esac + # shellcheck disable=SC2034 ROOT="/dev/block/${major}:${minor}" } @@ -185,6 +187,7 @@ _handle_device_vs_ip() # - Otherwise, substitute in any device name we already have local IFS=: set -f + # shellcheck disable=SC2086 set -- ${IP} set +f if [ -n "$6" ]; then @@ -299,6 +302,7 @@ read_fstab_entry() { for file in ${rootmnt?}/etc/fstab; do if [ -f "$file" ]; then + # shellcheck disable=SC2034 while read -r MNT_FSNAME MNT_DIR MNT_TYPE MNT_OPTS MNT_FREQ MNT_PASS MNT_JUNK; do case "$MNT_FSNAME" in ""|\#*) diff --git a/scripts/init-top/all_generic_ide b/scripts/init-top/all_generic_ide index 120901a..0f408d0 100755 --- a/scripts/init-top/all_generic_ide +++ b/scripts/init-top/all_generic_ide @@ -13,6 +13,7 @@ prereqs) ;; esac +# shellcheck disable=SC2013 for x in $(cat /proc/cmdline); do case ${x} in all_generic_ide) diff --git a/scripts/init-top/keymap b/scripts/init-top/keymap index 00578ce..10507fd 100755 --- a/scripts/init-top/keymap +++ b/scripts/init-top/keymap @@ -23,5 +23,6 @@ fi # Load custom keymap if [ -x /bin/loadkeys ] && [ -r /etc/boottime.kmap.gz ]; then + # shellcheck disable=SC2086 loadkeys ${OPTS} /etc/boottime.kmap.gz fi diff --git a/scripts/local b/scripts/local index 06d93de..e3e8426 100644 --- a/scripts/local +++ b/scripts/local @@ -181,8 +181,10 @@ local_mount_root() # FIXME This has no error checking # Mount root if [ "${FSTYPE}" != "unknown" ]; then + # shellcheck disable=SC2086 mount ${roflag} -t "${FSTYPE}" ${ROOTFLAGS} "${ROOT}" "${rootmnt?}" else + # shellcheck disable=SC2086 mount ${roflag} ${ROOTFLAGS} "${ROOT}" "${rootmnt}" fi } diff --git a/scripts/nfs b/scripts/nfs index 275e2e4..1fce7f1 100644 --- a/scripts/nfs +++ b/scripts/nfs @@ -71,6 +71,7 @@ nfs_mount_root_impl() roflag="-o rw" fi + # shellcheck disable=SC2086 nfsmount -o nolock ${roflag} ${NFSOPTS} "${NFSROOT}" "${rootmnt?}" } @@ -121,6 +122,7 @@ nfs_mount_fs_impl() read_fstab_entry "$1" + # shellcheck disable=SC2086 nfsmount ${roflag} ${NFSOPTS} -o "${MNT_OPTS}" "$MNT_FSNAME" "${rootmnt}${MNT_DIR}" } diff --git a/unmkinitramfs b/unmkinitramfs index a49ab7f..9414403 100755 --- a/unmkinitramfs +++ b/unmkinitramfs @@ -119,6 +119,7 @@ splitinitramfs() OPTIONS=$(getopt -o hv --long help,list,verbose -n "$0" -- "$@") # Check for non-GNU getopt +# shellcheck disable=SC2181 if [ $? != 0 ] ; then echo "W: non-GNU getopt" >&2 ; exit 1 ; fi cpio_opts="--preserve-modification-time --no-absolute-filenames --quiet" @@ -156,4 +157,5 @@ if [ $# -ne $expected_args ]; then exit 2 fi +# shellcheck disable=SC2086 splitinitramfs "$1" "${2:-}" $cpio_opts diff --git a/update-initramfs b/update-initramfs index 632c9de..749f685 100755 --- a/update-initramfs +++ b/update-initramfs @@ -146,6 +146,7 @@ generate_initramfs() if [ "${verbose}" = 1 ]; then OPTS="-v ${OPTS}" fi + # shellcheck disable=SC2086 if mkinitramfs ${OPTS} "${initramfs}.new" "${version}"; then mv -f "${initramfs}.new" "${initramfs}" set_sha1 @@ -190,6 +191,7 @@ ro_boot_check() return 0 fi + # shellcheck disable=SC1004 boot_opts=$(awk '/boot/{if ((match($4, /^ro/) || match($4, /,ro/)) \ && $2 == "/boot") print "ro"}' /proc/mounts) if [ -n "${boot_opts}" ]; then @@ -243,6 +245,7 @@ set_highest_version() version= return fi + # shellcheck disable=SC2086 set -- ${version_list} version=${1} } @@ -376,6 +379,7 @@ if [ "${version}" = "all" ] \ fi for u_version in ${version_list}; do verbose "Execute: ${0} -${mode} -k \"${u_version}\" ${OPTS}" + # shellcheck disable=SC2086 "${0}" -${mode} -k "${u_version}" ${OPTS} done exit 0 -- GitLab From 3650731f3332d544ee84946d91141da4626606b8 Mon Sep 17 00:00:00 2001 From: Benjamin Drung Date: Mon, 10 Dec 2018 16:52:47 +0100 Subject: [PATCH 078/213] Replace 'echo -n' by printf In POSIX sh, echo flags are undefined. Busybox and dash support 'echo -n', but better be on the safe side by using printf instead. Signed-off-by: Benjamin Drung --- docs/framebuffer | 10 +++++----- scripts/functions | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/framebuffer b/docs/framebuffer index 508fc51..81ba77f 100644 --- a/docs/framebuffer +++ b/docs/framebuffer @@ -44,19 +44,19 @@ parse_video_opts() for opt in ${OPTS}; do # Already in the "=" form if [ "${opt}" != "${opt#*=}" ]; then - echo -n "$opt " + printf "%s" "$opt " # In the ":" form elif [ "${opt}" != "${opt#*:}" ]; then - echo -n "${opt%:*}=${opt#*:} " + printf "%s" "${opt%:*}=${opt#*:} " # Presumably a modevalue without the "mode=" prefix elif [ "${opt}" != "${opt#[0-9]*x[0-9]}" ]; then # Adjust: mode= option? - echo -n "mode=$opt " + printf "%s" "mode=$opt " # ... or mode_option= option? - # echo -n "mode_option=$opt " + # printf "%s" "mode_option=$opt " # Presumably a boolean else - echo -n "${opt}=1 " + printf "%s" "${opt}=1 " fi done } diff --git a/scripts/functions b/scripts/functions index 57ebd0d..8a08827 100644 --- a/scripts/functions +++ b/scripts/functions @@ -3,7 +3,7 @@ _log_msg() { if [ "${quiet?}" = "y" ]; then return; fi - echo -n "$*" + printf "%s" "$*" } log_success_msg() -- GitLab From 9c0feb22125b6a1dc9f260635d7551feaf8a4389 Mon Sep 17 00:00:00 2001 From: Benjamin Drung Date: Mon, 10 Dec 2018 16:52:52 +0100 Subject: [PATCH 079/213] Run shellcheck on package build time To keep the code in a clean state, run shellcheck on package build time. Signed-off-by: Benjamin Drung --- debian/control | 2 +- debian/rules | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/debian/control b/debian/control index 5598ac8..57554c4 100644 --- a/debian/control +++ b/debian/control @@ -3,7 +3,7 @@ Section: utils Priority: optional Uploaders: Michael Prokop , Ben Hutchings Maintainer: Debian kernel team -Build-Depends: debhelper (>= 9), bash-completion +Build-Depends: debhelper (>= 9), bash-completion, shellcheck Rules-Requires-Root: no Standards-Version: 4.1.5 Vcs-Browser: https://salsa.debian.org/kernel-team/initramfs-tools diff --git a/debian/rules b/debian/rules index d590956..2f03906 100755 --- a/debian/rules +++ b/debian/rules @@ -19,3 +19,8 @@ override_dh_install: mkinitramfs > debian/initramfs-tools-core/usr/sbin/mkinitramfs chmod 755 debian/initramfs-tools-core/usr/sbin/mkinitramfs dh_install + +override_dh_auto_test: +ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) + shellcheck -e SC1090,SC1091 -s dash hook-functions $$(find * -type f \( -executable ! -name rules -o -regex '.*\.\(post\|pre\).*' -o -regex "^\(docs\|scripts\)/.*" ! -name '*.md' \)) +endif -- GitLab From c9cb0a0bd7aafcdbb2daf3840ede2fca78761a40 Mon Sep 17 00:00:00 2001 From: Benjamin Drung Date: Mon, 17 Dec 2018 13:41:55 +0100 Subject: [PATCH 080/213] Add autopkgtest for shellcheck --- debian/tests/control | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 debian/tests/control diff --git a/debian/tests/control b/debian/tests/control new file mode 100644 index 0000000..4c4f3f8 --- /dev/null +++ b/debian/tests/control @@ -0,0 +1,3 @@ +# TODO: Check $(find /usr/share/initramfs-tools/hooks /usr/share/initramfs-tools/scripts -type f) once klibc, kmod, and systemd are fixed! +Test-Command: shellcheck -e SC1090,SC1091 -s dash /usr/bin/lsinitramfs /usr/sbin/mkinitramfs /usr/bin/unmkinitramfs /usr/share/initramfs-tools/hook-functions /usr/share/initramfs-tools/init /etc/kernel/postinst.d/initramfs-tools /etc/kernel/postrm.d/initramfs-tools /usr/sbin/update-initramfs +Depends: @, shellcheck -- GitLab From bafb9d4b6c999b92f955fabdf9af7b189e301c99 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Tue, 1 Jan 2019 23:32:32 +0000 Subject: [PATCH 081/213] init: Always export the resume and noresume variables, as documented When testing the pending changes to fix unsafe shell usage, I found that the "resume" variable is unset if resume is disabled. This results in an error in the resume script if it's changed to require that "resume" is set. Conversely, "noresume" variable is not set if resume is enabled. Set it to an empty string in that case. Also, unset it before exec'ing the real init system. Signed-off-by: Ben Hutchings --- init | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/init b/init index 5d10622..7c3f6aa 100755 --- a/init +++ b/init @@ -62,6 +62,7 @@ export panic= export blacklist= export resume= export resume_offset= +export noresume= export drop_caps= export fastboot=n export forcefsck=n @@ -198,8 +199,7 @@ if [ -z "${BOOT}" ]; then fi if [ -n "${noresume}" ] || [ "$RESUME" = none ]; then - export noresume=y - unset resume + noresume=y else resume=${RESUME:-} fi @@ -311,6 +311,7 @@ unset quiet unset readonly unset resume unset resume_offset +unset noresume unset fastboot unset forcefsck unset fsckfix -- GitLab From f21fdae151b08db80b24e0813316f047b6d7debe Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Tue, 1 Jan 2019 23:02:42 +0000 Subject: [PATCH 082/213] debian/rules: Use a more conservative "find" for shellcheck arguments Make sure we don't include the copies of scripts under debian/initramfs-tools{,-core}, or any non-shell executables. Signed-off-by: Ben Hutchings --- debian/rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/rules b/debian/rules index 2f03906..97a16df 100755 --- a/debian/rules +++ b/debian/rules @@ -22,5 +22,5 @@ override_dh_install: override_dh_auto_test: ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) - shellcheck -e SC1090,SC1091 -s dash hook-functions $$(find * -type f \( -executable ! -name rules -o -regex '.*\.\(post\|pre\).*' -o -regex "^\(docs\|scripts\)/.*" ! -name '*.md' \)) + shellcheck -e SC1090,SC1091 -s dash hook-functions $$(find hooks scripts -type f) $$({ find . -maxdepth 1 -type f -executable; find debian -maxdepth 1 -type f; find docs kernel -type f; } | xargs grep -l '^#!/bin/sh') endif -- GitLab From 9c6356429d56c83ec5057f975290291778a08760 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Mon, 4 Feb 2019 01:07:55 +0100 Subject: [PATCH 083/213] Change get_fstype to be silent on failure Currently get_fstype prints "unknown" on failure, and some callers then have to check for this special string. Change it to return the empty string on failure. Most callers check whether it succeeded or not, so this doesn't make any difference to them. local_mount_root and hooks/fsck do check for "unknown", so update them accordingly. Signed-off-by: Ben Hutchings --- hooks/fsck | 2 +- scripts/functions | 12 +++--------- scripts/local | 2 +- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/hooks/fsck b/hooks/fsck index 6301b9b..c587e8f 100755 --- a/hooks/fsck +++ b/hooks/fsck @@ -53,7 +53,7 @@ get_fsck_type_fstab () { if [ "${MNT_DIR}" = "/" ] || [ "${MNT_TYPE}" = "auto" ]; then MNT_FSNAME="$(resolve_device "${MNT_FSNAME}")" fstype() { "/usr/lib/klibc/bin/fstype" "$@"; } - get_fstype "${MNT_FSNAME}" + get_fstype "${MNT_FSNAME}" || echo unknown unset -f fstype else echo "${MNT_TYPE}" diff --git a/scripts/functions b/scripts/functions index 8a08827..612f288 100644 --- a/scripts/functions +++ b/scripts/functions @@ -158,7 +158,7 @@ parse_numeric() { # Return value: indicates if an fs could be recognized get_fstype () { - local FS FSTYPE RET + local FS FSTYPE FS="${1}" # blkid has a more complete list of file systems, @@ -166,16 +166,10 @@ get_fstype () FSTYPE="unknown" eval "$(fstype "${FS}" 2> /dev/null)" if [ "$FSTYPE" = "unknown" ]; then - FSTYPE=$(blkid -o value -s TYPE "${FS}") + FSTYPE=$(blkid -o value -s TYPE "${FS}") || return fi - RET=$? - - if [ -z "${FSTYPE}" ]; then - FSTYPE="unknown" - fi - echo "${FSTYPE}" - return ${RET} + return 0 } _handle_device_vs_ip() diff --git a/scripts/local b/scripts/local index e3e8426..ad6d3c7 100644 --- a/scripts/local +++ b/scripts/local @@ -180,7 +180,7 @@ local_mount_root() # FIXME This has no error checking # Mount root - if [ "${FSTYPE}" != "unknown" ]; then + if [ -n "${FSTYPE}" ]; then # shellcheck disable=SC2086 mount ${roflag} -t "${FSTYPE}" ${ROOTFLAGS} "${ROOT}" "${rootmnt?}" else -- GitLab From 58df6d327c64d4342cc277dd0a82d60fcba4e771 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Mon, 4 Feb 2019 01:13:27 +0100 Subject: [PATCH 084/213] scripts/functions: Abort _checkfs_once early if fs type is unknown Passing -t '' to fsck is not going to work, so print a meaningful warning instead. Signed-off-by: Ben Hutchings --- scripts/functions | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/functions b/scripts/functions index 612f288..cb21468 100644 --- a/scripts/functions +++ b/scripts/functions @@ -351,6 +351,10 @@ _checkfs_once() fi FSCKCODE=0 + if [ -z "${TYPE}" ]; then + log_warning_msg "Type of $NAME file system is unknown, so skipping check." + return + fi if ! command -v fsck >/dev/null 2>&1; then log_warning_msg "fsck not present, so skipping $NAME file system" return -- GitLab From f8ceeb90abeeb5e84eff950b39d397b4570be2db Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Sun, 3 Feb 2019 22:36:54 +0100 Subject: [PATCH 085/213] scripts/local: Explicitly check for missing root parameter and mount failure Panic if the root parameter is missing or empty, or if the mount commands fail. This is loosely based on a patch by G.raud. Thanks: "G.raud" Closes: #848906 Signed-off-by: Ben Hutchings --- scripts/local | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/scripts/local b/scripts/local index ad6d3c7..a353344 100644 --- a/scripts/local +++ b/scripts/local @@ -155,6 +155,9 @@ local_device_setup() local_mount_root() { local_top + if [ -z "${ROOT}" ]; then + panic "No root device specified. Boot arguments must include a root= parameter." + fi local_device_setup "${ROOT}" "root file system" ROOT="${DEV}" @@ -178,14 +181,10 @@ local_mount_root() checkfs "${ROOT}" root "${FSTYPE}" - # FIXME This has no error checking # Mount root - if [ -n "${FSTYPE}" ]; then - # shellcheck disable=SC2086 - mount ${roflag} -t "${FSTYPE}" ${ROOTFLAGS} "${ROOT}" "${rootmnt?}" - else - # shellcheck disable=SC2086 - mount ${roflag} ${ROOTFLAGS} "${ROOT}" "${rootmnt}" + # shellcheck disable=SC2086 + if ! mount ${roflag} ${FSTYPE:+-t "${FSTYPE}"} ${ROOTFLAGS} "${ROOT}" "${rootmnt?}"; then + panic "Failed to mount ${ROOT} as root file system." fi } @@ -211,9 +210,10 @@ local_mount_fs() checkfs "$MNT_FSNAME" "$MNT_DIR" "${MNT_TYPE}" fi - # FIXME This has no error checking # Mount filesystem - mount ${roflag} -t "${MNT_TYPE}" -o "${MNT_OPTS}" "$MNT_FSNAME" "${rootmnt}${MNT_DIR}" + if ! mount ${roflag} -t "${MNT_TYPE}" -o "${MNT_OPTS}" "$MNT_FSNAME" "${rootmnt}${MNT_DIR}"; then + panic "Failed to mount ${MNT_FSNAME} as $MNT_DIR file system." + fi } mountroot() -- GitLab From a5ae8a1c9e501f7524036ff5ba2680ae0fcb4c5f Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Sun, 3 Feb 2019 22:40:45 +0100 Subject: [PATCH 086/213] scripts/{local,nfs}: Remove redundant modprobe of filesystem modules The kernel will automatically request filesystem modules as needed. Also, the kernel now requests filesystem modules through an alias of the form "fs-" while we were still using the bare type name. Signed-off-by: Ben Hutchings --- scripts/local | 6 ------ scripts/nfs | 2 -- 2 files changed, 8 deletions(-) diff --git a/scripts/local b/scripts/local index a353344..bf6e17e 100644 --- a/scripts/local +++ b/scripts/local @@ -176,9 +176,6 @@ local_mount_root() roflag=-w fi - # FIXME This has no error checking - modprobe "${FSTYPE}" - checkfs "${ROOT}" root "${FSTYPE}" # Mount root @@ -203,9 +200,6 @@ local_mount_fs() roflag=-w fi - # FIXME This has no error checking - modprobe "${MNT_TYPE}" - if [ "$MNT_PASS" != 0 ]; then checkfs "$MNT_FSNAME" "$MNT_DIR" "${MNT_TYPE}" fi diff --git a/scripts/nfs b/scripts/nfs index 1fce7f1..4242f31 100644 --- a/scripts/nfs +++ b/scripts/nfs @@ -80,7 +80,6 @@ nfs_mount_root() { nfs_top - modprobe nfs # For DHCP modprobe af_packet @@ -130,7 +129,6 @@ nfs_mount_fs() { nfs_top - modprobe nfs # For DHCP modprobe af_packet -- GitLab From a002df9909d924a8b41a3139492d9d3e88e08232 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Sun, 3 Feb 2019 22:53:28 +0100 Subject: [PATCH 087/213] hook-functions: Remove an obsolete FIXME This was introduced in commit 5de4f2d88e47, for which the commit message says "add FIXME's to point missing /lib64 symlink parts". I think this is obsolete as copy_file does now replicate symlinks where needed. Gbp-Dch: Ignore Signed-off-by: Ben Hutchings --- hook-functions | 1 - 1 file changed, 1 deletion(-) diff --git a/hook-functions b/hook-functions index d6d66f4..48bab9b 100644 --- a/hook-functions +++ b/hook-functions @@ -131,7 +131,6 @@ copy_file() { # check if already copied [ -e "${DESTDIR}/${target}" ] && return 1 - #FIXME: inst_dir mkdir -p "${DESTDIR}/${target%/*}" if [ -h "${src}" ]; then -- GitLab From 4807ede18d8839ef321502a17919f72f4ce61ed0 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Mon, 4 Feb 2019 02:52:28 +0100 Subject: [PATCH 088/213] hook-functions: Avoid symlinks that conflict with usr-merge in copy_file The host filesystem may not be usr-merged and may contain symlinks between corresponding names under e.g. /bin and /usr/bin. However the initramfs is always usr-merged. Before checking whether the target of the copy matches the symlink target, apply the usr-merge transformation to both filenames. Signed-off-by: Ben Hutchings --- hook-functions | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/hook-functions b/hook-functions index 48bab9b..af9d9c1 100644 --- a/hook-functions +++ b/hook-functions @@ -124,6 +124,11 @@ copy_file() { [ -f "${src}" ] || return 2 + # Canonicalise usr-merged target directories + case "${target}" in + /bin/* | /lib* | /sbin/*) target="/usr${target}" ;; + esac + if [ -d "${DESTDIR}/${target}" ]; then target="${target}/${src##*/}" fi @@ -138,6 +143,14 @@ copy_file() { # just link directly to the ultimate target link_target="$(readlink -f "${src}")" || return $(($? + 1)) + # Update source for the copy + src="${link_target}" + + # Canonicalise usr-merged target directories + case "${link_target}" in + /bin/* | /lib* | /sbin/*) link_target="/usr${link_target}" ;; + esac + if [ "${link_target}" != "${target}" ]; then [ "${verbose?}" = "y" ] && echo "Adding ${type}-link ${src}" @@ -147,7 +160,6 @@ copy_file() { fi # Copy the link target if it doesn't already exist - src="${link_target}" target="${link_target}" [ -e "${DESTDIR}/${target}" ] && return 0 mkdir -p "${DESTDIR}/${target%/*}" -- GitLab From 79f49b96ba98bc23e5d3280b39b7979e9495d8c3 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Sun, 3 Feb 2019 23:40:11 +0100 Subject: [PATCH 089/213] {hooks,scripts}/keymap: Use setupcon --setup-dir setupcon gained a --setup-dir option to support initramfs builders, documented since console-setup 1.111. Use this to simplify our own scripts. Related-to: #620041 Signed-off-by: Ben Hutchings --- hooks/keymap | 42 ++++++++--------------------------------- scripts/init-top/keymap | 14 ++------------ 2 files changed, 10 insertions(+), 46 deletions(-) diff --git a/hooks/keymap b/hooks/keymap index 75703ba..64f8e6d 100755 --- a/hooks/keymap +++ b/hooks/keymap @@ -20,47 +20,21 @@ if [ "$KEYMAP" != "y" ] && [ "$KEYMAP" != "Y" ]; then exit 0 fi -# Step 1 - Basic tools -if [ ! -x /bin/loadkeys ]; then - echo "loadkeys is missing. Please install the 'kbd' package." - exit 0 -fi - if [ ! -x /bin/setupcon ]; then echo "setupcon is missing. Please install the 'console-setup' package." exit 0 fi . /usr/share/initramfs-tools/hook-functions -copy_exec /bin/loadkeys /bin -if ! setupcon --save-keyboard "${DESTDIR}/etc/boottime.kmap.gz"; then - echo "Warning: error while trying to store keymap file - ignoring request to install /etc/boottime.kmap.gz" - rm -f "${DESTDIR}/etc/boottime.kmap.gz" - exit 0 -fi +# Tell setupcon to copy/create the files it needs. +setupcon --setup-dir "$DESTDIR" -# Step 2 - Check for UTF8 console -if [ ! -x /usr/bin/kbd_mode ]; then - exit 0 -fi +# Copy additional files that setupcon needs. We assume they are +# executables. +while read -r file; do + copy_exec "$file" +done < "$DESTDIR/morefiles" +rm -f "$DESTDIR/morefiles" -if [ -r /etc/environment ]; then - env="/etc/environment" -elif [ -r /etc/default/locale ]; then - env="/etc/default/locale" -else - exit 0 -fi - -for var in LANG LC_ALL LC_CTYPE; do - value=$(grep -E "^[^#]*${var}=" $env | tail -n1 | cut -d= -f2) - eval $var="$value" -done - -charmap=$(LANG=$LANG LC_ALL=$LC_ALL LC_CTYPE=$LC_CTYPE locale charmap) -if [ "$charmap" = "UTF-8" ]; then - copy_exec /usr/bin/kbd_mode /bin -fi exit 0 - diff --git a/scripts/init-top/keymap b/scripts/init-top/keymap index 10507fd..1c6b2dc 100755 --- a/scripts/init-top/keymap +++ b/scripts/init-top/keymap @@ -13,16 +13,6 @@ prereqs) ;; esac -OPTS="-q" - -# Should terminal be in UTF8 mode? -if [ -x /bin/kbd_mode ]; then - /bin/kbd_mode -u - OPTS="${OPTS} -u" -fi - -# Load custom keymap -if [ -x /bin/loadkeys ] && [ -r /etc/boottime.kmap.gz ]; then - # shellcheck disable=SC2086 - loadkeys ${OPTS} /etc/boottime.kmap.gz +if [ -x /bin/setupcon ]; then + /bin/setupcon fi -- GitLab From 839be1bf119531f4bc4c7825a48f2d460e1da0a6 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Mon, 4 Feb 2019 01:20:10 +0100 Subject: [PATCH 090/213] scripts/local: Handle rootfstype=auto the same as if type is unspecified Closes: #908967 Signed-off-by: Ben Hutchings --- scripts/local | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/local b/scripts/local index bf6e17e..a103e68 100644 --- a/scripts/local +++ b/scripts/local @@ -162,7 +162,7 @@ local_mount_root() ROOT="${DEV}" # Get the root filesystem type if not set - if [ -z "${ROOTFSTYPE}" ]; then + if [ -z "${ROOTFSTYPE}" ] || [ "${ROOTFSTYPE}" = auto ]; then FSTYPE=$(get_fstype "${ROOT}") else FSTYPE=${ROOTFSTYPE} -- GitLab From f086b72cabfb629c5c0e2c6f790c8ddd055141ba Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Mon, 4 Feb 2019 02:07:35 +0100 Subject: [PATCH 091/213] mkinitramfs: Use default compression level for lzop As reported in #916935, lzop -9 is slower than gzip (although decompression is still much faster). There is currently no compression level between the default and -9, so use the default. Closes: #916935 Signed-off-by: Ben Hutchings --- mkinitramfs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkinitramfs b/mkinitramfs index c372c20..1541acd 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -146,7 +146,7 @@ fi case "${compress}" in gzip) [ -n "${SOURCE_DATE_EPOCH}" ] && compress="gzip -n" ;; lz4) compress="lz4 -9 -l" ;; -lzop) compress="lzop -9" ;; +lzop) ;; xz) compress="xz --check=crc32" ;; *) echo "W: Unknown compression command ${compress}" >&2 ;; esac -- GitLab From d343f5e583dfbb325ebde37639a15574cc1b60dc Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Mon, 4 Feb 2019 23:18:57 +0100 Subject: [PATCH 092/213] README: Summarise what initramfs-tools does and point to manual pages README hasn't been updated since the initial checkin in 2005, and the old contents are obsolete: the original goals have either been achieved or abandoned (we're not going to build udev against klibc), and initrds are largely forgotten. Replace these with a quick summary of what an initramfs is needed for, how initramfs-tools does it, and a pointer to the manual pages. Suggested-by: Robie Basak Signed-off-by: Ben Hutchings --- debian/README | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/debian/README b/debian/README index dc85c9b..7fa0c61 100644 --- a/debian/README +++ b/debian/README @@ -1,12 +1,37 @@ initramfs-tools =============== -This package is a work in progress towards the replacement of the initrd -system with an initramfs system. +The Linux kernel may boot using an "initramfs", an archive of files +that it unpacks into an in-memory file system at the beginning of the +boot process. This archive must contain its own init program which +the kernel will run as the first user process. In a Debian system, +the initramfs is responsible for: -The goals include using klibc for all earlyspace tools, an integrated udev -and an integrated hotplug. +* Loading essential driver modules +* Setting up a network connection, if required +* Setting up layered storage devices, if required +* Resuming from hibernation (suspend-to-disk), if possible +* Checking and mounting the root and /usr file systems +* Handing over to the main init system -See the TODO file for a current status. +initramfs-tools is designed to be extensible, and many other packages +provide these and additional features in the initramfs. -Jeff Bailey - 2005-04-24 +On x86 systems, the initramfs can also contain CPU microcode updates +that the kernel will apply at a very early stage. These are provided +by the (non-free) intel-microcode and amd64-microcode packages. + +Debian's official kernel packages require the use of an initramfs, +since drivers and filesystem code are built as modules that need to be +loaded before the file systems can be mounted. Custom kernel packages +that have this code built-in may still need an initramfs to set up +layered storage devices or to provide microcode updates. + +If initramfs-tools is installed, it will generate an initramfs +automatically whenever a kernel is installed or upgraded (and remove +it when the kernel is removed). If only initramfs-tools-core is +installed, you can run mkinitramfs to generate an initramfs. + +The initramfs-tools(7) manual page documents the supported parameters +and how to extend initramfs-tools. There are additional manual pages +for the various commands and configuration files. -- GitLab From c5dd80acca22e3ae2ab1544529164894e52e3358 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Mon, 4 Feb 2019 23:52:07 +0100 Subject: [PATCH 093/213] initramfs-tools(7): Document how to update the initramfs from another package We didn't document our trigger and really should do so. Closes: #893897 Signed-off-by: Ben Hutchings --- initramfs-tools.7 | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/initramfs-tools.7 b/initramfs-tools.7 index 271c7aa..45b7de7 100644 --- a/initramfs-tools.7 +++ b/initramfs-tools.7 @@ -601,6 +601,28 @@ is the path where root gets mounted usually /root. indicates that a debug log is captured for further investigation. +.SH UPDATING THE INITRAMFS FROM ANOTHER PACKAGE +Package maintainer scripts should not run \fBupdate-initramfs\fR +directly. A package that installs hooks for initramfs-tools should +include a triggers file containing: +.RS +.nf +activate\-noawait update\-initramfs +.fi +.RE + +Kernel packages must call the kernel hooks as documented in the +Debian Kernel Handbook. + +A package that requires an initramfs to function, but is not a kernel +package, should include a triggers file containing: +.RS +.nf +activate\-await update\-initramfs +.fi +.RE + + .SH KERNEL HOOKS initramfs-tools includes hook scripts that are called by kernel packages on installation and removal, so that an initramfs is -- GitLab From 2e5e389adac846f3c791b7046909471f9a9ad28b Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Tue, 5 Feb 2019 01:34:03 +0000 Subject: [PATCH 094/213] scripts/functions: Revert change to _log_msg and make callers format-safe _log_msg used to pass its arguments straight through to printf (but only if "quiet" is not used), but this was changed by commits f277309e0b6b and 3650731f3332. We still need it do that, so that when callers pass "\\n" it is replaced by a newline. Change the callers to separate the format and argument strings, fixing the format-safety problem that the earlier commits were intended to address. Signed-off-by: Ben Hutchings --- scripts/functions | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/scripts/functions b/scripts/functions index cb21468..077697f 100644 --- a/scripts/functions +++ b/scripts/functions @@ -3,27 +3,28 @@ _log_msg() { if [ "${quiet?}" = "y" ]; then return; fi - printf "%s" "$*" + # shellcheck disable=SC2059 + printf "$@" } log_success_msg() { - _log_msg "Success: $*\\n" + _log_msg "Success: %s\\n" "$*" } log_failure_msg() { - _log_msg "Failure: $*\\n" + _log_msg "Failure: %s\\n" "$*" } log_warning_msg() { - _log_msg "Warning: $*\\n" + _log_msg "Warning: %s\\n" "$*" } log_begin_msg() { - _log_msg "Begin: $* ... " + _log_msg "Begin: %s ... " "$*" } log_end_msg() -- GitLab From 49139ca2c372b28c37773154c2fbbf2b3811ad46 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Tue, 5 Feb 2019 00:04:25 +0100 Subject: [PATCH 095/213] scripts/local-premount/resume: Report when we are resuming Resuming can be quite slow on a hard drive, and if plymouth is used then the output of /bin/resume won't be seen. Show a message in plymouth, then hide it if /bin/resume returns. Roughly based on a patch by Mario Limonciello. Thanks: Mario Limonciello Signed-off-by: Ben Hutchings --- scripts/local-premount/resume | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/scripts/local-premount/resume b/scripts/local-premount/resume index 88abd86..bf23baf 100755 --- a/scripts/local-premount/resume +++ b/scripts/local-premount/resume @@ -26,9 +26,26 @@ if ! local_device_setup "${resume}" "suspend/resume device" false; then exit 0 fi +use_plymouth=false +if command -v plymouth >/dev/null && plymouth --ping; then + use_plymouth=true + plymouth display-message --text="Resuming from hibernation" + + # The above command does not wait for a framebuffer update to + # complete, so the kernel can freeze the framebuffer before + # the message is even visible. Wait just a moment to make + # that less likely. + sleep 0.1 +fi + # hardcode path, uswsusp ships an resume binary too if [ -n "${resume_offset?}" ]; then /bin/resume "${DEV}" "${resume_offset}" else /bin/resume "${DEV}" fi + +if "$use_plymouth"; then + # plymouth hide-message does not work yet + plymouth display-message --text="" +fi -- GitLab From 28b9d1ddf94282e987da27601723a926ae4acf4c Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Tue, 5 Feb 2019 00:56:39 +0100 Subject: [PATCH 096/213] scripts/nfs: Use "sleep" instead of /bin/sleep Thee is no reason to avoid using a shell built-in implementation of sleep here, not even the reason we had elsewhere of needing support for fractional seconds. Closes: #677049 Signed-off-by: Ben Hutchings --- scripts/nfs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/nfs b/scripts/nfs index 4242f31..40c92c7 100644 --- a/scripts/nfs +++ b/scripts/nfs @@ -95,7 +95,7 @@ nfs_mount_root() while [ ${nfs_retry_count} -lt "${delay}" ] \ && [ $ret -ne 0 ] ; do [ "$quiet" != "y" ] && log_begin_msg "Retrying nfs mount" - /bin/sleep 1 + sleep 1 nfs_mount_root_impl ret=$? nfs_retry_count=$(( nfs_retry_count + 1 )) -- GitLab From db394d3ee5b553622113233465855d33690b3fb9 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Tue, 5 Feb 2019 01:09:20 +0100 Subject: [PATCH 097/213] Print warnings and errors in initramfs generation consistently All warning (non-fatal condition) and error (fatal condition) messages should be printed to stderr, and should start with a prefix of "W:" or "E:" respectively. Also remove the word "ignoring" from some warning messages. It follows from the fact that they are warnings that the problem is being ignored. Signed-off-by: Ben Hutchings --- hook-functions | 2 +- hooks/fsck | 4 ++-- mkinitramfs | 20 ++++++++++---------- update-initramfs | 6 +++--- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/hook-functions b/hook-functions index af9d9c1..28f9384 100644 --- a/hook-functions +++ b/hook-functions @@ -789,7 +789,7 @@ call_scripts() "${initdir}/${cs_x}" && ec=$? || ec=$? # allow hooks to abort build: if [ "$ec" -ne 0 ]; then - echo "E: ${initdir}/${cs_x} failed with return $ec." + echo "E: ${initdir}/${cs_x} failed with return $ec." >&2 # only errexit on mkinitramfs [ -n "${version}" ] && exit $ec fi diff --git a/hooks/fsck b/hooks/fsck index c587e8f..f64b6e0 100755 --- a/hooks/fsck +++ b/hooks/fsck @@ -91,13 +91,13 @@ copy_exec /sbin/logsave for type in $fsck_types; do if [ "$type" = "unknown" ] ; then - echo "Warning: couldn't identify filesystem type for fsck hook, ignoring." + echo "W: couldn't identify filesystem type for fsck hook" >&2 continue fi if prog="$(command -v "fsck.${type}")"; then copy_exec "$prog" else - echo "Warning: /sbin/fsck.${type} doesn't exist, can't install to initramfs, ignoring." + echo "W: /sbin/fsck.${type} doesn't exist, can't install to initramfs" >&2 fi done diff --git a/mkinitramfs b/mkinitramfs index 1541acd..7df3f7a 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -74,7 +74,7 @@ done # these conf dirs are for boot scripts and land on initramfs for i in ${EXTRA_CONF}; do if [ -d "${CONFDIR}/conf.d/${i}" ]; then - echo "Warning: ${CONFDIR}/conf.d/${i} is a directory instead of file, ignoring." + echo "W: ${CONFDIR}/conf.d/${i} is a directory instead of file" >&2 elif [ -e "${CONFDIR}/conf.d/${i}" ]; then . "${CONFDIR}/conf.d/${i}" elif [ -e "/usr/share/initramfs-tools/conf.d/${i}" ]; then @@ -85,7 +85,7 @@ done # source package confs for i in /usr/share/initramfs-tools/conf-hooks.d/*; do if [ -d "${i}" ]; then - echo "Warning: ${i} is a directory instead of file, ignoring." + echo "W: ${i} is a directory instead of file." >&2 elif [ -e "${i}" ]; then . "${i}" fi @@ -159,8 +159,8 @@ fi MODULESDIR="/lib/modules/${version}" if [ ! -e "${MODULESDIR}" ]; then - echo "WARNING: missing ${MODULESDIR}" - echo "Ensure all necessary drivers are built into the linux image!" + echo "W: missing ${MODULESDIR}" >&2 + echo "W: Ensure all necessary drivers are built into the linux image!" >&2 fi if [ ! -e "${MODULESDIR}/modules.dep" ]; then depmod "${version}" @@ -250,8 +250,8 @@ list) # nothing to add ;; *) - echo "W: mkinitramfs: unsupported MODULES setting: ${MODULES}." - echo "W: mkinitramfs: Falling back to MODULES=most." + echo "W: mkinitramfs: unsupported MODULES setting: ${MODULES}." >&2 + echo "W: mkinitramfs: Falling back to MODULES=most." >&2 auto_add_modules ;; esac @@ -295,7 +295,7 @@ if [ -n "${ROOT:-}" ]; then fi if ! command -v ldd >/dev/null 2>&1 ; then - echo "WARNING: no ldd around - install libc-bin" >&2 + echo "E: no ldd around - install libc-bin" >&2 exit 1 fi @@ -413,15 +413,15 @@ eval "$( echo "ec3=$?;" >&4 )" if [ "$ec1" -ne 0 ]; then - echo "E: mkinitramfs failure find $ec1 cpio $ec2 $compress $ec3" + echo "E: mkinitramfs failure find $ec1 cpio $ec2 $compress $ec3" >&2 exit "$ec1" fi if [ "$ec2" -ne 0 ]; then - echo "E: mkinitramfs failure cpio $ec2 $compress $ec3" + echo "E: mkinitramfs failure cpio $ec2 $compress $ec3" >&2 exit "$ec2" fi if [ "$ec3" -ne 0 ]; then - echo "E: mkinitramfs failure $compress $ec3" + echo "E: mkinitramfs failure $compress $ec3" >&2 exit "$ec3" fi ) || exit 1 diff --git a/update-initramfs b/update-initramfs index 749f685..e3e89ff 100755 --- a/update-initramfs +++ b/update-initramfs @@ -195,8 +195,8 @@ ro_boot_check() boot_opts=$(awk '/boot/{if ((match($4, /^ro/) || match($4, /,ro/)) \ && $2 == "/boot") print "ro"}' /proc/mounts) if [ -n "${boot_opts}" ]; then - echo "WARNING: /boot is ro mounted." - echo "update-initramfs: Not updating ${initramfs}" + echo "W: /boot is ro mounted." >&2 + echo "W: update-initramfs: Not updating ${initramfs}" >&2 exit 0 fi } @@ -343,7 +343,7 @@ while getopts "k:cudvtb:h?" flag; do b) BOOTDIR="${OPTARG}" if [ ! -d "${BOOTDIR}" ]; then - echo "Error: ${BOOTDIR} is not a directory." >&2 + echo "E: ${BOOTDIR} is not a directory." >&2 exit 1 fi ;; -- GitLab From d9cf2f2dbd116d01b386a21b085309f22cc0bc42 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Tue, 5 Feb 2019 01:13:28 +0100 Subject: [PATCH 098/213] hooks/fsck: If get_fstype fails, report which file system it failed for Closes: #766446 Signed-off-by: Ben Hutchings --- hooks/fsck | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/hooks/fsck b/hooks/fsck index f64b6e0..5d2e94a 100755 --- a/hooks/fsck +++ b/hooks/fsck @@ -53,7 +53,9 @@ get_fsck_type_fstab () { if [ "${MNT_DIR}" = "/" ] || [ "${MNT_TYPE}" = "auto" ]; then MNT_FSNAME="$(resolve_device "${MNT_FSNAME}")" fstype() { "/usr/lib/klibc/bin/fstype" "$@"; } - get_fstype "${MNT_FSNAME}" || echo unknown + if ! get_fstype "${MNT_FSNAME}"; then + echo "W: Couldn't identify type of $2 file system for fsck hook" >&2 + fi unset -f fstype else echo "${MNT_TYPE}" @@ -62,8 +64,8 @@ get_fsck_type_fstab () { } get_fsck_types() { - get_fsck_type_fstab / - get_fsck_type_fstab /usr + get_fsck_type_fstab / root + get_fsck_type_fstab /usr /usr } case $1 in @@ -90,11 +92,6 @@ copy_exec /sbin/fsck copy_exec /sbin/logsave for type in $fsck_types; do - if [ "$type" = "unknown" ] ; then - echo "W: couldn't identify filesystem type for fsck hook" >&2 - continue - fi - if prog="$(command -v "fsck.${type}")"; then copy_exec "$prog" else -- GitLab From 5002aa9e09bf6ff02451764a902e627a33dcf890 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Tue, 13 Feb 2018 00:23:35 +0000 Subject: [PATCH 099/213] mkinitramfs: Delete comment about an impossible deprecation Debian installer creates files under /etc/initramfs-tools/conf.d which definitely need to be used by mkinitramfs. This deprecation is not going to happen. Gbp-Dch: ignore Signed-off-by: Ben Hutchings --- mkinitramfs | 2 -- 1 file changed, 2 deletions(-) diff --git a/mkinitramfs b/mkinitramfs index 7df3f7a..28a77d0 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -70,8 +70,6 @@ for i in /usr/share/initramfs-tools/conf.d/* "${CONFDIR}"/conf.d/*; do [ -e "$i" ] && EXTRA_CONF="${EXTRA_CONF} $(basename "$i" \ | grep '^[[:alnum:]][[:alnum:]\._-]*$' | grep -v '\.dpkg-.*$')"; done -# FIXME: deprecated those settings on mkinitramfs run -# these conf dirs are for boot scripts and land on initramfs for i in ${EXTRA_CONF}; do if [ -d "${CONFDIR}/conf.d/${i}" ]; then echo "W: ${CONFDIR}/conf.d/${i} is a directory instead of file" >&2 -- GitLab From 1ae0994ff9a16ea2e8c4c61ba2f526820ffe608d Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Tue, 13 Feb 2018 00:52:36 +0000 Subject: [PATCH 100/213] mkinitramfs: Change EXTRA_CONF to include directory names Collecting just basenames in EXTRA_CONF is a bit strange and makes it complicated to use later on. A (probably unintended) result of collecting only basenames is that configuration files in /etc/initramfs-tools/conf.d mask those in /usr/share/initramfs-tools/conf.d. Some users might rely on this, so preserve that behaviour. Signed-off-by: Ben Hutchings --- mkinitramfs | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/mkinitramfs b/mkinitramfs index 28a77d0..c834eca 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -65,18 +65,31 @@ done . /usr/share/initramfs-tools/hook-functions . "${CONFDIR}/initramfs.conf" + EXTRA_CONF='' -for i in /usr/share/initramfs-tools/conf.d/* "${CONFDIR}"/conf.d/*; do - [ -e "$i" ] && EXTRA_CONF="${EXTRA_CONF} $(basename "$i" \ - | grep '^[[:alnum:]][[:alnum:]\._-]*$' | grep -v '\.dpkg-.*$')"; +maybe_add_conf() { + if [ -e "$1" ] && \ + basename "$1" \ + | grep '^[[:alnum:]][[:alnum:]\._-]*$' \ + | grep -qv '\.dpkg-.*$'; then + EXTRA_CONF="${EXTRA_CONF} $1" + fi +} +for i in /usr/share/initramfs-tools/conf.d/*; do + # Configuration files in /etc mask those in /usr/share + if ! [ -e "${CONFDIR}"/conf.d/"$(basename "${i}")" ]; then + maybe_add_conf "${i}" + fi +done +for i in "${CONFDIR}"/conf.d/*; do + maybe_add_conf "${i}" done + for i in ${EXTRA_CONF}; do - if [ -d "${CONFDIR}/conf.d/${i}" ]; then - echo "W: ${CONFDIR}/conf.d/${i} is a directory instead of file" >&2 - elif [ -e "${CONFDIR}/conf.d/${i}" ]; then - . "${CONFDIR}/conf.d/${i}" - elif [ -e "/usr/share/initramfs-tools/conf.d/${i}" ]; then - . "/usr/share/initramfs-tools/conf.d/${i}" + if [ -d "${i}" ]; then + echo "W: ${i} is a directory instead of file" >&2 + else + . "${i}" fi done @@ -279,12 +292,7 @@ done echo "DPKG_ARCH=${DPKG_ARCH}" > "${DESTDIR}/conf/arch.conf" cp -p "${CONFDIR}/initramfs.conf" "${DESTDIR}/conf" for i in ${EXTRA_CONF}; do - if [ -e "${CONFDIR}/conf.d/${i}" ]; then - copy_file config "${CONFDIR}/conf.d/${i}" /conf/conf.d - elif [ -e "/usr/share/initramfs-tools/conf.d/${i}" ]; then - copy_file config "/usr/share/initramfs-tools/conf.d/${i}" \ - /conf/conf.d - fi + copy_file config "${i}" /conf/conf.d done # ROOT hardcoding -- GitLab From 34f84b42df830a85aaf0c666ca177135b6394491 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Tue, 13 Feb 2018 00:56:24 +0000 Subject: [PATCH 101/213] mkinitramfs: Don't add directories to EXTRA_CONF Currently we warn about finding directories under /etc/initramfs-tools/conf.d but still try to copy them later on. Signed-off-by: Ben Hutchings --- mkinitramfs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/mkinitramfs b/mkinitramfs index c834eca..266c032 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -72,7 +72,12 @@ maybe_add_conf() { basename "$1" \ | grep '^[[:alnum:]][[:alnum:]\._-]*$' \ | grep -qv '\.dpkg-.*$'; then - EXTRA_CONF="${EXTRA_CONF} $1" + if [ -d "$1" ]; then + echo "W: $1 is a directory instead of file" >&2 + else + EXTRA_CONF="${EXTRA_CONF} $1" + . "$1" + fi fi } for i in /usr/share/initramfs-tools/conf.d/*; do @@ -85,14 +90,6 @@ for i in "${CONFDIR}"/conf.d/*; do maybe_add_conf "${i}" done -for i in ${EXTRA_CONF}; do - if [ -d "${i}" ]; then - echo "W: ${i} is a directory instead of file" >&2 - else - . "${i}" - fi -done - # source package confs for i in /usr/share/initramfs-tools/conf-hooks.d/*; do if [ -d "${i}" ]; then -- GitLab From db31e7eb6f8b635e27af9c876f4db5f224622645 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Mon, 13 Aug 2018 17:36:09 +0100 Subject: [PATCH 102/213] mkinitramfs: Use pigz if available instead of gzip pigz parallelises compression on SMP systems. Signed-off-by: Ben Hutchings --- mkinitramfs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/mkinitramfs b/mkinitramfs index 266c032..0757b5f 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -152,7 +152,14 @@ if ! command -v "${compress}" >/dev/null 2>&1; then fi case "${compress}" in -gzip) [ -n "${SOURCE_DATE_EPOCH}" ] && compress="gzip -n" ;; +gzip) # If we're doing a reproducible build, use gzip -n + if [ -n "${SOURCE_DATE_EPOCH}" ]; then + compress="gzip -n" + # Otherwise, substitute pigz if it's available + elif command -v pigz >/dev/null; then + compress=pigz + fi + ;; lz4) compress="lz4 -9 -l" ;; lzop) ;; xz) compress="xz --check=crc32" ;; -- GitLab From e4a55898587a8dee40b4c20cd902bba23dbf3280 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Mon, 13 Aug 2018 17:37:17 +0100 Subject: [PATCH 103/213] initramfs-tools-core: Recommend pigz Signed-off-by: Ben Hutchings --- debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/control b/debian/control index 57554c4..5006b67 100644 --- a/debian/control +++ b/debian/control @@ -25,7 +25,7 @@ Description: generic modular initramfs generator (automation) Package: initramfs-tools-core Architecture: all Multi-Arch: foreign -Recommends: ${busybox:Recommends} +Recommends: ${busybox:Recommends}, pigz Depends: klibc-utils (>= 2.0.4-8~), cpio (>= 2.12), kmod, udev, coreutils (>= 8.24), e2fsprogs, ${misc:Depends} Suggests: bash-completion Breaks: initramfs-tools (<< 0.121~), ${busybox:Breaks} -- GitLab From b8d3d5968cfb93e4db22057c3eef143a154ded6f Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 6 Feb 2019 01:46:10 +0000 Subject: [PATCH 104/213] Remove descriptions of removed/deprecated options from man page synopsises I already these options from the Options sections but forgot the Synopsis. Signed-off-by: Ben Hutchings --- mkinitramfs.8 | 8 -------- update-initramfs.8 | 1 - 2 files changed, 9 deletions(-) diff --git a/mkinitramfs.8 b/mkinitramfs.8 index 241ab7d..34895d4 100644 --- a/mkinitramfs.8 +++ b/mkinitramfs.8 @@ -17,14 +17,6 @@ mkinitramfs \- low-level tool for generating an initramfs image .RB [ \-v ] .RI [ version ] -.B mkinitramfs -.RB [ \-\-supported-host-version= -.IR hversion ] - -.B mkinitramfs -.RB [ \-\-supported-target-version= -.IR tversion ] - .SH DESCRIPTION The .B mkinitramfs diff --git a/update-initramfs.8 b/update-initramfs.8 index bb88499..a880c25 100644 --- a/update-initramfs.8 +++ b/update-initramfs.8 @@ -8,7 +8,6 @@ update\-initramfs \- generate an initramfs image .RB \-c | \-d | \-u .RB [ \-k .IR version ] -.RB [ \-t ] .RB [ \-v ] .RB [ \-b .IR directory ] -- GitLab From 4d57f637a9b10d74d00d380dde3cea7885fdeae7 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 6 Feb 2019 03:12:52 +0000 Subject: [PATCH 105/213] mkinitramfs(8), update-initramfs(8): Fix over-indentation of options When using inline markup, all whitespace is significant, so these options had an extra space in front of them. Signed-off-by: Ben Hutchings --- mkinitramfs.8 | 15 ++++++++------- update-initramfs.8 | 14 +++++++------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/mkinitramfs.8 b/mkinitramfs.8 index 34895d4..ced5d18 100644 --- a/mkinitramfs.8 +++ b/mkinitramfs.8 @@ -39,38 +39,39 @@ happens in this early userspace. .SH OPTIONS .TP -\fB \-c \fI compress +\fB\-c \fI compress Override the .B COMPRESS setting in .IR initramfs.conf . .TP -\fB \-d \fI confdir +\fB\-d \fI confdir Set an alternate configuration directory. .TP -\fB \-k +.TP +\fB\-k Keep the temporary directory used to make the image. .TP -\fB \-o \fI outfile +\fB\-o \fI outfile Write the image to .IR outfile . .TP -\fB \-r \fI root +\fB\-r \fI root Override the .B ROOT setting in .IR initramfs.conf . .TP -\fB \-v +\fB\-v Set the verbose mode output. .TP -\fI version +\fIversion Set the kernel version of the initramfs image (defaults to the running kernel). diff --git a/update-initramfs.8 b/update-initramfs.8 index a880c25..e99e212 100644 --- a/update-initramfs.8 +++ b/update-initramfs.8 @@ -27,7 +27,7 @@ happens in this early userspace. .SH OPTIONS .TP -\fB \-k \fI version +\fB\-k \fI version Set the specific kernel version for whom the initramfs will be generated. For example the output of uname \-r for your currently running kernel. This argument is optional for update. The default is the latest kernel version. @@ -41,28 +41,28 @@ to .B update\-initramfs. .TP -\fB \-c +\fB\-c This mode creates a new initramfs. .TP -\fB \-u +\fB\-u This mode updates an existing initramfs. .TP -\fB \-d +\fB\-d This mode removes an existing initramfs. .TP -\fB \-v +\fB\-v This option increases the amount of information you are given during the chosen action. .TP -\fB \-b \fI directory +\fB\-b \fI directory Set an different bootdir for the image creation. .TP -\fB \-h +\fB\-h Print a short help page describing the available options in .B update\-initramfs. -- GitLab From 66902db1a1152773bc93337c2f55d74265c1d056 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 6 Feb 2019 02:58:37 +0000 Subject: [PATCH 106/213] update-initramfs(8): Fix formatting of mode options in the synopsis The regular/bold formatting are applied to the wrong things on this line. We also need braces to show where the alternate options start and ends. Signed-off-by: Ben Hutchings --- update-initramfs.8 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update-initramfs.8 b/update-initramfs.8 index e99e212..286188c 100644 --- a/update-initramfs.8 +++ b/update-initramfs.8 @@ -5,7 +5,7 @@ update\-initramfs \- generate an initramfs image .SH SYNOPSIS .B update\-initramfs -.RB \-c | \-d | \-u +.RB { \-c | \-d | \-u } .RB [ \-k .IR version ] .RB [ \-v ] -- GitLab From bb9d247a7161ba29f2c71d8db2a8622e9de86048 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 6 Feb 2019 01:39:13 +0000 Subject: [PATCH 107/213] Move usage function for mkinitramfs out of hook-functions Signed-off-by: Ben Hutchings --- hook-functions | 20 -------------------- mkinitramfs | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/hook-functions b/hook-functions index 28f9384..cc2bc87 100644 --- a/hook-functions +++ b/hook-functions @@ -670,26 +670,6 @@ hidden_dep_add_modules() ) } -# mkinitramfs help message -usage() -{ - cat >&2 << EOF - -Usage: ${0} [OPTION]... -o outfile [version] - -Options: - -c compress Override COMPRESS setting in initramfs.conf. - -d confdir Specify an alternative configuration directory. - -k Keep temporary directory used to make the image. - -o outfile Write to outfile. - -r root Override ROOT setting in initramfs.conf. - -See mkinitramfs(8) for further details. -EOF - exit 1 - -} - # Find the source for a script file. This is needed to work around # temporary directories mounted with the noexec option. The source # will be on / or /usr which must be executable. diff --git a/mkinitramfs b/mkinitramfs index 0757b5f..aaed605 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -11,6 +11,24 @@ verbose="n" BUSYBOXDIR= export BUSYBOXDIR +usage() +{ + cat >&2 << EOF + +Usage: ${0} [OPTION]... -o outfile [version] + +Options: + -c compress Override COMPRESS setting in initramfs.conf. + -d confdir Specify an alternative configuration directory. + -k Keep temporary directory used to make the image. + -o outfile Write to outfile. + -r root Override ROOT setting in initramfs.conf. + +See mkinitramfs(8) for further details. +EOF + exit 1 +} + OPTIONS=$(getopt -o c:d:ko:r:v -n "$0" -- "$@") # Check for non-GNU getopt -- GitLab From 2380cb8a2f1dbefe2f16dcbb3cefd9f1783af5e1 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 6 Feb 2019 02:27:32 +0000 Subject: [PATCH 108/213] update-initramfs: Use getopt instead of getopts All the other commands use getopt, and getopts doesn't support long options. Signed-off-by: Ben Hutchings --- update-initramfs | 41 +++++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/update-initramfs b/update-initramfs index e3e89ff..6f9894e 100755 --- a/update-initramfs +++ b/update-initramfs @@ -320,41 +320,54 @@ verbose=0 ## -while getopts "k:cudvtb:h?" flag; do - case "${flag}" in - k) - version="${OPTARG}" +OPTIONS=$(getopt -o "k:cudvtb:h?" -n "$0" -- "$@") || usage + +eval set -- "$OPTIONS" + +while true; do + case "$1" in + -k) + version="$2" + shift 2 ;; - c) + -c) mode="c" + shift ;; - d) + -d) mode="d" + shift ;; - u) + -u) mode="u" + shift ;; - v) + -v) verbose="1" + shift ;; - t) + -t) # accepted for compatibility, but ignored + shift ;; - b) - BOOTDIR="${OPTARG}" + -b) + BOOTDIR="$2" if [ ! -d "${BOOTDIR}" ]; then echo "E: ${BOOTDIR} is not a directory." >&2 exit 1 fi + shift 2 ;; - h|?) + -h|-\?) usage ;; + --) + shift + break + ;; esac done -shift $((OPTIND - 1)) - if [ $# -ne 0 ]; then printf "Extra argument '%s'\\n\\n" "$1" >&2 usage -- GitLab From abca1937f3dd64d750c3487e5c8d460e19cba67b Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 6 Feb 2019 02:46:03 +0000 Subject: [PATCH 109/213] update-initramfs: Make -h option return 0 and write usage to stdout Asking for help is not an error. Signed-off-by: Ben Hutchings --- update-initramfs | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/update-initramfs b/update-initramfs index 6f9894e..a4bbb1f 100755 --- a/update-initramfs +++ b/update-initramfs @@ -35,10 +35,7 @@ esac usage() { - if [ -n "${1:-}" ]; then - printf "%s\\n\\n" "${*}" >&2 - fi - cat >&2 << EOF + cat << EOF Usage: ${0} [OPTION]... Options: @@ -51,6 +48,14 @@ Options: -h This message EOF +} + +usage_error() +{ + if [ -n "${1:-}" ]; then + printf "%s\\n\\n" "${*}" >&2 + fi + usage >&2 exit 1 } @@ -253,7 +258,7 @@ set_highest_version() create() { if [ -z "${version}" ]; then - usage "Create mode requires a version argument" + usage_error "Create mode requires a version argument" fi set_initramfs @@ -303,7 +308,7 @@ update() delete() { if [ -z "${version}" ]; then - usage "Delete mode requires a version argument" + usage_error "Delete mode requires a version argument" fi set_initramfs @@ -320,7 +325,7 @@ verbose=0 ## -OPTIONS=$(getopt -o "k:cudvtb:h?" -n "$0" -- "$@") || usage +OPTIONS=$(getopt -o "k:cudvtb:h?" -n "$0" -- "$@") || usage_error eval set -- "$OPTIONS" @@ -360,6 +365,7 @@ while true; do ;; -h|-\?) usage + exit 0 ;; --) shift @@ -370,12 +376,12 @@ done if [ $# -ne 0 ]; then printf "Extra argument '%s'\\n\\n" "$1" >&2 - usage + usage_error fi # Validate arguments if [ -z "${mode}" ]; then - usage "You must specify at least one of -c, -u, or -d." + usage_error "You must specify at least one of -c, -u, or -d." fi if [ "${version}" = "all" ] \ -- GitLab From ccf07ee2f187ad3e7a538d468469772bf536ef99 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 6 Feb 2019 03:33:43 +0000 Subject: [PATCH 110/213] update-initramfs: Support --help option Signed-off-by: Ben Hutchings --- update-initramfs | 4 ++-- update-initramfs.8 | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/update-initramfs b/update-initramfs index a4bbb1f..c059266 100755 --- a/update-initramfs +++ b/update-initramfs @@ -325,7 +325,7 @@ verbose=0 ## -OPTIONS=$(getopt -o "k:cudvtb:h?" -n "$0" -- "$@") || usage_error +OPTIONS=$(getopt -o "k:cudvtb:h?" --long help -n "$0" -- "$@") || usage_error eval set -- "$OPTIONS" @@ -363,7 +363,7 @@ while true; do fi shift 2 ;; - -h|-\?) + -h|-\?|--help) usage exit 0 ;; diff --git a/update-initramfs.8 b/update-initramfs.8 index 286188c..83781b4 100644 --- a/update-initramfs.8 +++ b/update-initramfs.8 @@ -62,7 +62,7 @@ the chosen action. Set an different bootdir for the image creation. .TP -\fB\-h +\fB\-h\fR, \fB--help\fR Print a short help page describing the available options in .B update\-initramfs. -- GitLab From c80032179ca00694a70ff71aa5cd0db14a8a45e2 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 6 Feb 2019 02:40:07 +0000 Subject: [PATCH 111/213] Make all commands return 2 in case of a usage error Signed-off-by: Ben Hutchings --- lsinitramfs | 4 ++-- mkinitramfs | 6 +++--- unmkinitramfs | 2 +- update-initramfs | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lsinitramfs b/lsinitramfs index 1235e4d..f86ad9c 100755 --- a/lsinitramfs +++ b/lsinitramfs @@ -9,7 +9,7 @@ usage() if [ "$#" -eq 0 ] ; then usage >&2 - exit 1 + exit 2 fi umi_opts="--list" @@ -17,7 +17,7 @@ umi_opts="--list" OPTIONS=$(getopt -o hl --long help,long -n "$0" -- "$@") # Check for non-GNU getopt # shellcheck disable=SC2181 -if [ $? != 0 ] ; then echo "W: non-GNU getopt" >&2 ; exit 1 ; fi +if [ $? != 0 ] ; then echo "W: non-GNU getopt" >&2 ; exit 2 ; fi eval set -- "$OPTIONS" diff --git a/mkinitramfs b/mkinitramfs index aaed605..3c3eb6c 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -26,14 +26,14 @@ Options: See mkinitramfs(8) for further details. EOF - exit 1 + exit 2 } OPTIONS=$(getopt -o c:d:ko:r:v -n "$0" -- "$@") # Check for non-GNU getopt # shellcheck disable=SC2181 -if [ $? != 0 ] ; then echo "W: non-GNU getopt" >&2 ; exit 1 ; fi +if [ $? != 0 ] ; then echo "W: non-GNU getopt" >&2 ; exit 2 ; fi eval set -- "$OPTIONS" @@ -154,7 +154,7 @@ esac case "${version}" in */*) echo "$PROG: ${version} is not a valid kernel version" >&2 - exit 1 + exit 2 ;; esac diff --git a/unmkinitramfs b/unmkinitramfs index 9414403..852bc1b 100755 --- a/unmkinitramfs +++ b/unmkinitramfs @@ -120,7 +120,7 @@ splitinitramfs() OPTIONS=$(getopt -o hv --long help,list,verbose -n "$0" -- "$@") # Check for non-GNU getopt # shellcheck disable=SC2181 -if [ $? != 0 ] ; then echo "W: non-GNU getopt" >&2 ; exit 1 ; fi +if [ $? != 0 ] ; then echo "W: non-GNU getopt" >&2 ; exit 2 ; fi cpio_opts="--preserve-modification-time --no-absolute-filenames --quiet" expected_args=2 diff --git a/update-initramfs b/update-initramfs index c059266..2a8a413 100755 --- a/update-initramfs +++ b/update-initramfs @@ -56,7 +56,7 @@ usage_error() printf "%s\\n\\n" "${*}" >&2 fi usage >&2 - exit 1 + exit 2 } mild_panic() -- GitLab From fc81f7f5f0da28d3f7b89bf57c8ddd4f8fd7d4f2 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 6 Feb 2019 01:47:03 +0000 Subject: [PATCH 112/213] mkinitramfs: Support -h and --help options Signed-off-by: Ben Hutchings --- mkinitramfs | 15 ++++++++++++--- mkinitramfs.8 | 7 ++++++- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/mkinitramfs b/mkinitramfs index 3c3eb6c..4a4a4ea 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -13,7 +13,7 @@ export BUSYBOXDIR usage() { - cat >&2 << EOF + cat << EOF Usage: ${0} [OPTION]... -o outfile [version] @@ -26,10 +26,15 @@ Options: See mkinitramfs(8) for further details. EOF +} + +usage_error() +{ + usage >&2 exit 2 } -OPTIONS=$(getopt -o c:d:ko:r:v -n "$0" -- "$@") +OPTIONS=$(getopt -o c:d:hko:r:v --long help -n "$0" -- "$@") # Check for non-GNU getopt # shellcheck disable=SC2181 @@ -51,6 +56,10 @@ while true; do exit 1 fi ;; + -h|--help) + usage + exit 0 + ;; -o) outfile="$2" shift 2 @@ -128,7 +137,7 @@ if [ -n "${UMASK:-}" ]; then fi if [ -z "${outfile}" ]; then - usage + usage_error fi touch "$outfile" diff --git a/mkinitramfs.8 b/mkinitramfs.8 index ced5d18..b31b542 100644 --- a/mkinitramfs.8 +++ b/mkinitramfs.8 @@ -16,6 +16,8 @@ mkinitramfs \- low-level tool for generating an initramfs image .IR root ] .RB [ \-v ] .RI [ version ] +.br +.BR mkinitramfs " " -h .SH DESCRIPTION The @@ -49,7 +51,6 @@ setting in \fB\-d \fI confdir Set an alternate configuration directory. -.TP .TP \fB\-k Keep the temporary directory used to make the image. @@ -75,6 +76,10 @@ Set the verbose mode output. Set the kernel version of the initramfs image (defaults to the running kernel). +.TP +\fB\-h\fR, \fB\-\-help\fR +Display usage information and exit. + .SH ENVIRONMENT .B mkinitramfs honours the -- GitLab From 94e05dd4c404b2c2b67cb78715b35f5892bec2d9 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 6 Feb 2019 03:21:03 +0000 Subject: [PATCH 113/213] unmkinitramfs(8): Abbreviate synopsis to avoid wrapping Instead of listing all the options, only mention -o (which is non- optional) and show that other options can be included. Signed-off-by: Ben Hutchings --- mkinitramfs.8 | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/mkinitramfs.8 b/mkinitramfs.8 index b31b542..3267ad4 100644 --- a/mkinitramfs.8 +++ b/mkinitramfs.8 @@ -5,16 +5,9 @@ mkinitramfs \- low-level tool for generating an initramfs image .SH SYNOPSIS .B mkinitramfs -.RB [ \-c -.IR compress ] -.RB [ \-d -.IR confdir ] -.RB [ \-k ] -.RB \-o +.RI [ option ]... +.B \-o .IR outfile -.RB [ \-r -.IR root ] -.RB [ \-v ] .RI [ version ] .br .BR mkinitramfs " " -h -- GitLab From 00809d736ae9a153946db417dbb54dbdaeadefc0 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 6 Feb 2019 03:23:13 +0000 Subject: [PATCH 114/213] Make manual pages and usage messages more consistent * Don't use angle brackets around parameters * Show all options in manual page synopses if possible * Make the usage summary line match the manual page synopsis, excluding the -h option * List all options in usage messages * Refer to manual pages from usage messages * Include one blank line at start and end of usage messages Signed-off-by: Ben Hutchings --- lsinitramfs | 11 ++++++++++- lsinitramfs.8 | 4 +++- mkinitramfs | 3 ++- unmkinitramfs | 11 ++++++++++- unmkinitramfs.8 | 4 +++- update-initramfs | 6 ++++-- update-initramfs.8 | 3 ++- 7 files changed, 34 insertions(+), 8 deletions(-) diff --git a/lsinitramfs b/lsinitramfs index f86ad9c..03ee517 100755 --- a/lsinitramfs +++ b/lsinitramfs @@ -4,7 +4,16 @@ set -eu usage() { - echo "Usage: $(basename "$0") [-l] " + cat << EOF + +Usage: lsinitramfs [-l] initramfs-file... + +Options: + -l Display long and more verbose listing of initramfs content + +See lsinitramfs(8) for further details. + +EOF } if [ "$#" -eq 0 ] ; then diff --git a/lsinitramfs.8 b/lsinitramfs.8 index eb07fa6..c571552 100644 --- a/lsinitramfs.8 +++ b/lsinitramfs.8 @@ -5,8 +5,10 @@ lsinitramfs \- list content of an initramfs image .SH SYNOPSIS .B lsinitramfs -.RI [ options ] " " [ ] +.RB [ -l ] +.IR initramfs-file ... .br +.BR lsinitramfs " " -h .SH DESCRIPTION The diff --git a/mkinitramfs b/mkinitramfs index 4a4a4ea..30ef48b 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -15,7 +15,7 @@ usage() { cat << EOF -Usage: ${0} [OPTION]... -o outfile [version] +Usage: mkinitramfs [option]... -o outfile [version] Options: -c compress Override COMPRESS setting in initramfs.conf. @@ -25,6 +25,7 @@ Options: -r root Override ROOT setting in initramfs.conf. See mkinitramfs(8) for further details. + EOF } diff --git a/unmkinitramfs b/unmkinitramfs index 852bc1b..821c6e8 100755 --- a/unmkinitramfs +++ b/unmkinitramfs @@ -4,7 +4,16 @@ set -eu usage() { - echo "Usage: $(basename "$0") [-v] " + cat << EOF + +Usage: unmkinitramfs [-v] initramfs-file directory + +Options: + -v Display verbose messages about extraction + +See unmkinitramfs(8) for further details. + +EOF } # Extract a compressed cpio archive diff --git a/unmkinitramfs.8 b/unmkinitramfs.8 index 45ffd40..ae9252d 100644 --- a/unmkinitramfs.8 +++ b/unmkinitramfs.8 @@ -5,8 +5,10 @@ unmkinitramfs \- extract content from an initramfs image .SH SYNOPSIS .B unmkinitramfs -.RI [ options ] " " +.RB [ -v ] +.IR initramfs-file " " directory .br +.BR unmkinitramfs " " -h .SH DESCRIPTION The diff --git a/update-initramfs b/update-initramfs index 2a8a413..0b2d0b3 100755 --- a/update-initramfs +++ b/update-initramfs @@ -36,7 +36,8 @@ esac usage() { cat << EOF -Usage: ${0} [OPTION]... + +Usage: update-initramfs {-c|-d|-u} [-k version] [-v] [-b directory] Options: -k version Specify kernel version or 'all' @@ -45,7 +46,8 @@ Options: -d Remove an existing initramfs -b directory Set alternate boot directory -v Be verbose - -h This message + +See update-initramfs(8) for further details. EOF } diff --git a/update-initramfs.8 b/update-initramfs.8 index 83781b4..6a17adf 100644 --- a/update-initramfs.8 +++ b/update-initramfs.8 @@ -11,7 +11,8 @@ update\-initramfs \- generate an initramfs image .RB [ \-v ] .RB [ \-b .IR directory ] -.RB [ \-h ] +.br +.BR update\-initramfs " " \-h .SH DESCRIPTION The .B update\-initramfs -- GitLab From 45f4d152b59c09fd37fad497e0b5c09e61c321b2 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 6 Feb 2019 03:41:44 +0000 Subject: [PATCH 115/213] squash! Make all commands return 2 in case of a usage error Also print errors to stderr --- unmkinitramfs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/unmkinitramfs b/unmkinitramfs index 821c6e8..3efe8eb 100755 --- a/unmkinitramfs +++ b/unmkinitramfs @@ -16,6 +16,12 @@ See unmkinitramfs(8) for further details. EOF } +usage_error() +{ + usage >&2 + exit 2 +} + # Extract a compressed cpio archive xcpio() { @@ -162,8 +168,7 @@ while true; do done if [ $# -ne $expected_args ]; then - usage - exit 2 + usage_error fi # shellcheck disable=SC2086 -- GitLab From 908bd7dc3528633baafa8ffbf97411f34bbd5c84 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 6 Feb 2019 03:42:12 +0000 Subject: [PATCH 116/213] lsinitramfs, mkinitramfs, unmkinitramfs: Show usage if getopt fails We currently show an odd warning about "non-GNU getopt", which doesn't make any sense: 1. It appears in case of a fatal error, thus a mere warning is not appropriate. 2. It appears in case of *any* error from getopt(1), which will have already issued its own error message. 3. getopt(1) is normally provided by util-linux, not a GNU package. 4. There doesn't seem to be any alternate implementation in Debian. This reverts commit e967b03f31e784e8a8a6189c5de5d7b0e6b9bb56, and the additional copy of this warning in unmkinitramfs. Signed-off-by: Ben Hutchings --- lsinitramfs | 12 +++++++----- mkinitramfs | 6 +----- unmkinitramfs | 5 +---- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/lsinitramfs b/lsinitramfs index 03ee517..c106697 100755 --- a/lsinitramfs +++ b/lsinitramfs @@ -16,17 +16,19 @@ See lsinitramfs(8) for further details. EOF } -if [ "$#" -eq 0 ] ; then +usage_error() +{ usage >&2 exit 2 +} + +if [ "$#" -eq 0 ] ; then + usage_error fi umi_opts="--list" -OPTIONS=$(getopt -o hl --long help,long -n "$0" -- "$@") -# Check for non-GNU getopt -# shellcheck disable=SC2181 -if [ $? != 0 ] ; then echo "W: non-GNU getopt" >&2 ; exit 2 ; fi +OPTIONS=$(getopt -o hl --long help,long -n "$0" -- "$@") || usage_error eval set -- "$OPTIONS" diff --git a/mkinitramfs b/mkinitramfs index 30ef48b..0fff550 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -35,11 +35,7 @@ usage_error() exit 2 } -OPTIONS=$(getopt -o c:d:hko:r:v --long help -n "$0" -- "$@") - -# Check for non-GNU getopt -# shellcheck disable=SC2181 -if [ $? != 0 ] ; then echo "W: non-GNU getopt" >&2 ; exit 2 ; fi +OPTIONS=$(getopt -o c:d:hko:r:v --long help -n "$0" -- "$@") || usage_error eval set -- "$OPTIONS" diff --git a/unmkinitramfs b/unmkinitramfs index 3efe8eb..2124c48 100755 --- a/unmkinitramfs +++ b/unmkinitramfs @@ -132,10 +132,7 @@ splitinitramfs() fi } -OPTIONS=$(getopt -o hv --long help,list,verbose -n "$0" -- "$@") -# Check for non-GNU getopt -# shellcheck disable=SC2181 -if [ $? != 0 ] ; then echo "W: non-GNU getopt" >&2 ; exit 2 ; fi +OPTIONS=$(getopt -o hv --long help,list,verbose -n "$0" -- "$@") || usage_error cpio_opts="--preserve-modification-time --no-absolute-filenames --quiet" expected_args=2 -- GitLab From 1cc6e78e771e415742a6b03973189d899d800396 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 6 Feb 2019 03:44:14 +0000 Subject: [PATCH 117/213] lsinitramfs: Check for empty list of arguments after parsing options If "lsinitramfs" with no arguments is invalid, "lsinitramfs -l" should be too. Signed-off-by: Ben Hutchings --- lsinitramfs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lsinitramfs b/lsinitramfs index c106697..5b3315f 100755 --- a/lsinitramfs +++ b/lsinitramfs @@ -22,10 +22,6 @@ usage_error() exit 2 } -if [ "$#" -eq 0 ] ; then - usage_error -fi - umi_opts="--list" OPTIONS=$(getopt -o hl --long help,long -n "$0" -- "$@") || usage_error @@ -52,6 +48,10 @@ while true; do esac done +if [ "$#" -eq 0 ] ; then + usage_error +fi + for initramfs in "$@" ; do unmkinitramfs $umi_opts -- "$initramfs" done -- GitLab From fb3ea629d73c403bfe25aa2be2d5da5fe814dd7e Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 6 Feb 2019 04:36:55 +0000 Subject: [PATCH 118/213] hooks/resume: Report in excruciating detail if the -v option is used Related-to: #916696 Signed-off-by: Ben Hutchings --- hooks/resume | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/hooks/resume b/hooks/resume index 97226fa..2e41e0c 100755 --- a/hooks/resume +++ b/hooks/resume @@ -32,27 +32,39 @@ if [ -n "$RESUME" ] && [ "$RESUME" != auto ]; then echo >&2 "W: but no matching swap device is available." fi -# If we were not explicitly requested to select a device, report that we -# are doing so +# If we were not explicitly requested to select a device, or the -v +# option is used, report that we are doing so report_auto() { - test "$RESUME" = auto || echo >&2 "I: $*" + test "${verbose?}" != y && test "$RESUME" = auto || echo "I: $*" } +# Report in excruciating detail if the -v option is used +report_verbose() +{ + test "${verbose?}" != y || echo "I: $*" +} + +report_verbose "Configuration sets RESUME=$RESUME" + # Try to autodetect the RESUME partition, using biggest swap device that # is not ephemeral. We need to be able to read the listed swap partitions. resume_auto= if ! ischroot && [ -r /proc/swaps ]; then # shellcheck disable=SC2013 for resume_auto in $(grep ^/dev/ /proc/swaps | sort -rnk3 | cut -d " " -f 1); do + report_verbose "Checking swap device $resume_auto" ephemeral=false dm_name="$(dmsetup info -c --noheadings -o name "$resume_auto" 2>/dev/null)" # dm-crypt is ephemeral if the key file is /dev/urandom if [ -n "$dm_name" ] && [ -e /etc/crypttab ]; then + report_verbose "$resume_auto has device-mapper name $dm_name; checking crypttab" # shellcheck disable=SC2034 while read -r cryptdev srcdev keyfile junk; do + report_verbose "Found cryptdev=$cryptdev keyfile=$keyfile" if [ "$cryptdev" = "$dm_name" ] && [ "$keyfile" = /dev/urandom ]; then + report_verbose "Rejecting $resume_auto since it has no permanent key" ephemeral=true fi done < /etc/crypttab @@ -61,6 +73,7 @@ if ! ischroot && [ -r /proc/swaps ]; then # zram is ephemeral case "$resume_auto" in /dev/zram*) + report_verbose "Rejecting $resume_auto since it is zram" ephemeral=true ;; esac -- GitLab From 40e544e13611c1b2690eb99a8096fc16c1b9c74e Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 6 Feb 2019 20:17:57 +0000 Subject: [PATCH 119/213] Releasing version 0.133. Signed-off-by: Ben Hutchings --- debian/changelog | 82 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/debian/changelog b/debian/changelog index 3b75bf8..5c96d58 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,85 @@ +initramfs-tools (0.133) unstable; urgency=medium + + [ Ben Hutchings ] + * [942f1d2] unmkinitramfs, lsinitramfs: Avoid zcat compatibility issue by + running gzip (Closes: #903931) + * [94683ef] mkinitramfs: Remove check for kernel version < 2.6.38 + * [40fb032] mkinitramfs; Stop setting both compress and COMPRESS variables + * [01af757] initramfs-tools: Change trigger declaration to "interest-await" + * [2bb6a9c] update-initramfs: Remove test for working dpkg-trigger + * [1f10559] kernel hooks: Remove use of update-initramfs -t option + * [1343b68] update-initramfs: Remove undocumented -y option + * [e0d4024] mkinitramfs: Warn if the compression command is not recognised + * [bafb9d4] init: Always export the resume and noresume variables, as + documented + * [f21fdae] debian/rules: Use a more conservative "find" for shellcheck + arguments + * [9c63564] Change get_fstype to be silent on failure + * [58df6d3] scripts/functions: Abort _checkfs_once early if fs type is + unknown + * [f8ceeb9] scripts/local: Explicitly check for missing root parameter and + mount failure. Thanks to "G.raud" (Closes: #848906) + * [a5ae8a1] scripts/{local,nfs}: Remove redundant modprobe of filesystem + modules + * [4807ede] hook-functions: Avoid symlinks that conflict with usr-merge in + copy_file + * [79f49b9] {hooks,scripts}/keymap: Use setupcon --setup-dir + * [839be1b] scripts/local: Handle rootfstype=auto the same as if type is + unspecified (Closes: #908967) + * [f086b72] mkinitramfs: Use default compression level for lzop + (Closes: #916935) + * [d343f5e] README: Summarise what initramfs-tools does and point to manual + pages + * [c5dd80a] initramfs-tools(7): Document how to update the initramfs from + another package (Closes: #893897) + * [2e5e389] scripts/functions: Revert change to _log_msg and make callers + format-safe + * [49139ca] scripts/local-premount/resume: Report when we are resuming. + Thanks to Mario Limonciello + * [28b9d1d] scripts/nfs: Use "sleep" instead of /bin/sleep (Closes: #677049) + * [db394d3] Print warnings and errors in initramfs generation consistently + * [d9cf2f2] hooks/fsck: If get_fstype fails, report which file system it + failed for (Closes: #766446) + * [1ae0994] mkinitramfs: Change EXTRA_CONF to include directory names + * [34f84b4] mkinitramfs: Don't add directories to EXTRA_CONF + * [db31e7e] mkinitramfs: Use pigz if available instead of gzip + * [e4a5589] initramfs-tools-core: Recommend pigz + * [b8d3d59] Remove descriptions of removed/deprecated options from man page + synopses + * [4d57f63] mkinitramfs(8), update-initramfs(8): Fix over-indentation of + options + * [66902db] update-initramfs(8): Fix formatting of mode options in the + synopsis + * [bb9d247] Move usage function for mkinitramfs out of hook-functions + * [2380cb8] update-initramfs: Use getopt instead of getopts + * [abca193] update-initramfs: Make -h option return 0 and write usage to + stdout + * [ccf07ee] update-initramfs: Support --help option + * [c800321] Make all commands return 2 in case of a usage error + * [fc81f7f] mkinitramfs: Support -h and --help options + * [94e05dd] unmkinitramfs(8): Abbreviate synopsis to avoid wrapping + * [00809d7] Make manual pages and usage messages more consistent + * [45f4d15] unmkinitramfs: Write usage on stderr in case of error + * [908bd7d] lsinitramfs, mkinitramfs, unmkinitramfs: Show usage if getopt + fails + * [1cc6e78] lsinitramfs: Check for empty list of arguments after parsing + options + * [fb3ea62] hooks/resume: Report in excruciating detail if the -v option is + used + + [ Benjamin Drung ] + * [806c757] scripts/functions: Fix syntax error: unexpected "(" on panic + * [88b0c9b] mkinitramfs: Fix termination of gzip compression case + * [5438f31] scripts/functions: Drop render function + * [3c8b4c3] Remove trailing newline from debian/changelog + * [f277309] Fix (nearly) all issues found by shellcheck + * [2bab73b] Disable shellcheck for desired behaviour + * [3650731] Replace 'echo -n' by printf + * [9c0feb2] Run shellcheck on package build time + * [c9cb0a0] Add autopkgtest for shellcheck + + -- Ben Hutchings Wed, 06 Feb 2019 20:13:59 +0000 + initramfs-tools (0.132) unstable; urgency=medium * [4e1f80e] mkinitramfs: Don't try to remove nonexistent /var/cache/ldconfig -- GitLab From 8aeae9f368f3f85e7653831d6870de2796b470c8 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Sun, 10 Feb 2019 22:44:49 +0000 Subject: [PATCH 120/213] hooks/resume: Disable resume when there are no suitable swap devices In 0.131 the automatic selection of a resume device was changed to disable resume if the largest swap device was encrypted with a ephemeral key. In 0.132 I changed the automatic selection to also reject zram devices, but I also changed it to loop over all swap devices since zram might well be used alongside a conventional swap device that we could use. Unfortunately, in case swap devices are available but none are suitable, this results in selecting the last one. Closes: #916696 Thanks: Trek Signed-off-by: Ben Hutchings --- hooks/resume | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hooks/resume b/hooks/resume index 2e41e0c..0cd78fe 100755 --- a/hooks/resume +++ b/hooks/resume @@ -81,7 +81,10 @@ if ! ischroot && [ -r /proc/swaps ]; then $ephemeral || break done - if [ -n "$resume_auto" ] && ! $ephemeral; then + if $ephemeral; then + resume_auto= + fi + if [ -n "$resume_auto" ]; then if [ -n "$dm_name" ]; then resume_auto_canon="/dev/mapper/$dm_name" elif UUID=$(blkid -s UUID -o value "$resume_auto"); then -- GitLab From 5e94f2244ac2be71a27f661e77e3f05be977cf1b Mon Sep 17 00:00:00 2001 From: Benjamin Drung Date: Mon, 11 Feb 2019 12:37:48 +0100 Subject: [PATCH 121/213] autopkgtest: Check also /usr/share/initramfs-tools/{hooks,scripts} klibc 2.0.5-1, kmod 26-1, and systemd 240-4 fixed their shellcheck issues. So we can also check the whole /usr/share/initramfs-tools/hooks and /usr/share/initramfs-tools/scripts directories. Signed-off-by: Benjamin Drung --- debian/tests/control | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/debian/tests/control b/debian/tests/control index 4c4f3f8..2845c35 100644 --- a/debian/tests/control +++ b/debian/tests/control @@ -1,3 +1,2 @@ -# TODO: Check $(find /usr/share/initramfs-tools/hooks /usr/share/initramfs-tools/scripts -type f) once klibc, kmod, and systemd are fixed! -Test-Command: shellcheck -e SC1090,SC1091 -s dash /usr/bin/lsinitramfs /usr/sbin/mkinitramfs /usr/bin/unmkinitramfs /usr/share/initramfs-tools/hook-functions /usr/share/initramfs-tools/init /etc/kernel/postinst.d/initramfs-tools /etc/kernel/postrm.d/initramfs-tools /usr/sbin/update-initramfs +Test-Command: shellcheck -e SC1090,SC1091 -s dash /usr/bin/lsinitramfs /usr/sbin/mkinitramfs /usr/bin/unmkinitramfs /usr/share/initramfs-tools/hook-functions /usr/share/initramfs-tools/init /etc/kernel/postinst.d/initramfs-tools /etc/kernel/postrm.d/initramfs-tools /usr/sbin/update-initramfs $(find /usr/share/initramfs-tools/hooks /usr/share/initramfs-tools/scripts -type f) Depends: @, shellcheck -- GitLab From eb98d2ea110baed9651e33b83ce0da2dfa210080 Mon Sep 17 00:00:00 2001 From: Topi Miettinen Date: Sat, 13 Apr 2019 13:25:25 +0300 Subject: [PATCH 122/213] init: /dev can be noexec and /run nodev /dev used to be mounted with "exec" flag due to /dev/MAKEDEV script but that's history and it's now located in /sbin. mmap() with file descriptor to "/dev/zero" (instead of modern mmap(,,,MAP_ANON...)) will still work. There's no reason to have (char/block) device nodes in /run, so let's mount it with "nodev". This does not affect sockets, fifos etc. Signed-off-by: Topi Miettinen --- init | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init b/init index 3dc9f6b..1cc96c3 100755 --- a/init +++ b/init @@ -33,7 +33,7 @@ export quiet # Note that this only becomes /dev on the real filesystem if udev's scripts # are used; which they will be, but it's worth pointing out -mount -t devtmpfs -o nosuid,mode=0755 udev /dev +mount -t devtmpfs -o noexec,nosuid,mode=0755 udev /dev mkdir /dev/pts mount -t devpts -o noexec,nosuid,gid=5,mode=0620 devpts /dev/pts || true @@ -207,7 +207,7 @@ else resume=${RESUME:-} fi -mount -t tmpfs -o "noexec,nosuid,size=${RUNSIZE:-10%},mode=0755" tmpfs /run +mount -t tmpfs -o "nodev,noexec,nosuid,size=${RUNSIZE:-10%},mode=0755" tmpfs /run mkdir -m 0755 /run/initramfs if [ -n "$log_output" ]; then -- GitLab From 994d698a953c0022983c221924b1338aa11cf067 Mon Sep 17 00:00:00 2001 From: Alper Nebi Yasak Date: Tue, 30 Apr 2019 17:33:12 +0300 Subject: [PATCH 123/213] hook-functions: Include extcon-usbc-cros-ec when MODULES=most Signed-off-by: Alper Nebi Yasak --- hook-functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hook-functions b/hook-functions index cc2bc87..1bfe61f 100644 --- a/hook-functions +++ b/hook-functions @@ -538,7 +538,7 @@ auto_add_modules() copy_modules_dir kernel/drivers/usb/musb copy_modules_dir kernel/drivers/usb/renesas_usbhs # and any extcon drivers for USB - modules="$modules extcon-usb-gpio" + modules="$modules extcon-usb-gpio extcon-usbc-cros-ec" # Add the axp20x_usb_power power supply driver, # required to initialize the USB host controllers # on a number of armhf systems -- GitLab From 4e3496a3ec83eee8d82a5f0ae13de365036825c5 Mon Sep 17 00:00:00 2001 From: Alper Nebi Yasak Date: Tue, 30 Apr 2019 17:46:19 +0300 Subject: [PATCH 124/213] hook-functions: Include extcon drivers when MODULES=dep Signed-off-by: Alper Nebi Yasak --- hook-functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hook-functions b/hook-functions index 1bfe61f..df72db0 100644 --- a/hook-functions +++ b/hook-functions @@ -449,7 +449,7 @@ dep_add_modules() fi # sys walk some important device classes - for class in gpio phy regulator rtc; do + for class in extcon gpio phy regulator rtc; do for device in "/sys/class/$class"/*; do device="$(readlink -f "$device")" \ && sys_walk_mod_add "$device" -- GitLab From 40f6647444b84b0987a80b38d919475880503ad7 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Sat, 4 May 2019 21:54:06 +0100 Subject: [PATCH 125/213] hook-functions: Include all keyboard driver modules when MODULES=most Until recently most keyboard drivers were either built-in or HID (which we already include). However there are other important modular keyboard drivers such as cros_ec_keyb which were only included when MODULES=dep. Thanks: Alper Nebi Yasak Signed-off-by: Ben Hutchings --- hook-functions | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/hook-functions b/hook-functions index df72db0..f2da18a 100644 --- a/hook-functions +++ b/hook-functions @@ -544,9 +544,11 @@ auto_add_modules() # on a number of armhf systems modules="$modules axp20x_usb_power" - # Include all HID drivers unless we're sure they - # don't support keyboards. hid-*ff covers various - # game controllers with force feedback. + # Include all keyboard drivers and all HID drivers + # unless we're sure they don't support keyboards. + # hid-*ff covers various game controllers with + # force feedback. + copy_modules_dir kernel/drivers/input/keyboard copy_modules_dir kernel/drivers/hid \ 'hid-*ff.ko' hid-a4tech.ko hid-cypress.ko \ hid-dr.ko hid-elecom.ko hid-gyration.ko \ -- GitLab From 797e5fed520bf71a546b2a224e2ad5d5b0daa913 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Sat, 4 May 2019 22:04:24 +0100 Subject: [PATCH 126/213] hook-functions: Include cros_ec_spi and SPI drivers when MODULES=most On some ChromeOS devices the keyboard is attached to an EC which the host must communicate with over SPI. Thanks: Alper Nebi Yasak Signed-off-by: Ben Hutchings --- hook-functions | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hook-functions b/hook-functions index f2da18a..323aa40 100644 --- a/hook-functions +++ b/hook-functions @@ -562,6 +562,8 @@ auto_add_modules() hid-speedlink.ko hid-tivo.ko hid-twinhan.ko \ hid-uclogic.ko hid-wacom.ko hid-waltop.ko \ hid-wiimote.ko hid-zydacron.ko + # needed to access keyboard on some ChromeOS devices + modules="$modules cros_ec_spi" # Any of these might be needed by other drivers copy_modules_dir kernel/drivers/bus @@ -573,6 +575,7 @@ auto_add_modules() copy_modules_dir kernel/drivers/phy copy_modules_dir kernel/drivers/pinctrl copy_modules_dir kernel/drivers/regulator + copy_modules_dir kernel/drivers/spi copy_modules_dir kernel/drivers/usb/phy # Needed for periodic fsck -- GitLab From 37dcf3d078523c44e0f6a5ced2eaf731b9426bb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Wed, 19 Jun 2019 23:13:41 +0200 Subject: [PATCH 127/213] mkinitramfs: suppress warning when using bzip2 or lzma When using bzip2 a message is emitted W: Unknown compression command bzip2 which is wrong and irritating. Suppress this warning for both bzip2 and lzma. Fixes: e0d4024d2931 ("mkinitramfs: Warn if the compression command is not recognised") Closes: #930754 --- mkinitramfs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mkinitramfs b/mkinitramfs index 0fff550..c5fa7b3 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -185,8 +185,10 @@ gzip) # If we're doing a reproducible build, use gzip -n fi ;; lz4) compress="lz4 -9 -l" ;; -lzop) ;; xz) compress="xz --check=crc32" ;; +bzip2|lzma|lzop) + # no parameters needed + ;; *) echo "W: Unknown compression command ${compress}" >&2 ;; esac -- GitLab From f65627d96f16388deb7c3e1c88b1098baec6a59b Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Sat, 6 Jul 2019 15:58:37 +0100 Subject: [PATCH 128/213] resume: Set plymouth status only if there is a suspend image We always need to write the resume device name to the kernel, either (a) to resume, if a suspend image is found, or (b) to enable suspend to that device later. We let the kernel distinguish the two cases itself. Since we started reporting the attempt to resume through plymouth, if the text front-end is used (currently the default in Debian) the message remains on-screen and is confusing in case (b). (If the frame-buffer front-end is used, we clear the message.) I can't think of a message that usefully covers both cases, and if case (b) it's not really necessary to report anything. Use fstype to check for a suspend image before reporting that we're resuming. Closes: #928736 Signed-off-by: Ben Hutchings --- scripts/local-premount/resume | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/scripts/local-premount/resume b/scripts/local-premount/resume index bf23baf..63dcc49 100755 --- a/scripts/local-premount/resume +++ b/scripts/local-premount/resume @@ -26,9 +26,9 @@ if ! local_device_setup "${resume}" "suspend/resume device" false; then exit 0 fi -use_plymouth=false -if command -v plymouth >/dev/null && plymouth --ping; then - use_plymouth=true +if [ "$(get_fstype "${DEV}")" = suspend ] && + command -v plymouth >/dev/null && + plymouth --ping; then plymouth display-message --text="Resuming from hibernation" # The above command does not wait for a framebuffer update to @@ -44,8 +44,3 @@ if [ -n "${resume_offset?}" ]; then else /bin/resume "${DEV}" fi - -if "$use_plymouth"; then - # plymouth hide-message does not work yet - plymouth display-message --text="" -fi -- GitLab From c31a908540f2dd055d9e471184124aa447309c3f Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Sat, 27 Jul 2019 22:22:18 +0100 Subject: [PATCH 129/213] hook-functions: Fix copy_file with target of "/bin" The copy_file function applies two transformations to the target filename: 1. If it matches /bin/*, /lib*, or /sbin/*, add /usr to the beginning since the initramfs is usrmerged. 2. If it refers a directory, add the basename of the source filename. These need to be done in the opposite order, to handle a target filename of "/bin" correctly. Closes: #928689 Signed-off-by: Ben Hutchings --- hook-functions | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hook-functions b/hook-functions index 323aa40..151a84e 100644 --- a/hook-functions +++ b/hook-functions @@ -124,15 +124,15 @@ copy_file() { [ -f "${src}" ] || return 2 + if [ -d "${DESTDIR}/${target}" ]; then + target="${target}/${src##*/}" + fi + # Canonicalise usr-merged target directories case "${target}" in /bin/* | /lib* | /sbin/*) target="/usr${target}" ;; esac - if [ -d "${DESTDIR}/${target}" ]; then - target="${target}/${src##*/}" - fi - # check if already copied [ -e "${DESTDIR}/${target}" ] && return 1 -- GitLab From 8a29ef38677fe861e78d8e5a181009ee0053d30b Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Sat, 27 Jul 2019 22:31:38 +0100 Subject: [PATCH 130/213] scripts/functions: Use "reboot -f" to reboot on panic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit klibc's reboot implementation always calls reboot(2), whereas busybox's reboot implementation defaults to signalling an init daemon which doesn't exist in the initramfs. The solution is simply to use the -f option, which both implementations accept. This seems to have been broken since commit c04a9db5b70b "hooks/klibc: Make us play more nicely with busybox and static bin/sh" which caused busybox's reboot implementation to be preferred over klibc's. The failure to reboot was previously reported as #751488, but only worked around by forcing a kernel panic if it failed. Closes: #923165 Related-to: #751488 Thanks: Michael Niewöhner Signed-off-by: Ben Hutchings --- scripts/functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/functions b/scripts/functions index 077697f..ad900ca 100644 --- a/scripts/functions +++ b/scripts/functions @@ -45,7 +45,7 @@ panic() if [ -n "${panic?}" ]; then echo "Rebooting automatically due to panic= boot argument" sleep "${panic}" - reboot + reboot -f exit # in case reboot fails, force kernel panic fi -- GitLab From da9f53eb56371cdbbaf5808073ba59e717ac7322 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Sat, 27 Jul 2019 22:50:59 +0100 Subject: [PATCH 131/213] unmkinitramfs: Work around lz4cat filename check "lz4cat -t" checks that the filename ends in ".lz4", not just that it has a valid header etc. This can be avoided by giving it the file as stdin instead of by name. Closes: #930366 Thanks: Dimitri John Ledkov Signed-off-by: Ben Hutchings --- unmkinitramfs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unmkinitramfs b/unmkinitramfs index 2124c48..3f8c75d 100755 --- a/unmkinitramfs +++ b/unmkinitramfs @@ -33,7 +33,7 @@ xcpio() gzip -c -d "$archive" elif xzcat -t "$archive" >/dev/null 2>&1 ; then xzcat "$archive" - elif lz4cat -t "$archive" >/dev/null 2>&1 ; then + elif lz4cat -t < "$archive" >/dev/null 2>&1 ; then lz4cat "$archive" elif bzip2 -t "$archive" >/dev/null 2>&1 ; then bzip2 -c -d "$archive" -- GitLab From cf7bb4b36648b4871fe13b04608df7e04ff7385b Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Sat, 27 Jul 2019 22:58:06 +0100 Subject: [PATCH 132/213] initramfs-tools-core: Depend on logsave or older e2fsprogs The fsck hook depends on logsave, which has moved from e2fsprogs to a separate binary package. Closes: #932854 Signed-off-by: Ben Hutchings --- debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/control b/debian/control index 5006b67..ebeea3f 100644 --- a/debian/control +++ b/debian/control @@ -26,7 +26,7 @@ Package: initramfs-tools-core Architecture: all Multi-Arch: foreign Recommends: ${busybox:Recommends}, pigz -Depends: klibc-utils (>= 2.0.4-8~), cpio (>= 2.12), kmod, udev, coreutils (>= 8.24), e2fsprogs, ${misc:Depends} +Depends: klibc-utils (>= 2.0.4-8~), cpio (>= 2.12), kmod, udev, coreutils (>= 8.24), logsave | e2fsprogs (<< 1.45.3-1~), ${misc:Depends} Suggests: bash-completion Breaks: initramfs-tools (<< 0.121~), ${busybox:Breaks} Replaces: initramfs-tools (<< 0.121~) -- GitLab From 85707183a7ae9758d096347670a4c57a4b145c31 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Sat, 27 Jul 2019 23:25:14 +0100 Subject: [PATCH 133/213] update-initramfs(8): Document -d option as "delete" instead of "remove" This is mnemonic, and consistent with messages the command may output. Signed-off-by: Ben Hutchings --- update-initramfs.8 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update-initramfs.8 b/update-initramfs.8 index 6a17adf..e954d7f 100644 --- a/update-initramfs.8 +++ b/update-initramfs.8 @@ -51,7 +51,7 @@ This mode updates an existing initramfs. .TP \fB\-d -This mode removes an existing initramfs. +This mode deletes an existing initramfs. .TP \fB\-v -- GitLab From fffe514a4bb34d19c46cce25c6c27372572565f8 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Sat, 27 Jul 2019 23:27:01 +0100 Subject: [PATCH 134/213] update-initramfs(8): Update description of "-k all" option Describe the new behaviour introduced by commit f39625afd6ba "update-initramfs: Make "-k all" take over other initramfs images". Signed-off-by: Ben Hutchings --- update-initramfs.8 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/update-initramfs.8 b/update-initramfs.8 index e954d7f..1047965 100644 --- a/update-initramfs.8 +++ b/update-initramfs.8 @@ -37,9 +37,8 @@ The use of "all" for the .I version string specifies .B update\-initramfs -to execute the chosen action for all kernel versions, that are already known -to -.B update\-initramfs. +to execute the chosen action for all installed kernel versions that already +have an initramfs. .TP \fB\-c -- GitLab From ef3f0a5e193b7dcf352e5424a52d4ea8b6f0635e Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Sun, 28 Jul 2019 01:14:55 +0100 Subject: [PATCH 135/213] Releasing version 0.134. Signed-off-by: Ben Hutchings --- debian/changelog | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/debian/changelog b/debian/changelog index 5c96d58..c39f336 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,40 @@ +initramfs-tools (0.134) unstable; urgency=medium + + [ Ben Hutchings ] + * [8aeae9f] hooks/resume: Disable resume when there are no suitable swap + devices. Thanks to Trek (Closes: #916696) + * [40f6647] hook-functions: Include all keyboard driver modules when + MODULES=most. Thanks to Alper Nebi Yasak + * [797e5fe] hook-functions: Include cros_ec_spi and SPI drivers when + MODULES=most. Thanks to Alper Nebi Yasak + * [f65627d] resume: Set plymouth status only if there is a suspend image + (Closes: #928736) + * [c31a908] hook-functions: Fix copy_file with target of "/bin" + (Closes: #928689) + * [8a29ef3] scripts/functions: Use "reboot -f" to reboot on panic. + Thanks to Michael Niewöhner (Closes: #923165) + * [da9f53e] unmkinitramfs: Work around lz4cat filename check. + Thanks to Dimitri John Ledkov (Closes: #930366) + * [cf7bb4b] initramfs-tools-core: Depend on logsave or older e2fsprogs + (Closes: #932854) + * [8570718] update-initramfs(8): Document -d option as "delete" instead of + "remove" + * [fffe514] update-initramfs(8): Update description of "-k all" option + + [ Benjamin Drung ] + * [5e94f22] autopkgtest: Check also + /usr/share/initramfs-tools/{hooks,scripts} + + [ Alper Nebi Yasak ] + * [994d698] hook-functions: Include extcon-usbc-cros-ec when MODULES=most + * [4e3496a] hook-functions: Include extcon drivers when MODULES=dep + + [ Uwe Kleine-König ] + * [37dcf3d] mkinitramfs: suppress warning when using bzip2 or lzma + (Closes: #930754) + + -- Ben Hutchings Sun, 28 Jul 2019 01:10:56 +0100 + initramfs-tools (0.133) unstable; urgency=medium [ Ben Hutchings ] -- GitLab From 43488a3851057537d3b9e23c91bc898371966d63 Mon Sep 17 00:00:00 2001 From: Alper Nebi Yasak Date: Sun, 11 Aug 2019 15:24:32 +0000 Subject: [PATCH 136/213] hook-functions: Handle spi-rockchip hidden dependency on pl330 Recent kernel versions (v5.0) enabled SPI DMA channels in the RK3399 DTS file. Not including pl330 in the initramfs now makes some systems unbootable (at least rk3399-gru-kevin) presumably because of this. Signed-off-by: Alper Nebi Yasak --- hook-functions | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hook-functions b/hook-functions index 151a84e..c9f676f 100644 --- a/hook-functions +++ b/hook-functions @@ -670,6 +670,9 @@ hidden_dep_add_modules() nvme) echo vmd ;; + spi-rockchip) + echo pl330 + ;; esac done ) -- GitLab From 116ce5c6bd17291f2e2e8fd3efc6a0660223953e Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 21 Aug 2019 17:48:03 +0100 Subject: [PATCH 137/213] autopkgtest: Only test hook and boot scripts from specific packages There are still other packages with hooks and scripts that shellcheck finds fault with. This shouldn't cause a test failure for initramfs-tools itself, but unfortunately that's what happens now: https://ci.debian.net/data/autopkgtest/testing/amd64/i/initramfs-tools/2780481/log.gz Replace the Test-Command with a script that tests only hook and boot scripts installed by specific binary packages. We can expand this list as and when other packages are updated. Signed-off-by: Ben Hutchings --- debian/tests/control | 2 +- debian/tests/shellcheck | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100755 debian/tests/shellcheck diff --git a/debian/tests/control b/debian/tests/control index 2845c35..ab19b6c 100644 --- a/debian/tests/control +++ b/debian/tests/control @@ -1,2 +1,2 @@ -Test-Command: shellcheck -e SC1090,SC1091 -s dash /usr/bin/lsinitramfs /usr/sbin/mkinitramfs /usr/bin/unmkinitramfs /usr/share/initramfs-tools/hook-functions /usr/share/initramfs-tools/init /etc/kernel/postinst.d/initramfs-tools /etc/kernel/postrm.d/initramfs-tools /usr/sbin/update-initramfs $(find /usr/share/initramfs-tools/hooks /usr/share/initramfs-tools/scripts -type f) +Tests: shellcheck Depends: @, shellcheck diff --git a/debian/tests/shellcheck b/debian/tests/shellcheck new file mode 100755 index 0000000..37765a2 --- /dev/null +++ b/debian/tests/shellcheck @@ -0,0 +1,25 @@ +#!/bin/sh -eu + +export LC_COLLATE=C.UTF-8 +unset LC_ALL + +# The packages that install hook/boot scripts +dpkg -S /usr/share/initramfs-tools/hooks /usr/share/initramfs-tools/scripts \ + | sed 's/: .*//; s/, /\n/g' \ + | sort -u \ + > "$AUTOPKGTEST_TMP/installed-packages" + +# The packages that we're prepared to test +echo "initramfs-tools initramfs-tools-core klibc-utils kmod udev" \ + | sed 's/ /\n/g' \ + | sort -u \ + > "$AUTOPKGTEST_TMP/tested-packages" + +# Installed hook/boot scripts that we're prepared to test +join "$AUTOPKGTEST_TMP/installed-packages" "$AUTOPKGTEST_TMP/tested-packages" \ + | xargs dpkg -L \ + | grep -E '^/usr/share/initramfs-tools/(hooks|scripts)/' \ + | while read file; do test -f "$file" && printf '%s\n' "$file"; done \ + > "$AUTOPKGTEST_TMP/hook-boot-scripts" + +shellcheck -e SC1090,SC1091 -s dash /usr/bin/lsinitramfs /usr/sbin/mkinitramfs /usr/bin/unmkinitramfs /usr/share/initramfs-tools/hook-functions /usr/share/initramfs-tools/init /etc/kernel/postinst.d/initramfs-tools /etc/kernel/postrm.d/initramfs-tools /usr/sbin/update-initramfs $(cat "$AUTOPKGTEST_TMP/hook-boot-scripts") -- GitLab From e7b44b46d5541fc2cc4b8c639d3510ca8f8e3d16 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 21 Aug 2019 23:07:36 +0100 Subject: [PATCH 138/213] Releasing version 0.135. Signed-off-by: Ben Hutchings --- debian/changelog | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/debian/changelog b/debian/changelog index c39f336..e5ea007 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,17 @@ +initramfs-tools (0.135) unstable; urgency=medium + + [ Topi Miettinen ] + * [eb98d2e] init: /dev can be noexec and /run nodev + + [ Alper Nebi Yasak ] + * [43488a3] hook-functions: Handle spi-rockchip hidden dependency on pl330 + + [ Ben Hutchings ] + * [116ce5c] autopkgtest: Only test hook and boot scripts from specific + packages + + -- Ben Hutchings Wed, 21 Aug 2019 23:06:28 +0100 + initramfs-tools (0.134) unstable; urgency=medium [ Ben Hutchings ] -- GitLab From 90bd459cde5188e2463ccc36c1d1c5eb3ba7bbc5 Mon Sep 17 00:00:00 2001 From: Mathieu Malaterre Date: Tue, 3 Sep 2019 14:22:24 +0200 Subject: [PATCH 139/213] Update to new name for kernel module therm_pm72 Also update a minor comment to clarify what to load nowadays. See commit 6cd320996746 ("powerpc/powermac: New windfarm driver for PowerMac G5 (AGP) and Xserve G5"). Signed-off-by: Mathieu Malaterre --- hooks/thermal | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/hooks/thermal b/hooks/thermal index 5807386..0a42c12 100755 --- a/hooks/thermal +++ b/hooks/thermal @@ -24,7 +24,7 @@ case "$DPKG_ARCH" in powerpc|ppc64) # Only G5 Mac machines need to load - # therm_pm72 or one of the windfarm_pm* modules. + # windfarm_core or one of the windfarm_pm* modules. [ -r /proc/cpuinfo ] || exit 0 @@ -32,8 +32,11 @@ powerpc|ppc64) MODEL="${MODEL##*: }" case "$MODEL" in - RackMac3,1|PowerMac7,2|PowerMac7,3) - force_load therm_pm72 + RackMac3,1) + force_load windfarm_rm31 + ;; + PowerMac7,2|PowerMac7,3) + force_load windfarm_pm72 ;; PowerMac8,1|PowerMac8,2) force_load windfarm_pm81 -- GitLab From ded7214cbff09ed24fb9eb7c4571e5930a0b5037 Mon Sep 17 00:00:00 2001 From: Alper Nebi Yasak Date: Tue, 8 Oct 2019 17:09:01 +0300 Subject: [PATCH 140/213] hook-functions: Handle dw_mmc-rockchip hidden dependency on rockchip-io-domain Without rockchip-io-domain, I'm getting the following errors when plugging micro SD cards to a rk3399-gru-kevin: dwmmc_rockchip fe320000.dwmmc: All phases bad! mmc1: tuning execution failed: -5 mmc1: error -5 whilst initialising SD card In that case the relevant /dev/mmcblk* device isn't available either, so we can't boot from the external SD card. Signed-off-by: Alper Nebi Yasak --- hook-functions | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hook-functions b/hook-functions index c9f676f..d69ce04 100644 --- a/hook-functions +++ b/hook-functions @@ -673,6 +673,9 @@ hidden_dep_add_modules() spi-rockchip) echo pl330 ;; + dw_mmc-rockchip) + echo rockchip-io-domain + ;; esac done ) -- GitLab From da8519036860f4b74465bb50fbfbef901bcb2f7e Mon Sep 17 00:00:00 2001 From: Alper Nebi Yasak Date: Thu, 1 Aug 2019 15:58:13 +0300 Subject: [PATCH 141/213] hook-functions: Include modules for Chromebook Plus display On Samsung Chromebook Plus (v1), messages and prompts printed during an initramfs run aren't visible to the user unless the pwm_bl, rockchipdrm, pwm-cros-ec and panel-simple modules are included. This commit includes these when MODULES=dep and when MODULES=most. For MODULES=dep: adds backlight and pwm to the dep_modules_add sys-walk. Walking backlight includes pwm_bl and pwm includes pwm-cros-ec. Since panel-simple isn't reachable from /sys/class/**, but it can be reached from /sys/devices/platform/edp-panel, that path is sys-walked if it exists. When {efi,platform,simple,vesa}-framebuffer cannot provide a working framebuffer device, graphics is sys-walked as well. Walking drm works for rockchipdrm too, but also includes panfrost, so graphics was chosen instead. For MODULES=most: the modules are included in a new case 'fb' in the auto_add_modules intended for modules providing framebuffer support for machines where generic drivers don't provide one. Signed-off-by: Alper Nebi Yasak --- hook-functions | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/hook-functions b/hook-functions index c9f676f..1f00b20 100644 --- a/hook-functions +++ b/hook-functions @@ -449,7 +449,7 @@ dep_add_modules() fi # sys walk some important device classes - for class in extcon gpio phy regulator rtc; do + for class in backlight extcon gpio phy pwm regulator rtc; do for device in "/sys/class/$class"/*; do device="$(readlink -f "$device")" \ && sys_walk_mod_add "$device" @@ -473,6 +473,26 @@ dep_add_modules() fi done + # Sys walk graphics for machines that don't have a generic framebuffer + # device and wouldn't have a working video console otherwise. + walk_graphics=yes + for device in /sys/bus/platform/drivers/efi-framebuffer/* \ + /sys/bus/platform/drivers/platform-framebuffer/* \ + /sys/bus/platform/drivers/simple-framebuffer/* \ + /sys/bus/platform/drivers/vesa-framebuffer/*; do + if [ -d "$device" ]; then + walk_graphics=no + break + fi + done + + if [ "$walk_graphics" = "yes" ]; then + for device in /sys/class/graphics/*; do + device="$(readlink -f "$device")" \ + && sys_walk_mod_add "$device" + done + fi + # catch old-style IDE if [ -e /sys/bus/ide/devices/ ]; then modules="$modules ide-gd_mod ide-cd" @@ -503,6 +523,10 @@ dep_add_modules() modules="$modules sunvnet sunvdc" fi + if [ -e /sys/devices/platform/edp-panel ]; then + sys_walk_mod_add /sys/devices/platform/edp-panel + fi + # shellcheck disable=SC2086 manual_add_modules $modules } @@ -514,7 +538,7 @@ auto_add_modules() local modules= if [ "$#" -eq 0 ] ; then - set -- base net ide scsi block ata i2o dasd ieee1394 firewire mmc usb_storage + set -- base net ide scsi block ata i2o dasd ieee1394 firewire mmc usb_storage fb fi for arg in "$@" ; do @@ -625,6 +649,10 @@ auto_add_modules() usb_storage) copy_modules_dir kernel/drivers/usb/storage ;; + fb) + # For machines that don't have a generic framebuffer device. + modules="$modules rockchipdrm pwm-cros-ec pwm_bl panel-simple" + ;; esac done -- GitLab From afd266856ae4ccfdf6169fc5d8a4e2fcba81e77d Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Sun, 27 Oct 2019 14:33:39 +0000 Subject: [PATCH 142/213] debian/tests/control: Mark shellcheck test as superficial Running a static checker is not a substitute for proper integration tests, which are still TBD. Signed-off-by: Ben Hutchings --- debian/tests/control | 1 + 1 file changed, 1 insertion(+) diff --git a/debian/tests/control b/debian/tests/control index ab19b6c..38b6014 100644 --- a/debian/tests/control +++ b/debian/tests/control @@ -1,2 +1,3 @@ Tests: shellcheck Depends: @, shellcheck +Restrictions: superficial -- GitLab From e34affa66e8aa70531cce41bb32b3e8b937a0f50 Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Mon, 18 Nov 2019 14:02:14 +0300 Subject: [PATCH 143/213] Don't require build dependency on shellcheck when nocheck profile is enabled --- debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/control b/debian/control index ebeea3f..53e243d 100644 --- a/debian/control +++ b/debian/control @@ -3,7 +3,7 @@ Section: utils Priority: optional Uploaders: Michael Prokop , Ben Hutchings Maintainer: Debian kernel team -Build-Depends: debhelper (>= 9), bash-completion, shellcheck +Build-Depends: debhelper (>= 9), bash-completion, shellcheck Rules-Requires-Root: no Standards-Version: 4.1.5 Vcs-Browser: https://salsa.debian.org/kernel-team/initramfs-tools -- GitLab From e2ad678998504a27e50e6e753cf7202c28e90343 Mon Sep 17 00:00:00 2001 From: Johannes 'josch' Schauer Date: Sun, 17 Nov 2019 19:53:33 +0000 Subject: [PATCH 144/213] hook-functions: preloaded libraries should not end up in the initramfs Closes: #944929 --- hook-functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hook-functions b/hook-functions index 9d1b92d..0cba5c9 100644 --- a/hook-functions +++ b/hook-functions @@ -183,7 +183,7 @@ copy_exec() { copy_file binary "${src}" "${target}" || return $(($? - 1)) # Copy the dependant libraries - for x in $(ldd "${src}" 2>/dev/null | sed -e ' + for x in $(env --unset=LD_PRELOAD ldd "${src}" 2>/dev/null | sed -e ' /\//!d; /linux-gate/d; /=>/ {s/.*=>[[:blank:]]*\([^[:blank:]]*\).*/\1/}; -- GitLab From a1e17fcc02ca4661ea0ac862173623068cd11795 Mon Sep 17 00:00:00 2001 From: Debian Janitor Date: Tue, 10 Dec 2019 05:51:16 +0000 Subject: [PATCH 145/213] Bump debhelper from old 9 to 12. Fixes lintian: package-uses-old-debhelper-compat-version See https://lintian.debian.org/tags/package-uses-old-debhelper-compat-version.html for more details. --- debian/compat | 2 +- debian/control | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/compat b/debian/compat index ec63514..48082f7 100644 --- a/debian/compat +++ b/debian/compat @@ -1 +1 @@ -9 +12 diff --git a/debian/control b/debian/control index 53e243d..97d4882 100644 --- a/debian/control +++ b/debian/control @@ -3,7 +3,7 @@ Section: utils Priority: optional Uploaders: Michael Prokop , Ben Hutchings Maintainer: Debian kernel team -Build-Depends: debhelper (>= 9), bash-completion, shellcheck +Build-Depends: debhelper (>= 12~), bash-completion, shellcheck Rules-Requires-Root: no Standards-Version: 4.1.5 Vcs-Browser: https://salsa.debian.org/kernel-team/initramfs-tools -- GitLab From 4d86d1a99a781a128c6a0a9c01b3ec0053ca29ad Mon Sep 17 00:00:00 2001 From: Debian Janitor Date: Tue, 10 Dec 2019 05:51:36 +0000 Subject: [PATCH 146/213] Set debhelper-compat version in Build-Depends. Fixes lintian: uses-debhelper-compat-file See https://lintian.debian.org/tags/uses-debhelper-compat-file.html for more details. --- debian/compat | 1 - debian/control | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) delete mode 100644 debian/compat diff --git a/debian/compat b/debian/compat deleted file mode 100644 index 48082f7..0000000 --- a/debian/compat +++ /dev/null @@ -1 +0,0 @@ -12 diff --git a/debian/control b/debian/control index 97d4882..3d5bec0 100644 --- a/debian/control +++ b/debian/control @@ -3,7 +3,7 @@ Section: utils Priority: optional Uploaders: Michael Prokop , Ben Hutchings Maintainer: Debian kernel team -Build-Depends: debhelper (>= 12~), bash-completion, shellcheck +Build-Depends: debhelper-compat (= 12), bash-completion, shellcheck Rules-Requires-Root: no Standards-Version: 4.1.5 Vcs-Browser: https://salsa.debian.org/kernel-team/initramfs-tools -- GitLab From 9d8b6908a246877fc00e7f516d5320792ef85402 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Mon, 6 Jan 2020 09:05:26 +0000 Subject: [PATCH 147/213] mkinitramfs: Remove workaround for old udev versions Remove the temporary hack introduced by commit ab9130667d42 "init: Take over handling of rootdelay parameter from udev boot script". Signed-off-by: Ben Hutchings --- mkinitramfs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/mkinitramfs b/mkinitramfs index c5fa7b3..d27df5d 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -357,10 +357,6 @@ fi run_scripts /usr/share/initramfs-tools/hooks run_scripts "${CONFDIR}"/hooks -# Avoid double sleep when using older udev scripts -# shellcheck disable=SC2016 -sed -i 's/^\s*sleep \$ROOTDELAY$/:/' "${DESTDIR}/scripts/init-top/udev" - # cache boot run order for b in $(cd "${DESTDIR}/scripts" && find . -mindepth 1 -type d); do cache_run_scripts "${DESTDIR}" "/scripts/${b#./}" -- GitLab From 2b55aca6a548486970e17a04395a1f9f451b03fb Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Mon, 6 Jan 2020 09:11:03 +0000 Subject: [PATCH 148/213] mkinitramfs: Remove special case for Arm OABI ports This reverts commit 879602b218973fc7a5f92874bbaf41ea818fae31. The arm (OABI little-endian) port was replaced by armel and was last released in Debian 5.0. The armeb (OABI big-endian) port never made it into a Debian release and has died off completely. Signed-off-by: Ben Hutchings --- mkinitramfs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/mkinitramfs b/mkinitramfs index d27df5d..f6ab380 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -349,11 +349,6 @@ for file in /etc/modprobe.d/*.conf /lib/modprobe.d/*.conf ; do fi done -# workaround: libgcc always needed on old-abi arm -if [ "$DPKG_ARCH" = arm ] || [ "$DPKG_ARCH" = armeb ]; then - cp -a /lib/libgcc_s.so.1 "${DESTDIR}/lib/" -fi - run_scripts /usr/share/initramfs-tools/hooks run_scripts "${CONFDIR}"/hooks -- GitLab From a9e5169fbf673d18a271214bd691073611393404 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Tue, 7 Jan 2020 02:35:28 +0000 Subject: [PATCH 149/213] mkinitramfs: Remove armhf dynamic linker hack MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit da64d1a11ca8680e69d67c192b8d6e60be6411ee, which was a workaround for the inconsistent choices of interpreter path in the early days of armhf and the limitations of copy_file at the time. Now that copy_file automatically replicates symlinks and their targets, we don't need to do anything special about the dynamic linker. An initramfs built for Debian 10 on armhf currently contains: /lib/arm-linux-gnueabihf/ld-2.28.so regular file /lib/arm-linux-gnueabihf/ld-linux-armhf.so.3 link to ld-2.28.so /lib/arm-linux-gnueabihf/ld-linux.so.3 link to /lib/ld-linux-armhf.so.3 /lib/ld-linux-armhf.so.3 regular file There are two *copies* of the dynamic linker as well as two symlinks to one or the other of them. After this commit, the initramfs contains: /lib/arm-linux-gnueabihf/ld-2.28.so regular file /lib/arm-linux-gnueabihf/ld-linux-armhf.so.3 link to ld-2.28.so /lib/ld-linux-armhf.so.3 link to arm-linux-gnueabihf/ld-2.28.so The /lib/…/ld-linux.so.3 symlink is no longer created, because Debian armhf binaries all use /lib/ld-linux-armhf.so.3 as the interpreter path, but it would be created if we ever switched over. Signed-off-by: Ben Hutchings --- mkinitramfs | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/mkinitramfs b/mkinitramfs index f6ab380..26be331 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -384,18 +384,6 @@ if [ ! -e "${DESTDIR}/bin/sh" ]; then copy_exec /bin/sh "${DESTDIR}/bin/" fi -# dirty hack for armhf's double-linker situation; if we have one of -# the two known eglibc linkers, nuke both and re-create sanity -if [ "$DPKG_ARCH" = armhf ]; then - if [ -e "${DESTDIR}/lib/arm-linux-gnueabihf/ld-linux.so.3" ] || \ - [ -e "${DESTDIR}/lib/ld-linux-armhf.so.3" ]; then - rm -f "${DESTDIR}/lib/arm-linux-gnueabihf/ld-linux.so.3" - rm -f "${DESTDIR}/lib/ld-linux-armhf.so.3" - cp -aL /lib/ld-linux-armhf.so.3 "${DESTDIR}/lib/" - ln -sf /lib/ld-linux-armhf.so.3 "${DESTDIR}/lib/arm-linux-gnueabihf/ld-linux.so.3" - fi -fi - [ "${verbose}" = y ] && echo "Building cpio ${outfile} initramfs" if [ -s "${__TMPEARLYCPIO}" ]; then -- GitLab From 4df27e2cc6527d3b462ba7f22da465a662712f31 Mon Sep 17 00:00:00 2001 From: Romain Perier Date: Wed, 8 Jan 2020 19:12:12 +0100 Subject: [PATCH 150/213] hook-functions: Add f2fs as base in auto_add_modules For people wanting to change their filesystem to F2FS or for embedded devices with eMMC or sdcard, add the f2fs module and its dependency as base module. Moreover, this adds "crc32" as hidden dependency module for f2fs. --- hook-functions | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hook-functions b/hook-functions index 0cba5c9..fa1fe59 100644 --- a/hook-functions +++ b/hook-functions @@ -544,7 +544,7 @@ auto_add_modules() for arg in "$@" ; do case "$arg" in base) - modules="$modules btrfs ext2 ext3 ext4 ext4dev " + modules="$modules btrfs ext2 ext3 ext4 ext4dev f2fs" modules="$modules isofs jfs reiserfs udf xfs" modules="$modules nfs nfsv2 nfsv3 nfsv4" modules="$modules af_packet atkbd i8042 psmouse" @@ -686,6 +686,9 @@ hidden_dep_add_modules() btrfs) echo crc32c ;; + f2fs) + echo crc32 + ;; mlx4_core) echo mlx4_ib ;; -- GitLab From 0db57528703c2e2c58e1e23efd097046e8a29f83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Mon, 13 Jan 2020 18:16:20 +0100 Subject: [PATCH 151/213] Do not copy SELinux context in mkinitramfs (Closes: #948365) Instead use the default one with option 'Z'. --- mkinitramfs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkinitramfs b/mkinitramfs index 26be331..66d6493 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -362,7 +362,7 @@ depmod -a -b "${DESTDIR}" "${version}" rm -f "${DESTDIR}/lib/modules/${version}"/modules.*map # make sure that library search path is up to date -cp -ar /etc/ld.so.conf* "$DESTDIR"/etc/ +cp -aZ /etc/ld.so.conf* "$DESTDIR"/etc/ if ! ldconfig -r "$DESTDIR" ; then [ "$(id -u)" != "0" ] \ && echo "ldconfig might need uid=0 (root) for chroot()" >&2 -- GitLab From b19b6f3bad9afd0c399a5b216fab138597c2d414 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Sat, 18 Jan 2020 15:04:42 +0000 Subject: [PATCH 152/213] debian/rules: Suppress execution of dh_installinitramfs debhelper 12 wants to run dh_installinitramfs, but we don't want this - in particular, because it makes initramfs-tools-core's maintainer scripts run update-initramfs. Signed-off-by: Ben Hutchings --- debian/rules | 3 +++ 1 file changed, 3 insertions(+) diff --git a/debian/rules b/debian/rules index 97a16df..42ad0d3 100755 --- a/debian/rules +++ b/debian/rules @@ -20,6 +20,9 @@ override_dh_install: chmod 755 debian/initramfs-tools-core/usr/sbin/mkinitramfs dh_install +override_dh_installinitramfs: + @: + override_dh_auto_test: ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) shellcheck -e SC1090,SC1091 -s dash hook-functions $$(find hooks scripts -type f) $$({ find . -maxdepth 1 -type f -executable; find debian -maxdepth 1 -type f; find docs kernel -type f; } | xargs grep -l '^#!/bin/sh') -- GitLab From 55afeec83980546928c5b9506d2ae67c6e7a6053 Mon Sep 17 00:00:00 2001 From: Topi Miettinen Date: Sat, 18 Jan 2020 15:16:10 +0000 Subject: [PATCH 153/213] Tighten permissions for /run/initramfs /run/initramfs contains a log file from fsck of root file system, which could perhaps contain sensitive information, for example if /home or /var are also located there and fsck is triggered. Let's tighten the permissions to 0700. Signed-off-by: Topi Miettinen --- init | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init b/init index 1cc96c3..330a510 100755 --- a/init +++ b/init @@ -208,7 +208,7 @@ else fi mount -t tmpfs -o "nodev,noexec,nosuid,size=${RUNSIZE:-10%},mode=0755" tmpfs /run -mkdir -m 0755 /run/initramfs +mkdir -m 0700 /run/initramfs if [ -n "$log_output" ]; then exec >$log_output 2>&1 -- GitLab From 8330bcde702415062c36f85667a9a35ef221b0c4 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Sat, 18 Jan 2020 15:31:05 +0000 Subject: [PATCH 154/213] mkinitramfs: Use cp -p option for ld.so.conf* instead of -aZ This is consistent with all the other copies into the initramfs. Signed-off-by: Ben Hutchings --- mkinitramfs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkinitramfs b/mkinitramfs index 66d6493..2382eb6 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -362,7 +362,7 @@ depmod -a -b "${DESTDIR}" "${version}" rm -f "${DESTDIR}/lib/modules/${version}"/modules.*map # make sure that library search path is up to date -cp -aZ /etc/ld.so.conf* "$DESTDIR"/etc/ +cp -pPr /etc/ld.so.conf* "$DESTDIR"/etc/ if ! ldconfig -r "$DESTDIR" ; then [ "$(id -u)" != "0" ] \ && echo "ldconfig might need uid=0 (root) for chroot()" >&2 -- GitLab From 15fd713e73d6a89d63bf7bdc4c6bfccb409f1cec Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Sat, 18 Jan 2020 15:35:50 +0000 Subject: [PATCH 155/213] initramfs-tools(7): Change example to use copy_exec instead of cp Executables should always be installed into the initramfs with copy_exec. Signed-off-by: Ben Hutchings --- initramfs-tools.7 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/initramfs-tools.7 b/initramfs-tools.7 index 45b7de7..a36b50a 100644 --- a/initramfs-tools.7 +++ b/initramfs-tools.7 @@ -516,7 +516,7 @@ if [ ! \-x "/sbin/frobnicate" ]; then fi force_load frobnicator interval=10 -cp /sbin/frobnicate "${DESTDIR}/sbin" +copy_exec /sbin/frobnicate /sbin exit 0 .fi .RE -- GitLab From c2d589e0aa67a6d7a5b976d8fd217d92f121bf1f Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Sat, 18 Jan 2020 15:38:44 +0000 Subject: [PATCH 156/213] Revert "mkinitramfs: check if initramfs has a shell" This reverts commit 9c823ad2b3284a6bd5cfbdfdd699d3e033cadd3f. It did not solve the problem it was intended to, because it used "$DESTDIR" in the destination argument to copy_exec and would therefore copy to /var/tmp/ inside the initramfs. Signed-off-by: Ben Hutchings --- mkinitramfs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/mkinitramfs b/mkinitramfs index 2382eb6..1ab7f66 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -379,11 +379,6 @@ if [ -e "${CONFDIR}/DSDT.aml" ]; then copy_file DSDT "${CONFDIR}/DSDT.aml" fi -# Make sure there is a final sh in initramfs -if [ ! -e "${DESTDIR}/bin/sh" ]; then - copy_exec /bin/sh "${DESTDIR}/bin/" -fi - [ "${verbose}" = y ] && echo "Building cpio ${outfile} initramfs" if [ -s "${__TMPEARLYCPIO}" ]; then -- GitLab From 835d58417a123948c73c428180ec7bc32fc11080 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Sat, 18 Jan 2020 15:44:32 +0000 Subject: [PATCH 157/213] mkinitramfs: Copy modules.builtin.bin into initramfs modinfo now prints an error message if modules.builtin.bin (created by depmod) is missing. Copy it in early if it's present. Closes: #948257 Signed-off-by: Ben Hutchings --- mkinitramfs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mkinitramfs b/mkinitramfs index 1ab7f66..1b67a96 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -262,7 +262,9 @@ for d in conf/conf.d etc run scripts ${MODULESDIR}; do done # Copy in modules.builtin and modules.order (not generated by depmod) -for x in modules.builtin modules.order; do +# and modules.builtin.bin (generated by depmod, but too late to avoid +# error messages as in #948257) +for x in modules.builtin modules.builtin.bin modules.order; do if [ -f "${MODULESDIR}/${x}" ]; then cp -p "${MODULESDIR}/${x}" "${DESTDIR}${MODULESDIR}/${x}" fi -- GitLab From 00129773613c52129cb660e75904c900f16140d0 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Sat, 18 Jan 2020 15:47:23 +0000 Subject: [PATCH 158/213] init: Remove special case for kernel parameter resume=UUID=... This reverts commit 9f7bb9c72b5a50c0fbcd5f501072d3ff5aab91c4. All the keyword=value forms for block device naming are now handled in resolve_device. Related-to: #944777 Signed-off-by: Ben Hutchings --- init | 4 ---- 1 file changed, 4 deletions(-) diff --git a/init b/init index 330a510..e60ac11 100755 --- a/init +++ b/init @@ -122,10 +122,6 @@ for x in $(cat /proc/cmdline); do ;; resume=*) RESUME="${x#resume=}" - case $RESUME in - UUID=*) - RESUME="/dev/disk/by-uuid/${RESUME#UUID=}" - esac ;; resume_offset=*) resume_offset="${x#resume_offset=}" -- GitLab From 897ab776458b85784a8c4ec366465c98d153d498 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Sat, 18 Jan 2020 16:13:11 +0000 Subject: [PATCH 159/213] update-initramfs: Make "-c -k all" options useful again "update-initramfs -c -k all" used to re-create initramfs images if they had been deleted without using "update-initramfs -d", as it used the state directory to determine which kernel versions should have them. Since commit f39625a "update-initramfs: Make "-k all" take over other initramfs images", it ignores the state directory and is almost equivalent to "update-initramfs -u -k all". Change it to operate on all installed kernel versions. This will ignore which kernel versions suppressed initramfs generation, but I think it's reasonable to assume users won't use these options if they have installed such kernels. Closes: #926401 Signed-off-by: Ben Hutchings --- update-initramfs | 9 ++++++++- update-initramfs.8 | 7 ++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/update-initramfs b/update-initramfs index 0b2d0b3..3c1d9c4 100755 --- a/update-initramfs +++ b/update-initramfs @@ -388,7 +388,14 @@ fi if [ "${version}" = "all" ] \ || { [ "${update_initramfs}" = "all" ] && [ -z "${version}" ]; }; then - get_sorted_versions + case "${mode}" in + c) + version_list="$(linux-version list)" + ;; + d | u) + get_sorted_versions + ;; + esac if [ -z "${version_list}" ]; then verbose "Nothing to do, exiting." exit 0 diff --git a/update-initramfs.8 b/update-initramfs.8 index 1047965..b36fc57 100644 --- a/update-initramfs.8 +++ b/update-initramfs.8 @@ -35,10 +35,11 @@ This argument is optional for update. The default is the latest kernel version. The use of "all" for the .I version -string specifies +string specifies that .B update\-initramfs -to execute the chosen action for all installed kernel versions that already -have an initramfs. +should operate on all installed kernel versions (with \fB\-c\fR), or +on all installed kernel versions that already have an initramfs +(with \fB\-d\fR or \fB\-u\fR). .TP \fB\-c -- GitLab From d6c6eeca3540d18f5bce95b5ffcb1823ab3050ea Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Sat, 18 Jan 2020 16:38:41 +0000 Subject: [PATCH 160/213] init: Mount /dev with "exec" option if v86d is present v86d currently maps parts of /dev/mem as executable, even though it may use an emulator. For now, only mount /dev with the "noexec" option if it's not present. Closes: #940171 Signed-off-by: Ben Hutchings --- init | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/init b/init index e60ac11..2855753 100755 --- a/init +++ b/init @@ -33,7 +33,8 @@ export quiet # Note that this only becomes /dev on the real filesystem if udev's scripts # are used; which they will be, but it's worth pointing out -mount -t devtmpfs -o noexec,nosuid,mode=0755 udev /dev +test -x /usr/sbin/v86d && dev_exec="exec" || dev_exec="noexec" +mount -t devtmpfs -o $dev_exec,nosuid,mode=0755 udev /dev mkdir /dev/pts mount -t devpts -o noexec,nosuid,gid=5,mode=0620 devpts /dev/pts || true -- GitLab From a9e73b5df9c85c391c35ed2900d7eb75abd8d7b1 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Sat, 18 Jan 2020 17:11:32 +0000 Subject: [PATCH 161/213] hook-functions: Drop ext4dev from filesystem module list This is obsolete since Linux 2.6.28. Signed-off-by: Ben Hutchings --- hook-functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hook-functions b/hook-functions index fa1fe59..925a332 100644 --- a/hook-functions +++ b/hook-functions @@ -544,7 +544,7 @@ auto_add_modules() for arg in "$@" ; do case "$arg" in base) - modules="$modules btrfs ext2 ext3 ext4 ext4dev f2fs" + modules="$modules btrfs ext2 ext3 ext4 f2fs" modules="$modules isofs jfs reiserfs udf xfs" modules="$modules nfs nfsv2 nfsv3 nfsv4" modules="$modules af_packet atkbd i8042 psmouse" -- GitLab From 41d9ceb31022027bade8f3c14114ee607c154cb5 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Sat, 18 Jan 2020 17:36:12 +0000 Subject: [PATCH 162/213] mkinitramfs: Enable multihreaded xz compression Enable multithreading across all CPUs. Don't change the compression level as suggested, though. Users who still want faster compression should choose a different compressor. Closes: #942144 Signed-off-by: Ben Hutchings --- mkinitramfs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mkinitramfs b/mkinitramfs index 1b67a96..bb902f8 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -185,7 +185,10 @@ gzip) # If we're doing a reproducible build, use gzip -n fi ;; lz4) compress="lz4 -9 -l" ;; -xz) compress="xz --check=crc32" ;; +xz) compress="xz --check=crc32" + # If we're not doing a reproducible build, enable multithreading + test -z "${SOURCE_DATE_EPOCH}" && compress="$compress --threads=0" + ;; bzip2|lzma|lzop) # no parameters needed ;; -- GitLab From 21edcb0b36e0368bb1a19a7ea95a443f81844501 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Sat, 18 Jan 2020 18:51:12 +0000 Subject: [PATCH 163/213] Releasing version 0.136. Signed-off-by: Ben Hutchings --- debian/changelog | 52 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/debian/changelog b/debian/changelog index e5ea007..3bed4ce 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,55 @@ +initramfs-tools (0.136) unstable; urgency=medium + + [ Mathieu Malaterre ] + * [90bd459] Update to new name for kernel module therm_pm72 + + [ Alper Nebi Yasak ] + * [ded7214] hook-functions: Handle dw_mmc-rockchip hidden dependency on + rockchip-io-domain + * [da85190] hook-functions: Include modules for Chromebook Plus display + + [ Ben Hutchings ] + * [afd2668] debian/tests/control: Mark shellcheck test as superficial + * [9d8b690] mkinitramfs: Remove workaround for old udev versions + * [2b55aca] mkinitramfs: Remove special case for Arm OABI ports + * [a9e5169] mkinitramfs: Remove armhf dynamic linker hack + * [b19b6f3] debian/rules: Suppress execution of dh_installinitramfs + * [8330bcd] mkinitramfs: Use cp -p option for ld.so.conf* instead of -aZ + * [15fd713] initramfs-tools(7): Change example to use copy_exec instead of cp + * [c2d589e] Revert "mkinitramfs: check if initramfs has a shell" + * [835d584] mkinitramfs: Copy modules.builtin.bin into initramfs + (Closes: #948257) + * [0012977] init: Remove special case for kernel parameter resume=UUID=... + * [897ab77] update-initramfs: Make "-c -k all" options useful again + (Closes: #926401) + * [d6c6eec] init: Mount /dev with "exec" option if v86d is present + (Closes: #940171) + * [a9e73b5] hook-functions: Drop ext4dev from filesystem module list + * [41d9ceb] mkinitramfs: Enable multihreaded xz compression (Closes: #942144) + + [ Alexander Volkov ] + * [e34affa] Don't require build dependency on shellcheck when nocheck profile + is enabled + + [ Johannes 'josch' Schauer ] + * [e2ad678] hook-functions: preloaded libraries should not end up in the + initramfs (Closes: #944929) + + [ Debian Janitor ] + * [a1e17fc] Bump debhelper from old 9 to 12. + * [4d86d1a] Set debhelper-compat version in Build-Depends. + + [ Romain Perier ] + * [4df27e2] hook-functions: Add f2fs as base in auto_add_modules + + [ Christian Göttsche ] + * [0db5752] Do not copy SELinux context in mkinitramfs (Closes: #948365) + + [ Topi Miettinen ] + * [55afeec] Tighten permissions for /run/initramfs + + -- Ben Hutchings Sat, 18 Jan 2020 18:48:51 +0000 + initramfs-tools (0.135) unstable; urgency=medium [ Topi Miettinen ] -- GitLab From 1b28d253a9b757c49a8e17855efd8af426f761d9 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Thu, 30 Jan 2020 18:34:52 +0100 Subject: [PATCH 164/213] Document copy_exec as usable for shared libraries Signed-off-by: Ben Hutchings --- hook-functions | 4 ++-- initramfs-tools.7 | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/hook-functions b/hook-functions index 925a332..72c3674 100644 --- a/hook-functions +++ b/hook-functions @@ -170,7 +170,7 @@ copy_file() { cp -pP "${src}" "${DESTDIR}/${target}" || return $(($? + 1)) } -# $1 = executable to copy to initramfs, with library dependencies +# $1 = executable/shared library to copy to initramfs, with dependencies # $2 (optional) Name for the file on the initramfs # Location of the image dir is assumed to be $DESTDIR # We never overwrite the target if it exists. @@ -199,7 +199,7 @@ copy_exec() { x="${nonoptlib}" fi - copy_file library "${x}" || { + copy_file binary "${x}" || { ret=$? [ ${ret} = 1 ] || return $((ret - 1)) } diff --git a/initramfs-tools.7 b/initramfs-tools.7 index a36b50a..2d5d2d2 100644 --- a/initramfs-tools.7 +++ b/initramfs-tools.7 @@ -267,14 +267,14 @@ copy_modules_dir kernel/drivers/ata .RE .SS Including binaries -If you need to copy binaries to the initramfs module, a command like this -should be used: +If you need to copy an executable or shared library to the initramfs +module, use a command like this: .PP .RS copy_exec /sbin/mdadm /sbin .RE -mkinitramfs will automatically detect which libraries the executable depends on +mkinitramfs will automatically detect which libraries it depends on and copy them to the initramfs. This means that most executables, unless compiled with klibc, will automatically include glibc in the image which will increase its size by several hundred kilobytes. -- GitLab From f2ac13e8881f975b062a56050ceda85ef9ccc015 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Thu, 30 Jan 2020 19:18:25 +0100 Subject: [PATCH 165/213] hook-functions: copy_exec: Copy libgcc_s.so.0 along with libpthread.so pthread_cancel() in libpthread.so.1 depends on functions in libgcc_s.so.0, but uses dlopen() to link to it rather than having a static dependency. Handle this dynamic dependency in copy_exec so that it doesn't have to be handled in every affected hook script. Closes: #950254 Signed-off-by: Ben Hutchings --- hook-functions | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hook-functions b/hook-functions index 72c3674..884f820 100644 --- a/hook-functions +++ b/hook-functions @@ -199,6 +199,13 @@ copy_exec() { x="${nonoptlib}" fi + # Handle common dlopen() dependency (Debian bug #950254) + case "${x}" in + */libpthread.so.*) + copy_exec "${x%/*}/libgcc_s.so.1" || return + ;; + esac + copy_file binary "${x}" || { ret=$? [ ${ret} = 1 ] || return $((ret - 1)) -- GitLab From d96228a43a6d68963791daedbe104cffb9b18d15 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Thu, 30 Jan 2020 19:38:01 +0100 Subject: [PATCH 166/213] hook-functions: copy_exec: Correct verbose log message for symlinks It was logging the link target, not the name of the symlink. Signed-off-by: Ben Hutchings --- hook-functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hook-functions b/hook-functions index 884f820..6ff277c 100644 --- a/hook-functions +++ b/hook-functions @@ -152,7 +152,7 @@ copy_file() { esac if [ "${link_target}" != "${target}" ]; then - [ "${verbose?}" = "y" ] && echo "Adding ${type}-link ${src}" + [ "${verbose?}" = "y" ] && echo "Adding ${type}-link ${target}" # Create a relative link so it always points # to the right place -- GitLab From dd5fb3610b576c124ec6f22acc9494d44c06e6de Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Mon, 30 Mar 2020 00:01:11 +0100 Subject: [PATCH 167/213] hook-functions: Factor out device class walking into a function Signed-off-by: Ben Hutchings --- hook-functions | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/hook-functions b/hook-functions index 6ff277c..affe3a4 100644 --- a/hook-functions +++ b/hook-functions @@ -440,6 +440,16 @@ dep_add_modules_mount() block_dev_mod_add "$dev_node" } +class_add_modules() +{ + local device + + for device in "/sys/class/$1"/*; do + device="$(readlink -f "$device")" \ + && sys_walk_mod_add "$device" + done +} + dep_add_modules() { local device dev_node @@ -457,10 +467,7 @@ dep_add_modules() # sys walk some important device classes for class in backlight extcon gpio phy pwm regulator rtc; do - for device in "/sys/class/$class"/*; do - device="$(readlink -f "$device")" \ - && sys_walk_mod_add "$device" - done + class_add_modules "$class" done # clk, USB-PHY and pinctrl devices are outside the device model (!) so @@ -494,10 +501,7 @@ dep_add_modules() done if [ "$walk_graphics" = "yes" ]; then - for device in /sys/class/graphics/*; do - device="$(readlink -f "$device")" \ - && sys_walk_mod_add "$device" - done + class_add_modules graphics fi # catch old-style IDE -- GitLab From 14a00af217378aea834f2d7eb954568ace6bb00c Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Mon, 30 Mar 2020 00:03:02 +0100 Subject: [PATCH 168/213] hook-functions: Don't add backlight modules if we have generic fb device If we have a generic framebuffer device then there should be no need to set up any backlight in early boot. Also, backlight devices are sometimes handled by large drm drivers like i915 which we don't want to include by default. Fixes: da8519036860 ("hook-functions: Include modules for Chromebook ...") Signed-off-by: Ben Hutchings --- hook-functions | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hook-functions b/hook-functions index affe3a4..97a3407 100644 --- a/hook-functions +++ b/hook-functions @@ -466,7 +466,7 @@ dep_add_modules() fi # sys walk some important device classes - for class in backlight extcon gpio phy pwm regulator rtc; do + for class in extcon gpio phy pwm regulator rtc; do class_add_modules "$class" done @@ -501,6 +501,7 @@ dep_add_modules() done if [ "$walk_graphics" = "yes" ]; then + class_add_modules backlight class_add_modules graphics fi -- GitLab From f6133e19a8e264a81820078e7fb3f99d6d9f6020 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Tue, 28 Apr 2020 03:06:57 +0100 Subject: [PATCH 169/213] Fix new shellcheck warnings around unquoted parameter expansion These all seem to be harmless in practice, as the parameter values should not contain metacharacters. In _checkfs_once() *do not* quote $spinner or $force; if these are empty then we do not want to add arguments for them. Add a comment to suppress the warning. Signed-off-by: Ben Hutchings --- init | 2 +- scripts/functions | 2 ++ update-initramfs | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/init b/init index 2855753..43f6828 100755 --- a/init +++ b/init @@ -224,7 +224,7 @@ load_modules [ "$quiet" != "y" ] && log_end_msg if [ "$ROOTDELAY" ]; then - sleep $ROOTDELAY + sleep "$ROOTDELAY" fi maybe_break premount diff --git a/scripts/functions b/scripts/functions index ad900ca..db7c833 100644 --- a/scripts/functions +++ b/scripts/functions @@ -390,11 +390,13 @@ _checkfs_once() if [ "${quiet}" = n ] then log_begin_msg "Will now check $NAME file system" + # shellcheck disable=SC2086 logsave -a -s $FSCK_LOGFILE fsck $spinner $force $fix -V -t "$TYPE" "$DEV" FSCKCODE=$? log_end_msg else log_begin_msg "Checking $NAME file system" + # shellcheck disable=SC2086 logsave -a -s $FSCK_LOGFILE fsck $spinner $force $fix -T -t "$TYPE" "$DEV" FSCKCODE=$? log_end_msg diff --git a/update-initramfs b/update-initramfs index 3c1d9c4..063d865 100755 --- a/update-initramfs +++ b/update-initramfs @@ -173,7 +173,7 @@ run_bootloader() { # invoke policy conformant bootloader hooks if [ -d /etc/initramfs/post-update.d/ ]; then - run-parts --arg=${version} --arg=${initramfs} \ + run-parts --arg="${version}" --arg="${initramfs}" \ /etc/initramfs/post-update.d/ return 0 fi -- GitLab From 857042c99134cc2aa5d2959def37d0ae28cd555e Mon Sep 17 00:00:00 2001 From: AP Date: Tue, 28 Apr 2020 04:11:10 +0100 Subject: [PATCH 170/213] hook-functions: Search for firmware under /lib/firmware/updates I like to keep up with the official kernel releases. As a result the firmware they wind up requiring is newer than what is available in firmware packages. I placed the firmware from the git repo in /lib/firmware/updates/ which the kernel searches before /lib/firmware. Kernel can find them but update-initramfs cannot. I have attached an initial patch that solves this. I am currently using the resultng code and it is working fine for me. The one thing the patch does not do is allow for a custom location that can be provided to the kernel to search first. This is because that's a little more complicated and requires a decision wrt where to specify this location (ie the config file?). [bwh: Text above is from AP's bug report with minor edits; I added the subject line.] Closes: #956663 Signed-off-by: Ben Hutchings --- hook-functions | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/hook-functions b/hook-functions index 97a3407..188966e 100644 --- a/hook-functions +++ b/hook-functions @@ -53,7 +53,7 @@ add_modules_from_file() # Add dependent modules + eventual firmware manual_add_modules() { - local prefix kmod options firmware + local prefix kmod options firmware fwloc if [ $# -eq 0 ]; then return @@ -76,15 +76,19 @@ manual_add_modules() # Add required firmware for firmware in $(modinfo -k "${version}" -F firmware "${kmod}"); do - if [ -e "${DESTDIR}/lib/firmware/${firmware}" ] \ - || [ -e "${DESTDIR}/lib/firmware/${version}/${firmware}" ]; then + if [ -e "${DESTDIR}/lib/firmware/updates/${version}/${firmware}" ] \ + || [ -e "${DESTDIR}/lib/firmware/updates/${firmware}" ] \ + || [ -e "${DESTDIR}/lib/firmware/${version}/${firmware}" ] \ + || [ -e "${DESTDIR}/lib/firmware/${firmware}" ]; then continue fi # Only print warning for missing fw of loaded module # or forced loaded module - if [ ! -e "/lib/firmware/${firmware}" ] \ - && [ ! -e "/lib/firmware/${version}/${firmware}" ] ; then + if [ ! -e "/lib/firmware/updates/${version}/${firmware}" ] \ + && [ ! -e "/lib/firmware/updates/${firmware}" ] \ + && [ ! -e "/lib/firmware/${version}/${firmware}" ] \ + && [ ! -e "/lib/firmware/${firmware}" ]; then # Only warn about missing firmware if # /proc/modules exists if [ ! -e /proc/modules ] ; then @@ -99,12 +103,15 @@ manual_add_modules() continue fi - if [ -e "/lib/firmware/${version}/${firmware}" ]; then - copy_file firmware \ - "/lib/firmware/${version}/${firmware}" - else - copy_file firmware "/lib/firmware/${firmware}" - fi + for fwloc in "/lib/firmware/updates/${version}/${firmware}" \ + "/lib/firmware/updates/${firmware}" \ + "/lib/firmware/${version}/${firmware}" \ + "/lib/firmware/${firmware}"; do + if [ -e "$fwloc" ]; then + copy_file firmware "$fwloc" + break + fi + done done done } -- GitLab From b0987d4bce1f37b38e1be8510790046a3307fd1d Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Tue, 28 Apr 2020 18:24:37 +0100 Subject: [PATCH 171/213] Releasing version 0.137. Signed-off-by: Ben Hutchings --- debian/changelog | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/debian/changelog b/debian/changelog index 3bed4ce..db0d5f7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,23 @@ +initramfs-tools (0.137) unstable; urgency=medium + + [ Ben Hutchings ] + * [1b28d25] Document copy_exec as usable for shared libraries + * [f2ac13e] hook-functions: copy_exec: Copy libgcc_s.so.1 along with + libpthread.so.* (Closes: #950254) + * [d96228a] hook-functions: copy_exec: Correct verbose log message for + symlinks + * [dd5fb36] hook-functions: Factor out device class walking into a function + * [14a00af] hook-functions: Don't add backlight modules if we have generic + fb device (Closes: #955347) + * [f6133e1] Fix new shellcheck warnings around unquoted parameter expansion + (Closes: #958851) + + [ AP ] + * [857042c] hook-functions: Search for firmware under /lib/firmware/updates + (Closes: #956663) + + -- Ben Hutchings Tue, 28 Apr 2020 04:56:17 +0100 + initramfs-tools (0.136) unstable; urgency=medium [ Mathieu Malaterre ] -- GitLab From 0b034b47444976c9c92538bb5c835884ee1a0228 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Tue, 28 Apr 2020 18:32:46 +0100 Subject: [PATCH 172/213] docs/maintainer-notes.md: Delete the horizontal rules This is a short document and there is no need to break it up this much. Signed-off-by: Ben Hutchings --- docs/maintainer-notes.md | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/docs/maintainer-notes.md b/docs/maintainer-notes.md index 0f961ad..c529c0f 100644 --- a/docs/maintainer-notes.md +++ b/docs/maintainer-notes.md @@ -1,9 +1,5 @@ -*** - # Maintainer documentation for initramfs-tools -*** - ## Table of Contents * [1. Definitions](#definitions) @@ -19,14 +15,10 @@ * [7. Credits](#credits) * [8. License](#license) -*** - **NOTE:** The most recent version of this document is available at docs/maintainer-notes.md in the [the git repository](#checkout) or online at [salsa.debian.org](https://salsa.debian.org/kernel-team/initramfs-tools/blob/master/docs/maintainer-notes.md). -*** - ## 1. Definitions @@ -36,8 +28,6 @@ or online at [salsa.debian.org](https://salsa.debian.org/kernel-team/initramfs-t
$yourname:your fullname
-*** - ## 2. Preparations 1. Install required software: @@ -64,8 +54,6 @@ or online at [salsa.debian.org](https://salsa.debian.org/kernel-team/initramfs-t % git clone ssh://git@salsa.debian.org/kernel-team/initramfs-tools.git % cd initramfs-tools -*** - ## 3. Workflow for daily work ### 3.1 Implement new features @@ -137,8 +125,6 @@ any stale remote branches locally by executing: % gbp buildpackage --git-ignore-new --git-debian-branch="$(git branch | awk -F\*\ '/^* / { print $2}' )" --post-clean -*** - ### 3.4 Build snapshot version 1. Adjust debian/changelog accordingly: @@ -150,8 +136,6 @@ any stale remote branches locally by executing: % gbp buildpackage --git-debian-branch="$(git branch | awk -F\*\ '/^* / { print $2}' )" --post-clean [-us -uc] -*** - ## 4. Contribute 1. Create patch: @@ -167,8 +151,6 @@ any stale remote branches locally by executing: Discussion of features, bugs and patches are more than welcome on one of these lists. -*** - ## 5. Release new version 1. Creating changelog: @@ -202,8 +184,6 @@ any stale remote branches locally by executing: debian-kernel@lists.debian.org + kernel-team@lists.ubuntu.com - including a shortlog (generated through "git shortlog $TAG.."). -*** - ## 6. Resources * [initramfs-tools git web interface](https://salsa.debian.org/kernel-team/initramfs-tools) @@ -214,21 +194,13 @@ any stale remote branches locally by executing: * [bugreports @ ubuntu](https://bugs.launchpad.net/ubuntu/+source/initramfs-tools) * [qa page @ ubuntu](http://status.qa.ubuntu.com/qapkgstatus/initramfs-tools) -*** - ## 7. Credits * Thanks to Daniel Baumann for his "[Debian Packaging with Git](http://documentation.debian-projects.org/other/debian-packaging-git/)" which inspired this document. -*** - ## 8. License * This document is licensed under GPL v2 or any later version. -*** - *-- Michael Prokop <[mika@debian.org](mailto:mika@debian.org)>, Ben Hutchings <[ben@decadent.org.uk](mailto:ben@decadent.org.uk)>* - -*** -- GitLab From ba883cba3d7ab73e3fd899136edf89e40e46989e Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Tue, 28 Apr 2020 18:39:29 +0100 Subject: [PATCH 173/213] docs/maintainer-notes.md: Use Gitlab markup for table of contents Signed-off-by: Ben Hutchings --- docs/maintainer-notes.md | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/docs/maintainer-notes.md b/docs/maintainer-notes.md index c529c0f..3493382 100644 --- a/docs/maintainer-notes.md +++ b/docs/maintainer-notes.md @@ -1,19 +1,6 @@ # Maintainer documentation for initramfs-tools -## Table of Contents - -* [1. Definitions](#definitions) -* [2. Preparations](#preparations) -* [3. Workflow for daily work](#workflow) - * [3.1 Implement new features](#newfeature) - * [3.2 Merge branches](#merge) - * [3.3 Test specific branch](#test) - * [3.4 Build snapshot version](#snapshot) -* [4. Contribute](#contribute) -* [5. Release new version](#release) -* [6. Resources](#resources) -* [7. Credits](#credits) -* [8. License](#license) +[[_TOC_]] **NOTE:** The most recent version of this document is available at docs/maintainer-notes.md in the [the git repository](#checkout) -- GitLab From 5284a00d62559271c7c949f013a06c61dcc227c7 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Tue, 28 Apr 2020 18:40:05 +0100 Subject: [PATCH 174/213] docs/maintainer-notes.md: Use Gitlab markup for definition table This requires a heading row, so add one. Signed-off-by: Ben Hutchings --- docs/maintainer-notes.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/maintainer-notes.md b/docs/maintainer-notes.md index 3493382..367096a 100644 --- a/docs/maintainer-notes.md +++ b/docs/maintainer-notes.md @@ -8,12 +8,12 @@ or online at [salsa.debian.org](https://salsa.debian.org/kernel-team/initramfs-t ## 1. Definitions - - - - - -
$mailaddress:mailaddress of the user
$username:name of the Salsa account
$version:version string
$yourname:your fullname
+| Name | Meaning | +| --- | --- | +| **`$mailaddress`** | mailaddress of the user | +| **`$username`** | name of the Salsa account | +| **`$version`** | version string | +| **`$yourname`** | your fullname | ## 2. Preparations -- GitLab From a469b7ea945d79f8d1e6b01a39934f367dc9d5ce Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Tue, 28 Apr 2020 18:47:09 +0100 Subject: [PATCH 175/213] docs/maintainer-notes.md: Use archive.org URL for Daniel Baumann doc documentation.debian-projects.org seems to have gone away many years ago, but web.archive.org has a copy so link to that. Signed-off-by: Ben Hutchings --- docs/maintainer-notes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/maintainer-notes.md b/docs/maintainer-notes.md index 367096a..7116e59 100644 --- a/docs/maintainer-notes.md +++ b/docs/maintainer-notes.md @@ -183,7 +183,7 @@ any stale remote branches locally by executing: ## 7. Credits -* Thanks to Daniel Baumann for his "[Debian Packaging with Git](http://documentation.debian-projects.org/other/debian-packaging-git/)" which inspired this document. +* Thanks to Daniel Baumann for his "[Debian Packaging with Git](https://web.archive.org/web/20110528125600/http://documentation.debian-projects.org/other/debian-packaging-git/)" which inspired this document. ## 8. License -- GitLab From 424260e680843a1d3b2ac443271579391c69fdce Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Tue, 28 Apr 2020 18:51:26 +0100 Subject: [PATCH 176/213] debian/control, docs/maintainer-notes.md: Use my @debian.org address I'm now using benh@debian.org in debian/changelog, so make these consistent. Signed-off-by: Ben Hutchings --- debian/control | 2 +- docs/maintainer-notes.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/control b/debian/control index 3d5bec0..3768fad 100644 --- a/debian/control +++ b/debian/control @@ -1,7 +1,7 @@ Source: initramfs-tools Section: utils Priority: optional -Uploaders: Michael Prokop , Ben Hutchings +Uploaders: Michael Prokop , Ben Hutchings Maintainer: Debian kernel team Build-Depends: debhelper-compat (= 12), bash-completion, shellcheck Rules-Requires-Root: no diff --git a/docs/maintainer-notes.md b/docs/maintainer-notes.md index 7116e59..3b51046 100644 --- a/docs/maintainer-notes.md +++ b/docs/maintainer-notes.md @@ -190,4 +190,4 @@ any stale remote branches locally by executing: * This document is licensed under GPL v2 or any later version. *-- Michael Prokop <[mika@debian.org](mailto:mika@debian.org)>, -Ben Hutchings <[ben@decadent.org.uk](mailto:ben@decadent.org.uk)>* +Ben Hutchings <[benh@debian.org](mailto:benh@debian.org)>* -- GitLab From 482897b9a6001c69b16c651d4bc5b3a49a28d40f Mon Sep 17 00:00:00 2001 From: Vagrant Cascadian Date: Sat, 23 May 2020 17:25:35 -0700 Subject: [PATCH 177/213] hook-functions: Add modules needed for Pinebook LCD display. The Pinebook LCD disply does not show output until after the initramfs is loaded, which is too late to enter an encryption passphrase or debug issues with mounting the rootfs. Fix this by adding modules to "fb": analogix-anx6345, pwm-sun4i, sun4i-drm and sun8i-mixer. --- hook-functions | 1 + 1 file changed, 1 insertion(+) diff --git a/hook-functions b/hook-functions index 188966e..7a82b9c 100644 --- a/hook-functions +++ b/hook-functions @@ -671,6 +671,7 @@ auto_add_modules() fb) # For machines that don't have a generic framebuffer device. modules="$modules rockchipdrm pwm-cros-ec pwm_bl panel-simple" + modules="$modules analogix-anx6345 pwm-sun4i sun4i-drm sun8i-mixer" ;; esac done -- GitLab From c3cbf35505d1767189e6ae4b9d906bcf12275bb4 Mon Sep 17 00:00:00 2001 From: "Guilherme G. Piccoli" Date: Mon, 8 Jun 2020 18:38:52 -0300 Subject: [PATCH 178/213] scripts/functions: Prevents printf error carry over if wrong console is set Currently the _log_msg() functions is "void" typed - with no return -, which in terms of shell means it returns whatever its last command returns. This function is the basic building block for all error/warning messages in initramfs-tools. It was noticed [0] that in case of bad console is provided to kernel on command-line, printf (and apparently all write()-related functions) returns error, and so this error is carried over in _log_msg(). Happens that checkfs() function has a loop that runs forever in this scenario (*if* fsck is not present in initramfs, and obviously if "quiet" is not provided in the command-line). The situation is easily reproducible and we can find various reports dating back some years. The reports usually are of the form "machine can't boot if wrong console is provided" or slightly different forms of that, almost always relating serial consoles with boot issues. This patch proposes a pretty simple fix: return zero on _log_msg(). We should definitely not brake the boot due to error log functions; one could argue we could fix checkfs() and that's true, until eventually we find another subtle corner case of "misuse" of the _log_msg() return value (after some debugging), and fix that too, and so on... W could also argue that printf shouldn't return error in this case, and although a valid discussion, it's not worth to have users waiting on a dilemma while boot is quite easy to brake, just by passing a wrong kernel parameter (or having the underlying serial console device changed to output to a different port than the previously set on kernel cmdline). [0] bugs.launchpad.net/cloud-images/+bug/1573095/comments/46 Signed-off-by: Guilherme G. Piccoli --- scripts/functions | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/functions b/scripts/functions index db7c833..d8fb0ca 100644 --- a/scripts/functions +++ b/scripts/functions @@ -5,6 +5,7 @@ _log_msg() if [ "${quiet?}" = "y" ]; then return; fi # shellcheck disable=SC2059 printf "$@" + return 0 # Prevents error carry over in case of unavailable console } log_success_msg() -- GitLab From 3b8209947f08521a724e62067ffa64bfd3b77bf4 Mon Sep 17 00:00:00 2001 From: Unit 193 Date: Fri, 19 Jun 2020 05:11:08 -0400 Subject: [PATCH 179/213] When overriding configured compressor, warn the user. --- mkinitramfs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mkinitramfs b/mkinitramfs index bb902f8..29ead4d 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -171,8 +171,7 @@ unset COMPRESS if ! command -v "${compress}" >/dev/null 2>&1; then compress=gzip - [ "${verbose}" = y ] && \ - echo "No ${compress} in ${PATH}, using gzip" + echo "No ${compress} in ${PATH}, using gzip" fi case "${compress}" in -- GitLab From e94f410c71e90598b4fabca3970c7f282b5bd0a0 Mon Sep 17 00:00:00 2001 From: Norbert Lange Date: Wed, 29 Jul 2020 00:10:37 +0200 Subject: [PATCH 180/213] un-,mkinitramfs: add support for zstd Add support for zstd compression and decompression. Always use multithreaded compression, as zstd still generates identical archives. The zstd cmdline tool is usually able to decompress gzip, xz, lzma and lz4 so make sure to try the tool early. Signed-off-by: Norbert Lange --- conf/initramfs.conf | 2 +- mkinitramfs | 1 + unmkinitramfs | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/conf/initramfs.conf b/conf/initramfs.conf index dd76996..1d782f3 100644 --- a/conf/initramfs.conf +++ b/conf/initramfs.conf @@ -38,7 +38,7 @@ BUSYBOX=auto KEYMAP=n # -# COMPRESS: [ gzip | bzip2 | lz4 | lzma | lzop | xz ] +# COMPRESS: [ gzip | bzip2 | lz4 | lzma | lzop | xz | zstd ] # COMPRESS=gzip diff --git a/mkinitramfs b/mkinitramfs index bb902f8..d66a047 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -185,6 +185,7 @@ gzip) # If we're doing a reproducible build, use gzip -n fi ;; lz4) compress="lz4 -9 -l" ;; +zstd) compress="zstd -q -19 -T0" ;; xz) compress="xz --check=crc32" # If we're not doing a reproducible build, enable multithreading test -z "${SOURCE_DATE_EPOCH}" && compress="$compress --threads=0" diff --git a/unmkinitramfs b/unmkinitramfs index 3f8c75d..d1226c3 100755 --- a/unmkinitramfs +++ b/unmkinitramfs @@ -31,6 +31,8 @@ xcpio() if gzip -t "$archive" >/dev/null 2>&1 ; then gzip -c -d "$archive" + elif zstd -q -c -t "$archive" >/dev/null 2>&1 ; then + zstd -q -c -d "$archive" elif xzcat -t "$archive" >/dev/null 2>&1 ; then xzcat "$archive" elif lz4cat -t < "$archive" >/dev/null 2>&1 ; then -- GitLab From 181a35c05aef9c7a922dc7a50de2c60c866e4c23 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Tue, 1 Sep 2020 00:36:46 +0100 Subject: [PATCH 181/213] update-initramfs: Remove test for direct invocation from kernel package The direct invocation of update-initramfs in kernel package maintainer scripts was removed in: - Debian linux 2.6.39-1, thus in wheezy - Ubuntu linux 4.15.0-18.19 (I think), thus in bionic - kernel-package 12.001, thus in Debian squeeze and Ubuntu lucid Signed-off-by: Ben Hutchings --- kernel/postinst.d/initramfs-tools | 2 +- kernel/postrm.d/initramfs-tools | 2 +- update-initramfs | 22 ++++------------------ 3 files changed, 6 insertions(+), 20 deletions(-) diff --git a/kernel/postinst.d/initramfs-tools b/kernel/postinst.d/initramfs-tools index 5d02e57..6b6fef3 100755 --- a/kernel/postinst.d/initramfs-tools +++ b/kernel/postinst.d/initramfs-tools @@ -33,4 +33,4 @@ fi # we're good - create initramfs. update runs do_bootloader # shellcheck disable=SC2086 -INITRAMFS_TOOLS_KERNEL_HOOK=1 update-initramfs -c -k "${version}" ${bootopt} >&2 +update-initramfs -c -k "${version}" ${bootopt} >&2 diff --git a/kernel/postrm.d/initramfs-tools b/kernel/postrm.d/initramfs-tools index 471da86..c340beb 100755 --- a/kernel/postrm.d/initramfs-tools +++ b/kernel/postrm.d/initramfs-tools @@ -33,4 +33,4 @@ fi # delete initramfs # shellcheck disable=SC2086 -INITRAMFS_TOOLS_KERNEL_HOOK=1 update-initramfs -d -k "${version}" ${bootopt} >&2 +update-initramfs -d -k "${version}" ${bootopt} >&2 diff --git a/update-initramfs b/update-initramfs index 063d865..9d25c38 100755 --- a/update-initramfs +++ b/update-initramfs @@ -12,26 +12,12 @@ set -e [ -r ${CONF} ] && . ${CONF} -case "$DPKG_MAINTSCRIPT_PACKAGE" in -linux-image-*) - if [ -z "$INITRAMFS_TOOLS_KERNEL_HOOK" ]; then - # kernel maintainer script called us directly; ignore - # it and let the hook script handle it instead - echo "update-initramfs: deferring update (hook will be called later)" +if [ -n "$DPKG_MAINTSCRIPT_PACKAGE" ] && [ $# = 1 ] && [ x"$1" = x-u ]; then + if dpkg-trigger --no-await update-initramfs; then + echo "update-initramfs: deferring update (trigger activated)" exit 0 fi - ;; -?*) - if [ $# = 1 ] \ - && [ x"$1" = x-u ] - then - if dpkg-trigger --no-await update-initramfs; then - echo "update-initramfs: deferring update (trigger activated)" - exit 0 - fi - fi - ;; -esac +fi usage() { -- GitLab From 6ebe41b11b02277a161908c4b3f2fa9ed6c1b5df Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 25 Jul 2018 20:48:28 +0800 Subject: [PATCH 182/213] Remove obsolete update-initramfs state in /var/lib/initramfs-tools update-initramfs used to keep track of which initramfs images it created and "owned", to avoid overwriting the output of another coinstalled initramfs generator. As discussed in #765750, this is no longer a concern and the state checks have been removed. Now that I'm confident this hasn't caused a regression, also remove the state updates and the state directory. After this, there is no turning back: a downgrade will leave update-initramfs owning nothing. Signed-off-by: Ben Hutchings --- debian/initramfs-tools-core.dirs | 1 - debian/initramfs-tools-core.postinst | 5 +++++ update-initramfs | 15 --------------- 3 files changed, 5 insertions(+), 16 deletions(-) diff --git a/debian/initramfs-tools-core.dirs b/debian/initramfs-tools-core.dirs index 21f605c..8092c1b 100644 --- a/debian/initramfs-tools-core.dirs +++ b/debian/initramfs-tools-core.dirs @@ -14,4 +14,3 @@ usr/sbin usr/share/initramfs-tools/conf.d usr/share/initramfs-tools/conf-hooks.d usr/share/initramfs-tools/modules.d -/var/lib/initramfs-tools diff --git a/debian/initramfs-tools-core.postinst b/debian/initramfs-tools-core.postinst index 395e997..c4d7b75 100644 --- a/debian/initramfs-tools-core.postinst +++ b/debian/initramfs-tools-core.postinst @@ -40,4 +40,9 @@ if [ "$1" = configure ] && dpkg --compare-versions "$2" lt 0.123~; then finish_mv_conffile /etc/initramfs-tools/initramfs.conf initramfs-tools-core fi +# Remove obsolete state directory +if [ "$1" = configure ] && dpkg --compare-versions "$2" lt 0.138~; then + rm -rf /var/lib/initramfs-tools +fi + #DEBHELPER# diff --git a/update-initramfs b/update-initramfs index 9d25c38..dbd7ed6 100755 --- a/update-initramfs +++ b/update-initramfs @@ -1,6 +1,5 @@ #!/bin/sh -STATEDIR=/var/lib/initramfs-tools BOOTDIR=/boot CONF=/etc/initramfs-tools/update-initramfs.conf mode="" @@ -142,7 +141,6 @@ generate_initramfs() # shellcheck disable=SC2086 if mkinitramfs ${OPTS} "${initramfs}.new" "${version}"; then mv -f "${initramfs}.new" "${initramfs}" - set_sha1 # Guard against an unclean shutdown sync -f "${initramfs}" else @@ -165,17 +163,6 @@ run_bootloader() fi } -# Note that this must overwrite so that updates work. -set_sha1() -{ - sha1sum "${initramfs}" > "${STATEDIR}/${version}" -} - -delete_sha1() -{ - rm -f "${STATEDIR}/${version}" -} - # ro /boot is not modified ro_boot_check() { @@ -303,8 +290,6 @@ delete() echo "update-initramfs: Deleting ${initramfs}" - delete_sha1 - rm -f "${initramfs}" "${initramfs}.bak" } -- GitLab From 2f2ad0d2196b6a044e21117b8891eb2a0befdd59 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Fri, 15 May 2020 23:37:49 +0100 Subject: [PATCH 183/213] hook-functions: copy_exec: Copy libgcc_s.so with any soversion up to 9 hppa and m68k have higher soversions for libgcc_s.so, so copy libgcc_s.so.[1-9] instead of assuming soversion 1. (I considered copying libgcc_s.so.*, but I'm unsure whether that will ever match extra development files that we don't want.) Closes: #959768 Signed-off-by: Ben Hutchings --- hook-functions | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/hook-functions b/hook-functions index 7a82b9c..aa46383 100644 --- a/hook-functions +++ b/hook-functions @@ -209,7 +209,7 @@ copy_exec() { # Handle common dlopen() dependency (Debian bug #950254) case "${x}" in */libpthread.so.*) - copy_exec "${x%/*}/libgcc_s.so.1" || return + copy_libgcc "${x%/*}" || return ;; esac @@ -220,6 +220,15 @@ copy_exec() { done } +copy_libgcc() { + local libdir library + + libdir="$1" + for library in "${libdir}"/libgcc_s.so.[1-9]; do + copy_exec "${library}" || return + done +} + # Copy entire subtrees to the initramfs copy_modules_dir() { -- GitLab From 0f24cc1656e73ea2bb90e661c3d97741a27a8a65 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Sun, 6 Sep 2020 23:13:09 +0100 Subject: [PATCH 184/213] Add CI configuration for salsa.debian.org --- debian/salsa-ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 debian/salsa-ci.yml diff --git a/debian/salsa-ci.yml b/debian/salsa-ci.yml new file mode 100644 index 0000000..ac7bc44 --- /dev/null +++ b/debian/salsa-ci.yml @@ -0,0 +1,6 @@ +include: + - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/salsa-ci.yml + - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/pipeline-jobs.yml + +variables: + RELEASE: 'unstable' -- GitLab From 9877542bcf34fe2fa8b97eb08d93db876717f5e5 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Fri, 27 Jul 2018 11:08:32 +0800 Subject: [PATCH 185/213] initramfs.conf: Delete "NFS Section" comment There are no real sections in this file. Signed-off-by: Ben Hutchings --- conf/initramfs.conf | 4 ---- 1 file changed, 4 deletions(-) diff --git a/conf/initramfs.conf b/conf/initramfs.conf index 1d782f3..39874a8 100644 --- a/conf/initramfs.conf +++ b/conf/initramfs.conf @@ -43,10 +43,6 @@ KEYMAP=n COMPRESS=gzip -# -# NFS Section of the config. -# - # # DEVICE: ... # -- GitLab From 4309c3bcd97acdb17e250c56811faa9cfb4091fd Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Fri, 27 Jul 2018 11:21:20 +0800 Subject: [PATCH 186/213] Add FSTYPE config parameter to allow overriding filesystem type detection This is needed for testing, and should also be useful for building more generic initramfs images. Signed-off-by: Ben Hutchings --- conf/initramfs.conf | 9 +++++++++ hooks/fsck | 14 ++++++++++++-- initramfs.conf.5 | 6 ++++++ mkinitramfs | 1 + 4 files changed, 28 insertions(+), 2 deletions(-) diff --git a/conf/initramfs.conf b/conf/initramfs.conf index 39874a8..5e30c0c 100644 --- a/conf/initramfs.conf +++ b/conf/initramfs.conf @@ -66,3 +66,12 @@ NFSROOT=auto # RUNSIZE=10% + +# +# FSTYPE: ... +# +# The filesytem type(s) to support, or "auto" to use the current root +# filesystem type +# + +FSTYPE=auto diff --git a/hooks/fsck b/hooks/fsck index 5d2e94a..15127dd 100755 --- a/hooks/fsck +++ b/hooks/fsck @@ -64,8 +64,18 @@ get_fsck_type_fstab () { } get_fsck_types() { - get_fsck_type_fstab / root - get_fsck_type_fstab /usr /usr + if [ "${FSTYPE:-auto}" = auto ]; then + get_fsck_type_fstab / root + get_fsck_type_fstab /usr usr + else + local IFS=, + local fstype + set -f + for fstype in $FSTYPE; do + echo "$fstype" + done + set +f + fi } case $1 in diff --git a/initramfs.conf.5 b/initramfs.conf.5 index e227151..4615892 100644 --- a/initramfs.conf.5 +++ b/initramfs.conf.5 @@ -93,6 +93,12 @@ or is set to \fIauto\fP, will automatically select the largest available swap partition. Set it to \fInone\fP to disable resume from disk. +.TP +\fB FSTYPE +Specifies the filesystem type(s) to support, separated by commas. If +this is not defined or is set to \fIauto\fP, \fBmkinitramfs\fP will +automatically detect the current root and \fI/usr\fP filesystem types. + .SH VARIABLES FOR NFS BOOT .TP \fB DEVICE diff --git a/mkinitramfs b/mkinitramfs index 17d808e..3628990 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -247,6 +247,7 @@ export KEYMAP export MODULES export BUSYBOX export RESUME +export FSTYPE # Private, used by 'catenate_cpiogz'. export __TMPCPIOGZ -- GitLab From 6300aa109a7c8651a5e0c4d84ca10b363ddd5387 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Fri, 27 Jul 2018 16:24:55 +0800 Subject: [PATCH 187/213] Change "panic" parameter handling to work more like the kernel Negative timeout values are treated by the kernel as "reboot immediately" and 0 is treated as "wait forever". Emulate this behaviour in the panic() function. Treat invalid (non-numeric) values the same as 0, which seems to match what the kernel does. Previously we would ignore them completely and open a shell as normal. Signed-off-by: Ben Hutchings --- init | 5 ----- scripts/functions | 27 +++++++++++++++++++++++---- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/init b/init index 43f6828..3ad5579 100755 --- a/init +++ b/init @@ -135,11 +135,6 @@ for x in $(cat /proc/cmdline); do ;; panic=*) panic="${x#panic=}" - case ${panic} in - *[![:digit:].]*) - panic= - ;; - esac ;; ro) readonly=y diff --git a/scripts/functions b/scripts/functions index d8fb0ca..eccad66 100644 --- a/scripts/functions +++ b/scripts/functions @@ -42,11 +42,30 @@ panic() fi echo "$@" - # Disallow console access + + # The panic= parameter implies we should disallow console access if [ -n "${panic?}" ]; then - echo "Rebooting automatically due to panic= boot argument" - sleep "${panic}" - reboot -f + delay= + case "${panic?}" in + -*[![:digit:].]*) # invalid: wait forever + ;; + -*) # timeout < 0: reboot immediately + delay=0 + ;; + 0 | *[![:digit:].]*) # timeout = 0 or invalid: wait forever + ;; + *) # timeout > 0: seconds before rebooting + delay="${panic}" + ;; + esac + if [ -n "${delay}" ]; then + echo "Rebooting automatically due to panic= boot argument" + sleep "${delay}" + reboot -f + else + echo "Halting automatically due to panic= boot argument" + halt -f + fi exit # in case reboot fails, force kernel panic fi -- GitLab From 90d64bd8b9d58b42922882826d01913f6e8623e6 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Fri, 27 Jul 2018 13:56:48 +0800 Subject: [PATCH 188/213] debian/tests: Add common test preparation code This should allow implementing various test cases without too much repetition. Signed-off-by: Ben Hutchings --- debian/tests/test-common | 76 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 debian/tests/test-common diff --git a/debian/tests/test-common b/debian/tests/test-common new file mode 100644 index 0000000..9e3bb4a --- /dev/null +++ b/debian/tests/test-common @@ -0,0 +1,76 @@ +# -*- mode: sh -*- + +if [ -n "${AUTOPKGTEST_TMP}" ]; then + export TMPDIR="${AUTOPKGTEST_TMP}" +fi + +# Skeleton configuration directory +CONFDIR="$(mktemp -d)" +cp conf/initramfs.conf "${CONFDIR}/initramfs.conf" +echo "RESUME=none" >>"${CONFDIR}/initramfs.conf" +touch "${CONFDIR}/modules" +mkdir "${CONFDIR}/scripts" + +# initramfs image file +INITRAMFS="$(mktemp)" + +# root disk image file +ROOTDISK="$(mktemp)" + +# root disk interface type (for qemu) and device name (for Linux) +test -n "${ROOTDISK_QEMU_IF}" || ROOTDISK_QEMU_IF=virtio +test -n "${ROOTDISK_LINUX_NAME}" || ROOTDISK_LINUX_NAME=vda + +# Create a root fs with a trivial userspace +ROOTDIR="$(mktemp -d)" +INIT_MESSAGE='root fs init system started successfully' +for subdir in bin dev lib proc run sbin sys usr usr/bin; do + mkdir "${ROOTDIR}/${subdir}" +done +cat >"${ROOTDIR}/sbin/init" <&2 "E: Test must set LOCALVERSION to the kernel version suffix, e.g. -amd64" + exit 2 +fi +KVER="$(dpkg-query -Wf '${Depends}' "linux-image${LOCALVERSION}" | sed 's/^linux-image-//; s/ .*//')" + +# VM output file +OUTPUT="$(mktemp)" + +build_initramfs() { + /usr/sbin/mkinitramfs -d "${CONFDIR}" -o "${INITRAMFS}" "${KVER}" +} + +build_rootfs_ext2() { + # Get directory size + local blocks="$(du --summarize "${ROOTDIR}" | cut -f 1)" + local inodes="$(du --summarize --inodes "${ROOTDIR}" | cut -f 1)" + + # Add fudge factor + blocks="$((blocks + 20 + blocks / 4))" + inodes="$((inodes + 10))" + + # genext2fs writes status messages to stderr; hide that from + # autopkgtest + genext2fs 2>&1 -b "${blocks}" -N "${inodes}" -U -d "${ROOTDIR}" "${ROOTDISK}" +} + +run_qemu_amd64() { + timeout --foreground 60 qemu-system-x86_64 -m 1G -drive "file=${ROOTDISK},if=${ROOTDISK_QEMU_IF},media=disk,format=raw" -nographic -no-reboot -kernel "/boot/vmlinuz-${KVER}" -initrd "${INITRAMFS}" -append "root=/dev/${ROOTDISK_LINUX_NAME} ro console=ttyS0,115200 panic=-1 " | tee "${OUTPUT}" + grep -qF "${INIT_MESSAGE}" "${OUTPUT}" +} -- GitLab From 3dd298490b61c9bc163acbac8a56ed9568455bd9 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Fri, 27 Jul 2018 12:47:24 +0800 Subject: [PATCH 189/213] debian/tests: Add basic test for amd64 using klibc and not busybox Signed-off-by: Ben Hutchings --- debian/tests/amd64-klibc | 19 +++++++++++++++++++ debian/tests/control | 3 +++ 2 files changed, 22 insertions(+) create mode 100755 debian/tests/amd64-klibc diff --git a/debian/tests/amd64-klibc b/debian/tests/amd64-klibc new file mode 100755 index 0000000..8d89b9b --- /dev/null +++ b/debian/tests/amd64-klibc @@ -0,0 +1,19 @@ +#!/bin/sh -e + +LOCALVERSION=-amd64 +. debian/tests/test-common + +cat >>"${CONFDIR}/initramfs.conf" < Date: Fri, 27 Jul 2018 14:13:52 +0800 Subject: [PATCH 190/213] debian/tests: Add basic test for amd64 using busybox Signed-off-by: Ben Hutchings --- debian/tests/amd64-busybox | 19 +++++++++++++++++++ debian/tests/control | 3 +++ 2 files changed, 22 insertions(+) create mode 100755 debian/tests/amd64-busybox diff --git a/debian/tests/amd64-busybox b/debian/tests/amd64-busybox new file mode 100755 index 0000000..1daf998 --- /dev/null +++ b/debian/tests/amd64-busybox @@ -0,0 +1,19 @@ +#!/bin/sh -e + +LOCALVERSION=-amd64 +. debian/tests/test-common + +cat >>"${CONFDIR}/initramfs.conf" < Date: Fri, 27 Jul 2018 14:33:15 +0800 Subject: [PATCH 191/213] debian/tests: Add basic tests for amd64 with only ata/virtio driver For now, use MODULES=list. I want to test with MODULES=dep too, but that will require putting a Debian installation inside the VM so we can run mkinitramfs there. Signed-off-by: Ben Hutchings --- debian/tests/amd64-ata-only | 22 ++++++++++++++++++++++ debian/tests/amd64-virtio-only | 22 ++++++++++++++++++++++ debian/tests/control | 6 ++++++ 3 files changed, 50 insertions(+) create mode 100755 debian/tests/amd64-ata-only create mode 100755 debian/tests/amd64-virtio-only diff --git a/debian/tests/amd64-ata-only b/debian/tests/amd64-ata-only new file mode 100755 index 0000000..7daa9e5 --- /dev/null +++ b/debian/tests/amd64-ata-only @@ -0,0 +1,22 @@ +#!/bin/sh -e + +LOCALVERSION=-amd64 +ROOTDISK_QEMU_IF=ide +ROOTDISK_LINUX_NAME=sda +. debian/tests/test-common + +cat >>"${CONFDIR}/initramfs.conf" <"${CONFDIR}/modules" <>"${CONFDIR}/initramfs.conf" <"${CONFDIR}/modules" < Date: Fri, 27 Jul 2018 15:37:27 +0800 Subject: [PATCH 192/213] debian/tests: Add test for separate /usr device Signed-off-by: Ben Hutchings --- debian/tests/amd64-separate-usr | 36 +++++++++++++++++++++++++++++++++ debian/tests/control | 3 +++ debian/tests/test-common | 17 +++++++++++----- 3 files changed, 51 insertions(+), 5 deletions(-) create mode 100755 debian/tests/amd64-separate-usr diff --git a/debian/tests/amd64-separate-usr b/debian/tests/amd64-separate-usr new file mode 100755 index 0000000..552247b --- /dev/null +++ b/debian/tests/amd64-separate-usr @@ -0,0 +1,36 @@ +#!/bin/sh -e + +LOCALVERSION=-amd64 +ROOTDISK_QEMU_IF=virtio +ROOTDISK_LINUX_NAME=vda +USRDISK="$(mktemp)" +USRDISK_QEMU_IF=virtio +USRDISK_LINUX_NAME=vdb +. debian/tests/test-common + +cat >>"${CONFDIR}/initramfs.conf" <"${CONFDIR}/modules" < "${ROOTDIR}/etc/fstab" "/dev/${USRDISK_LINUX_NAME} /usr ext2 defaults 0 2" +USRDIR="$(mktemp -d)" +mv "${ROOTDIR}/usr/"* "${USRDIR}" + +build_rootfs_ext2 +build_fs_ext2 "${USRDIR}" "${USRDISK}" + +run_qemu_amd64 + +# Check that fsck ran on both devices +grep -q "^/dev/${ROOTDISK_LINUX_NAME}: clean," "${OUTPUT}" +grep -q "^/dev/${USRDISK_LINUX_NAME}: clean," "${OUTPUT}" diff --git a/debian/tests/control b/debian/tests/control index 8a9df83..55d7e51 100644 --- a/debian/tests/control +++ b/debian/tests/control @@ -13,3 +13,6 @@ Depends: @, qemu-system-x86, linux-image-amd64, klibc-utils, genext2fs Tests: amd64-virtio-only Depends: @, qemu-system-x86, linux-image-amd64, klibc-utils, genext2fs + +Tests: amd64-separate-usr +Depends: @, qemu-system-x86, linux-image-amd64, klibc-utils, genext2fs diff --git a/debian/tests/test-common b/debian/tests/test-common index 9e3bb4a..be28535 100644 --- a/debian/tests/test-common +++ b/debian/tests/test-common @@ -56,10 +56,13 @@ build_initramfs() { /usr/sbin/mkinitramfs -d "${CONFDIR}" -o "${INITRAMFS}" "${KVER}" } -build_rootfs_ext2() { +build_fs_ext2() { + local dir="${1}" + local disk="${2}" + # Get directory size - local blocks="$(du --summarize "${ROOTDIR}" | cut -f 1)" - local inodes="$(du --summarize --inodes "${ROOTDIR}" | cut -f 1)" + local blocks="$(du --summarize "${dir}" | cut -f 1)" + local inodes="$(du --summarize --inodes "${dir}" | cut -f 1)" # Add fudge factor blocks="$((blocks + 20 + blocks / 4))" @@ -67,10 +70,14 @@ build_rootfs_ext2() { # genext2fs writes status messages to stderr; hide that from # autopkgtest - genext2fs 2>&1 -b "${blocks}" -N "${inodes}" -U -d "${ROOTDIR}" "${ROOTDISK}" + genext2fs 2>&1 -b "${blocks}" -N "${inodes}" -U -d "${dir}" "${disk}" +} + +build_rootfs_ext2() { + build_fs_ext2 "${ROOTDIR}" "${ROOTDISK}" } run_qemu_amd64() { - timeout --foreground 60 qemu-system-x86_64 -m 1G -drive "file=${ROOTDISK},if=${ROOTDISK_QEMU_IF},media=disk,format=raw" -nographic -no-reboot -kernel "/boot/vmlinuz-${KVER}" -initrd "${INITRAMFS}" -append "root=/dev/${ROOTDISK_LINUX_NAME} ro console=ttyS0,115200 panic=-1 " | tee "${OUTPUT}" + timeout --foreground 60 qemu-system-x86_64 -m 1G -drive "file=${ROOTDISK},if=${ROOTDISK_QEMU_IF},media=disk,format=raw" ${USRDISK:+-drive "file=${USRDISK},if=${USRDISK_QEMU_IF},media=disk,format=raw"} -nographic -no-reboot -kernel "/boot/vmlinuz-${KVER}" -initrd "${INITRAMFS}" -append "root=/dev/${ROOTDISK_LINUX_NAME} ro console=ttyS0,115200 panic=-1 " | tee "${OUTPUT}" grep -qF "${INIT_MESSAGE}" "${OUTPUT}" } -- GitLab From 6b3b361213803f364f919527a3faa8f270617f55 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Fri, 27 Jul 2018 18:22:36 +0800 Subject: [PATCH 193/213] debian/tests: Add test of the panic shell and parameter handling Signed-off-by: Ben Hutchings --- debian/tests/amd64-panic-shell | 32 ++++++++++++++++++++++++++++++++ debian/tests/control | 3 +++ debian/tests/test-common | 13 ++++++++++++- 3 files changed, 47 insertions(+), 1 deletion(-) create mode 100755 debian/tests/amd64-panic-shell diff --git a/debian/tests/amd64-panic-shell b/debian/tests/amd64-panic-shell new file mode 100755 index 0000000..7948914 --- /dev/null +++ b/debian/tests/amd64-panic-shell @@ -0,0 +1,32 @@ +#!/bin/sh -e + +LOCALVERSION=-amd64 +ROOTDISK_QEMU_IF=virtio +ROOTDISK_LINUX_NAME=nonexistent +. debian/tests/test-common + +cat >>"${CONFDIR}/initramfs.conf" <"${CONFDIR}/modules" <&1 "$@" +} + run_qemu_amd64() { - timeout --foreground 60 qemu-system-x86_64 -m 1G -drive "file=${ROOTDISK},if=${ROOTDISK_QEMU_IF},media=disk,format=raw" ${USRDISK:+-drive "file=${USRDISK},if=${USRDISK_QEMU_IF},media=disk,format=raw"} -nographic -no-reboot -kernel "/boot/vmlinuz-${KVER}" -initrd "${INITRAMFS}" -append "root=/dev/${ROOTDISK_LINUX_NAME} ro console=ttyS0,115200 panic=-1 " | tee "${OUTPUT}" + _run_qemu_amd64 "panic=-1" grep -qF "${INIT_MESSAGE}" "${OUTPUT}" } -- GitLab From a7718dcce49a5c1dc025dd22de52b05e4ce8b004 Mon Sep 17 00:00:00 2001 From: Jann Horn Date: Mon, 7 Sep 2020 01:56:53 +0200 Subject: [PATCH 194/213] Add firmware for built-in drivers There's an old bug report from 2017 (#857054) complaining that firmware for built-in drivers is not automatically added to initramfs; and back then, the kernel did not collect information about such dependencies in a place where initramfs-tools could access it (#857055). However, since Linux 5.2 (released in mid-2019), the kernel actually provides this information via modules.builtin.modinfo; you can see at e.g. that the buster kernel package ships this file. (There aren't actually any firmware dependencies listed in there though; I guess the upstream Debian kernel config just has no built-in code with firmware dependencies?) Wire it up, so that people with custom kernel configs don't have to waste time figuring out that their devices don't work properly because the firmware wasn't available at boot. Closes: #857054 --- hook-functions | 81 ++++++++++++++++++++++++++++++++++++-------------- mkinitramfs | 3 ++ 2 files changed, 62 insertions(+), 22 deletions(-) diff --git a/hook-functions b/hook-functions index aa46383..e6408b3 100644 --- a/hook-functions +++ b/hook-functions @@ -50,10 +50,42 @@ add_modules_from_file() done } +# Locate a firmware file with the given name and copy it into DESTDIR, unless +# DESTDIR already contains such a file. +# Returns an error if no such firmware file can be located and DESTDIR doesn't +# already contain any matching file. (It is up to the caller to figure out +# whether a warning should be printed in that case.) +add_firmware() +{ + local firmware fwloc + + firmware="${1}" + + if [ -e "${DESTDIR}/lib/firmware/updates/${version?}/${firmware}" ] \ + || [ -e "${DESTDIR}/lib/firmware/updates/${firmware}" ] \ + || [ -e "${DESTDIR}/lib/firmware/${version}/${firmware}" ] \ + || [ -e "${DESTDIR}/lib/firmware/${firmware}" ]; then + return 0 + fi + + for fwloc in "/lib/firmware/updates/${version}/${firmware}" \ + "/lib/firmware/updates/${firmware}" \ + "/lib/firmware/${version}/${firmware}" \ + "/lib/firmware/${firmware}"; do + if [ -e "$fwloc" ]; then + copy_file firmware "$fwloc" + return 0 + fi + done + + # We can't figure out where to get that firmware from. + return 1 +} + # Add dependent modules + eventual firmware manual_add_modules() { - local prefix kmod options firmware fwloc + local prefix kmod options firmware if [ $# -eq 0 ]; then return @@ -76,19 +108,9 @@ manual_add_modules() # Add required firmware for firmware in $(modinfo -k "${version}" -F firmware "${kmod}"); do - if [ -e "${DESTDIR}/lib/firmware/updates/${version}/${firmware}" ] \ - || [ -e "${DESTDIR}/lib/firmware/updates/${firmware}" ] \ - || [ -e "${DESTDIR}/lib/firmware/${version}/${firmware}" ] \ - || [ -e "${DESTDIR}/lib/firmware/${firmware}" ]; then - continue - fi - # Only print warning for missing fw of loaded module # or forced loaded module - if [ ! -e "/lib/firmware/updates/${version}/${firmware}" ] \ - && [ ! -e "/lib/firmware/updates/${firmware}" ] \ - && [ ! -e "/lib/firmware/${version}/${firmware}" ] \ - && [ ! -e "/lib/firmware/${firmware}" ]; then + if ! add_firmware "$firmware"; then # Only warn about missing firmware if # /proc/modules exists if [ ! -e /proc/modules ] ; then @@ -102,20 +124,35 @@ manual_add_modules() fi continue fi - - for fwloc in "/lib/firmware/updates/${version}/${firmware}" \ - "/lib/firmware/updates/${firmware}" \ - "/lib/firmware/${version}/${firmware}" \ - "/lib/firmware/${firmware}"; do - if [ -e "$fwloc" ]; then - copy_file firmware "$fwloc" - break - fi - done done done } +# manual_add_modules() takes care of adding firmware for things that were built +# as modules; but drivers can also be built into the kernel itself. To cover +# that case, we have to look at modules.builtin.modinfo instead. +# This file is generated by the kernel's build process since commit 898490c010b5 +# ("moduleparam: Save information about built-in modules in separate file"), +# which was added in Linux 5.2. +add_builtin_firmware() +{ + local builtin_modinfo_path builtin_modname firmware + + builtin_modinfo_path="/lib/modules/${version?}/modules.builtin.modinfo" + if [ ! -e "$builtin_modinfo_path" ]; then + if linux-version compare "${version}" ge 5.2; then + echo "W: Can't find modules.builtin.modinfo (for locating built-in drivers' firmware, supported in Linux >=5.2)" >&2 + fi + return + fi + + tr '\0' '\n' < "$builtin_modinfo_path" | grep -E '^[^=]*\.firmware=' | sed -n 's/\.firmware=/\t/p' | while read -r builtin_modname firmware; do + if ! add_firmware "$firmware"; then + echo "W: Possible missing firmware /lib/firmware/${firmware} for built-in driver ${builtin_modname}" >&2 + fi + done +} + # $1 = file type (for logging) # $2 = file to copy to initramfs # $3 (optional) Name for the file on the initramfs diff --git a/mkinitramfs b/mkinitramfs index 17d808e..5b61490 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -305,6 +305,9 @@ esac # Resolve hidden dependencies hidden_dep_add_modules +# Add firmware for built-in code +add_builtin_firmware + # First file executed by linux cp -p /usr/share/initramfs-tools/init "${DESTDIR}/init" -- GitLab From b2174dfca33f86ddbaa477009f910b872a5dc699 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Fri, 11 Sep 2020 20:39:26 +0100 Subject: [PATCH 195/213] Releasing version 0.138. Signed-off-by: Ben Hutchings --- debian/changelog | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/debian/changelog b/debian/changelog index db0d5f7..789aa3d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,51 @@ +initramfs-tools (0.138) unstable; urgency=medium + + [ Ben Hutchings ] + * [0b034b4] docs/maintainer-notes.md: Delete the horizontal rules + * [ba883cb] docs/maintainer-notes.md: Use Gitlab markup for table of contents + * [5284a00] docs/maintainer-notes.md: Use Gitlab markup for definition table + * [a469b7e] docs/maintainer-notes.md: Use archive.org URL for Daniel Baumann + doc + * [424260e] debian/control, docs/maintainer-notes.md: Use my @debian.org + address + * [181a35c] update-initramfs: Remove test for direct invocation from kernel + package + * [6ebe41b] Remove obsolete update-initramfs state in + /var/lib/initramfs-tools + * [2f2ad0d] hook-functions: copy_exec: Copy libgcc_s.so with any soversion up + to 9 (Closes: #959768) + * [0f24cc1] Add CI configuration for salsa.debian.org + * [9877542] initramfs.conf: Delete "NFS Section" comment + * [4309c3b] Add FSTYPE config parameter to allow overriding filesystem type + detection (Closes: #923400) + * [6300aa1] Change "panic" parameter handling to work more like the kernel + * [90d64bd] debian/tests: Add common test preparation code + * [3dd2984] debian/tests: Add basic test for amd64 using klibc and not + busybox + * [69240b1] debian/tests: Add basic test for amd64 using busybox + * [3d834c8] debian/tests: Add basic tests for amd64 with only ata/virtio + driver + * [c14b760] debian/tests: Add test for separate /usr device + * [6b3b361] debian/tests: Add test of the panic shell and parameter handling + + [ Vagrant Cascadian ] + * [482897b] hook-functions: Add modules needed for Pinebook LCD display. + + [ Guilherme G. Piccoli ] + * [c3cbf35] scripts/functions: Prevents printf error carry over if wrong + console is set (Closes: #960355) + + [ Unit 193 ] + * [3b82099] When overriding configured compressor, warn the user. + + [ Norbert Lange ] + * [e94f410] un-,mkinitramfs: add support for zstd (Closes: #955469) + + [ Jann Horn ] + * [a7718dc] Add firmware for built-in drivers (Closes: #857054) + + -- Ben Hutchings Fri, 11 Sep 2020 20:37:29 +0100 + initramfs-tools (0.137) unstable; urgency=medium [ Ben Hutchings ] -- GitLab From 9679f0cf90b8ee27c47aa7a0abddf10922b26e9f Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Sun, 13 Sep 2020 17:55:58 +0100 Subject: [PATCH 196/213] debian/tests: Run amd64 tests on either amd64 or generic flavour * Change the linux-image-amd64 dependency to -amd64 | -generic:amd64 * Replace the LOCALVERSION variable with a SUPPORTED_FLAVOURS variable, and have test-common loop over the flavours * Change the dpkg-query pipeline that finds the kernel version string to avoid assumptions about ordering and versioning of dependencies This should allow the tests to run on Ubuntu or its derivatives without changes. Signed-off-by: Ben Hutchings --- debian/tests/amd64-ata-only | 2 +- debian/tests/amd64-busybox | 2 +- debian/tests/amd64-klibc | 2 +- debian/tests/amd64-panic-shell | 2 +- debian/tests/amd64-separate-usr | 2 +- debian/tests/amd64-virtio-only | 2 +- debian/tests/control | 12 ++++++------ debian/tests/test-common | 20 +++++++++++++------- 8 files changed, 25 insertions(+), 19 deletions(-) diff --git a/debian/tests/amd64-ata-only b/debian/tests/amd64-ata-only index 7daa9e5..b91601e 100755 --- a/debian/tests/amd64-ata-only +++ b/debian/tests/amd64-ata-only @@ -1,6 +1,6 @@ #!/bin/sh -e -LOCALVERSION=-amd64 +SUPPORTED_FLAVOURS='amd64 generic' ROOTDISK_QEMU_IF=ide ROOTDISK_LINUX_NAME=sda . debian/tests/test-common diff --git a/debian/tests/amd64-busybox b/debian/tests/amd64-busybox index 1daf998..3b6094c 100755 --- a/debian/tests/amd64-busybox +++ b/debian/tests/amd64-busybox @@ -1,6 +1,6 @@ #!/bin/sh -e -LOCALVERSION=-amd64 +SUPPORTED_FLAVOURS='amd64 generic' . debian/tests/test-common cat >>"${CONFDIR}/initramfs.conf" <>"${CONFDIR}/initramfs.conf" </dev/null | tr ',' '\n' | sed -n 's/^ *linux-image-\([-a-z0-9+.]*\).*/\1/p')" + if [ "$KVER" ]; then + break + fi +done +if [ -z "$KVER" ]; then + echo >&2 "E: Test must set SUPPORTED_FLAVOURS and depend on those flavours" + exit 2 +fi + if [ -n "${AUTOPKGTEST_TMP}" ]; then export TMPDIR="${AUTOPKGTEST_TMP}" fi @@ -42,13 +55,6 @@ cp /usr/lib/klibc/bin/sh "${ROOTDIR}/bin/sh" cp /usr/lib/klibc/bin/poweroff "${ROOTDIR}/bin/poweroff" cp "$(dpkg -L libklibc | grep '^/lib/klibc.*\.so$')" "${ROOTDIR}/lib/" -# Kernel version (really release) string -if [ -z "${LOCALVERSION}" ]; then - echo >&2 "E: Test must set LOCALVERSION to the kernel version suffix, e.g. -amd64" - exit 2 -fi -KVER="$(dpkg-query -Wf '${Depends}' "linux-image${LOCALVERSION}" | sed 's/^linux-image-//; s/ .*//')" - # VM output file OUTPUT="$(mktemp)" -- GitLab From 00990403084e4a8416871e56cf3d7d8b0ec9e4f6 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Sun, 13 Sep 2020 17:56:16 +0100 Subject: [PATCH 197/213] debian/tests/control: Mark all amd64 tests as skip-not-installable As these tests require installing an amd64 kernel package, they have to be skipped on other architectures. Tthere is currently no way to explicitly restrict them to specific architectures, so instead add the skip-not-installable restriction. Closes: #970184 Signed-off-by: Ben Hutchings --- debian/tests/control | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/tests/control b/debian/tests/control index 239db7f..b3efe72 100644 --- a/debian/tests/control +++ b/debian/tests/control @@ -4,18 +4,24 @@ Restrictions: superficial Tests: amd64-klibc Depends: @, qemu-system-x86, linux-image-amd64 | linux-image-generic:amd64, klibc-utils, genext2fs +Restrictions: skip-not-installable Tests: amd64-busybox Depends: @, qemu-system-x86, linux-image-amd64 | linux-image-generic:amd64, klibc-utils, busybox | busybox-initramfs, genext2fs +Restrictions: skip-not-installable Tests: amd64-ata-only Depends: @, qemu-system-x86, linux-image-amd64 | linux-image-generic:amd64, klibc-utils, genext2fs +Restrictions: skip-not-installable Tests: amd64-virtio-only Depends: @, qemu-system-x86, linux-image-amd64 | linux-image-generic:amd64, klibc-utils, genext2fs +Restrictions: skip-not-installable Tests: amd64-separate-usr Depends: @, qemu-system-x86, linux-image-amd64 | linux-image-generic:amd64, klibc-utils, genext2fs +Restrictions: skip-not-installable Tests: amd64-panic-shell Depends: @, qemu-system-x86, linux-image-amd64 | linux-image-generic:amd64, klibc-utils, genext2fs +Restrictions: skip-not-installable -- GitLab From 3616c8f345c7d2790474b55ea4f7f6aac8df0816 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Sun, 13 Sep 2020 19:26:57 +0100 Subject: [PATCH 198/213] conf/initramfs.conf: Fix typo "filesytem" Closes: #970235 Signed-off-by: Ben Hutchings --- conf/initramfs.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/initramfs.conf b/conf/initramfs.conf index 5e30c0c..01bdd85 100644 --- a/conf/initramfs.conf +++ b/conf/initramfs.conf @@ -70,7 +70,7 @@ RUNSIZE=10% # # FSTYPE: ... # -# The filesytem type(s) to support, or "auto" to use the current root +# The filesystem type(s) to support, or "auto" to use the current root # filesystem type # -- GitLab From cbbbb1b73e72124ba517325c51e0ea4bd7139104 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Sun, 13 Sep 2020 19:28:55 +0100 Subject: [PATCH 199/213] Releasing version 0.139. Signed-off-by: Ben Hutchings --- debian/changelog | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/debian/changelog b/debian/changelog index 789aa3d..fc88493 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +initramfs-tools (0.139) unstable; urgency=medium + + * [9679f0c] debian/tests: Run amd64 tests on either amd64 or generic flavour + * [0099040] debian/tests/control: Mark all amd64 tests as + skip-not-installable (Closes: #970184) + * [3616c8f] conf/initramfs.conf: Fix typo "filesytem" (Closes: #970235) + + -- Ben Hutchings Sun, 13 Sep 2020 19:28:00 +0100 + initramfs-tools (0.138) unstable; urgency=medium [ Ben Hutchings ] -- GitLab From ceb787b4470a1aaf12a25d91eaf0d9489bb95e93 Mon Sep 17 00:00:00 2001 From: Norbert Lange Date: Wed, 29 Jul 2020 00:56:47 +0200 Subject: [PATCH 200/213] mkinitramfs: use temporary file for uncompressed cpio A Compressor can benefit if the uncompressed size is known at the start. Potential benefits are less memory requirements when decoding, and simpler framing (no "streaming mode"). This changes the pipe to create a new temporary file containing the main cpio archive. The final initramfs output file can then be created in a single write (no appending). Signed-off-by: Norbert Lange --- mkinitramfs | 44 +++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/mkinitramfs b/mkinitramfs index 9633524..7178e82 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -213,12 +213,16 @@ fi # Prepare to clean up temporary files on exit DESTDIR= __TMPCPIOGZ= +__TMPMAINCPIO= __TMPEARLYCPIO= clean_on_exit() { if [ "${keep}" = "y" ]; then - echo "Working files in ${DESTDIR:-}, early initramfs in ${__TMPEARLYCPIO:-} and overlay in ${__TMPCPIOGZ:-}" + echo "Working files in ${DESTDIR:-}," \ + "early initramfs in ${__TMPEARLYCPIO:-}," \ + "main initramfs in ${__TMPMAINCPIO:-} and" \ + "overlay in ${__TMPCPIOGZ:-}" else - for path in "${DESTDIR}" "${__TMPCPIOGZ}" "${__TMPEARLYCPIO}"; do + for path in "${DESTDIR}" "${__TMPCPIOGZ}" "${__TMPMAINCPIO}" "${__TMPEARLYCPIO}"; do test -z "${path}" || rm -rf "${path}" done fi @@ -231,6 +235,7 @@ trap "exit 1" INT TERM # makes the EXIT trap effective even when killed DESTDIR="$(mktemp -d "${TMPDIR:-/var/tmp}/mkinitramfs_XXXXXX")" || exit 1 chmod 755 "${DESTDIR}" __TMPCPIOGZ="$(mktemp "${TMPDIR:-/var/tmp}/mkinitramfs-OL_XXXXXX")" || exit 1 +__TMPMAINCPIO="$(mktemp "${TMPDIR:-/var/tmp}/mkinitramfs-MAIN_XXXXXX")" || exit 1 __TMPEARLYCPIO="$(mktemp "${TMPDIR:-/var/tmp}/mkinitramfs-FW_XXXXXX")" || exit 1 DPKG_ARCH=$(dpkg --print-architecture) @@ -390,13 +395,6 @@ fi [ "${verbose}" = y ] && echo "Building cpio ${outfile} initramfs" -if [ -s "${__TMPEARLYCPIO}" ]; then - cat "${__TMPEARLYCPIO}" >"${outfile}" || exit 1 -else - # truncate - true > "${outfile}" -fi - ( # preserve permissions if root builds the image, see #633582 [ "$(id -ru)" != 0 ] && cpio_owner_root="-R 0:0" @@ -412,10 +410,9 @@ if [ -n "${SOURCE_DATE_EPOCH}" ]; then fi # work around lack of "set -o pipefail" for the following pipe: -# cd "${DESTDIR}" && find . | LC_ALL=C sort | cpio --quiet $cpio_owner_root $cpio_reproducible -o -H newc | gzip >>"${outfile}" || exit 1 +# cd "${DESTDIR}" && find . | LC_ALL=C sort | cpio --quiet $cpio_owner_root $cpio_reproducible -o -H newc >>"${outfile}" || exit 1 ec1=1 ec2=1 -ec3=1 exec 3>&1 eval "$( # http://cfaj.freeshell.org/shell/cus-faq-2.html @@ -427,26 +424,31 @@ eval "$( LC_ALL=C sort } | { # shellcheck disable=SC2086 - cpio --quiet $cpio_owner_root $cpio_reproducible -o -H newc 4>&-; echo "ec2=$?;" >&4 - } | ${compress} >>"${outfile}" - echo "ec3=$?;" >&4 + cpio --quiet $cpio_owner_root $cpio_reproducible -o -H newc 4>&- >"${__TMPMAINCPIO}" + echo "ec2=$?;" >&4 + } )" if [ "$ec1" -ne 0 ]; then - echo "E: mkinitramfs failure find $ec1 cpio $ec2 $compress $ec3" >&2 + echo "E: mkinitramfs failure find $ec1 cpio $ec2" >&2 exit "$ec1" fi if [ "$ec2" -ne 0 ]; then - echo "E: mkinitramfs failure cpio $ec2 $compress $ec3" >&2 + echo "E: mkinitramfs failure cpio $ec2" >&2 exit "$ec2" fi -if [ "$ec3" -ne 0 ]; then - echo "E: mkinitramfs failure $compress $ec3" >&2 - exit "$ec3" -fi ) || exit 1 +{ +if [ -s "${__TMPEARLYCPIO}" ]; then + cat "${__TMPEARLYCPIO}" || exit 1 +fi + +$compress -c "${__TMPMAINCPIO}" || + { echo "E: mkinitramfs failure $compress $?" >&2; exit 1; } + if [ -s "${__TMPCPIOGZ}" ]; then - cat "${__TMPCPIOGZ}" >>"${outfile}" || exit 1 + cat "${__TMPCPIOGZ}" || exit 1 fi +} >"${outfile}" || exit 1 exit 0 -- GitLab From ea68f658546f37de0425aab9b5f755464ded0d6c Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Wed, 2 Dec 2020 11:07:15 +0100 Subject: [PATCH 201/213] mkinitramfs: report actually requested compress util if it's not present We're always reporting something like: "No gzip in /usr/bin:/sbin:/bin, using gzip" if we assign the compress variable before the warning message. Fix ordering accordingly. Signed-off-by: Michael Prokop --- mkinitramfs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkinitramfs b/mkinitramfs index 9633524..01eed77 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -170,8 +170,8 @@ fi unset COMPRESS if ! command -v "${compress}" >/dev/null 2>&1; then - compress=gzip echo "No ${compress} in ${PATH}, using gzip" + compress=gzip fi case "${compress}" in -- GitLab From 33c10ef43b03dc6d9ee09a46c598f6ee34ad0b81 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 9 Dec 2020 18:04:33 +0100 Subject: [PATCH 202/213] init: Mount /dev without the noexec option This partially reverts commit eb98d2ea110b "init: /dev can be noexec and /run nodev". The noexec option broke v86d (which we have a specific workaround for), and could also be a problem for SGX support in future. Using noexec here doesn't provide a security benefit in a default Debian configuration, since there are other writable directories on filesystems not mounted with this option. Those are also writable by all users, not just uid 0. The mount options can be overridden by an entry for /dev in /etc/fstab (at least when booting with systemd). References: https://lore.kernel.org/linux-sgx/20201209000321.GA62845@kernel.org/T/ Signed-off-by: Ben Hutchings --- init | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/init b/init index 3ad5579..0eaee1c 100755 --- a/init +++ b/init @@ -33,8 +33,7 @@ export quiet # Note that this only becomes /dev on the real filesystem if udev's scripts # are used; which they will be, but it's worth pointing out -test -x /usr/sbin/v86d && dev_exec="exec" || dev_exec="noexec" -mount -t devtmpfs -o $dev_exec,nosuid,mode=0755 udev /dev +mount -t devtmpfs -o nosuid,mode=0755 udev /dev mkdir /dev/pts mount -t devpts -o noexec,nosuid,gid=5,mode=0620 devpts /dev/pts || true -- GitLab From 35177dbef0ae8e9b1ea67bcb72f71f9a7b4b9934 Mon Sep 17 00:00:00 2001 From: dann frazier Date: Mon, 26 Oct 2020 17:25:18 -0600 Subject: [PATCH 203/213] Add time_elapsed() function, subsuming $local_top_time Generalize the elapsed time tracking in local-top so that it can be used elsewhere. This requires some additional quoting in local_device_setup() comparisons to pass shellcheck. Now that the reference time is recorded earlier (in init vs. local-top), the rootdev wait time will now be reduced by however long it it takes to process init-premount. The belief is that our wait time is sufficiently long for that to be negligible. Also, this could potentially break any local-top scripts that use $local_top_time directly. A survey of the current packages in sid shows no packages that contain a file under /usr/share/initramfs-tools/scripts/local-top/ that contain "local_top_time". Signed-off-by: dann frazier --- init | 5 +++++ scripts/functions | 19 +++++++++++++++++++ scripts/local | 17 +++-------------- 3 files changed, 27 insertions(+), 14 deletions(-) diff --git a/init b/init index 3ad5579..70a6b22 100755 --- a/init +++ b/init @@ -218,6 +218,10 @@ maybe_break modules load_modules [ "$quiet" != "y" ] && log_end_msg +starttime="$(_uptime)" +starttime=$((starttime + 1)) # round up +export starttime + if [ "$ROOTDELAY" ]; then sleep "$ROOTDELAY" fi @@ -310,6 +314,7 @@ unset noresume unset fastboot unset forcefsck unset fsckfix +unset starttime # Move virtual filesystems over to the real filesystem mount -n -o move /sys ${rootmnt}/sys diff --git a/scripts/functions b/scripts/functions index eccad66..2cc2f9a 100644 --- a/scripts/functions +++ b/scripts/functions @@ -144,6 +144,25 @@ load_modules() fi } +_uptime() { + local uptime + uptime="$(cat /proc/uptime)" + uptime="${uptime%%[. ]*}" + echo "$uptime" +} + +time_elapsed() { + # shellcheck disable=SC2154 + if [ -z "$starttime" ]; then + log_failure_msg "time_elapsed() called before \$starttime initialized" + echo 0 + fi + local delta + delta="$(_uptime)" + delta=$((delta - starttime)) + echo "$delta" +} + # lilo compatibility parse_numeric() { case $1 in diff --git a/scripts/local b/scripts/local index a103e68..becb798 100644 --- a/scripts/local +++ b/scripts/local @@ -8,14 +8,6 @@ local_top() [ "$quiet" != "y" ] && log_end_msg fi local_top_used=yes - - # Start time for measuring elapsed time in local_device_setup - if [ -z "${local_top_time}" ]; then - local_top_time="$(cat /proc/uptime)" - local_top_time="${local_top_time%%[. ]*}" - local_top_time=$((local_top_time + 1)) # round up - export local_top_time - fi } local_block() @@ -44,7 +36,6 @@ local_bottom() fi local_premount_used=no local_top_used=no - unset local_top_time } # $1=device ID to mount @@ -94,9 +85,7 @@ local_device_setup() while true; do sleep 1 - time_elapsed="$(cat /proc/uptime)" - time_elapsed="${time_elapsed%%[. ]*}" - time_elapsed=$((time_elapsed - local_top_time)) + time_elapsed="$(time_elapsed)" local_block "${dev_id}" @@ -113,7 +102,7 @@ local_device_setup() else break fi - if [ ${count} -ge ${time_elapsed} ]; then + if [ "${count}" -ge "${time_elapsed}" ]; then break; fi /scripts/local-block/mdadm "${dev_id}" @@ -125,7 +114,7 @@ local_device_setup() log_end_msg 0 break fi - if [ ${time_elapsed} -ge "${slumber}" ]; then + if [ "${time_elapsed}" -ge "${slumber}" ]; then log_end_msg 1 || true break fi -- GitLab From 947717dc0c9aa1a1c116121f616cc7f5408cb8bf Mon Sep 17 00:00:00 2001 From: dann frazier Date: Mon, 26 Oct 2020 17:24:57 -0600 Subject: [PATCH 204/213] configure_networking(): Wait for specified network device configure_networking() will issue a `udevadm settle` before trying to configure an interface. However that's just a "best effort" mechanism for waiting until all NICs have been discovered. There is no way to *actually* know that all NICs have been discovered. The USB protocol sets no time limit on enumeration, for example, and I have a USB NIC that is consistently discovered after this point. However, in the case that the user has told us which interface they expect to be used in the initramfs (via ip=), we can just wait for it specifically. Bail only if it hasn't appeared within 3 minutes. We can perhaps allow that timeout to be overridden from the command line in the future. Closes: #965935 Signed-off-by: dann frazier --- scripts/functions | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/scripts/functions b/scripts/functions index 2cc2f9a..53dcb96 100644 --- a/scripts/functions +++ b/scripts/functions @@ -276,6 +276,21 @@ configure_networking() # networking already configured thus bail out [ -n "${DEVICE}" ] && [ -e /run/net-"${DEVICE}".conf ] && return 0 + if [ -n "${DEVICE}" ]; then + local netdevwait=180 + log_begin_msg "Waiting up to ${netdevwait} secs for ${DEVICE} to become available" + while [ "$(time_elapsed)" -lt "$netdevwait" ]; do + if [ -e "/sys/class/net/${DEVICE}" ]; then + break + fi + sleep 1 + done + if [ ! -e "/sys/class/net/${DEVICE}" ]; then + log_failure_msg "Interface ${DEVICE} did not appear in time" + fi + log_end_msg + fi + wait_for_udev 10 # support ip options see linux sources -- GitLab From ac2243bde1a45f40f6b860125130b8a268137371 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Mon, 14 Dec 2020 00:18:03 +0100 Subject: [PATCH 205/213] scripts/functions: Fix indentation for recently added functions Ident with tabs instead of 4 spaces. Gbp-Dch: ignore Signed-off-by: Ben Hutchings --- scripts/functions | 48 +++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/scripts/functions b/scripts/functions index 53dcb96..54290f8 100644 --- a/scripts/functions +++ b/scripts/functions @@ -145,22 +145,22 @@ load_modules() } _uptime() { - local uptime - uptime="$(cat /proc/uptime)" - uptime="${uptime%%[. ]*}" - echo "$uptime" + local uptime + uptime="$(cat /proc/uptime)" + uptime="${uptime%%[. ]*}" + echo "$uptime" } time_elapsed() { - # shellcheck disable=SC2154 - if [ -z "$starttime" ]; then - log_failure_msg "time_elapsed() called before \$starttime initialized" - echo 0 - fi - local delta - delta="$(_uptime)" - delta=$((delta - starttime)) - echo "$delta" + # shellcheck disable=SC2154 + if [ -z "$starttime" ]; then + log_failure_msg "time_elapsed() called before \$starttime initialized" + echo 0 + fi + local delta + delta="$(_uptime)" + delta=$((delta - starttime)) + echo "$delta" } # lilo compatibility @@ -277,18 +277,18 @@ configure_networking() [ -n "${DEVICE}" ] && [ -e /run/net-"${DEVICE}".conf ] && return 0 if [ -n "${DEVICE}" ]; then - local netdevwait=180 - log_begin_msg "Waiting up to ${netdevwait} secs for ${DEVICE} to become available" - while [ "$(time_elapsed)" -lt "$netdevwait" ]; do - if [ -e "/sys/class/net/${DEVICE}" ]; then - break + local netdevwait=180 + log_begin_msg "Waiting up to ${netdevwait} secs for ${DEVICE} to become available" + while [ "$(time_elapsed)" -lt "$netdevwait" ]; do + if [ -e "/sys/class/net/${DEVICE}" ]; then + break + fi + sleep 1 + done + if [ ! -e "/sys/class/net/${DEVICE}" ]; then + log_failure_msg "Interface ${DEVICE} did not appear in time" fi - sleep 1 - done - if [ ! -e "/sys/class/net/${DEVICE}" ]; then - log_failure_msg "Interface ${DEVICE} did not appear in time" - fi - log_end_msg + log_end_msg fi wait_for_udev 10 -- GitLab From 4b58593efc91ef9deef293a29cc5544cda226fe6 Mon Sep 17 00:00:00 2001 From: Bastian Blank Date: Thu, 7 Jan 2021 11:19:26 +0100 Subject: [PATCH 206/213] Include all PCI controller modules On several platforms some PCI controllers are actually supported and shipped as modules. Include all of them in the "most" class. Signed-off-by: Bastian Blank --- hook-functions | 1 + 1 file changed, 1 insertion(+) diff --git a/hook-functions b/hook-functions index e6408b3..97fb173 100644 --- a/hook-functions +++ b/hook-functions @@ -661,6 +661,7 @@ auto_add_modules() copy_modules_dir kernel/drivers/i2c/busses copy_modules_dir kernel/drivers/i2c/muxes copy_modules_dir kernel/drivers/mfd + copy_modules_dir kernel/drivers/pci/controller copy_modules_dir kernel/drivers/phy copy_modules_dir kernel/drivers/pinctrl copy_modules_dir kernel/drivers/regulator -- GitLab From a930e9a448d807cd23632c095a45d48842ff2f24 Mon Sep 17 00:00:00 2001 From: Bastian Blank Date: Sat, 13 Mar 2021 18:50:42 +0100 Subject: [PATCH 207/213] Include all reset controller modules On some arm SoC platforms those modules are used to reset and setup arbitrary other devices. As they are small, just include all of them in the "most" class. Signed-off-by: Bastian Blank --- hook-functions | 1 + 1 file changed, 1 insertion(+) diff --git a/hook-functions b/hook-functions index 97fb173..9c82fb2 100644 --- a/hook-functions +++ b/hook-functions @@ -665,6 +665,7 @@ auto_add_modules() copy_modules_dir kernel/drivers/phy copy_modules_dir kernel/drivers/pinctrl copy_modules_dir kernel/drivers/regulator + copy_modules_dir kernel/drivers/reset copy_modules_dir kernel/drivers/spi copy_modules_dir kernel/drivers/usb/phy -- GitLab From f350f122a244c60f91a3e3e5f8b58f9cb75308b6 Mon Sep 17 00:00:00 2001 From: Bastian Blank Date: Sat, 13 Mar 2021 19:13:10 +0100 Subject: [PATCH 208/213] Releasing version 0.140. Signed-off-by: Bastian Blank --- debian/changelog | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/debian/changelog b/debian/changelog index fc88493..f1fb6fb 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,23 @@ +initramfs-tools (0.140) unstable; urgency=medium + + [ Norbert Lange ] + * mkinitramfs: use temporary file for uncompressed cpio + + [ Michael Prokop ] + * mkinitramfs: report actually requested compress util if it's not present + + [ Ben Hutchings ] + * init: Mount /dev without the noexec option + + [ dann frazier ] + * configure_networking(): Wait for specified network device (Closes: #965935) + + [ Bastian Blank ] + * Include all PCI controller modules + * Include all reset controller modules + + -- Bastian Blank Sat, 13 Mar 2021 19:13:18 +0100 + initramfs-tools (0.139) unstable; urgency=medium * [9679f0c] debian/tests: Run amd64 tests on either amd64 or generic flavour -- GitLab From 2eea8ceb73f39abe3a4615bc5a89e54617c75085 Mon Sep 17 00:00:00 2001 From: Carsten Schoenert Date: Tue, 22 Mar 2022 18:14:03 +0100 Subject: [PATCH 209/213] d/gbp.conf: Adding a quite default config for gbp --- debian/gbp.conf | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 debian/gbp.conf diff --git a/debian/gbp.conf b/debian/gbp.conf new file mode 100644 index 0000000..78ed4d9 --- /dev/null +++ b/debian/gbp.conf @@ -0,0 +1,6 @@ +[DEFAULT] +sign-tags = True +debian-branch = pureos/latest +debian-tag = pureos/%(version)s +upstream-branch = +upstream-tag = %(version)s -- GitLab From 6546005211a353077f832ed311f405f5202f1fbd Mon Sep 17 00:00:00 2001 From: Carsten Schoenert Date: Wed, 23 Mar 2022 07:03:45 +0100 Subject: [PATCH 210/213] d/control: Remove Uploaders field Using the field Uploaders within a derivative is misleading and will produce the Lintian error 'invalid-field-for-derivative'. https://lintian.debian.org/tags/invalid-field-for-derivative --- debian/control | 1 - 1 file changed, 1 deletion(-) diff --git a/debian/control b/debian/control index eeca0dc..060abc9 100644 --- a/debian/control +++ b/debian/control @@ -1,7 +1,6 @@ Source: initramfs-tools Section: utils Priority: optional -Uploaders: Michael Prokop , Ben Hutchings Maintainer: PureOS Maintainers Build-Depends: debhelper-compat (= 12), bash-completion, shellcheck Rules-Requires-Root: no -- GitLab From 652009f91b3072060d42ef10e0aef78ede9f2b3c Mon Sep 17 00:00:00 2001 From: Carsten Schoenert Date: Wed, 23 Mar 2022 07:07:25 +0100 Subject: [PATCH 211/213] d/control: Adjust Maintainer/Vcs to PureOS fork --- debian/control | 3 +++ 1 file changed, 3 insertions(+) diff --git a/debian/control b/debian/control index 060abc9..173dba7 100644 --- a/debian/control +++ b/debian/control @@ -2,11 +2,14 @@ Source: initramfs-tools Section: utils Priority: optional Maintainer: PureOS Maintainers +XBSC-Oiginal-Maintainer: Debian kernel team Build-Depends: debhelper-compat (= 12), bash-completion, shellcheck Rules-Requires-Root: no Standards-Version: 4.1.5 Vcs-Browser: https://source.puri.sm/pureos/core/initramfs-tools Vcs-Git: https://source.puri.sm/pureos/core/initramfs-tools.git +XSBC-Original-Vcs-Browser: https://salsa.debian.org/kernel-team/initramfs-tools +XSBC-Original-Vcs-Git: https://salsa.debian.org/kernel-team/initramfs-tools.git Package: initramfs-tools Architecture: all -- GitLab From cea0d0f59e06ef424dd02687d691695a4c11cea9 Mon Sep 17 00:00:00 2001 From: Carsten Schoenert Date: Wed, 23 Mar 2022 07:08:32 +0100 Subject: [PATCH 212/213] Add d/pureos-ci.yml for CI --- debian/pureos-ci.yml | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 debian/pureos-ci.yml diff --git a/debian/pureos-ci.yml b/debian/pureos-ci.yml new file mode 100644 index 0000000..9bb8c3a --- /dev/null +++ b/debian/pureos-ci.yml @@ -0,0 +1,7 @@ +include: + - 'https://source.puri.sm/Librem5/librem5-ci/raw/master/librem5-pipeline-definitions.yml' + - 'https://source.puri.sm/Librem5/librem5-ci/raw/master/librem5-pipeline-byzantium-jobs.yml' + +stages: + - package + - test-package -- GitLab From 18475082ea7b4e8f9c8b8e902974feb447dceca6 Mon Sep 17 00:00:00 2001 From: Carsten Schoenert Date: Wed, 23 Mar 2022 07:22:53 +0100 Subject: [PATCH 213/213] WIP: Document changes and release 0.140pureos1 --- debian/changelog | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/debian/changelog b/debian/changelog index c6ebf4a..d4cf274 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,14 @@ +initramfs-tools (0.140pureos1) byzantium; urgency=medium + + * Merge in 0.140 from Debian stable, remaining change + - Depend on busybox instead of just recommending it + - Don't show "Possible missing firmware" messages unless "-v" is passed + * d/control: Remove Uploaders field + * d/control: Adjust Maintainer/Vcs to PureOS fork + * Add d/pureos-ci.yml for CI + + -- Carsten Schoenert Wed, 23 Mar 2022 07:19:15 +0100 + initramfs-tools (0.140) unstable; urgency=medium [ Norbert Lange ] -- GitLab