bugGNU GRUB - Bugs: bug #64475, grub failed to initrd...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #64475: grub failed to initrd /boot/amd-ucode.img in btrfs partition with bees

Submitter:  Watermelon Rei <watermelonrei>
Submitted:  Wed 26 Jul 2023 12:17:14 PM UTC
   
 
Category:  Filesystem Severity:  Major
Priority:  5 - Normal Item Group:  Software Error
Status:  None Privacy:  Public
Assigned to:  None Originator Name: 
Open/Closed:  Open Release:  Git master
Release:  Reproducibility:  Every Time
Planned Release:  None

Jump to the original submission

Tue 10 Oct 2023 06:23:42 AM UTC, comment #6: 

It happened to me too and I'd like to receive notifications on this bug (I didn't figure out another way besides leaving a comment).

lilydjwg
Fri 28 Jul 2023 06:45:43 AM UTC, comment #5: 

Hello, I used
"qemu-img create -f raw example.img 200M"
to created a 200Mb image file, and
"losetup /dev/loop0 example.img",
mounting example.img as a loop device.

Then I formatted the /dev/loop0 by mkfs.btrfs with default options,

"mount /dev/loop0 /boot",
mounting the loop0 device to /boot,
copied the amd-ucode.img file to /boot/amd-ucode_src.img, and I noticed that I had enabled the zstd compression for my root partition, so I ran
"btrfs filesystem defragment -r -v -czstd /boot/"
to compress the amd-ucode_src.img file.

After that, started the beesd service for loop0, install the amd-ucode package by package manager, then I confirmed  the bees deduplicated the amd-ucode.img.

umount the /boot and "losetup -d /dev/loop0",
I compressed the example.img file with zstd.
I am not sure this image could cause the grub boot failed, just control the variables as same as possible.
Thanks!

