You are not logged in.

#1 2014-11-14 14:09:53

yafeng
Member
Registered: 2013-02-28
Posts: 16

Can't boot from btrfs RAID1[SOLVED]

Today I tried to install Archlinux on btrfs RAID1,but the system will not boot after installation.

I installed btrfs-progs and added btrfs hook to mkinitcpio.conf, and then run the mkinitcpio -p linux.

After rebooting, the system stops at the fallback command line mode.

Problem is in btrfs device scan command,and the error code is:

failed to open /dev/btrfs-control skipping device registration:no such file or directory.

after that,the btrfs RAID1 can't mount and fallback to fallback command line mode.

but I try to ls /dev,the btrfs-control file exits.

and now I can run btrfs device scan and mount the btrfs filesystem,and exit the  fallback command line mode.

The system can login normally.

The question is, Why run btrfs hook,  /dev/btrfs-control file don't exits,but after fallback to fallback command line mode,this file exits.

At first, I add a delay in the init before "btrfs device scan" command, but this does not solve the problem.

But when I add the command btrfs into hook:
mknod / dev / btrfs-control c 10 234

The system can be started normally.

Last edited by yafeng (2014-11-15 16:26:52)

Offline

#2 2014-11-14 14:18:46

nstgc
Member
Registered: 2014-03-17
Posts: 393

Re: Can't boot from btrfs RAID1[SOLVED]

Just to clarify, this isn't a case of something that once worked and now does not work?

Offline

#3 2014-11-14 14:32:56

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,750
Website

Re: Can't boot from btrfs RAID1[SOLVED]

You don't need the btrfs initcpio hook unless you don't have udev in your initramfs. Can you boot without it?


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#4 2014-11-14 15:01:27

yafeng
Member
Registered: 2013-02-28
Posts: 16

Re: Can't boot from btrfs RAID1[SOLVED]

nstgc wrote:

Just to clarify, this isn't a case of something that once worked and now does not work?

Yes, I'm sure, when I tested a few days ago still work properly.

Offline

#5 2014-11-14 15:09:11

yafeng
Member
Registered: 2013-02-28
Posts: 16

Re: Can't boot from btrfs RAID1[SOLVED]

WorMzy wrote:

You don't need the btrfs initcpio hook unless you don't have udev in your initramfs. Can you boot without it?

If only a single disk btrfs file system, btrfs hook is not needed,
But if it is a btrfs RAID system, you must run 'btrfs device scan' before mount
Otherwise it is impossible to mount
and the btrfs hook only run this command:

#!/usr/bin/ash

run_hook() {
    btrfs device scan
}

Offline

#6 2014-11-14 15:41:00

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,750
Website

Re: Can't boot from btrfs RAID1[SOLVED]

yafeng wrote:
WorMzy wrote:

You don't need the btrfs initcpio hook unless you don't have udev in your initramfs. Can you boot without it?

But if it is a btrfs RAID system, you must run 'btrfs device scan' before mount
Otherwise it is impossible to mount

This is incorrect, udev handles btrfs device detection for you.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#7 2014-11-14 16:20:31

yafeng
Member
Registered: 2013-02-28
Posts: 16

Re: Can't boot from btrfs RAID1[SOLVED]

The new discovery, add "modprobe btrfs" command before  "btrfs device scan" 
The system can start normaly too, guess possible reason is that udev hook not loaded  btrfs filesystem drive.

Offline

#8 2014-11-14 17:07:20

nstgc
Member
Registered: 2014-03-17
Posts: 393

Re: Can't boot from btrfs RAID1[SOLVED]

yafeng wrote:

The new discovery, add "modprobe btrfs" command before  "btrfs device scan" 
The system can start normaly too, guess possible reason is that udev hook not loaded  btrfs filesystem drive.

So is it fixed now?

Offline

#9 2014-11-14 23:47:16

yafeng
Member
Registered: 2013-02-28
Posts: 16

Re: Can't boot from btrfs RAID1[SOLVED]

nstgc wrote:
yafeng wrote:

The new discovery, add "modprobe btrfs" command before  "btrfs device scan" 
The system can start normaly too, guess possible reason is that udev hook not loaded  btrfs filesystem drive.

So is it fixed now?

No, the problem has not been solved yet.
I modified the code so that you can boot my pc
But if you install archlinux in a multi-device btrfs volume
System still does not boot, until you also modify initscripts,
I hope Archlinux developers can fix this problem.

