GRUB install on Debian 11 live image failed to get canonical path of 'overlay'
2
votes
1
answer
3664
views
We're building a Debian based product. To simplify building these in the factory, I'm trying to build a live disk that will install the main OS. We have an older product that uses this processbut was based on Debian 7. I'm using Debian 11. I've based my Debian 11 recovery process and image on the Debian 7 one. Both use
live-build
. The Debian 11 system pulls the OS from mainline bullseye
repos plus my repo for the one package that carries our bits. It's a multistep process where we run live-build
to build the operational system's OS, squash it into a squashfs, then build a live OS around it with a script that does things like partition the driven, unsquash the squashfs file to the appropriate partition, and, most critically not working, apply GRUB.
Part of the build does:
install -d /boot/seed
grub-mkimage -Ox86_64-efi -o /boot/seed/BOOTX64.EFI -p '(hd0,1)/EFI/BOOT/grub' \
part_gpt part_msdos fat
grub-mkimage -Oi386-pc -o /boot/seed/mbr-core.img -p '(hd0,msdos1)/biosgrub' \
part_msdos fat biosdisk
grub-mkimage -Oi386-pc -o /boot/seed/gpt-core.img -p '(hd0,gpt1)/biosgrub' \
part_gpt fat biosdisk
cp -a /usr/lib/grub/i386-pc/boot.img /boot/seed/boot.img
cp -a /usr/lib/grub/i386-pc/modinfo.sh /boot/seed/modinfo.sh
grub-editenv /boot/seed/grubenv create
These files end up in the live OS and get copied to the ESP partition prior to attempting to install GRUB. Those files and all the various GRUB modules are copied midway through the install script.
Later on in the script, we call grub-install
.
grub-install \
--directory /mnt/biosgrub \
--boot-image boot.img \
--core-image core_img \
/dev/sda
The problem here is that the newer versions of grub-install
no longer support core-image
and boot-image
switches like the version from Debian 7 did so that fails immediately. I took out the boot-image
and core-image
switches and now it fails with:
grub-install: error: failed to get canonical path of `overlay'.
And yes, there really is an opening backtick with a closing single quote on overlay
.
I've tried removing the GRUB step, letting it unsquash everything, then booting to a graphical live disk running Manjaro (had it laying about) to try to get more info on the GRUB situation. Running grub-install
there fails in the same way.
From googling, I've learned that this is because grub-install
thinks the target device is using an overlayfs and can't figure out which actual device to use but I'm not really sure where to go from here nor am I certain what questions to ask. I'm happy to provide more details although somethings will have to be redacted for proprietary software reasons.
If it matters, manually mounting the created OS partition off-system shows everything to be in the right place, our code is in place and would probably run well if there were a bootloader.
ETA: I've made some progress here, mounting the unsquashed OS into a directory in the live disk, mounting /proc
, /sys
, and /dev
into that directory, mounting my EFI partition into it, and chroot
ing into it. Then running grub-install /dev/sda
but grub is still missing on startup.
Asked by jsimon
(121 rep)
Dec 21, 2021, 08:52 PM
Last activity: Jul 9, 2025, 07:05 PM
Last activity: Jul 9, 2025, 07:05 PM