(file #54989)

Watermelon Rei <watermelonrei>
Fri 28 Jul 2023 05:20:14 AM UTC, comment #4: 


comment #2:

> Can you recreate this with a small image and send it to me? You can use grub-fstest IMAGE cmp PATHINIMAGE PATHEXTERNAL to check if GRUB sees your files correctly


When I try to create a 16Mb raw img file and mkfs.btrfs the image file I got a massage:

> mkfs.btrfs example.img

btrfs-progs v6.3.2
See https://btrfs.readthedocs.io for more information.

ERROR: 'example.img' is too small to make a usable filesystem
ERROR: minimum size for each btrfs device is 114294784

I need to find some ways to upload the file above 16Mb

or i just uploade it to cloud storage.

Watermelon Rei <watermelonrei>
Fri 28 Jul 2023 01:29:49 AM UTC, comment #3: 

Here is the output of grub-fstest:

$ sudo grub-fstest /dev/nvme0n1p5 cmp /boot/amd-ucode.img linux-firmware/src/amd-ucode.img
grub-fstest: error: unexpected end of file.
$ sha512sum /boot/amd-ucode.img
bf563f3e46444bb74a9b5cdc9099b2e144f87ed00e129d23b64a822b218beb9c0758b6f95240866d241eb3eaa7230a53e01089b9f06c02d8737f152a53583db6  /boot/amd-ucode.img
$ sha512sum linux-firmware/src/amd-ucode.img
bf563f3e46444bb74a9b5cdc9099b2e144f87ed00e129d23b64a822b218beb9c0758b6f95240866d241eb3eaa7230a53e01089b9f06c02d8737f152a53583db6  linux-firmware/src/amd-ucode.img


information about bees:

Jul 26 16:52:15 Evangelion-05L beesd[606]: crawl_5_24128949[666]: dedup: src 56K [0x0..0xe000] {0x8055fac000} /run/bees/mnt/ed48d493-7777-451e-b7c5-fd4929b80146/home/watermelon/linux-firmware/src/amd-ucode.img
Jul 26 16:52:15 Evangelion-05L beesd[606]: crawl_5_24128949[666]:        dst 56K [0x0..0xe000] {0x945596f000} /run/bees/mnt/ed48d493-7777-451e-b7c5-fd4929b80146/boot/amd-ucode.img
Jul 26 16:52:15 Evangelion-05L beesd[606]: crawl_5_24128949[666]: scan: 56K 0x0 [Dddddddddddddd] 0xe000 /run/bees/mnt/ed48d493-7777-451e-b7c5-fd4929b80146/boot/amd-ucode.img
Jul 26 16:54:14 Evangelion-05L beesd[606]: crawl_5_24134164[655]: dedup: src 56K [0x0..0xe000] {0x8055fac000} /run/bees/mnt/ed48d493-7777-451e-b7c5-fd4929b80146/home/watermelon/linux-firmware/src/amd-ucode.img
Jul 26 16:54:14 Evangelion-05L beesd[606]: crawl_5_24134164[655]:        dst 56K [0x0..0xe000] {0x900230a000} /run/bees/mnt/ed48d493-7777-451e-b7c5-fd4929b80146/boot/amd-ucode.img
Jul 26 16:54:14 Evangelion-05L beesd[606]: crawl_5_24134164[655]: zero bbd BeesBlockData { 4K 0xe000 fd = 188 '/run/bees/mnt/ed48d493-7777-451e-b7c5-fd4929b80146/boot/amd-ucode.img', address = 0x9002318000, hash = 0x0, data[4096] }
Jul 26 16:54:14 Evangelion-05L beesd[606]: crawl_5_24134164[655]: copy: 4K [0xe000..0xf000) fd = 188 '/run/bees/mnt/ed48d493-7777-451e-b7c5-fd4929b80146/boot/amd-ucode.img'
Jul 26 16:54:14 Evangelion-05L beesd[606]: crawl_5_24134164[655]:        dst 4K [0xe000..0xf000] {0x9002318000} /run/bees/mnt/ed48d493-7777-451e-b7c5-fd4929b80146/boot/amd-ucode.img
Jul 26 16:54:14 Evangelion-05L beesd[606]: crawl_5_24134164[655]: scan: 60K 0x0 [dddddddddddddd+] 0xf000 /run/bees/mnt/ed48d493-7777-451e-b7c5-fd4929b80146/boot/amd-ucode.img
Jul 27 13:31:50 Evangelion-05L beesd[610]: crawl_5_24142659[656]: dedup: src 56K [0x0..0xe000] {0x8055fac000} /run/bees/mnt/ed48d493-7777-451e-b7c5-fd4929b80146/home/watermelon/linux-firmware/src/amd-ucode.img
Jul 27 13:31:50 Evangelion-05L beesd[610]: crawl_5_24142659[656]:        dst 56K [0x0..0xe000] {0x957fef4000} /run/bees/mnt/ed48d493-7777-451e-b7c5-fd4929b80146/boot/amd-ucode.img
Jul 27 13:31:50 Evangelion-05L beesd[610]: crawl_5_24142659[656]: zero bbd BeesBlockData { 4K 0xe000 fd = 84 '/run/bees/mnt/ed48d493-7777-451e-b7c5-fd4929b80146/boot/amd-ucode.img', address = 0x957ff02000, hash = 0x0, data[4096] }
Jul 27 13:31:50 Evangelion-05L beesd[610]: crawl_5_24142659[656]: copy: 4K [0xe000..0xf000) fd = 84 '/run/bees/mnt/ed48d493-7777-451e-b7c5-fd4929b80146/boot/amd-ucode.img'
Jul 27 13:31:50 Evangelion-05L beesd[610]: crawl_5_24142659[656]:        dst 4K [0xe000..0xf000] {0x957ff02000} /run/bees/mnt/ed48d493-7777-451e-b7c5-fd4929b80146/boot/amd-ucode.img
Jul 27 13:31:50 Evangelion-05L beesd[610]: crawl_5_24142659[656]: scan: 60K 0x0 [dddddddddddddd+] 0xf000 /run/bees/mnt/ed48d493-7777-451e-b7c5-fd4929b80146/boot/amd-ucode.img


(file #54988)

Watermelon Rei <watermelonrei>
Thu 27 Jul 2023 05:27:39 PM UTC, comment #2: 

Can you recreate this with a small image and send it to me? You can use grub-fstest IMAGE cmp PATHINIMAGE PATHEXTERNAL to check if GRUB sees your files correctly

Vladimir Serbinenko <phcoder>
Group administrator
Wed 26 Jul 2023 12:24:29 PM UTC, comment #1: 

I mean, something wrong with grub btrfs module, sorry for my mistyping!

Watermelon Rei <watermelonrei>
Wed 26 Jul 2023 12:17:14 PM UTC, original submission:  

Grub version 2.12rc1

OS: archlinux x86_64

The output of "fdisk -l":
Disk /dev/nvme0n1: 476.94 GiB, 512110190592 bytes, 1000215216 sectors
Disk model: SAMSUNG MZVLQ512HALU-00000             
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt


Device             Start        End   Sectors   Size Type
/dev/nvme0n1p1      2048     206847    204800   100M EFI System
/dev/nvme0n1p2    206848     239615     32768    16M Microsoft reserved
/dev/nvme0n1p3    239616  499009031 498769416 237.8G Microsoft basic data
/dev/nvme0n1p4 499009536  500226047   1216512   594M Windows recovery environment
/dev/nvme0n1p5 500228096 1000215182 499987087 238.4G Linux filesystem

fstab:

# /dev/nvme1n1p5
UUID=ed48d493-7777-451e-b7c5-fd4929b80146       /               btrfs           rw,relatime,compress= zstd,ssd,space_cache,subvolid=5,subvol=/   0 0

# /dev/nvme1n1p1
UUID=90F9-3E63          /efi            vfat            rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro       0 2


I updated amd-ucode package from a old version A to the new version B, then reboot system, I got following error during grub loading microcode:

> error: start_image() returned 0x8000000000000001


changed the line 
"initrd  /boot/amd-ucode.img /boot/initramfs-linux.img"
to
"initrd /boot/initramfs-linux.img"
in /boot/grub/grub.cfg, the system booted.

I just downgraded amd-ucode back to version A, but the system boot was still failed.

After multiple attempts, I found that boot failed is not associated with amd-ucode, I had enabled beesd service for deduplicating root partition nvme1n1p5, and bees just deduplicated the /boot/amd-ucode.img, which caused the failed.

Disabled & stopped beesd, reinstall amd-ucode with any version, system boot successfully.

There might be something wrong with grub btrfs model.

Maybe this procedure can reproduce the issue:

1. enable & start a beesd service for root partition;
2. pre-save the amd-ucode.img to somewhere in root partition;
3. install the amd-ucode package, that the package manager install the same amd-ucode.img file to /boot/, and triggering bees deduplicate /boot/amd-ucode.img
4. reboot, grub fail in boot.


these are output of "btrfs inspect-internal dump-tree " about amd-ucode.img file with and without beesd enabled:

without dedup:
item 76 key (14156031 DIR_ITEM 2438870455) itemoff 6638 itemsize 43
location key (24128949 INODE_ITEM 0) type FILE
transid 63598 data_len 0 name_len 13
name: amd-ucode.img
item 4 key (14156031 DIR_INDEX 168) itemoff 16056 itemsize 43
location key (24128949 INODE_ITEM 0) type FILE
transid 63598 data_len 0 name_len 13
name: amd-ucode.img
item 31 key (24128949 INODE_ITEM 0) itemoff 13460 itemsize 160
generation 63598 transid 63598 size 61440 nbytes 61440
block group 0 mode 100644 links 1 uid 0 gid 0 rdev 0
sequence 3 flags 0x0(none)
atime 1690359197.0 (2023-07-26 16:13:17)
ctime 1690359197.297284954 (2023-07-26 16:13:17)
mtime 1690334459.0 (2023-07-26 09:20:59)
otime 1690359197.297284954 (2023-07-26 16:13:17)
item 32 key (24128949 INODE_REF 14156031) itemoff 13437 itemsize 23
index 168 namelen 13 name: amd-ucode.img
item 33 key (24128949 EXTENT_DATA 0) itemoff 13384 itemsize 53
generation 63598 type 1 (regular)
extent data disk byte 637091115008 nr 61440
extent data offset 0 nr 61440 ram 61440
extent compression 0 (none)


with dudep:
item 76 key (14156031 DIR_ITEM 2438870455) itemoff 6638 itemsize 43
location key (24126976 INODE_ITEM 0) type FILE
transid 63502 data_len 0 name_len 13
name: amd-ucode.img
item 4 key (14156031 DIR_INDEX 167) itemoff 16056 itemsize 43
location key (24126976 INODE_ITEM 0) type FILE
transid 63502 data_len 0 name_len 13
name: amd-ucode.img
item 63 key (24126976 INODE_ITEM 0) itemoff 10170 itemsize 160
generation 63502 transid 63540 size 61440 nbytes 57344
block group 0 mode 100644 links 1 uid 0 gid 0 rdev 0
sequence 8 flags 0x0(none)
atime 1690355371.0 (2023-07-26 15:09:31)
ctime 1690357303.165164843 (2023-07-26 15:41:43)
mtime 1690334459.0 (2023-07-26 09:20:59)
otime 1690355371.34542255 (2023-07-26 15:09:31)
item 64 key (24126976 INODE_REF 14156031) itemoff 10147 itemsize 23
index 167 namelen 13 name: amd-ucode.img
item 65 key (24126976 EXTENT_DATA 0) itemoff 10094 itemsize 53
generation 62918 type 1 (regular)
extent data disk byte 551198310400 nr 4096
extent data offset 0 nr 4096 ram 4096
extent compression 0 (none)
item 66 key (24126976 EXTENT_DATA 4096) itemoff 10041 itemsize 53
generation 58924 type 1 (regular)
extent data disk byte 612950372352 nr 90112
extent data offset 24576 nr 16384 ram 131072
extent compression 3 (zstd)
item 67 key (24126976 EXTENT_DATA 20480) itemoff 9988 itemsize 53
generation 62296 type 1 (regular)
extent data disk byte 620042072064 nr 36864
extent data offset 0 nr 36864 ram 36864
extent compression 0 (none)

Watermelon Rei <watermelonrei>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #54989:  example.img.zst added by watermelonrei (61KiB - application/zstd - the compressed img file containing amd-ucode.img(deduped file) and amd-ucode_src.img(srouce file))
file #54988:  amd-ucode.img added by watermelonrei (60KiB - application/x-raw-disk-image)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by lilydjwg (Posted a comment)
  • -email is unavailable- added by phcoder (Posted a comment)
  • -email is unavailable- added by watermelonrei (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-07-28 watermelonrei Attached File- Added example.img.zst, #54989
    2023-07-28 watermelonrei Attached File- Added amd-ucode.img, #54988

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code