Saturday, March 19, 2016

Ubuntu cannot mount /boot/efi

Yesterday all of a sudden Ubuntu (14.04) refused to boot with a strange message that it could not mount /boot/efi.

Running fsck from GRUB (Advanced menu) revealed this error

mount: wrong fs type, bad option, bad superblock on /dev/sdb1,
       missing codepage or helper program, or other error
       In some cases useful info is found in syslog - try
       dmesg | tail or so

mountall: mount /boot/efi [771] terminated with status 32
mountall: filesystem could not be mounted: /boot/efi


Opened root shell and tried to find the boot partition
# parted
GNU Parted 2.3
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print devices                                                    
/dev/sda (1000GB)
/dev/sdb (120GB)
(parted) select /dev/sdb
Using /dev/sdb
(parted) print                                                            
Model: ATA Samsung SSD 840 (scsi)
Disk /dev/sdb: 120GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End    Size    File system     Name  Flags
 1      1049kB  538MB  537MB   fat32                 boot
 2      538MB   112GB  111GB   ext4
 3      112GB   120GB  8466MB  linux-swap(v1)

Ok, so the boot partition is #1 on /dev/sdb, i.e. /dev/sdb1
Tried to mount it manually

mount /dev/sdb1 /boot/efi

Same error as above
Ok, let's see the syslog as suggested in the message

dmesg | tail

New error message

FAT-fs (sdb1): IO charset iso8859-1 not found

Searching for this error found this post that suggested it is a problem with the dependency database.
Tried running this as suggested in the post

sudo modprobe nls_iso8859-1

but it complained that it could not load /lib/modules/3.13.0-83-generic/modules.dep.bin. This file existed but it was empty. But the file of the same name was non-empty in an older kernel directory.

So back in GRUB and selected the previous kernel version and Ubuntu booted normally.
Then tried this in an attempt to fix the package database

sudo apt-get check

It complained with some error and suggested the following command

sudo dpkg --configure -a

This finally fixed the issue. Afterwards Ubuntu booted normally with the latest kernel.
Still not clear what caused this glitch. Didn't run any upgrades or so before it.
Luckily it resolved without reinstall.