matt@crucible:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.3 LTS
Release:        16.04
Codename:       xenial

So last night I was running "sudo apt-get upgrade" to update my system when it popped into some keyboard-terminal-based input screen asking me which disk partion(s) to install some weird GRUB thing. And it made it sound like I had to pick the right partition or I'd foul things up. It said if I wasn't sure I should pick em all. There were four entries in the list (which seems a little weird to me since I think I only have one solid-state-drive in this particular machine and I don't know why I would have set up more partitions than absolutely necessary). I was loathe to pointlessly copy grub to partitions where it was not needed.

I felt like I had been suddenly unwillingly warped into an alternate reality where I was the ignorant Nazi in the Indiana Jones and the Last Crusade movie scene where I had to pick the right grail:


I found some web page (playing the role of the beautiful girl) telling me "sda" was "right" for most people. In my lust for keeping unneeded copies of grub from my drive, I boldly selected only the "sda" partition and proceeded.

I've been using ubuntu for years, but the only time I ever mess with grub is when I'm setting up a new box. And I haven't done that in years. Everytime I install, I have to carefully read the install instructions to guide me through the grub and partition setup. I don't remember how I set up the partitions on this machine anymore, or where I put grub. All I know about grub is it's some bit of code that's run by the BIOS that lets you pick whether you want to boot windows or ubuntu. My systems are ubuntu-only.

I was also afraid to control-c out of the upgrade process thinking that might leave things in a state from which a second run of apt-get upgrade couldn't recover. (Once I interrupted an upgrade and fouled things up and was left scouring the internet for how to recover.)

So here are my questions:

1) Why didn't they add a way to gracefully exit the install so I could research the right answer?

2) What would have happened if I had control-c'ed out of the install?

3) How can I figure out for sure whether I "chose poorly" and my ubuntu system is now in the process of painfully withering into a pile of dust?

4) If I did drink from the wrong grail, is there any recovery?

update: as requested, here is the log (with some newlines added) from the apt-get upgrade in question. I see four lines with the string "grub". Not sure which one threw me into the form entry screen:

Start-Date: 2018-02-22  05:18:50
Commandline: apt-get upgrade
Requested-By: matt (1000)
    libaudit-common:amd64 (1:2.4.5-1ubuntu2, 1:2.4.5-1ubuntu2.1),
    update-manager-core:amd64 (1:16.04.10, 1:16.04.12),
    uuid-runtime:amd64 (2.27.1-6ubuntu3.3, 2.27.1-6ubuntu3.4),
    libfdisk1:amd64 (2.27.1-6ubuntu3.3, 2.27.1-6ubuntu3.4),
    libapt-inst2.0:amd64 (1.2.24, 1.2.25),
    libsystemd0:amd64 (229-4ubuntu21, 229-4ubuntu21.1),
    grub-common:amd64 (2.02~beta2-36ubuntu3.15, 2.02~beta2-36ubuntu3.16),
    apt:amd64 (1.2.24, 1.2.25),
    libparted2:amd64 (3.2-15, 3.2-15ubuntu0.1),
    libmount1:amd64 (2.27.1-6ubuntu3.3, 2.27.1-6ubuntu3.4),
    util-linux:amd64 (2.27.1-6ubuntu3.3, 2.27.1-6ubuntu3.4),
    libnuma1:amd64 (2.0.11-1ubuntu1, 2.0.11-1ubuntu1.1),
    grub2-common:amd64 (2.02~beta2-36ubuntu3.15, 2.02~beta2-36ubuntu3.16),
    udev:amd64 (229-4ubuntu21, 229-4ubuntu21.1),
    resolvconf:amd64 (1.78ubuntu5, 1.78ubuntu6),
    libapt-pkg5.0:amd64 (1.2.24, 1.2.25),
    grub-pc:amd64 (2.02~beta2-36ubuntu3.15, 2.02~beta2-36ubuntu3.16),
    libudev1:amd64 (229-4ubuntu21, 229-4ubuntu21.1),
    libapparmor1:amd64 (2.10.95-0ubuntu2.7, 2.10.95-0ubuntu2.8),
    mount:amd64 (2.27.1-6ubuntu3.3, 2.27.1-6ubuntu3.4),
    grub-pc-bin:amd64 (2.02~beta2-36ubuntu3.15, 2.02~beta2-36ubuntu3.16),
    gcc-5-base:amd64 (5.4.0-6ubuntu1~16.04.6, 5.4.0-6ubuntu1~16.04.9),
    libblkid1:amd64 (2.27.1-6ubuntu3.3, 2.27.1-6ubuntu3.4),
    libapparmor-perl:amd64 (2.10.95-0ubuntu2.7, 2.10.95-0ubuntu2.8),
    python3-update-manager:amd64 (1:16.04.10, 1:16.04.12),
    systemd-sysv:amd64 (229-4ubuntu21, 229-4ubuntu21.1),
    libuuid1:amd64 (2.27.1-6ubuntu3.3, 2.27.1-6ubuntu3.4),
    libpam-systemd:amd64 (229-4ubuntu21, 229-4ubuntu21.1),
    parted:amd64 (3.2-15, 3.2-15ubuntu0.1),
    systemd:amd64 (229-4ubuntu21, 229-4ubuntu21.1),
    libsmartcols1:amd64 (2.27.1-6ubuntu3.3, 2.27.1-6ubuntu3.4),
    apt-utils:amd64 (1.2.24, 1.2.25),
    sosreport:amd64 (3.4-1~ubuntu16.04.1, 3.5-1~ubuntu16.04.2),
    bsdutils:amd64 (1:2.27.1-6ubuntu3.3, 1:2.27.1-6ubuntu3.4),
    apparmor:amd64 (2.10.95-0ubuntu2.7, 2.10.95-0ubuntu2.8),
    apt-transport-https:amd64 (1.2.24, 1.2.25),
    linux-firmware:amd64 (1.157.15, 1.157.16),
    libstdc++6:amd64 (5.4.0-6ubuntu1~16.04.6, 5.4.0-6ubuntu1~16.04.9),
    cloud-guest-utils:amd64 (0.27-0ubuntu24, 0.27-0ubuntu25),
    libaudit1:amd64 (1:2.4.5-1ubuntu2, 1:2.4.5-1ubuntu2.1)
