Might have deleted kernel, but haven't shut off computer yet
My /boot was full and I couldn't update, so I tried to get rid of unnecessary files, but I think I might have deleted some things I shouldn't have. I don't know if grub or grub2 works, or whether or not I can still boot into windows. However, I haven't shut off my computer yet so I was hoping I could fix everything now. What can I do?
I used this command:
for akernel in $(dpkg -l 'linux-' | sed '/^ii/!d;/'"$(uname -r | sed "s/(.)-([^0-9]+)/\1/")"'/d;s/^[^ ]* [^ ]* ([^ ])./\1/;/[0-9]/!d'); do sudo apt-get purge $akernel; done
uname -r
3.13.0-66-generic
ls -lhA /boot
total 29M
-rw-r--r-- 1 root root 1.2M Oct 7 12:34 abi-3.13.0-66-generic
-rw-r--r-- 1 root root 162K Oct 7 12:34 config-3.13.0-66-generic
drwxr-xr-x 5 root root 1.0K Dec 17 21:41 grub
-rw-r--r-- 1 root root 19M Oct 30 18:15 initrd.img-3.13.0-66-generic
drwx------ 2 root root 12K Feb 7 2015 lost+found
-rw-r--r-- 1 root root 173K Mar 12 2014 memtest86+.bin
-rw-r--r-- 1 root root 174K Mar 12 2014 memtest86+.elf
-rw-r--r-- 1 root root 175K Mar 12 2014 memtest86+_multiboot.bin
-rw------- 1 root root 3.3M Oct 7 12:34 System.map-3.13.0-66-generic
-rw------- 1 root root 5.6M Oct 7 12:34 vmlinuz-3.13.0-66-generic
du -h /boot
du: cannot read directory ‘/boot/lost+found’: Permission denied
12K /boot/lost+found
2.1M /boot/grub/i386-pc
9.0K /boot/grub/locale
2.3M /boot/grub/fonts
6.7M /boot/grub 36M /boot
df -h /boot
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 361M 180M 159M 54% /boot
Open the terminal and type:
sudo apt-get install --reinstall linux-image-generic sudo grub-install /dev/sdX sudo update-grub
...where for
/dev/sdXsubstitute the drive where your GRUB bootloader is installed. Normally users should not include a partition number, which would produce an error message as the command would attempt to write the information to a partition. You can find the Device name of this drive using the Disks application. Check twice in Disks to make sure that you type the correct Device name of the drive where your GRUB bootloader is installed.
Since it isn't done during execution of the sudo grub-install
command, running sudo update-grub
after the install will ensure that the GRUB menu is up-to-date.