lucid to precise to trusty upgrade may leave system unbootable

Bug #1491894 reported by Louis Bouchard on 2015-09-03
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
grub2 (Ubuntu)
High
Louis Bouchard
Trusty
High
Louis Bouchard

Bug Description

A system, initially installed on 10.04 Lucid then upgraded to 12.04 precise, when upgraded to Trusty may not reboot following the end of the do-release-upgrade command.

Reproduction steps
==================

Install a VM with 10.04.4-server ISO. When booted in 10.04, issue :

$ sudo do-release-upgrade # to 12.04 precise

Then let the system upgrade and reboot.

$ sudo do-release-upgrade # to 14.04 trusty

Then let the system upgrade and reboot

Upon reboot, the system will display a blank screen with a prompt and will not reboot.

Workaround
==========

Force a reconfiguration of the grub-pc package :
$ sudo dpkg-reconfigure grub-pc

Louis Bouchard (louis) on 2015-09-04
Changed in grub2 (Ubuntu):
status: New → Confirmed
importance: Undecided → High
description: updated
Louis Bouchard (louis) on 2015-09-07
Changed in grub2 (Ubuntu):
assignee: nobody → Louis Bouchard (louis-bouchard)
Bryan Quigley (bryanquigley) wrote :

I believe a default change is needed before this would work:
1. Install and update Lucid on a VM
2. Note output of false from `sudo debconf-show grub-pc | grep empty
3. Run "sudo dpkg-reconfigure grub-pc". Note how it doesn't let you Select No. (looks to be bug 580408)
4. Note how _empty is now true.

5. Upgrade to 12.04.
6. During upgrade if _empty is set to true no grub prompt loads. If a prompt does load, selecting to not install grub will be equivalent for the next breakage.
7. Upgrade to 14.04 and reboot. Note how it doesn't ask you any questions at all about Grub.
8. Find blinking cursor and broken grub.

Louis Bouchard (louis) wrote :

Well, it looks like the culprit could pretty well be a wrong setting of the grub-pc/install_devices_empty variable.

Checking each context I find :

Lucid (initial) : grub-pc/install_devices_empty: true
Lucid (post reconf) : grub-pc/install_devices_empty: true

Whereas on a frech Precise install we have :
* grub-pc/install_devices: /dev/vda
   grub-pc/install_devices_empty: false

When upgrading from Lucid, the debconf values are wrong since even if grub has been installed, the debconf values do not reflect this so the first stage is not reinstalled, hence the failed boot.

Louis Bouchard (louis) on 2015-09-08
description: updated
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

Louis Bouchard (louis) on 2015-09-09
Changed in grub2 (Ubuntu):
status: Confirmed → In Progress
Changed in grub2 (Ubuntu Trusty):
status: New → In Progress
importance: Undecided → High
assignee: nobody → Louis Bouchard (louis-bouchard)
tags: added: sts
Louis Bouchard (louis) wrote :

Ok, just trying to be a bit clearer for my own good :

A system upgraded from Lucid to Precise will have the following debconf setup :

* grub-pc/install_devices:
  grub-pc/install_devices_failed_upgrade: true
* grub-pc/install_devices_empty: true
  grub-pc/install_devices_failed: false
  grub-pc/install_devices_disks_changed:

Once this system will be upgraded to Trusty, it will have :

* grub-pc/install_devices_empty: true
  grub-pc/install_devices_failed_upgrade: true
  grub-pc/install_devices_disks_changed:
  grub-pc/install_devices_failed: false
* grub-pc/install_devices:

Normally, the system should have what a fresh precise system had in the previous comment :

* grub-pc/install_devices: /dev/vda
  grub-pc/install_devices_failed_upgrade: true
  grub-pc/install_devices_empty: false
  grub-pc/install_devices_failed: false
  grub-pc/install_devices_disks_changed:

Louis Bouchard (louis) wrote :

First proposition of fix for discussion

Louis Bouchard (louis) wrote :

Second proposition of fix which exclude execution of the fix if grub-pc/install_devices already holds a value

tags: added: patch
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers