Monday, April 29, 2024
 Popular · Latest · Hot · Upcoming
32
rated 0 times [  32] [ 0]  / answers: 1 / hits: 7671  / 1 Year ago, wed, february 22, 2023, 11:33:32

While I was trying to remove files from a SD card from the same directory, I ran sudo rm /* and now Ubuntu isn't working.
When I restarted I get the error: kernel panic attempted to kill init.


I'm new to Linux. What should I do now? I don't want to loose my data.


More From » sudo

 Answers
6

That command would have deleted all the links in / (and any files if you happened to have any).
Boot an install USB, mount the damaged root (change the sdxy to match your system) at /mnt:


sudo mount -t ext4 /dev/sdxy /mnt

Replace the links with the following:


cd /mnt
sudo ln -s usr/bin bin
sudo ln -s usr/sbin sbin
sudo ln -s usr/lib lib
sudo ln -s usr/lib32 lib32
sudo ln -s usr/lib64 lib64
sudo ln -s usr/libx32 libx32

The only other possible file that might cause problems eventually is a /swapfile if one were present. I don't, but that may be another thing to fix after you can boot normally.


[#59] Thursday, February 23, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
afisird

Total Points: 193
Total Questions: 112
Total Answers: 111

Location: Angola
Member since Mon, Jul 12, 2021
3 Years ago
afisird questions
Wed, Jul 27, 22, 03:53, 2 Years ago
Sun, Mar 12, 23, 18:05, 1 Year ago
Sun, Dec 11, 22, 01:19, 1 Year ago
Sun, May 1, 22, 18:56, 2 Years ago
;