Offline

#10 2014-11-15 00:23:03

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,750
Website

Re: Can't boot from btrfs RAID1[SOLVED]

yafeng wrote:

But if you install archlinux in a multi-device btrfs volume
System still does not boot, until you also modify initscripts

What "initscripts" are you referring to? Are you not booting with systemd?

My btrfs raid1 has worked fine with no btrfs hook since 2012.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#11 2014-11-15 11:34:41

yafeng
Member
Registered: 2013-02-28
Posts: 16

Re: Can't boot from btrfs RAID1[SOLVED]

WorMzy wrote:
yafeng wrote:

But if you install archlinux in a multi-device btrfs volume
System still does not boot, until you also modify initscripts

What "initscripts" are you referring to? Are you not booting with systemd?

My btrfs raid1 has worked fine with no btrfs hook since 2012.

I do not know if you have not updated to the latest, about three days ago, installed to RAID1 can boot, but since yesterday, you can not boot from the RAID1, or you can upgrade at your system or test in vmware.

Three days ago, I discussed the btrfs group RAID1 / RAID10 problem with a friend, at that time the installation is successful, the problem was not solved the problem of btrfs auto degraded, yesterday I tried to write a script to solve this problem, but the unexpected discovery after installation has been unable to boot

systemd does not exist in the initrd,Except you include the systemd' hook in mkinitcpio.conf

In the initrd, there are some init scripts,this contains detect and mount the file system.

Offline

#12 2014-11-15 13:07:42

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,750
Website

Re: Can't boot from btrfs RAID1[SOLVED]

I do not know if you have not updated to the latest

Latest what? I usually run on mainline kernel (currently 3.18.0-rc4), but I've just checked the Arch kernel (3.17.2-1) and that works fine here too. I usually use the latest integration branch of btrfs-progs too (currently integration-20141113), but this shouldn't make any difference on the boot process, as the only btrfs-related files in my initramfs are:

$ lsinitcpio /boot/initramfs-linux-mainline.img|grep btrfs
./usr/lib/udev/rules.d/64-btrfs.rules
./usr/lib/modules/3.18.0-rc4-mainline/kernel/btrfs.ko

$ lsinitcpio /boot/initramfs-linux.img|grep btrfs
./usr/lib/udev/rules.d/64-btrfs.rules
./usr/lib/modules/3.17.2-1-ARCH/kernel/btrfs.ko

at that time the installation is successful, the problem was not solved the problem of btrfs auto degraded

So is the problem that you have a degraded btrfs RAID?


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#13 2014-11-15 13:42:21

yafeng
Member
Registered: 2013-02-28
Posts: 16

Re: Can't boot from btrfs RAID1[SOLVED]

well  I make a vboxvm in vbox and add two disk in it, and use the last iso install system:
395981304c84f78e.png
and then
30dc8eff039cf101.png
exit && reboot
637819a1bb21265b.png

Offline

#14 2014-11-15 13:49:30

yafeng
Member
Registered: 2013-02-28
Posts: 16

Re: Can't boot from btrfs RAID1[SOLVED]

After I add the btrfs hook to system , the result is
e0644d51f5f55d65.png
btrfs device scan fail :
failed to open /dev/btrfs-control
but this file is exits
this time I can mount the rootfs to new_root and exit the fallback command line
5e5d13a2aeae6cfe.png

Offline

#15 2014-11-15 13:58:48

yafeng
Member
Registered: 2013-02-28
Posts: 16

Re: Can't boot from btrfs RAID1[SOLVED]

edit the /usr/lib/initcpio/hooks/btrfs and add modprobe btrfs
fe919a06394dbd28.png
run mkinitcpio -p linux
90fdbcf8ac201285.png
and the system boot sucess

Offline

#16 2014-11-15 14:19:39

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,750
Website

Re: Can't boot from btrfs RAID1[SOLVED]

Please change your images to links.

Hmm, I can reproduce this if I remove btrfs from my modules array in my mkinitcpio.conf. It seems that the btrfs module isn't being loaded before udev is triggered, so the array isn't being populated.

Try this: remove the btrfs hook, add btrfs to your modules array in mkinitcpio.conf, then rebuild your initramfs and see if you can boot.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#17 2014-11-15 15:43:18

yafeng
Member
Registered: 2013-02-28
Posts: 16

Re: Can't boot from btrfs RAID1[SOLVED]

