Skip to content

Instantly share code, notes, and snippets.

@vvikramjhu
Last active October 2, 2017 05:08
Show Gist options
  • Save vvikramjhu/014db5c12ed7a5bc20d8d276750aaa81 to your computer and use it in GitHub Desktop.
Save vvikramjhu/014db5c12ed7a5bc20d8d276750aaa81 to your computer and use it in GitHub Desktop.
it@it:~$ sudo mkdir /mnt/root; sudo mkdir -p /mnt/EFI;
it@it:~$ sudo umount /dev/sdb7
it@it:~$ sudo mount /dev/sdb7 /mnt/root
sudo mount -t vfat -o rw,users /dev/sdb2 /mnt/EFI
it@it:~$ ls /mnt/
EFI root
it@it:~$ ls /mnt/root/
bin boot cdrom dev etc home initrd.img initrd.img.old lib lib64 lost+found media mnt opt proc root run sbin srv sys tmp usr var vmlinuz vmlinuz.old
it@it:~$ sudo chroot /mnt/root/
root@it:/# ping -c3 ubuntu.com
PING ubuntu.com (91.189.94.40) 56(84) bytes of data.
64 bytes from ovinnik.canonical.com (91.189.94.40): icmp_seq=1 ttl=53 time=85.0 ms
64 bytes from ovinnik.canonical.com (91.189.94.40): icmp_seq=2 ttl=53 time=89.8 ms
64 bytes from ovinnik.canonical.com (91.189.94.40): icmp_seq=3 ttl=53 time=94.6 ms
--- ubuntu.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 85.063/89.845/94.645/3.927 ms
apt install --reinstall grub-efi-amd64-signed
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
efibootmgr grub-common grub-efi-amd64 grub-efi-amd64-bin grub-pc-bin
grub2-common secureboot-db
Suggested packages:
multiboot-doc grub-emu xorriso desktop-base
The following packages will be REMOVED:
grub-gfxpayload-lists grub-pc
The following NEW packages will be installed:
efibootmgr grub-efi-amd64 grub-efi-amd64-bin grub-efi-amd64-signed
secureboot-db
The following packages will be upgraded:
grub-common grub-pc-bin grub2-common
3 upgraded, 5 newly installed, 2 to remove and 450 not upgraded.
Need to get 971 kB/4,032 kB of archives.
After this operation, 5,443 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main efibootmgr amd64 0.5.4-7ubuntu1.2 [28.4 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main grub-efi-amd64-bin amd64 2.02~beta2-9ubuntu1.14 [649 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main grub-efi-amd64 amd64 2.02~beta2-9ubuntu1.14 [45.3 kB]
Get:4 http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main grub-efi-amd64-signed amd64 1.34.16+2.02~beta2-9ubuntu1.14 [245 kB]
Get:5 http://us.archive.ubuntu.com/ubuntu/ trusty/main secureboot-db amd64 1.1 [2,740 B]
Fetched 971 kB in 0s (1,370 kB/s)
Preconfiguring packages ...
(Reading database ... 196243 files and directories currently installed.)
Removing grub-gfxpayload-lists (0.6) ...
Removing grub-pc (2.02~beta2-9ubuntu1.3) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Selecting previously unselected package efibootmgr.
(Reading database ... 196224 files and directories currently installed.)
Preparing to unpack .../efibootmgr_0.5.4-7ubuntu1.2_amd64.deb ...
Unpacking efibootmgr (0.5.4-7ubuntu1.2) ...
Preparing to unpack .../grub2-common_2.02~beta2-9ubuntu1.14_amd64.deb ...
Unpacking grub2-common (2.02~beta2-9ubuntu1.14) over (2.02~beta2-9ubuntu1.3) ...
Preparing to unpack .../grub-pc-bin_2.02~beta2-9ubuntu1.14_amd64.deb ...
Unpacking grub-pc-bin (2.02~beta2-9ubuntu1.14) over (2.02~beta2-9ubuntu1.3) ...
Preparing to unpack .../grub-common_2.02~beta2-9ubuntu1.14_amd64.deb ...
Unpacking grub-common (2.02~beta2-9ubuntu1.14) over (2.02~beta2-9ubuntu1.3) ...
Selecting previously unselected package grub-efi-amd64-bin.
Preparing to unpack .../grub-efi-amd64-bin_2.02~beta2-9ubuntu1.14_amd64.deb ...
Unpacking grub-efi-amd64-bin (2.02~beta2-9ubuntu1.14) ...
Selecting previously unselected package grub-efi-amd64.
Preparing to unpack .../grub-efi-amd64_2.02~beta2-9ubuntu1.14_amd64.deb ...
Unpacking grub-efi-amd64 (2.02~beta2-9ubuntu1.14) ...
Selecting previously unselected package grub-efi-amd64-signed.
Preparing to unpack .../grub-efi-amd64-signed_1.34.16+2.02~beta2-9ubuntu1.14_amd64.deb ...
Unpacking grub-efi-amd64-signed (1.34.16+2.02~beta2-9ubuntu1.14) ...
Selecting previously unselected package secureboot-db.
Preparing to unpack .../secureboot-db_1.1_amd64.deb ...
Unpacking secureboot-db (1.1) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Processing triggers for install-info (5.2.0.dfsg.1-2) ...
Processing triggers for ureadahead (0.100.0-16) ...
Setting up efibootmgr (0.5.4-7ubuntu1.2) ...
Setting up grub-common (2.02~beta2-9ubuntu1.14) ...
Installing new version of config file /etc/grub.d/00_header ...
Installing new version of config file /etc/grub.d/30_uefi-firmware ...
Setting up grub2-common (2.02~beta2-9ubuntu1.14) ...
Setting up grub-pc-bin (2.02~beta2-9ubuntu1.14) ...
Setting up grub-efi-amd64-bin (2.02~beta2-9ubuntu1.14) ...
Setting up grub-efi-amd64 (2.02~beta2-9ubuntu1.14) ...
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.19.0-80-generic
Found initrd image: /boot/initrd.img-3.19.0-80-generic
Found linux image: /boot/vmlinuz-3.19.0-25-generic
Found initrd image: /boot/initrd.img-3.19.0-25-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
Found Windows Recovery Environment (loader) on /dev/sdb3
Found Windows 8 (loader) on /dev/sdb5
Found Windows Recovery Environment (loader) on /dev/sdc1
done
Setting up grub-efi-amd64-signed (1.34.16+2.02~beta2-9ubuntu1.14) ...
Setting up secureboot-db (1.1) ...
Can't access efivars filesystem at /sys/firmware/efi/efivars, aborting
Rerun of same commands but this time seems to have worked :
it@it:~$ sudo mkdir /mnt/root; sudo mkdir -p /mnt/EFI;
it@it:~$ sudo mount /dev/sdb7 /mnt/root
it@it:~$ sudo mount -t vfat -o rw,users /dev/sdb2 /mnt/EFI
it@it:~$ ls /mnt/
EFI root
it@it:~$ ls -la /mnt/root/boot/grub/
total 2400
drwxr-xr-x 5 root root 4096 Oct 2 03:18 .
drwxr-xr-x 3 root root 4096 Oct 1 21:21 ..
drwxr-xr-x 2 root root 4096 Oct 1 21:19 fonts
-r--r--r-- 1 root root 10441 Oct 2 03:18 grub.cfg
-rw-r--r-- 1 root root 1024 Oct 2 03:17 grubenv
drwxr-xr-x 2 root root 12288 Oct 2 01:04 i386-pc
drwxr-xr-x 2 root root 4096 Oct 2 01:04 locale
-rw-r--r-- 1 root root 2405285 Oct 2 03:17 unicode.pf2
it@it:~$ for i in /dev /dev/pts /sys /proc /run; do sudo mount -B $i /mnt/root$i; done
it@it:~$ modprobe efivars
it@it:~$ sudo chroot /mnt/root/
root@it:/# ping -c3 ubuntu.com
PING ubuntu.com (91.189.94.40) 56(84) bytes of data.
64 bytes from ovinnik.canonical.com (91.189.94.40): icmp_seq=1 ttl=53 time=86.5 ms
64 bytes from ovinnik.canonical.com (91.189.94.40): icmp_seq=2 ttl=53 time=90.9 ms
64 bytes from ovinnik.canonical.com (91.189.94.40): icmp_seq=3 ttl=53 time=91.7 ms
--- ubuntu.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 86.572/89.753/91.787/2.278 ms
root@it:/# apt install --reinstall grub-efi-amd64-signed
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 450 not upgraded.
Need to get 0 B/245 kB of archives.
After this operation, 0 B of additional disk space will be used.
(Reading database ... 196517 files and directories currently installed.)
Preparing to unpack .../grub-efi-amd64-signed_1.34.16+2.02~beta2-9ubuntu1.14_amd64.deb ...
Unpacking grub-efi-amd64-signed (1.34.16+2.02~beta2-9ubuntu1.14) over (1.34.16+2.02~beta2-9ubuntu1.14) ...
Setting up grub-efi-amd64-signed (1.34.16+2.02~beta2-9ubuntu1.14) ...
root@it:/#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment