You are not logged in.

#1 2021-01-18 13:25:46

zeitgeist87
Member
Registered: 2012-06-19
Posts: 6

[SOLVED] Strange Issue with Grub

Hi guys,

I have a really strange and frustrating issue with GRUB where I need some expert advice. I have a working, encrypted Arch Linux installation on an SSD. I have been using it for years.  Everything works fine and Grub boots correctly, as long as I connect the SSD over SATA internally. Everything uses UUIDs and works like a treat. However, if I connect the exact same SSD over a SATA-To-USB3-Adapter I get an "error: unknown filesystem". The oddest thing is, that the decryption works, but after that it cannot find any file system.

1. Grub promts me to enter my password for the encrypted volume, If I enter the correct password it works and opens the slot, if I enter the wrong password it shows an error message. So it clearly found the disk and is able to decrypt it.
2. I get dropped into the rescue shell with "error: unknown filesystem"
3. If I type "ls" I can see there is a device "(crypto0)", if I type "ls (crypto0)" I get the same "error: unknown filesystem" error.
4. All other partitions, even internal hard drives where I know the file system is FAT32, show the exact same error: "error: unknown filesystem"

The EXACT same SSD connected internally directly to SATA works just fine, so it is not an incompatible file system or a missing module or invalid UUIDs. The ONLY variable I changed is to connect it over USB. I tried all the usual commands without any effect:

1. grub-mkconfig -o /boot/grub/grub.conf
2. grub-install --target=i386-pc /dev/sda
3. grub-install --target=i386-pc --recheck /dev/sda
4. grub-install --target=i386-pc --recheck --removable /dev/sda

I installed the latest Grub, which apperently was a big mistake. I did a grub-install with the new version, and now it stopped working. The strangest thing is, that it used to work over USB for years with exactly this SSD and file system. Do you have any idea what the problem could be?

Thank you,

Best regards,
Andreas

Last edited by zeitgeist87 (2021-01-22 06:25:07)

Offline

#2 2021-01-18 13:32:19

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,427

Re: [SOLVED] Strange Issue with Grub

Try to boot the fallback image, it's likely that you need a module that isn't in the generated image to access via the usb slot I'm guessing usb_storage or so, explicitly add it to the MODULES line in your mkinitcpio.conf. You are past GRUB when you get the unknown file system error no amount of fiddling with grub will fix this.

Offline

#3 2021-01-18 13:46:18

zeitgeist87
Member
Registered: 2012-06-19
Posts: 6

Re: [SOLVED] Strange Issue with Grub

Hi V1del,

Thanks for your response. I use an encrypted boot partition, so I have to enter my password in Grub.

https://wiki.archlinux.org/index.php/GR … pted_/boot

I am in the Grub rescue shell and not in the initramfs rescue shell. Also Grub can find the partition with the correct UUID. The Grub command "cryptomount (hd0,msdos1)" works if I enter the correct password. After that, there is a device "(crypto0)". So everything should work. It is just, that on that decrypted device, Grub cannot find any file system.

Furthermore, if I connect the SSD directly with SATA it works.

Offline

#4 2021-01-18 18:34:37

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,680
Website

Re: [SOLVED] Strange Issue with Grub

zeitgeist87 wrote:

4. grub-install --target=i386-pc --recheck --removable /dev/sda

The --removable option is meaningless for a non-UEFI system.

I don't use encryption so I might be missing something obvious but try adding the USB modules to core.img:

# grub-install --target=i386-pc --modules=usb /dev/sda

EDIT: list of modules here in case you want to try some others.

Last edited by Head_on_a_Stick (2021-01-18 18:36:40)

Offline

#5 2021-01-19 21:47:02

zeitgeist87
Member
Registered: 2012-06-19
Posts: 6

Re: [SOLVED] Strange Issue with Grub

Thank you Head_on_a_Stick,

I tried any possible combination without any luck. In the end I was using the following command, but it seems to make no difference:

sudo grub-install --target=i386-pc --modules="part_gpt part_msdos usb usbms btrfs fat usb_keyboard biosdisk luks lvm" --recheck  /dev/sda

There seems to be a bit of randomness to it. Sometimes I get lucky and Grub boots a bit further.

USB:

grub> ls
(crypto0) (proc) ...
grub> ls (crypto0)
Device crypto0: File system btrfs - ...
grub> ls (crypto0)/
dev/ run/ boot/ lib/ sbin/ srv/ ...
grub> ls (crypto0)/boot
Error: unknown filesystem
Error: unknown filesystem
Error: unknown filesystem
Error: unknown filesystem
...
grub>  ls (crypto0)/
Error: unknown filesyste
grub>

Same disk over SATA (no changes since the USB test):

grub> ls
(crypto0) (proc) ...
grub> ls (crypto0)
Device crypto0: File system btrfs - ...
grub> ls (crypto0)/
dev/ run/ boot/ lib/ sbin/ srv/ ...
grub> ls (crypto0)/boot
vmlinuz-linux grub/ initramfs-linux.img

It has to be some kind of timing issue. How is it possible that it works perfectly over SATA and kinda half works over USB? How can I debug this issue?

Best regards
Andreas

Last edited by zeitgeist87 (2021-01-19 21:52:51)

Offline

#6 2021-01-20 01:33:13

kermit63
Member
Registered: 2018-07-04
Posts: 171

Re: [SOLVED] Strange Issue with Grub

This is a long shot.

Try plugging to a different USB port (if you have another one). Sometimes a failing port can yield inconsistent results.

Offline

#7 2021-01-20 02:25:27

mozurin
Member
Registered: 2020-12-13
Posts: 9

Re: [SOLVED] Strange Issue with Grub

Typing `set debug=all` in the grub shell, you might be able to get more useful information about that error.

Offline

#8 2021-01-22 06:24:41

zeitgeist87
Member
Registered: 2012-06-19
Posts: 6

Re: [SOLVED] Strange Issue with Grub

I found the issue using

set debug=disk

and then googling the error message:

error: attempt to read or write outside of disk “hd0″

The following page has the perfect description of what is happening:

https://miloserdov.org/?p=2420

In my case, the legacy BIOS disk drivers work differently for USB and SATA disks. In my setup I used one big root file system, which also included the /boot directory. So depending on the state of the file system, some blocks end up outside of the extremely limited range of the legacy disk driver. Every time I executed grub-install I changed the file system and introduced some kind of randomness. I even got it to work briefly, by deleting a lot of data and defragmenting the file system.

The short term solution is to use a separate boot partition located at the beginning of the disk. The long term solution would be to switch to UEFI.

Thank you for your help!

Offline

Board footer

Powered by FluxBB