Bug#540786: [grub-common] update-grub/grub-mkconfig doesnt work with btrfs as rootfs

Robert Wohlrab robert.wohlrab at gmx.de
Mon Aug 10 10:56:56 UTC 2009


Package: grub-common
Version: 1.96+20090725-1
Severity: normal

I have following test machine setup:
linux-2.6.31-rc5
/dev/sda2 - ext2 for /boot
/dev/sda3 - btrfs for /
/dev/sda4 - extended
/dev/sda5 - ext4 for /home
/dev/sda6 - swap

The system is booted (added a own block at /boot/grub/grub.cfg). When I run 
`update-grub` or `grub-mkconfig -o /boot/grub/grub.cfg` it just prints
 grub-probe: error: cannot find a device for /.

The problem seems to be that / is different then /dev/sda3

root.st_dev == 16
sda3.st_rdev == 2051

root.st_dev != sda2.st_rdev

If I look at /boot it looks like:
boot.st_dev == 2050
sda2.st_rdev == 2050

Maybe it has something to do with btrfs's subvolume support.

The problem is now that grub-probe now tests st_dev of / against st_rdev of 
the block devices in util/getroot.c find_root_device(..).
 if (S_ISBLK (st.st_mode) && st.st_rdev == dev)

Here the complete struct stat of /dev/sda3
1: st = {
 st_dev = 13,
 st_ino = 3243,
 st_nlink = 1,
 st_mode = 25008,
 st_uid = 0,
 st_gid = 6,
 __pad0 = 0,
 st_rdev = 2051,
 st_size = 0,
 st_blksize = 4096,
 st_blocks = 0,
 st_atim = {tv_sec = 1249898809, tv_nsec = 773817591},
 st_mtim = {tv_sec = 1249898809, tv_nsec = 753815550},
 st_ctim = {tv_sec = 1249891613, tv_nsec = 405308420},
 __unused = {0, 0, 0}}

and of /
1: st = {
 st_dev = 16,
 st_ino = 256,
 st_nlink = 1,
 st_mode = 16877,
 st_uid = 0,
 st_gid = 0,
 __pad0 = 0,
 st_rdev = 0,
 st_size = 286,
 st_blksize = 4096,
 st_blocks = 8,
 st_atim = {tv_sec = 1249891701, tv_nsec = 425313494},
 st_mtim = {tv_sec = 1249891699, tv_nsec = 353312069},
 st_ctim = {tv_sec = 1249891699, tv_nsec = 353312069},
 __unused = {0, 0, 0}}

--- System information. ---
Architecture: amd64
Kernel:       Linux 2.6.31-rc5

Debian Release: squeeze/sid
  500 unstable        ftp.debian.org 
    1 experimental    ftp.debian.org 

--- Package information. ---
Depends                    (Version) | Installed
====================================-+-====================
libc6                       (>= 2.3) | 2.9-23
libfreetype6              (>= 2.2.1) | 2.3.9-5
libncurses5      (>= 5.6+20071006-3) | 5.7+20090803-1
zlib1g                  (>= 1:1.1.4) | 1:1.2.3.3.dfsg-15
base-files               (>= 4.0.1~) | 5.0.0


Package's Recommends field is empty.

Suggests           (Version) | Installed
============================-+-===========
multiboot-doc                | 





-- 
Robert Wohlrab





More information about the Pkg-grub-devel mailing list