Public bug reported:

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.

** Affects: grub-installer (Ubuntu)
     Importance: Undecided
         Status: New

** Attachment added: "syslog part relevant to the bogus behavior"
   
https://bugs.launchpad.net/bugs/1926528/+attachment/5493167/+files/syslog-grub-installer.log

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1926528

Title:
  random failure of grub-installer, working after several retries

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/grub-installer/+bug/1926528/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to