WorMzy wrote:

Try this: remove the btrfs hook, add btrfs to your modules array in mkinitcpio.conf, then rebuild your initramfs and see if you can boot.

The system can boot successfully

WorMzy wrote:

It seems that the btrfs module isn't being loaded before udev is triggered, so the array isn't being populated.

I think so
But just a few days ago, the system is not this problem

Offline

#18 2014-11-15 15:52:35

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,750
Website

Re: Can't boot from btrfs RAID1[SOLVED]

There has just been an update to the systemd family of packages (which includes udev), so perhaps something has changed regarding the timing of udev events. In a failed boot, I just need to run "# modprobe btrfs && udevadm trigger", and then I can mound my filesystem as normal.

If it worked before, then I think you should open a bug against the systemd and mkinitcpio packages.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#19 2014-11-15 16:08:32

yafeng
Member
Registered: 2013-02-28
Posts: 16

Re: Can't boot from btrfs RAID1[SOLVED]

So is the problem that you have a degraded btrfs RAID?

This is another problem.

If your RAID1 damaged (HDD damaged or removed, replace the hard drive), the btrfs arry will also appear unable to mount, and the system can not boot.

According to wiki said,we must mount it in degraded mode

mount /dev/sda /new_root -o ${rootflag},degraded

Of course, you can modify the grub command line,and add degraded  parameters.

However, this is somewhat inconvenient, especially remote to operate a computer (NAS or server).

So I hope it can automatically degraded,When a problem occurs Array.

mkinitcpio-btrfs from AUR packages contain this feature
But  on my system  this package is not working properly (perhapsI do not know how to use)
So I wrote a hook for initcpio, only automatic degraded, this script:

https://github.com/yafengabc/btrfs-autodegraded

Offline

#20 2014-11-16 15:33:12

phatfish
Member
From: England
Registered: 2013-04-21
Posts: 5

Re: Can't boot from btrfs RAID1[SOLVED]

I can confirm this bug, i have a RAID1 setup with the btrfs hook enabled, and get the same error as yafeng, the "open /dev/btrfs-control" error in his screenshot. Luckily i was running the update when i was at the machine, usually i am remote.

I restored to a snapshot i took just before the update, and will have a search to see if a bug report was created.

Offline

#21 2014-11-16 21:23:42

davidm
Member
Registered: 2009-04-25
Posts: 371

Re: Can't boot from btrfs RAID1[SOLVED]

WorMzy wrote:

Try this: remove the btrfs hook, add btrfs to your modules array in mkinitcpio.conf, then rebuild your initramfs and see if you can boot.

I also ran into the problem on a multi-device btrfs RAID1 system.  The above fixed it.

Shouldn't an announcement be made about this or something?  I bet quite a few people run multi-device btrfs systems on Arch.

Offline

#22 2014-11-17 18:53:34

ratcheer
Member
Registered: 2011-10-09
Posts: 912

Re: Can't boot from btrfs RAID1[SOLVED]

I believe my problem is the exact same thing: https://bbs.archlinux.org/viewtopic.php?id=189987 I will try the suggestion of adding btrfs to mkinitcpio.conf and rebuilding initramfs.

Is this going to be fixed in the future? I have had this Arch system running for three months, and I never had to do this, before.

Tim

Offline

#23 2014-11-17 20:04:25

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,750
Website

Re: Can't boot from btrfs RAID1[SOLVED]

ratcheer wrote:

I believe my problem is the exact same thing: https://bbs.archlinux.org/viewtopic.php?id=189987 I will try the suggestion of adding btrfs to mkinitcpio.conf and rebuilding initramfs.

Is this going to be fixed in the future? I have had this Arch system running for three months, and I never had to do this, before.

Tim

I had a quick look, but I couldn't find a bug report. Yafeng, did you open one? If so, can you post a link please.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#24 2014-11-19 13:56:08

rpodgorny
Member
Registered: 2014-11-19
Posts: 7

Re: Can't boot from btrfs RAID1[SOLVED]

me too. a day worth of work finally brought me here. please make an official announcement. thank you...

Offline

#25 2014-11-22 12:39:55

frederik
Member
Registered: 2014-01-05
Posts: 8

Re: Can't boot from btrfs RAID1[SOLVED]

+1 for official announcement. Took me a whole night without sleep

Last edited by frederik (2014-11-22 12:40:11)

Offline

Board footer

Powered by FluxBB