Permission structure of filesystem destroyed
Hi guys, maybe someone with experience in Linux file system can help me with this one.
Last night I was updating some packages and f*$@ knows how it messed up with the entire permission structure of my system. I've realised that when I rebooted my Pi and everything went back to a sort of default look, some background images missing, and even the controllers, although working in EmulationStation, wouldn't be recognised within any of the emulators. Retroarch woudn't save any edits either. Quitting to the terminal would show the constant flow of "permission denied" messages the Pi was displaying whenever it tried to write and/or read certain files, including config ones.
When I tried to call sudo ~/RetroPie-Setup/retropie_setup.sh to see if I could do something I got this message:
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
A little Google job landed me on this page explaining that ownership must be the issue: "You destroyed the permission structure of your entire filesystem!"
Also in our forum.
Now I know that instead of going through the trouble of trying and fixing it I should just flash my card again, but I really wouldn't like that if I had a chance to recover my work. I have a very elaborated custom theme I've been working on for months, tweaks for every emulator as well as descriptions for certain games, hi-res covers and videos for hundreds of roms handpicked from the Internet (such as hacks and everything that can't be scrapped).
My FTP software says that my Pi's IP isn't running an FTP server, so I can't do any backups. Also, my last image backup is some 6 months old. (I'm stupid.)
Seems like if I somehow could revert/override the ownership I would be able to salvage my theme, files and configs but none of the help given in the links above seems to work. I can't boot my Pi straight into terminal as root, can't enter safe mode (does it have one?), can't use chown... All I get is permission denied.
As a late disclaimer, although an old timer programmer with a computer science degree, I don't have any real experience with unix/linux (been stuck with telecom for too long now ), everything I know on the matter is thanks to tinkering with Retropie for some two years now. I do, however, understand all the concepts at play since transferring of knowledge goes a long way
Thanks for reading this long ramble, and thanks for any suggestions in advance.
@fabio78 my advice is to always make backups before doing any updates ;)
@herb_fargus Learning the hard way, boss :)
@fabio78 were you logged in via SSH at all while performing your updates? I caused a lot of problems early on by forgetting to log out as “root” user.
I've never seen updates causing such kind of problems, most likely they're the result of of a mis-typed command.
@chuckyp I was. I think you nailed the cause there.
@chuckyp you sir are a star!
I took a hint on what you said and tried to connect my FTP client without enabling SSH and IT WORKED!
Makes sense now that if root is somehow locked out, enabling root user via SSH wouldn't allow me to connect.
Now I can backup my data before a fresh install.
Massive thank you!
@fabio78 glad it worked. It’s one of the first huge issues I ran into when I started to make more advanced changes.