help-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "grub-install: error: unaligned device size." When grub-install is r


From: Andrei Borzenkov
Subject: Re: "grub-install: error: unaligned device size." When grub-install is run from a bcache-backed filesystem.
Date: Tue, 2 May 2017 19:45:02 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

02.05.2017 09:05, J Mo пишет:
> 
> Hello!
> 
> I am trying to do a drive migration and have encountered an error that
> I've never seen before, and has me confused:
> 
> address@hidden grub-install /dev/disk/by-id/ata-WDC_WD3003FZEX-xxxxxxxxxxxx
> Installing for i386-pc platform.
> grub-install: error: unaligned device size.
> 
> 
> 
> Googling for "grub-install: error: unaligned device size." came up with
> nothing at all.
> 
> I would assume grub is complaining about some partition being unaligned,
> but that's not the case as far as I can see.
> 
> Environment here is a typical PC, Debian Unstable with grub packages
> 2.02~beta3-5 and standard Debian kernel 4.9.0-2-amd64.
> 
> The key factor causing this problems seems to be that I am running
> grub-install from a chroot environment on top of a bcache-backed
> filesystem.
> 
> Note that when I talk about bcache here, I'm talking about the old
> bcache type, not the new bcachefs.
> 
> If I copy my grub boot directory to another non-bcache filesystem
> location, it works fine.
> 
> I tried various overrides like --force and -s without success.
> 
> Here's what the end of grub-install with -v looks like:
> 
> grub-install: info: copying `/usr/share/grub/unicode.pf2' ->
> `/boot/grub/fonts/unicode.pf2'.
> grub-install: info: /dev/bcache0 is not present.
> grub-install: info: Looking for /dev/bcache0.
> grub-install: info: /dev/bcache0 is a parent of /dev/bcache0.
> grub-install: info: /dev/bcache0 is present.
> grub-install: info: Looking for /dev/bcache0.
> grub-install: info: /dev/bcache0 is a parent of /dev/bcache0.
> grub-install: info: /dev/bcache0 is present.
> grub-install: info: Looking for /dev/bcache0.
> grub-install: info: /dev/bcache0 is a parent of /dev/bcache0.
> grub-install: info: drive = 0.
> grub-install: error: unaligned device size.
> 

This message means that device size is not multiple of its sector size
as reported by kernel. Message is probably misleading indeed and could
be improved.

Please show output of

blockdev --report /dev/bcache0

> 
> 
> I am guessing that the grub-install process is doing some kind of sanity
> check to make sure that the /boot part is going to be accessible to the
> stage1 bootloader found in the MBR/bios-boot-part. The info messages
> above seem to indicate that grub-install trips up recursively on the
> bcache device. In this case, I was using a /boot grub install that was
> on a bcache-backed ext4 filesystem.
> 
> My workaround is to just copy the files to a temporary non-bcached
> location and run "grub-install --boot-directory=/mnt/new-bcache-boot/
> /dev/disk/by-id/ata-WDC_WD3003FZEX-xxxxxxxxxxx", but it seems kinda
> silly that I need to do this.
> 

Well, we do need to know whether device is accessible by firmware (BIOS
in legacy case) and exact location on this device. So we do need to map
from bcache to underlying device somehow. I personally am not familiar
with it, so someone will need to write a patch to handle it. It is more
appropriate for grub-devel list though.

I suggest you open feature request on
https://savannah.gnu.org/projects/grub so it is not get forgotten.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]