[plug] Dumb stuff recovery
Brad Campbell
brad at fnarfbargle.com
Mon Aug 26 08:16:37 AWST 2024
I learned something new today.
I have a duplicate test server here I use to stage and script all updates on the prod machine. I had just done a major OS update and was getting ready to tweak the package manager. Before I did that I thought I'll backup the root fs entirely. I did that using rsync to a mounted RAID6 on /server. I performed a few tweaks and wanted to undo them, so I cd to the backup directory and ran this :
rsync -avxH --delete /root/ /
What I should have typed was rsync -avxH --delete root/ /
So I wiped out the entire root filesystem excepting the root directory.
That left me with a running root shell and nothing else. All commands were gone. Unless it was a bash builtin I was stuffed.
I never knew you could run the dynamic loader as an executable.
/server/root/lib/x86_64-linux-gnu/ld-2.31.so --library-path /server/root/usr/lib:/server/root/usr/lib/x86_64-linux-gnu:/server/root/lib/x86_64-linux-gnu/ /server/root/usr/bin/rsync -avxH --delete /server/root/ /
And I was back in business. Bad day when you don't learn something!
Thankfully bash completion still worked, although I still had the fs skeleton on the prod server to refer to for directory names just in case.
Regards,
Brad
More information about the plug
mailing list