You are not logged in.

#1 2015-10-27 21:51:49

epicepee
Member
Registered: 2014-11-02
Posts: 54

Switching to btrfs for root partition, kernel panic on boot

Edit: Should have specified, I'm on a ThinkPad T440, 64-bit UEFI, triple-boot with Arch, Ubuntu and Win10.

Hi!  I have split /home and / partitions, and for a few reasons I'm moving from ext4 to btrfs for my root partition.

Before I move totally I figured I'd copy my / partition to a spare, convert it to btrfs, and try that first, so if something goes wrong I can try again / keep running Arch while I fix it.

So, I cleared some space and made a btrfs partition, then booted a live-USB and cp'd the whole partition over.  Seemed to go smoothly.  I booted back to Arch (on the ext4 partition) and mounted the partition, everything seemed intact.  I changed the fstab on the new root, arch-chrooted in and ran mkinitcpio, un-chrooted, remade the grub config, and rebooted.

grub sees the new root, but I get a kernel panic when I try to boot it.  Here's the message:

Kernel panic -- not syncing: VFS: Unable to mount root fs on unknown-block(0,0)

I've tried adding "insmod btrfs" to the grub config, viewing the boot command in grub shows that it's there.  I've tried using UUID and /dev/sdaX in the fstab.  I've remade the initramfs more times than I can count.  Nothing has worked.

At the moment, I'm copying my ext4 root to a new partition, I'm going to convert it to btrfs with btrfs-convert, as the wiki page describes.

Any ideas?  I've done some research but haven't found anything that's helped.

Last edited by epicepee (2015-10-28 00:58:33)

Offline

#2 2015-10-27 22:27:01

mike_r
Member
Registered: 2009-01-22
Posts: 114

Re: Switching to btrfs for root partition, kernel panic on boot

DON'T USE BTRFS-CONVERT! As far as I can tell from the btrfs mailing list, it is pretty much broken at present. If nothing else, I would start with a fresh install in the original btrfs partition (rather than cp-ing things over). I'm using btrfs for root and home, but I started clean after a failed convert attempt, and it works fine.


Linux User #353 - SLS -> Slackware -> Red Hat -> Mandrake -> Fedora -> Arch

Offline

#3 2015-10-27 23:57:36

epicepee
Member
Registered: 2014-11-02
Posts: 54

Re: Switching to btrfs for root partition, kernel panic on boot

Thank you for your help!

That's good to know.  I'll probably still give btrfs-convert a shot because there's no downside in this case, but I'll thoroughly check things afterwards.

As for a new install, that's a bit of a last resort for me, since I have quite a bit installed on, and a few modifications to, my current install.  If I do do that, would it be safe/sane to use my current /home?

My main question is whether I missed any steps while moving everything over and reconfiguring for the new partition.

Edit: btrfs-convert seems to have resulted in the same thing as the huge cp: a valid but un-bootable / partition.

Last edited by epicepee (2015-10-28 00:55:45)

Offline

#4 2015-10-28 08:52:44

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 9,003
Website

Re: Switching to btrfs for root partition, kernel panic on boot

epicepee wrote:

booted a live-USB and cp'd the whole partition over.

What command did you use to achieve this?

I wish I had known about the btrfs-convert problems before I hosed my laptop trying it...
sad


Jin, Jîyan, Azadî

Offline

#5 2015-10-28 10:21:38

mich41
Member
Registered: 2012-06-22
Posts: 796

Re: Switching to btrfs for root partition, kernel panic on boot

It looks like the kernel tries to mount block device pointed by the root= parameter but cannot find it. I'm not sure if the same wouldn't happen if it found the partition but didn't have btrfs driver loaded, but I think that in such case the panic message would be different.

However, I believe the kernel shouldn't be doing any immediate mounting if there is an initramfs. Are you sure grub loads initramfs? Is anything printed before the panic message? What's the exact kernel command line?

What happens if you specify the root parameter as /dev/sdXY?

BTW, forget fstab, your system doesn't boot that far yet.

Last edited by mich41 (2015-10-28 14:32:13)

