Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] Kernel panic when using a custom initramfs
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
schmittlauch
n00b
n00b


Joined: 12 Sep 2014
Posts: 23

PostPosted: Thu May 28, 2015 12:44 pm    Post subject: [SOLVED] Kernel panic when using a custom initramfs Reply with quote

I'm trying to create a custom Initramfs, following the guide in the wiki.But when I'm trying to boot using it, I get a kernel panic: http://i.imgur.com/cakjE72.jpg

I commented out most of the code in init to be dropped into a rescue shell fpr debugging purposes, nevertheless I still get the kernel panic. This is my curent init script:
Code:

#!/bin/busybox sh

#helper functions
rescue_shell() {
    echo "Something went wrong. Dropping to a shell."
   exec sh
}

# Mount the /proc and /sys filesystems.
echo "Mounting proc sys dev"
sleep 5
mount -t proc none /proc || rescue_shell
sleep 5
mount -t sysfs none /sys || rescue_shell
sleep 5
mount -t devtmpfs none /dev || rescue_shell
sleep 5

echo "To the rescue!!"
exec sh
 
## Do stuff here.
#echo "Opening encrypted devices"
#sleep 5
#cryptsetup open --type --allow-discards luks /dev/sda3 sda3 || rescue_shell
#sleep 5
#cryptsetup open --type --allow-discards luks /dev/sdb1 sdb1 || rescue_shell
#sleep 5
#
#echo "Mounting partitions"
#sleep 5
##mount -t btrfs -o defaults,noatime,ssd /dev/sda2 /boot
##mount -t vfat /dev/sda1 /boot/efi
#mount -t btrfs -o ro,defaults,noatime,ssd,space_cache,compress=lzo /dev/mapper/sda3 || rescue_shell
#sleep 5
#
## Clean up.
#umount /proc
#umount /sys
#umount /dev
#
## Boot the real root.
#echo "Invoking init"
#sleep 5
#exec switch_root /mnt/root /usr/lib/systemd/systemd || rescue_shell


I'm using kernel 3.14.14 on 64bit machine

Does anybody have a clue about what's going wrong?


Last edited by schmittlauch on Fri May 29, 2015 1:22 pm; edited 1 time in total
Back to top
View user's profile Send private message
cboldt
l33t
l33t


Joined: 24 Aug 2005
Posts: 837

PostPosted: Thu May 28, 2015 1:57 pm    Post subject: Reply with quote

I assume your busybox is part of the initramfs file, copied to the location that bootloader is told to load. Also, busybox should be compiled "static," or else you need to add the libraries to your initramfs. Static binary is cleaner, IMO.

Can you boot (at least get past kernel panic) without an initramfs? I've had kernel panics when moving to new hardware, and not having the drives available because my hand-made kernel config lacks the correct drivers.
Back to top
View user's profile Send private message
schmittlauch
n00b
n00b


Joined: 12 Sep 2014
Posts: 23

PostPosted: Thu May 28, 2015 4:53 pm    Post subject: Reply with quote

Yes, I put cryptsetup and busybox as static binaries into the initramfs. I have a working genkernel-based initramfs which only works with kernel 3.14 and below, that's why I'm building an own which should be easier to debug.
I also didn't supply any cmdline parameters for this basic initramfs.
Back to top
View user's profile Send private message
Goverp
l33t
l33t


Joined: 07 Mar 2007
Posts: 668

PostPosted: Fri May 29, 2015 9:53 am    Post subject: Reply with quote

IIRC you get these symptoms if you don't have console device in the /dev tree; busybox won't start without it.
_________________
Greybeard
Back to top
View user's profile Send private message
schmittlauch
n00b
n00b


Joined: 12 Sep 2014
Posts: 23

PostPosted: Fri May 29, 2015 1:22 pm    Post subject: Reply with quote

I tried compressing the initramfs with gzip instead of xz and that made it work. This is weird as the working genkernel initramfs was xz compressed, too, and that did work.
Back to top
View user's profile Send private message
cboldt
l33t
l33t


Joined: 24 Aug 2005
Posts: 837

PostPosted: Fri May 29, 2015 2:48 pm    Post subject: Reply with quote

I never would have guessed the problem! Now that you found it, I'm curious if the difference between the genkernel and non-working arrangements is a function of the kernel being built to handle xz compression.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 13845

PostPosted: Sat May 30, 2015 12:43 am    Post subject: Reply with quote

If you embed the initramfs in the kernel via the kernel build system, it will compressed with the main kernel image and uncompressed into memory automatically. If you build an external initramfs, you need to enable the appropriate RD_compression Kconfig option: RD_GZIP, RD_XZ, etc.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum