Just hit /var and /dev with an accidental sudo rm -rf. Am I hosed?

Okay, before you make too much fun of me, I am very tired and thought I was inside the local storage volume for a docker container.

Manjaro recreated both these folders on reboot, but exactly how much trouble am I in?

I have a sneaking suspicion I just wrecked a ton of support files for … a lot of different things.

Edit: If the answer is "you need to ahead and reinstall Manjaro, that’s fine. Just let me know. :slight_smile:

Reinstalling would be the simplest solution. Someone more experienced than I might be able to help you restore the files, but it probably won’t be easy.

P.S. Never sudo rm -rf . anywhere without carefully checking which directory is active first. Use pwd to view the full path of the active directory.

I feel incredibly stupid right now.

I was trying to get rid of some folders docker created, and since it runs as root, I have to to sudo rm -rf them. This particular container duplicated a lot of the file structure, so it had /var and /dev folders.

I’d already done it half a dozen times, but after months of docker’ing, my luck ran out.

I realized what I had done exactly 5 seconds afterwards.

I do have a full system backup, but it’s a bit old.

I’ll probably just get a fresh backup of my home and etc directories, restore from the full system backup, and then overlay the home and etc directories and see where that leaves me.

EDIT: I restored the root partition to a version from 2 weeks ago. That seems to have healed things, though now I have a file conflict in the boot directory. I guess I need to restore that to the older version, too.

EDIT 2: restored the boot partition as well, and everything is fine again. Luckily I haven’t tinkered with the system too much in the last two weeks.

1 Like

What kind of a container touches /dev? I know the containers live under /var/lib/docker/ by default, but isn’t applications being contained the whole point?

I mis-spoke a bit, it seems.

The container creates a persistent file storage directory, which contains copies of the in-container /var and /dev folders.

I wanted to clear those out since I could not guarantee their state, since the container did not come up correctly.