Fixes a bug where the kernel thinks the boot partition is still mounted
and it's unavailable for mounting in the rootfs
If you look at what the initramfs was doing before !5635, it was
explicitly umounting the boot partition from /boot in the initramfs and
then mounting it under /boot in the rootfs:
c45d7ec0a5/main/postmarketos-initramfs/init.sh (L87)
With this patch, we're now back to umounting /boot in the initramfs.
The second part of that original logic is now handled elsewhere now, and
that seems to be working OK.
The bug was reported here:
https://gitlab.postmarketos.org/postmarketOS/pmaports/-/issues/3279#note_454346
[ci:skip-build]: already built successfully in CI
76 lines
1.9 KiB
Bash
76 lines
1.9 KiB
Bash
#!/bin/sh
|
|
# shellcheck disable=SC1091
|
|
|
|
# Export all variables so they're available in /init_2nd.sh
|
|
set -a
|
|
|
|
IN_CI="false"
|
|
LOG_PREFIX="[pmOS-rd]"
|
|
|
|
[ -e /hooks/10-verbose-initfs.sh ] && set -x
|
|
|
|
[ -e /hooks/05-ci.sh ] && IN_CI="true"
|
|
|
|
[ -e /etc/unudhcpd.conf ] && . /etc/unudhcpd.conf
|
|
. ./init_functions.sh
|
|
. /usr/share/misc/source_deviceinfo
|
|
[ -e /etc/os-release ] && . /etc/os-release
|
|
# provide a default for os-release's VERSION in case the file doesn't exist
|
|
VERSION="${VERSION:-unknown}"
|
|
|
|
# This is set during packaging and is used when triaging bug reports
|
|
INITRAMFS_PKG_VERSION="<<INITRAMFS_PKG_VERSION>>"
|
|
|
|
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
|
|
/bin/busybox --install -s
|
|
/bin/busybox-extras --install -s
|
|
|
|
# Mount everything, set up logging, modules, mdev
|
|
mount_proc_sys_dev
|
|
setup_log
|
|
echo " ❬❬ PMOS STAGE 1 ❭❭"
|
|
echo "initramfs version: $INITRAMFS_PKG_VERSION"
|
|
setup_firmware_path
|
|
|
|
setup_usb_network
|
|
start_unudhcpd
|
|
|
|
# Jump straight to the 2nd stage init if available
|
|
# (no separate -extra) or no-op otherwise
|
|
jump_init_2nd
|
|
|
|
echo "Loading initramfs-extra..."
|
|
|
|
# We need mdev to find the boot partition
|
|
setup_mdev
|
|
|
|
if [ "$IN_CI" = "false" ]; then
|
|
setup_framebuffer
|
|
show_splash "Loading..."
|
|
fi
|
|
|
|
load_modules /lib/modules/initramfs.load
|
|
|
|
# Discover the partitions if they're "subpartitions"
|
|
# (where the whole disk image is flashed to a partition)
|
|
mount_subpartitions
|
|
|
|
# Poll for the boot partition to become available or crash
|
|
wait_boot_partition
|
|
mount_boot_partition /boot
|
|
extract_initramfs_extra /boot/initramfs-extra
|
|
# /boot is mounted later into the rootfs
|
|
umount /boot
|
|
|
|
# Kill mdev, since it's replaced by udev in the
|
|
# second stage init
|
|
kill mdev 2>/dev/null
|
|
|
|
# Now we can jump to the 2nd stage init
|
|
jump_init_2nd
|
|
|
|
# Somehow init_2nd.sh is missing
|
|
echo "$LOG_PREFIX ERROR: /init_2nd.sh not found!"
|
|
echo "$LOG_PREFIX For more information, see <https://postmarketos.org/debug-shell>"
|
|
fail_halt_boot
|