Accidentally Deleted /boot/ (Debian)
Accidentally Deleted /boot/ (Debian)
Hi all,
I'm having a bad day and did something colossally stupid, deleting everything from /boot/.
The system is still running. What do you think my best course of action is?
My current idea is to create a timeshift backup, reinstall debian from USB, then restore from backup in timeshift
If this won't work or you have a better idea I would really appreciate your advice.
Thanks in advance
Your system would continue to work as long as you don't turn it off. So no matter what you do, keep it on until you restored your /boot
Recovering it should be straightforward, assuming you didn't put custom files directly to /boot.
Just reinstall the linux kernels using apt. Then manually run
grub-install
with appropriate parameters. Finally, runupdate-grub
orgrub-mkconfig
to recreate the grub config.If the system is turned off, you can use live USB and chroot to it to properly install the kernel packages.
I've only ever used grub with bios/mbr or a BIOS/gpt (with grub bios partition).
No clue about efi/uefi.
This is the simplest method I can think of.
The arch wiki, however, is, as always, a great source of info:
https://wiki.archlinux.org/title/GRUB
**Linux is amazing in it's ability to keep working even when you accidentally all the things.
Annoyingly so. I once made a backup. Then to confirm it would restore the system, I deleted everything on root path. as in /
It did as told.
OK let's reboot and verify system.
Sudo reboot
Command not found
sudo shutdown
Command not found
But it sat there with a blinking cursor on the terminal
Can you link me to the commands to reinstall the kernel? Thank you for very much your help[
probably something like
apt reinstall linux-image-...
To find ..., run
apt list --installed | grep linux-image
and pick oneEdit: also if need current kernel, can see booted kernel name using
uname -a
Can't find an article for it at the moment, but I can tell you real quick how I would've done it.
Use
aptitude
and look for linux-image-amd64 or something under Installed -> kernel. The exact name might be a bit different.View the package and look under the Version and check out the one that's marked 'i' (for installed). Select that package and mark it to reinstall (shortcut 'L').
Then finally execute it (shortcut 'g' and then 'g' again).