I run Ubuntu 14.04 and always update regularly (nearly every day). Today on July 8, the Ubuntu update behaved differently than usual. It said "Not all updates can be installed" and suggested a "Partial update". Never tried that, but I trust Ubuntu. One of the things I noticed on the update list was the bootloader GRUB, but hey, I trust Ubuntu.
After completion it asked me to restart and when I do this it boots directly into Windows. That is, GRUB is effectively uninstalled and I have no choice of whether I want to boot into Ubuntu now. I am not a shark in either Linux or Windows, but I feel quite the more handicapped in Windows 8 (it just came bundled).
Is Ubuntu still present on the laptop? If yes, how do I get back to it soonest possible? (I've got a presentation to give in the weekend and setting up a new system and fetching backup data is slow).
Failing to grub-install following answer of Christian Benke
I am now probing the system with a ubuntu usb stick.
ubuntu@ubuntu:~$ sudo parted -l
Model: ATA TOSHIBA THNSNJ25 (scsi)
Disk /dev/sda: 256GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 1049kB 1075MB 1074MB ntfs Basic data partition hidden, diag
2 1075MB 1180MB 105MB fat32 Basic data partition boot
3 1180MB 1314MB 134MB ntfs Basic data partition msftres
4 1314MB 44.7GB 43.4GB ntfs Basic data partition msftdata
6 44.7GB 46.7GB 2000MB linux-swap(v1)
7 46.7GB 244GB 197GB ext4
5 244GB 256GB 12.1GB ntfs Basic data partition hidden, diag
A quick "sudo mkdir /media/[mountpoint]" followed by "sudo mount /dev/sda[X] /media/[mountpoint]" allowed inspection of the partitions:
/dev/sda1 Windows boot files
/dev/sda2 EFI files
/dev/sda3 Empty
/dev/sda4 Windows system
/dev/sda5 Toshiba recovery
/dev/sda6 Ubuntu swap partition (not mountable)
/dev/sda7 Ubuntu system
Obviously, /dev/sda7 is what I want to continue with.
ubuntu@ubuntu:~$ sudo mkdir /media/oldroot
ubuntu@ubuntu:~$ sudo mount /dev/sda7 /media/oldroot
ubuntu@ubuntu:~$ sudo mount --bind /dev /media/oldroot/dev
ubuntu@ubuntu:~$ sudo mount --bind /proc /media/oldroot/proc
ubuntu@ubuntu:~$ sudo mount --bind /sys /media/oldroot/sys
ubuntu@ubuntu:~$ sudo chroot /media/oldroot /bin/sh
# lsb_release -d
Description: Ubuntu 14.04.2 LTS
# grub-install /dev/sda
Installing for x86_64-efi platform.
grub-install: error: cannot find EFI directory.
# exit
Clearly, grub-install did not find the EFI files at /dev/sda2, but mounting it beforehand at /media/oldroot/boot/efi seemed to work just fine:
ubuntu@ubuntu:~$ sudo mount /dev/sda2 /media/oldroot/boot/efi
ubuntu@ubuntu:~$ sudo chroot /media/oldroot /bin/sh
# lsb_release -d
Description: Ubuntu 14.04.2 LTS
# grub-install /dev/sda
Installing for x86_64-efi platform.
Installation finished. No error reported.
# update-grub
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.16.0-43-generic
Found initrd image: /boot/initrd.img-3.16.0-43-generic
Found linux image: /boot/vmlinuz-3.16.0-41-generic
Found initrd image: /boot/initrd.img-3.16.0-41-generic
Found linux image: /boot/vmlinuz-3.16.0-40-generic
Found initrd image: /boot/initrd.img-3.16.0-40-generic
Found linux image: /boot/vmlinuz-3.16.0-39-generic
Found initrd image: /boot/initrd.img-3.16.0-39-generic
Found linux image: /boot/vmlinuz-3.16.0-38-generic
Found initrd image: /boot/initrd.img-3.16.0-38-generic
Found linux image: /boot/vmlinuz-3.16.0-37-generic
Found initrd image: /boot/initrd.img-3.16.0-37-generic
Found linux image: /boot/vmlinuz-3.16.0-36-generic
Found initrd image: /boot/initrd.img-3.16.0-36-generic
Found linux image: /boot/vmlinuz-3.16.0-34-generic
Found initrd image: /boot/initrd.img-3.16.0-34-generic
Found linux image: /boot/vmlinuz-3.16.0-33-generic
Found initrd image: /boot/initrd.img-3.16.0-33-generic
Adding boot menu entry for EFI firmware configuration
done
# exit
This did not solved the problem, however. Upon reboot, GRUB did not show up and it went directly into Windows again? Thank you so far, what seems to be the problem this time?
Failing to reinstall affected packages
As suggested, I look at the apt/history.log file to see what happened during the "partial update" which stopped GRUB from working. Unfortunately, it contains no entry for the update on July 8:
ubuntu@ubuntu:~$ cat /media/summer7/var/log/apt/history.log
Start-Date: 2015-07-03 09:32:40
Commandline: aptdaemon role='role-commit-packages' sender=':1.79'
Upgrade: lightdm:amd64 (1.10.5-0ubuntu1, 1.10.5-0ubuntu1.1), liblightdm-gobject-1-0:amd64 (1.10.5-0ubuntu1, 1.10.5-0ubuntu1.1)
End-Date: 2015-07-03 09:32:42
Start-Date: 2015-07-05 20:02:01
Commandline: aptdaemon role='role-commit-packages' sender=':1.85'
Upgrade: libxcomp3:amd64 (3.5.0.31-0~605~ubuntu14.04.1, 3.5.0.32-0~668~ubuntu14.04.1), nxproxy:amd64 (3.5.0.31-0~605~ubuntu14.04.1, 3.5.0.32-0~668~ubuntu14.04.1), irqbalance:amd64 (1.0.6-2ubuntu0.14.04.1, 1.0.6-2ubuntu0.14.04.2)
End-Date: 2015-07-05 20:02:04
Start-Date: 2015-07-07 20:00:24
Commandline: aptdaemon role='role-commit-packages' sender=':1.81'
Install: linux-image-3.16.0-43-generic:amd64 (3.16.0-43.58~14.04.1), linux-headers-3.16.0-43:amd64 (3.16.0-43.58~14.04.1), linux-headers-3.16.0-43-generic:amd64 (3.16.0-43.58~14.04.1), linux-image-extra-3.16.0-43-generic:amd64 (3.16.0-43.58~14.04.1), linux-signed-image-3.16.0-43-generic:amd64 (3.16.0-43.58~14.04.1)
Upgrade: linux-signed-image-generic-lts-utopic:amd64 (3.16.0.41.33, 3.16.0.43.34), libfontembed1:amd64 (1.0.52-0ubuntu1.4, 1.0.52-0ubuntu1.5), linux-image-generic-lts-utopic:amd64 (3.16.0.41.33, 3.16.0.43.34), cups-browsed:amd64 (1.0.52-0ubuntu1.4, 1.0.52-0ubuntu1.5), linux-signed-generic-lts-utopic:amd64 (3.16.0.41.33, 3.16.0.43.34), cups-filters-core-drivers:amd64 (1.0.52-0ubuntu1.4, 1.0.52-0ubuntu1.5), cups-filters:amd64 (1.0.52-0ubuntu1.4, 1.0.52-0ubuntu1.5), libgtksourceview2.0-0:amd64 (2.10.5-1ubuntu2, 2.10.5-1ubuntu2.14.04.1), linux-generic-lts-utopic:amd64 (3.16.0.41.33, 3.16.0.43.34), linux-libc-dev:amd64 (3.13.0-55.94, 3.13.0-57.95), libgtksourceview2.0-common:amd64 (2.10.5-1ubuntu2, 2.10.5-1ubuntu2.14.04.1), linux-headers-generic-lts-utopic:amd64 (3.16.0.41.33, 3.16.0.43.34), libcupsfilters1:amd64 (1.0.52-0ubuntu1.4, 1.0.52-0ubuntu1.5)
End-Date: 2015-07-07 20:01:11
In fact, it seems a bit small in length doesn't it? Also, the last entry was 2 hours into the future compared to when the file was touched last:
ubuntu@ubuntu:~$ ls -l /media/summer7/var/log/apt/history.log
-rw-r--r-- 1 root root 1925 Jul 7 18:01 /media/summer7/var/log/apt/history.log
So maybe we are looking at a file corruption here? Oh well, I tried an apt-get update and it did not work:
ubuntu@ubuntu:~$ sudo mount --bind /dev /media/oldroot/dev
ubuntu@ubuntu:~$ sudo mount --bind /proc /media/oldroot/proc
ubuntu@ubuntu:~$ sudo mount --bind /sys /media/oldroot/sys
ubuntu@ubuntu:~$ sudo chroot /media/oldroot apt-get update
Everything failed to fetch with "could not resolve" error, much like this question. The following fails
ubuntu@ubuntu:~$ sudo chroot /media/oldroot ping dk.archive.ubuntu.com
ping: unknown host dk.archive.ubuntu.com
and the /media/oldroot/etc/resolv.conf file is completely empty. Is this a bad sign?