I’m working on a some materials for a class wherein I’ll be teaching some young, wide-eyed Windows nerds about Linux and we’re including a section we’re calling “foot guns”. Basically it’s ways you might shoot yourself in the foot while meddling with your newfound Linux powers.
I’ve got the usual forgetting the .
in lines like this:
$ rm -rf ./bin
As well as a bunch of other fun stories like that one time I mounted my Linux home folder into my Windows machine, forgot I did that, then deleted a parent folder.
You know, the war stories.
Tell me yours. I wanna share your mistakes so that they can learn from them.
Fun (?) side note: somehow, my entire ${HOME}/projects
folder has been deleted like… just now, and I have no idea how it happened. I may have a terrible new story to add if I figure it out.
Not too long ago, on a Slackware box I needed to manually change glibc to another version. No problem, I thought, just remove the version that’s there and install the package for the version I needed. So
removepkg glibc
and then immediately dawned on me… oh wait I really didn’t want to do that… Of course, after thatinstallpkg
and pretty much everything else was broken since pretty much everything either depends on glibc, or has a dependency that depends on glibc, so I couldn’t install the new package or do pretty much anything other than smack my forehead.Wasn’t actually too big of a deal to fix. Used another computer to create a bootable USB stick with the Slackware installer, booted the computer with the USB stick, and did some chroot trickery to reinstall the old glibc package again. Then booted it back up normally and used
upgradepkg
to change glibc like I should have in the first place.Breaking the bootloader, uninstalling nvidia drivers ton install mesa without removing mesa/nouveau from the blacklist
Mounted root to a game folder on home and
sudo rm -rf ~/games/*
because I accidentally copied the home folder into the games subvol which turned out to be the root subvol. Thanks btrfs!BTRFS: yo dawg, we heard you like partitions, so we put partitions in your partitions, so you can mount it inside your mounts.
I really like the idea of partitions without fixed sizes. I know it’s not the same but just as useful when you reinstall your system.
apt
something that ended up removingsudo
. No more admin rights.- used
rsync
to backup pretty much everything in / , with remove source option… find
with-delete
option miss positioned. It deleted stuff before finding matching patternchown
/chmod
on/bin
and/or/usr/bin
- Removed everything in
/etc
On the first point: isn’t it possible to just go su and reinstall sudo?
Or does it not work with disabled root?
It doesn’t work with root disabled.
The way to fix this is to boot in bash recovery where you land a root shell. From there you can hopefully
apt install sudo
if deb file is still in cache. If not, you have to make network function without systemd forapt install
to work. Or, you can get sudo deb file and all missing dependencies from usb stick andapt install
them from fs. Or just enable root, give it a password and reboot so you cansu -
andapt install sudo
Thanks!
The first one can be fixed by using
su
Not if root account is disabled. Which is by default on Ubuntu and Debian . You’d need
sudo su -
but well… No sudo left you know.Damn
My buddy was in a class doing a programming test. It was a couple minutes until turn in time, so he went to zip up the source files. He had already ran the appropriate zip command previously, so he pressed up three times and then enter. It appears he had miscalculated, because the command that ran was
rm *.c
. There were no backups.Linux commands are brutal
Install Red Hat.
Kidding? Maybe.
Red Hat was the first Linux I installed, about 24 years ago, and got hooked. Switched to Ubuntu about 19 years ago, and have used nothing but Debian and derivatives since. I’ve attempted Fedora a few times, but could not convince myself to stick to it.
Today I did rsync backwards. I just restored the backup and moved on.
I’ve reinstalled a few times throughout the years, simply because I didn’t want to deal with fixing something, mainly a bloated mess with multiple desktops. Sometimes it’s faster to back up home and nuke it from orbit.
Assuming you put everything important in home, that is…
dd if=/dev/zero of=/dev/sda status=progress
hmm why is it so fast
OH
CTRL-C
and then a kernel panic yeah my fs was gone
Trying to add my user to wheel: sudo groupmod -a wheel Deleted my group membership in everything but wheel. That was fun! Remote system too! Edit: I still don’t remember the syntax. Geez.
Added an usb drive by its /dev/sd** identifier to fstab without the nofail option. Wanted to do a quick reboot for something I can’t remember, then copy the files over to the USB drive, since I’d need them on the next day and… no boot. The reboot had assigned another name to the drive (/dev/sdb instead of /dev/sdc or something) and automount wouldn’t skip it because nofail was missing. In the middle of the night, with files I required right the next morning. Fun times.
rm ~*
I was running a Vanilla+ Minecraft server and was wondering why my plugin was not working. I had forgotten to unzip it before uploading it to the Ubuntu server vm and didn’t know how to unzip on Linux. So I just unzipped it in windows and re transferred the file. Yaay RSync.
Otherwise just basic mistakes command in the wrong folder type of stuff.
Switching to Arch.
Getting packages from a spider web of repos then not untangling the web before upgrading from one LTS release to another. Ended up with an unfixable problem with essential packages and dependency versions and had to do a fresh reinstall instead. Fortunately I backed up my files first so I didn’t lose anything important.