All of lore.kernel.org
 help / color / mirror / Atom feed
* cannot mount btrfs root partition
@ 2022-05-03  8:20 richard lucassen
  2022-05-03  8:32 ` Hugo Mills
  2022-05-03  8:35 ` richard lucassen
  0 siblings, 2 replies; 9+ messages in thread
From: richard lucassen @ 2022-05-03  8:20 UTC (permalink / raw)
  To: linux-btrfs

Hello list,

New to btrfs, I try to load a btrfs / filesystem WITHOUT initrd but it
ends up in a kernel panic. I run lilo, boot from /dev/md0.
md1: swap,
md2: / filesystem
sda6/sdb6: btrfs raid1

When booting the system on the old md2 root fs, the btrfs raid1 mounts
in /mnt/data/ without problems. Everyting seems to be ok:

# btrfs filesystem show
Label: 'data'  uuid: 3173a224-830f-41d7-8870-3db0e8c986c9
        Total devices 2 FS bytes used 1020.38MiB
        devid    1 size 187.32GiB used 2.01GiB path /dev/sda6
        devid    2 size 187.32GiB used 2.01GiB path /dev/sdb6

It works like a charm. But when I tell lilo to use
either /dev/sda6, /dev/sdb6 or the UUID, it ends up in a kernel panic.

Here's some config:

Vanilla kernel 5.10.113

$ grep BTRFS .config
CONFIG_BTRFS_FS=y
CONFIG_BTRFS_FS_POSIX_ACL=y
# CONFIG_BTRFS_FS_CHECK_INTEGRITY is not set
# CONFIG_BTRFS_FS_RUN_SANITY_TESTS is not set
# CONFIG_BTRFS_DEBUG is not set
# CONFIG_BTRFS_ASSERT is not set
# CONFIG_BTRFS_FS_REF_VERIFY is not set

lilo stanza:

image=/boot/vmlinuz-5.10.113-apu1
        label=btrfs
        read-only
        root=/dev/sdb6
        append="console=ttyS0,115200n8"

BTRFS: device label data devid 1 transid 19 /dev/root scanned \
  by swapper/0 (1)
BTRFS info (device sda6): flagging fs with big metadata feature
BTRFS info (device sda6): disk space caching is enabled
BTRFS info (device sda6): has skinny extents
BTRFS error (device sdb6): devid 1 uuid \
 d201a08f-84ab-42e1-a411-83caadd1df2d is missing
BTRFS error (device sdb6): failed to read the system array: -2 
BTRFS error (device sdb6): open_ctree failed

# blkid /dev/sda6
/dev/sda6: LABEL="data" UUID="3173a224-830f-41d7-8870-3db0e8c986c9"
UUID_SUB="d201a08f-84ab-42e1-a411-83caadd1df2d" BLOCK_SIZE="4096"
TYPE="btrfs" PARTUUID="e0829fd9-06"

# blkid /dev/sdb6
/dev/sdb6: LABEL="data" UUID="3173a224-830f-41d7-8870-3db0e8c986c9"
UUID_SUB="e660257e-740b-4d92-8996-97ba86cbb812" BLOCK_SIZE="4096"
TYPE="btrfs" PARTUUID="748c2646-06"

Finally, I see this:

No filesystem could mount root,
tried:
ext3
ext4
ext2
vfat
msdos
btrfs

So, btrfs is a built-in fs, the boot process tries the btrfs fs, but is
not able to read it.

As said before, I'm new to btrfs and I'm a bit puzzeled now. I'd rather
do not use an initrd. It smells a bit like what's happening in the 7
year old bug: https://bugs.archlinux.org/task/42884

I also tried to boot from a single btrfs partition (no raid1 config) on
a separate disk, but no way.

Can anyone shine a light on this?

R.

-- 
richard lucassen
https://contact.xaq.nl/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: cannot mount btrfs root partition
  2022-05-03  8:20 cannot mount btrfs root partition richard lucassen
@ 2022-05-03  8:32 ` Hugo Mills
  2022-05-03  8:45   ` richard lucassen
  2022-05-03  8:35 ` richard lucassen
  1 sibling, 1 reply; 9+ messages in thread
From: Hugo Mills @ 2022-05-03  8:32 UTC (permalink / raw)
  To: linux-btrfs

On Tue, May 03, 2022 at 10:20:01AM +0200, richard lucassen wrote:
> Hello list,
> 
> New to btrfs, I try to load a btrfs / filesystem WITHOUT initrd but it
> ends up in a kernel panic. I run lilo, boot from /dev/md0.
> md1: swap,
> md2: / filesystem
> sda6/sdb6: btrfs raid1

   Generally speaking, if you have a multi-device FS as your /, you
*really* should have an initramfs. In order to mount the FS, the
kernel needs to know which devices contain which parts of which
filesystem. The tool for doing this, "btrfs dev scan", runs in
userspace, so you have to have a userspace available before you can
mount /. This is what an initramfs is.

   In theory, it's possible to use a mount option to specify the
devices explicitly, but in practice, that's heavily dependent on the
device enumeration order, and can change at any time (between one
kernel version and another; or even simply between one boot and
another). I would strongly recommend against using it, for that
reason.

   Hugo.

> When booting the system on the old md2 root fs, the btrfs raid1 mounts
> in /mnt/data/ without problems. Everyting seems to be ok:
> 
> # btrfs filesystem show
> Label: 'data'  uuid: 3173a224-830f-41d7-8870-3db0e8c986c9
>         Total devices 2 FS bytes used 1020.38MiB
>         devid    1 size 187.32GiB used 2.01GiB path /dev/sda6
>         devid    2 size 187.32GiB used 2.01GiB path /dev/sdb6
> 
> It works like a charm. But when I tell lilo to use
> either /dev/sda6, /dev/sdb6 or the UUID, it ends up in a kernel panic.
> 
> Here's some config:
> 
> Vanilla kernel 5.10.113
> 
> $ grep BTRFS .config
> CONFIG_BTRFS_FS=y
> CONFIG_BTRFS_FS_POSIX_ACL=y
> # CONFIG_BTRFS_FS_CHECK_INTEGRITY is not set
> # CONFIG_BTRFS_FS_RUN_SANITY_TESTS is not set
> # CONFIG_BTRFS_DEBUG is not set
> # CONFIG_BTRFS_ASSERT is not set
> # CONFIG_BTRFS_FS_REF_VERIFY is not set
> 
> lilo stanza:
> 
> image=/boot/vmlinuz-5.10.113-apu1
>         label=btrfs
>         read-only
>         root=/dev/sdb6
>         append="console=ttyS0,115200n8"
> 
> BTRFS: device label data devid 1 transid 19 /dev/root scanned \
>   by swapper/0 (1)
> BTRFS info (device sda6): flagging fs with big metadata feature
> BTRFS info (device sda6): disk space caching is enabled
> BTRFS info (device sda6): has skinny extents
> BTRFS error (device sdb6): devid 1 uuid \
>  d201a08f-84ab-42e1-a411-83caadd1df2d is missing
> BTRFS error (device sdb6): failed to read the system array: -2 
> BTRFS error (device sdb6): open_ctree failed
> 
> # blkid /dev/sda6
> /dev/sda6: LABEL="data" UUID="3173a224-830f-41d7-8870-3db0e8c986c9"
> UUID_SUB="d201a08f-84ab-42e1-a411-83caadd1df2d" BLOCK_SIZE="4096"
> TYPE="btrfs" PARTUUID="e0829fd9-06"
> 
> # blkid /dev/sdb6
> /dev/sdb6: LABEL="data" UUID="3173a224-830f-41d7-8870-3db0e8c986c9"
> UUID_SUB="e660257e-740b-4d92-8996-97ba86cbb812" BLOCK_SIZE="4096"
> TYPE="btrfs" PARTUUID="748c2646-06"
> 
> Finally, I see this:
> 
> No filesystem could mount root,
> tried:
> ext3
> ext4
> ext2
> vfat
> msdos
> btrfs
> 
> So, btrfs is a built-in fs, the boot process tries the btrfs fs, but is
> not able to read it.
> 
> As said before, I'm new to btrfs and I'm a bit puzzeled now. I'd rather
> do not use an initrd. It smells a bit like what's happening in the 7
> year old bug: https://bugs.archlinux.org/task/42884
> 
> I also tried to boot from a single btrfs partition (no raid1 config) on
> a separate disk, but no way.
> 
> Can anyone shine a light on this?
> 
> R.
> 

-- 
Hugo Mills             | emacs: Emacs Makes A Computer Slow.
hugo@... carfax.org.uk |
http://carfax.org.uk/  |
PGP: E2AB1DE4          |

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: cannot mount btrfs root partition
  2022-05-03  8:20 cannot mount btrfs root partition richard lucassen
  2022-05-03  8:32 ` Hugo Mills