Offline

#6 2015-10-28 17:05:16

mike_r
Member
Registered: 2009-01-22
Posts: 114

Re: Switching to btrfs for root partition, kernel panic on boot

Another thing to check: is your root dir in a subvolume? Here is the linux kernel line from my grub.cfg

linux	/vmlinuz-linux root=/dev/mapper/root rw rootflags=subvol=@root cryptdevice=/dev/sda2:root quiet

I have the added complication that I have an encrypted root partition, but my root is the subvolume "@root" on the btrfs partition. Is that something you need to consider?

PS - closing the barn door after the horse has left ... I added a warning to the wiki page warning of ext3/4->btrfs conversions, with a link back to the btrfs wiki itself.


Linux User #353 - SLS -> Slackware -> Red Hat -> Mandrake -> Fedora -> Arch

Offline

#7 2015-10-28 21:11:17

epicepee
Member
Registered: 2014-11-02
Posts: 54

Re: Switching to btrfs for root partition, kernel panic on boot

Head_On_A_Stick:  I booted from a live ArchBang USB, mounted both partitions, and cp'd everything.  Pretty straightforward, though I'm not sure if it was the right way to do it.

mich41: The "Kernel panic" line is the very first one displayed.  I'm not sure how to see whether grub loads the initramfs, but I don't see why it wouldn't.  I'm not sure how to change the root parameter, since the boot command mentions the UUID (at the moment) several times.  Also, if fstab doesn't matter yet, how does mkinitcpio know what partition to use?  Is it just whatever's mounted as /?

mike_r: Here's the relevant part of my grub.cfg.

menuentry 'Arch Linux (rolling) (on /dev/sda11)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-e520333a-ace7-4e03-9860-c56ae0daa686' {
    insmod part_gpt
    insmod btrfs
    set root='hd0,gpt11'
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt11 --hint-efi=hd0,gpt11 --hint-baremetal=ahci0,gpt11  e520333a-ace7-4e03-9860-c56ae0daa686
    else
      search --no-floppy --fs-uuid --set=root e520333a-ace7-4e03-9860-c56ae0daa686
    fi
    linux /boot/vmlinuz-linux root=UUID=e520333a-ace7-4e03-9860-c56ae0daa686 rw
    initrd /boot/intel-ucode.img
}

I never intended to use subvolumes.  It's possible I did so by accident but it sounds unlikely.


Edit: I installed Arch on a new btrfs partition.  It takes up about 22.5gb with only some of my old programs installed, compared to 9.8gb of my current install; both are compressed.  It also takes about three times as long to boot as my current install. 

Also, I tried booting the copied install using /dev/sdXX notation, didn't help.

Last edited by epicepee (2015-10-29 00:31:44)

Offline

#8 2015-10-29 01:26:17

epicepee
Member
Registered: 2014-11-02
Posts: 54

Re: Switching to btrfs for root partition, kernel panic on boot

I got it working!  Mostly.

The command grub was running to start Linux didn't mention the initramfs, so I added that and it booted.  I'm not sure how to get grub-mkconfig to always add that, though; I'll look into it.

There are two issues at this point.  One is that the operating system is slow, which is odd since btrfs is supposed to be faster, especially with compression.  The other is that permissions seem kind of screwed up; sudo says it isn't owned by UID 0, and su won't take my password.  I can fix those two, but might that indicate other problems?

Offline

#9 2015-10-29 17:38:18

glenb77
Member
Registered: 2014-10-02
Posts: 68

Re: Switching to btrfs for root partition, kernel panic on boot

did you add btrfs as a hook in mkinitcpio.conf and then run mkinitcpio to make the image?

i use refind and create a refind_linux.conf file and have never had a problem.

i have also used fsarchiver to backup an ext4 parition and then resotre it as btrfs without problems

Offline

#10 2015-10-29 17:41:16

Scimmia
Fellow
Registered: 2012-09-01
Posts: 13,729

Re: Switching to btrfs for root partition, kernel panic on boot

the btrfs hook is unnecessary.

Offline

Board footer

Powered by FluxBB