* [gentoo-user] Musl custom initramfs kernel panic
@ 2024-03-09 14:03 efeizbudak
2024-03-09 16:23 ` Alexandru N. Barloiu
2024-03-09 16:26 ` Alexandru N. Barloiu
0 siblings, 2 replies; 5+ messages in thread
From: efeizbudak @ 2024-03-09 14:03 UTC (permalink / raw
To: Gentoo User
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [gentoo-user] Musl custom initramfs kernel panic
2024-03-09 14:03 [gentoo-user] Musl custom initramfs kernel panic efeizbudak
@ 2024-03-09 16:23 ` Alexandru N. Barloiu
2024-03-09 17:59 ` efeizbudak
2024-03-09 16:26 ` Alexandru N. Barloiu
1 sibling, 1 reply; 5+ messages in thread
From: Alexandru N. Barloiu @ 2024-03-09 16:23 UTC (permalink / raw
To: gentoo-user
clearly mount is using a symbol not provided by one of those shared
libraries, but no clue which it is. However you dont need dash and mount
and umount. Reason its working for genkernel is because its using
busybox instead of normal system mount/umount/dash. Might want to try
that. Smaller too.
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
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [gentoo-user] Musl custom initramfs kernel panic
2024-03-09 14:03 [gentoo-user] Musl custom initramfs kernel panic efeizbudak
2024-03-09 16:23 ` Alexandru N. Barloiu
@ 2024-03-09 16:26 ` Alexandru N. Barloiu
1 sibling, 0 replies; 5+ messages in thread
From: Alexandru N. Barloiu @ 2024-03-09 16:26 UTC (permalink / raw
To: gentoo-user
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
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [gentoo-user] Musl custom initramfs kernel panic
2024-03-09 16:23 ` Alexandru N. Barloiu
@ 2024-03-09 17:59 ` efeizbudak
2024-03-10 0:41 ` Hoël Bézier
0 siblings, 1 reply; 5+ messages in thread
From: efeizbudak @ 2024-03-09 17:59 UTC (permalink / raw
To: gentoo-user
How could I go about finding which library it is? lddtree is only giving
me libblkid and libmount, both of which are already inside the
initramfs. I will try to learn about busybox. Thank you.
On 2024-03-09 17:23, Alexandru N. Barloiu wrote:
> clearly mount is using a symbol not provided by one of those shared
> libraries, but no clue which it is. However you dont need dash and
> mount and umount. Reason its working for genkernel is because its using
> busybox instead of normal system mount/umount/dash. Might want to try
> that. Smaller too.
>
> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [gentoo-user] Musl custom initramfs kernel panic
2024-03-09 17:59 ` efeizbudak
@ 2024-03-10 0:41 ` Hoël Bézier
0 siblings, 0 replies; 5+ messages in thread
From: Hoël Bézier @ 2024-03-10 0:41 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: text/plain, Size: 360 bytes --]
Am Sat, Mar 09, 2024 at 06:59:15PM +0100 schrieb efeizbudak:
>How could I go about finding which library it is? lddtree is only giving
>me libblkid and libmount, both of which are already inside the
>initramfs. I will try to learn about busybox. Thank you.
You can try to run mount with strace on your host, and see which shared
libraries are opened.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-03-10 0:41 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-09 14:03 [gentoo-user] Musl custom initramfs kernel panic efeizbudak
2024-03-09 16:23 ` Alexandru N. Barloiu
2024-03-09 17:59 ` efeizbudak
2024-03-10 0:41 ` Hoël Bézier
2024-03-09 16:26 ` Alexandru N. Barloiu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox