Comment 3 for bug 1491894

Louis Bouchard (louis) wrote :

I have the feeling that this portion of the grub-pc.postinst script is causing the issue :

            db_get grub-pc/install_devices
            if [ -z "$RET" ]; then
              # Reset the seen flag if the current answer is false, since
              # otherwise we'll loop with no indication of why.
              db_get grub-pc/install_devices_empty
              if [ "$RET" = false ]; then
                db_fset grub-pc/install_devices_empty seen false
              fi
              if db_input critical grub-pc/install_devices_empty; then
                db_go
                db_get grub-pc/install_devices_empty
                if [ "$RET" = true ]; then
                  break
                else
                  db_fset "$question" seen false
                  db_fset grub-pc/install_devices_empty seen false
                fi
              else
                break # noninteractive
              fi
            else
              break
            fi

Here is the debug log of a normal (i.e. failed) update :

debconf (developer): starting /var/lib/dpkg/info/grub-pc.postinst configure 1.99-21ubuntu3.18
...
debconf (developer): <-- INPUT high grub-pc/install_devices
debconf (developer): --> 30 question skipped
debconf (developer): <-- GO
debconf (developer): --> 0 ok
debconf (developer): <-- GET grub-pc/install_devices
debconf (developer): --> 0
debconf (developer): <-- GET grub-pc/install_devices
debconf (developer): --> 0
debconf (developer): <-- GET grub-pc/install_devices_empty
debconf (developer): --> 0 true
debconf (developer): <-- INPUT critical grub-pc/install_devices_empty
debconf (developer): --> 30 question skipped

When install_devices_empty = true, no question is asked and so no chance of fixing grub

When changing install_devices_empty to false we get :

debconf (developer): starting /var/lib/dpkg/info/grub-pc.postinst configure 1.99-21ubuntu3.18
....
debconf (developer): <-- INPUT high grub-pc/install_devices
debconf (developer): --> 30 question skipped
debconf (developer): <-- GO
debconf (developer): --> 0 ok
debconf (developer): <-- GET grub-pc/install_devices
debconf (developer): --> 0
debconf (developer): <-- GET grub-pc/install_devices
debconf (developer): --> 0
debconf (developer): <-- GET grub-pc/install_devices_empty
debconf (developer): --> 0 false
debconf (developer): <-- FSET grub-pc/install_devices_empty seen false
debconf (developer): --> 0 false
debconf (developer): <-- INPUT critical grub-pc/install_devices_empty
debconf (developer): --> 0 question will be asked
debconf (developer): <-- GO