[Bug 1926528] Re: random failure of grub-installer, working after several retries
christopheg
1926528 at bugs.launchpad.net
Tue May 4 12:48:04 UTC 2021
above command missing some escapes, here is the correct one
d-i partman/early_command string \
sed -i "s/initial_proc_contents=\"\$(ls \$ROOT\/proc)\".*/set +e ; & ; set -e/" /usr/bin/grub-installer ;
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to grub-installer in Ubuntu.
https://bugs.launchpad.net/bugs/1926528
Title:
random failure of grub-installer, working after several retries
Status in grub-installer:
New
Status in grub-installer package in Ubuntu:
New
Bug description:
I prepared an unattended install usb key for focal base on netboot.iso
"http://archive.ubuntu.com/ubuntu/dists/focal/main/installer-amd64/current/legacy-images/netboot/mini.iso"
I'm modifying it to install a preseed to create user account, auto
partitioning and such things.
On some machines the unattended install stops when executing the step
"Install the GRUB boot loader on a hard disk".
The problem was rather bizarre because if I retried to execute several
times the Install Grub step it eventually worked.
As the installation logs were not saying much, I eventually edited
grub-installer on the boot key to enable the commented 'set +x' at the
beginning of the script.
Is the content the content of syslog relevant to this bug, both for a
breaking boot loader installation and a working one.
I was able to dig out and find where the bug is coming from. Actually
the origin of the bug is rather funny.
grub-installer script enables break on error with a 'set -e' at
beginning of the script.
A few lines below the script do:
initial_proc_contents="$(ls $ROOT/proc)"
But in the failing cases ls command is returning an exit code of 1
instead of 0 and stops the script.
I checked by doing a direct ls /target/proc ; echo $? from the shell.
And I actually get 1 most of the time and eventually 0 when I get
lucky (which would lead to grub installing correctly). My
understanding of that the underlying cause is that some process
terminated while ls was running and thus the pid of that process
disappeard from the /proc directory in the middle of the command.
After find that I was also able to check the bug disappears when
modifying grub-installer (just did 'set +e' just before the ls and
reenabled 'set -e' just after it, but there may be a better way to fix
that).
After that change the grub installation step works every time and if I
remove that change it starts again to break randomly.
Hopefully this report will help to fix that behavior in grub-installer
as I don't know how to prepackage package it in my key.
To manage notifications about this bug go to:
https://bugs.launchpad.net/grub-installer/+bug/1926528/+subscriptions
More information about the foundations-bugs
mailing list