0

I have a dual boot setup using Ubuntu Mate 17.04, fully patched and up-to-date. (The other OS, Windows 10, was installed first. Then, Ubuntu was installed using default options second.)

However, recently, every time sudo apt-get dist-upgrade runs non-trivially (i.e., trying to install something), a curious sequence of events happens:

  1. The first couple of commands will print out, appearing to succeed.
  2. The rest will fail with weird errors about a read-only filesystem, and the operation will abort itself.
  3. Boot now fails. Sometimes, I can get it to boot into Windows, but booting into Linux either fails or drops into a recovery shell.
  4. I boot using a USB recovery drive.
  5. gparted gives weird warnings about a bad superblock. I go about fixing it (only last command is necessary, but first two tell me what to do):
    • sudo fdisk -l | grep Linux | grep -Ev 'swap'
    • sudo dumpe2fs /dev/nvme0n1p6 | grep superblock
    • sudo fsck -b 32768 /dev/nvme0n1p6 -y
  6. It prints out a lot of garbage and negative numbers and says it changes stuff.
  7. Reboots into the real Linux just fine.
  8. sudo apt-get dist-upgrade now runs to completion with no weird errors.
  9. Reboot to either OS works.
  10. sudo apt-get autoremove to remove old Linux kernels.
  11. Reboot fails. Fix it again using steps 4–7.

What's weird is that this is repeatable (this sequence has happened the last 3 times I've tried dist-upgrade), and it doesn't happen with other operations.

My suspicion is that Ubuntu is updating the superblock incorrectly when trying to update the bootloader for each updated Linux kernel. Things I've tentatively ruled out:

  • It's not Windows, per se. The corruption happens without ever booting into Windows. Linux might be getting confused by the boot schema, however.
  • It's not the hard drive. The drive is a nearly new SSD, and the first time this happened, I verified the drive surface searching for bad blocks. In any case, the drive HW would remap the bad block once discovered, and it wouldn't corrupt the superblock again.

My question: What can I do to fix this? Otherwise, what should I look at, log-wise, config-wise the next time this inevitably happens, so that it can be debugged?

geometrian
  • 225
  • 3
  • 9
  • 1
    Before the dist-upgrade did you try running sudo apt-get update ? – ADDB Jun 13 '17 at 10:16
  • Sounds like you are running out of disk-space, happened to me a couble of times, problem is the packages is compressed, so first they are downloaded, then they are unpacked ( now they are claiming 5-6 times more space each) resulting in not enough space to download the next package!! This refusal of writing incomming data to disk can be misinterpreted as a writeprotection or a read only error! Try cleaning your system: Empty trash sudo apt autoremove sudo apt autoclean And remove old cernals (Keep the last 2 for recovery boot !) – Ken Mollerup Jun 13 '17 at 13:31
  • @ADDB Yes. The sequence for me is always apt-get update, upgrade, dist-upgrade, autoremove. – geometrian Jun 13 '17 at 20:56
  • @imallett it's best to state all commands you use. Sometimes such trivial commands missing can produce fatal errors – ADDB Jun 13 '17 at 20:58
  • @KenMollerup: Disk space is a good thought, but there's about 70GiB free space on the Linux partition, and it wouldn't explain the corruption. As to the rest, if you'd please read the question, autoremove is one of the commands causing the issues. @ADDB: All non-nop commands used were listed fully. Point of fact, from an apparently fine system, if dist-upgrade or autoremove do anything, it breaks it. – geometrian Jun 13 '17 at 21:03
  • Good point! Are you using dist-upgrade regularly because you are running beta-test? – Ken Mollerup Jun 14 '17 at 11:27
  • @KenMollerup Regularly, yes, but no; to keep updated with latest stable. – geometrian Jun 14 '17 at 18:16
  • Try without using the dist-upgrade - for some time - because: The dist-upgrade command may remove some packages!!. See: https://askubuntu.com/questions/194651/why-use-apt-get-upgrade-instead-of-apt-get-dist-upgrade – Ken Mollerup Jun 15 '17 at 06:25

0 Answers0