can also chroot into the environment where you prepared the initramfs
image to test stuff, which will save you rebooting time.
On 3/9/2024 4:03 PM, efeizbudak wrote:
Hi all,
After updating my musl, my custom initramfs had stopped working. Can
anyone give me a hand with this? I recompiled util-linux and updated
the related files in my initramfs and also tried building it with
static-libs but neither of these helped. On the other hand, the
initramfs I built using genkernel works just fine.
The init error:
Error relocating /bin/mount: mnt_context_enable_noautofs: symbol not
found
Error relocating /bin/mount: mnt_context_enable_onlyonce: symbol not
found
Error relocating /bin/mount: mnt_context_enable_noautofs: symbol not
found
Error relocating /bin/mount: mnt_context_enable_onlyonce: symbol not
found
Error relocating /bin/mount: mnt_context_enable_noautofs: symbol not
found
Error relocating /bin/mount: mnt_context_enable_onlyonce: symbol not
found
/init: 6: cannot create /proc/sys/kernel/printk: Directory nonexistent
Fatal error during RNG initialisation
Cannot initialize crypto RNG backend.
Device /dev/sda3 is not a valid LUKS device.
/init: 8: cannot create /proc/sys/kernel/printk: Directory nonexistent
Error relocating /bin/mount: mnt_context_enable_noautofs: symbol not
found
Error relocating /bin/mount: mnt_context_enable_onlyonce: symbol not
found
umount: /dev: not mounted.
umount: /proc: not mounted.
umount: /sys: not mounted.
switch_root: failed to mount moving /mnt/root to /: Invalid argument
switch_root: failed. Sorry.
Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000100
Kernel Offset: 0x9000000 from 0xffffffff81000000 (relocation range:
0xffffffff80000000-0xffffffffbfffffff)
---[ end Kernel panic - not syncing: Attempted to kill init!
exitcode+0x00000100 ]---
my init file in my initramfs:
#!/bin/dash
mount -t devtmpfs none /dev
mount -t proc none /proc
mount -t sysfs none /sys
echo 0 > /proc/sys/kernel/printk
cryptsetup luksOpen --allow-discards /dev/sda3 root
echo 1 > /proc/sys/kernel/printk
mount -o ro /dev/mapper/root /mnt/root
umount /dev /proc /sys
exec switch_root /mnt/root /sbin/init
my initramfs files:
.
├── bin
│ ├── dash
│ ├── mount
│ └── umount
├── dev
│ ├── console
│ ├── null
│ ├── sda3
│ └── tty
├── etc
├── init
├── lib
│ ├── ld-musl-x86_64.so.1
│ ├── libblkid.so.1
│ ├── libcap.so.2
│ ├── libdevmapper.so.1.02
│ ├── libmount.so.1
│ ├── libudev.so.1
│ └── libuuid.so.1
├── lib64
├── mnt
│ └── root
├── proc
├── root
├── run
├── sbin
│ ├── cryptsetup
│ └── switch_root
├── sys
├── trq.map
├── usr
│ ├── bin
│ └── lib
│ ├── libblkid.so.1
│ ├── libc.so
│ ├── libcap.so.2
│ ├── libcryptsetup.so.12
│ ├── libgcrypt.so.20
│ ├── libgpg-error.so.0
│ ├── libjson-c.so.5
│ ├── libmount.so.1
│ ├── libpopt.so.0
│ └── libuuid.so.1
└── var
├── log
└── run
how I update my initramfs:
lddtree.py --copy-to-tree /usr/src/initramfs /bin/mount
/sbin/cryptsetup /bin/dash /sbin/switch_root /bin/umount
cd /usr/src/initramfs
find . -print0 | cpio --null --create --verbose --format=newc >
/boot/custom-initramfs.img