End-Date: 2018-02-22  05:28:30

Here is some output of lsblk which might be helpful:

matt@crucible:~$ sudo lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL
sda                               111.8G
├─sda1                ext2          487M /boot
├─sda2                                1K
└─sda5                LVM2_member 111.3G
  ├─charon--vg-root   ext4        103.6G /
  └─charon--vg-swap_1 swap          7.7G [SWAP]

I'm pretty darn sure I selected the first entry in the grub-form and that it was labeled "sda". I also remember the second entry being labeled "sda1". But this strikes me as strange since it appears to me that "sda" is the name of a drive, and "sda1" is the name of a partition on that drive. I'm confused.

  • So, the "why did this happen" is because your computer got an updated version of grub. – Organic Marble Feb 23 '18 at 1:06
  • Yes, that was my assumption, but then, why does it have to be told where to put the upgraded version? Can't it just look at the system configuration and put things in the right place? This really seems weird. I wish I had taken better notes on what it said exactly. Doesn't everybody have to go through this same upgrade screen? – Matthew Busche Feb 23 '18 at 5:05

Well, usually we prefer one question at a time. But for you, today...

1) They did, sort-of. You can always open a new Terminal window or pop into a different TTY or open a new SSH session. If you know your way around the dpkg-reconfigure command, you can probably find that screen again.

2) If you CTRL+C (abort) the install, the system will simply pester you to upgrade again tomorrow. The system will keep pestering you until you agree, until you apt-pin the package, or until you uninstall the package that does the pestering. Generally, as you know, the best option is to install the upgrade.

3), and 4) seem basically like the same question. If you install GRUB to the wrong partition (a non-boot partition), it can be fixed.

Before you shut down your system to test your new GRUB, make sure you backup your data, and make sure you have a LiveUSB handy. Murphy's Law being what it is, those basic precautions make all the difference between it-turned-out-to-be-nothing vs. a very unhappy afternoon.

  • But don't I already have grub on my machine? I'm assuming this was some sort of upgrade to my existing grub. If not, then why was it suddenly trying to install it? And if so, then why did it even have to ask me where it was?I'm going to be upgrading two other (more important) unbuntu systems soon. I'd like to know how to figure out what the right answer to this question is before I start. – Matthew Busche Feb 22 '18 at 22:39
  • @MatthewBusche if you look in /var/log/apt/history.log this will tell you what programs were updated last night. If you edit your question and include that information, then it will be much easier to answer the "why did grub get updated" part. I see that on Feb 5 my 16.04 system got an update to grub itself, but perhaps you haven't run updates in a while. – Organic Marble Feb 22 '18 at 23:33

sda is the correct location for the boot-loader-installation in your case.

Your output from lsblk indicates, that your system is installed in legacy-mode (old MBR-partitioning-scheme).

Installing the boot-loader to sda means to install it in the Master-Boot-Record of the drive (the very first sector of the drive). You need it there to boot your system.

If you would install the boot-loader to a partition (e.g. sda1), the boot-loader would be installed in the first sector of the partition and you could't directly boot from this location. To install the boot-loader to a partition makes sense if you have more than one operating system installed, so one of the OS's has its boot-loader in the MBR, the others in their PBR (Partition Boot Record) and they can be chain-loaded.

  • Thanks for the confirmation that I did ok. I just rebooted the system. It came back up fine. Still, I don't understand why the apt-get upgrade was demanding that I tell it where grub was. Why can't it just look for it, find it, and upgrade as appropriate? – Matthew Busche Feb 23 '18 at 21:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.