@ 2022-05-03  8:35 ` richard lucassen
  1 sibling, 0 replies; 9+ messages in thread
From: richard lucassen @ 2022-05-03  8:35 UTC (permalink / raw)
  To: linux-btrfs

On Tue, 3 May 2022 10:20:01 +0200
richard lucassen <mailinglists@lucassen.org> wrote:

> lilo stanza:
> image=/boot/vmlinuz-5.10.113-apu1
>         label=btrfs
>         read-only
>         root=/dev/sdb6
>         append="console=ttyS0,115200n8"
> 
> BTRFS: device label data devid 1 transid 19 /dev/root scanned \
>   by swapper/0 (1)
> BTRFS info (device sda6): flagging fs with big metadata feature
> BTRFS info (device sda6): disk space caching is enabled
> BTRFS info (device sda6): has skinny extents
> BTRFS error (device sdb6): devid 1 uuid \
>  d201a08f-84ab-42e1-a411-83caadd1df2d is missing
> BTRFS error (device sdb6): failed to read the system array: -2 
> BTRFS error (device sdb6): open_ctree failed

[addendum]

I also have a /dev/sda6 lilo stanza, it is possible that the logs shown
come from using root=/dev/sda6

-- 
richard lucassen
https://contact.xaq.nl/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: cannot mount btrfs root partition
  2022-05-03  8:32 ` Hugo Mills
@ 2022-05-03  8:45   ` richard lucassen
  2022-05-03  9:08     ` Hugo Mills
  0 siblings, 1 reply; 9+ messages in thread
From: richard lucassen @ 2022-05-03  8:45 UTC (permalink / raw)
  To: linux-btrfs

On Tue, 3 May 2022 09:32:06 +0100
Hugo Mills <hugo@carfax.org.uk> wrote:

> > New to btrfs, I try to load a btrfs / filesystem WITHOUT initrd but
> > it ends up in a kernel panic. I run lilo, boot from /dev/md0.
> > md1: swap,
> > md2: / filesystem
> > sda6/sdb6: btrfs raid1
> 
>    Generally speaking, if you have a multi-device FS as your /, you
> *really* should have an initramfs. In order to mount the FS, the
> kernel needs to know which devices contain which parts of which
> filesystem. The tool for doing this, "btrfs dev scan", runs in
> userspace, so you have to have a userspace available before you can
> mount /. This is what an initramfs is.
> 
>    In theory, it's possible to use a mount option to specify the
> devices explicitly, but in practice, that's heavily dependent on the
> device enumeration order, and can change at any time (between one
> kernel version and another; or even simply between one boot and
> another). I would strongly recommend against using it, for that
> reason.

Ok, but I see the same problem using a single /dev/sdc1 (non-raid1)
btrfs system. AFAIUI, that should work, correct?

I know devices can be renamed, but also tried to append

rootflags=device=/dev/sda6,device=/dev/sdb6

as written on this page:

https://btrfs.wiki.kernel.org/index.php/Using_Btrfs_with_Multiple_Devices

I have no idea if that is the right syntax, but that did not work
either.

And I know: it is also there: I should use an initrd, but just eager to
why it is not working anyway...

R.

-- 
richard lucassen
https://contact.xaq.nl/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: cannot mount btrfs root partition
  2022-05-03  8:45   ` richard lucassen
@ 2022-05-03  9:08     ` Hugo Mills
  2022-05-03  9:34       ` richard lucassen
  0 siblings, 1 reply; 9+ messages in thread
From: Hugo Mills @ 2022-05-03  9:08 UTC (permalink / raw)
  To: linux-btrfs

On Tue, May 03, 2022 at 10:45:50AM +0200, richard lucassen wrote:
> On Tue, 3 May 2022 09:32:06 +0100
> Hugo Mills <hugo@carfax.org.uk> wrote:
> 
> > > New to btrfs, I try to load a btrfs / filesystem WITHOUT initrd but
> > > it ends up in a kernel panic. I run lilo, boot from /dev/md0.
> > > md1: swap,
> > > md2: / filesystem
> > > sda6/sdb6: btrfs raid1
> > 
> >    Generally speaking, if you have a multi-device FS as your /, you
> > *really* should have an initramfs. In order to mount the FS, the
> > kernel needs to know which devices contain which parts of which
> > filesystem. The tool for doing this, "btrfs dev scan", runs in
> > userspace, so you have to have a userspace available before you can
> > mount /. This is what an initramfs is.
> > 
> >    In theory, it's possible to use a mount option to specify the
> > devices explicitly, but in practice, that's heavily dependent on the
> > device enumeration order, and can change at any time (between one
> > kernel version and another; or even simply between one boot and
> > another). I would strongly recommend against using it, for that
> > reason.
> 
> Ok, but I see the same problem using a single /dev/sdc1 (non-raid1)
> btrfs system. AFAIUI, that should work, correct?
> 
> I know devices can be renamed, but also tried to append
> 
> rootflags=device=/dev/sda6,device=/dev/sdb6
> 
> as written on this page:
> 
> https://btrfs.wiki.kernel.org/index.php/Using_Btrfs_with_Multiple_Devices
> 
> I have no idea if that is the right syntax, but that did not work
> either.
> 
> And I know: it is also there: I should use an initrd, but just eager to
> why it is not working anyway...

   For the single-drive case, I don't know why that's not working. Is
the error message the same with that as for the multi-device FS?

   Hugo.

-- 
Hugo Mills             | Great films about cricket: The Third Man
hugo@... carfax.org.uk |
http://carfax.org.uk/  |
PGP: E2AB1DE4          |

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: cannot mount btrfs root partition
  2022-05-03  9:08     ` Hugo Mills
@ 2022-05-03  9:34       ` richard lucassen
  2022-05-03  9:54         ` Qu Wenruo
  0 siblings, 1 reply; 9+ messages in thread
From: richard lucassen @ 2022-05-03  9:34 UTC (permalink / raw)
  To: linux-btrfs

On Tue, 3 May 2022 10:08:42 +0100
Hugo Mills <hugo@carfax.org.uk> wrote:

>    For the single-drive case, I don't know why that's not working. Is
> the error message the same with that as for the multi-device FS?

Oops, error, mea culpa, it's an SD card and I forgot the "rootwait"
option. It boots into btrfs now!

About the option to specify the devices explicitely, is this the right
syntax to tell the kernel what to do?

append="root=/dev/sda6 rootflags=device=/dev/sda6,device=/dev/sdb6"

R.

