Mistakenly deleted system boot files

chilusoft

New Member
Joined
Mar 23, 2019
Messages
3
Reaction score
2
Credits
38
Hello Penguin users.,

I mistakenly ran the command sudo rm /*, and deleted some system files. So my Linux machine won't boot. I am trying to enter into recovery mode but the boot sequence is always ending up in a kernel panic error.

I know important files such as the initial ram disk file and others are gone and that is why the machine is failing to boot.

So, is there a way I can get the system up and running by way of patching in the missing files without having to re-install the entire operating system?

I was using Linux Mint 20.1
 


Since you did that only files were removed and the files that were you removed were symbolic links, you can just reset them.
1. Boot with the Linux Mint installation media
2. Mount your root filesystem under /mnt, for example: sudo mount /dev/sda1 /mnt
3 Change into the /mnt directory: cd /mnt
4. Recreate the symlinks like this.
Code:
sudo ln -s usr/bin bin
sudo ln -s usr/lib lib
sudo ln -s usr/lib32 lib32
sudo ln -s usr/lib64 lib64
sudo ln -s usr/libx32 libx32
sudo ln -s usr/sbin sbin
5. Change back to your home directory: cd
6. Unmount your root directory from /mnt: sudo umount /mnt
7. Reboot your system en boot normally from your hard disk
Hello Penguin users.,

I mistakenly ran the command sudo rm /*, and deleted some system files.
How can you run that by accident?
 
Thank you for the solution. I will try it out as soon as possible. How I ran the command mistakenly is kind of a common mistake that might happen to anyone else.
I wanted to delete files that existed in a certain folder in /var/www/html/ directory. I cd'd into that folder and wanted to get rid of the files with the command sudo rm ./* as i never had write permisson so i was tempted to use sudo instead of changing the file and folder permissions and owbership which would have been safer i guess. But, ended up running the command sudo rm /*, missin the dot before the forward slash and hit enter.

That's how I came to commit the mistake.
 
Hello Penguin users.,

I mistakenly ran the command sudo rm /*, and deleted some system files. So my Linux machine won't boot.
I was using Linux Mint 20.1

This is where a System Image comes in very handy, you just put the Image back on the Drive and you're up and running in 15/20 minutes...simple. ;)
 
Same time, or even less, with a Timeshift restore using a full snapshot.

Timeshift ships installed with Linux Mint, so why not use it?

@chilusoft here's a snippet I provide on the subject


... and a belated welcome to linux.org :)

Chris Turner
wizardfromoz
 

Members online


Latest posts

Top