-- 
richard lucassen
https://contact.xaq.nl/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: cannot mount btrfs root partition
  2022-05-03  9:34       ` richard lucassen
@ 2022-05-03  9:54         ` Qu Wenruo
  2022-05-03 11:30           ` richard lucassen
  0 siblings, 1 reply; 9+ messages in thread
From: Qu Wenruo @ 2022-05-03  9:54 UTC (permalink / raw)
  To: linux-btrfs



On 2022/5/3 17:34, richard lucassen wrote:
> On Tue, 3 May 2022 10:08:42 +0100
> Hugo Mills <hugo@carfax.org.uk> wrote:
>
>>     For the single-drive case, I don't know why that's not working. Is
>> the error message the same with that as for the multi-device FS?
>
> Oops, error, mea culpa, it's an SD card and I forgot the "rootwait"
> option. It boots into btrfs now!
>
> About the option to specify the devices explicitely, is this the right
> syntax to tell the kernel what to do?
>
> append="root=/dev/sda6 rootflags=device=/dev/sda6,device=/dev/sdb6"

Since you only have two devices in the fs, you can skip the one in the
root=, just by:

root=/dev/sda6 rootflags=device=/dev/sdb6

You can test with all devices forgot:

# btrfs devices scan -u /dev/sda6
# btrfs devices scan -u /dev/sdb6
# mount /dev/sda6 -o device=/dev/sdb6 /mnt/btrfs

Thanks,
Qu
>
> R.
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: cannot mount btrfs root partition
  2022-05-03  9:54         ` Qu Wenruo
@ 2022-05-03 11:30           ` richard lucassen
  2022-05-03 11:34             ` Qu Wenruo
  0 siblings, 1 reply; 9+ messages in thread
From: richard lucassen @ 2022-05-03 11:30 UTC (permalink / raw)
  To: linux-btrfs

On Tue, 3 May 2022 17:54:54 +0800
Qu Wenruo <quwenruo.btrfs@gmx.com> wrote:

> > About the option to specify the devices explicitely, is this the
> > right syntax to tell the kernel what to do?
> >
> > append="root=/dev/sda6 rootflags=device=/dev/sda6,device=/dev/sdb6"
> 
> Since you only have two devices in the fs, you can skip the one in the
> root=, just by:
> 
> root=/dev/sda6 rootflags=device=/dev/sdb6
> 
> You can test with all devices forgot:
> 
> # btrfs devices scan -u /dev/sda6
> # btrfs devices scan -u /dev/sdb6
> # mount /dev/sda6 -o device=/dev/sdb6 /mnt/btrfs

Thnx Qu, but Hugo is right: to boot btrfs raid1 you need userspace on
initramfs, and these options are for /etc/fstab, not for use at boot
time when there is no / device available.

R.

-- 
richard lucassen
https://contact.xaq.nl/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: cannot mount btrfs root partition
  2022-05-03 11:30           ` richard lucassen
@ 2022-05-03 11:34             ` Qu Wenruo
  0 siblings, 0 replies; 9+ messages in thread
From: Qu Wenruo @ 2022-05-03 11:34 UTC (permalink / raw)
  To: linux-btrfs



On 2022/5/3 19:30, richard lucassen wrote:
> On Tue, 3 May 2022 17:54:54 +0800
> Qu Wenruo <quwenruo.btrfs@gmx.com> wrote:
>
>>> About the option to specify the devices explicitely, is this the
>>> right syntax to tell the kernel what to do?
>>>
>>> append="root=/dev/sda6 rootflags=device=/dev/sda6,device=/dev/sdb6"
>>
>> Since you only have two devices in the fs, you can skip the one in the
>> root=, just by:
>>
>> root=/dev/sda6 rootflags=device=/dev/sdb6
>>
>> You can test with all devices forgot:
>>
>> # btrfs devices scan -u /dev/sda6
>> # btrfs devices scan -u /dev/sdb6
>> # mount /dev/sda6 -o device=/dev/sdb6 /mnt/btrfs
>
> Thnx Qu, but Hugo is right: to boot btrfs raid1 you need userspace on
> initramfs, and these options are for /etc/fstab, not for use at boot
> time when there is no / device available.

Oh right, forgot that without an initramfs, we have nothing, including
/dev...

>
> R.
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-05-03 11:34 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-03  8:20 cannot mount btrfs root partition richard lucassen
2022-05-03  8:32 ` Hugo Mills
2022-05-03  8:45   ` richard lucassen
2022-05-03  9:08     ` Hugo Mills
2022-05-03  9:34       ` richard lucassen
2022-05-03  9:54         ` Qu Wenruo
2022-05-03 11:30           ` richard lucassen
2022-05-03 11:34             ` Qu Wenruo
2022-05-03  8:35 ` richard lucassen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.