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.
From Wikipedia, the free encyclopedia
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.
Community icon by Alpár-Etele Méder, licensed under CC BY 3.0
Can’t remember exactly what happened but it involved changing permissions on
/bin
/sbin
and similar. You know for security …In the end I didn’t have permissions to run
chmod
,su
orsudo
Fortunately there is little that can’t be fixed by booting from a live image.
I once removed all groups from my user by using
usermod -g
instead ofusermod -G
I did the same! After that, I never tried to run that command from memory
You probably mean that you used
usermod -G
instead ofusermod -a -G
The -a stands for append
But you understand what I mean.
Not me but a colleague of mine wrote a bash script that had something like this and ran it on a server:
Reminder that bash will resolve uninitiated variables to the empty string.
Luckily he halted the process after it had only nuked /boot and /bin. If it had gotten to /var and the mounted data storage within, we would have been in trouble
Do you work at Valve?
Ahhhh why not anything in
/tmp
or better${TMPDIR:-/tmp}
or bestmktemp
Always use
set -eu
Yeah if you don’t put bash in European mode, it is a lot more dangerous.
rm *.c
when I meantrm *.o
Always do an echo first before you put rm in a script. You know the story.
Alias rm to echo and install trash. Saved me many times.
I’m still stuck in vi
:q
Is that the “licking my own nose” emoticon?
E37: No write since last change
:!w /etc/fstab
first!I totally pulled a LTT and removed my kernel. >_< There was a “real time” kernel listed in apt, and I installed it because I was curious if it would reduce lock latency for a project I was working on. (I wasn’t trying to solve a problem, just curious) It didn’t and I figured it was probably a bad idea to leave it installed. So I did an apt remove, and the rest went something like this.
Apt: Are you sure you want to remove the your kernel? Y/N
Me: Oh jeez… I don’t want to do that.
Motor Memory: Y <return>
Apt: Are you really really sure? Your computer will not boot if you do this. Y/N
Me: Oh, crap! That’s not what I meant to do. Definitely not!
Motor Memory: Y <return>
Me: No! Why would my brain betray me!?
Fortunately this was on a PopOS machine, so I booted into the recovery partition. Even if fixing it only took a minute, I still felt very very dumb. >_<
Man, that’s a really dumb story that I find really relatable despite not having had any experiences like that. It feels like it’d be very in character for me though. Thanks for sharing, it helps me feel less silly in the various times where I’ve messed up (of which I am struggling to recall specific examples, but whatever brain part is responsible for embarrassment can remember, apparently)
I do dumb things like edit my network configuration do some stuff and log out. Then I can’t login the next weekend because the IP address is wrong. Also:
Ifconfig eth0 down
And I am booted from ssh.
Yeah screwing with the network interface of the machine you’re SSHd into is something nearly every sysadmin have done at least once.
That or changing something, rebooting the server and subsequently being unable to contact it again due to said change. I’m always scared and feeling I’m taking a risk when upgrading a major OS version over SSH, yet Ubuntu never failed me in that, it’s the silly things that got me, like messing with fstab.
I once tried to restore replication on a broken MySQL cluster by restoring the backup on the only good, running node.
I updated a manjaro system.
Did you… Kill-a-manjaro?
I rebooted PC in the middle of Manjaro update. Apparently, kernel was updating, so it broke.
Took me 15mins to restore, but they could make some safeguards.
Other than that, never faced issues updating Manjaro.
Well, there’s a reason why Windows says “Don’t turn off your computer” during updates. I think noob-friendly Linux distros should implement a similar system, where Kernel updates are only installed on shutdown and a message is displayed telling the user not to shut down their computer. There should still be rescue mechanisms like Btrfs snapshots or a recovery system that automatically detects a broken kernel and reinstalls it.
I think it can be done even simpler - no need for a special screen, just make notification and don’t turn off while the kernel is updating.
I moved from Manjaro after a couple system updates just borked something like X11, but those happened over a 3 year course of using Manjaro.
As insightful as it is to find the root cause of a Linux problem like that, on my main system it was just not something I wanted to deal with or risk having right when I need the PC.
I see. Thanks for sharing your experience! What do you use now?
I moved from Manjaro to EndeavourOS and was been pretty happy with that. Unfortunately my study mandates things like .docx files, Visio drawings, things that just are more clunky to do if I’m trying to do it under Linux, so I’ve been actually using Windows 10 on my daily driver.
However I have LMDE on a second machine which I have been pretty happy with, although I am more of an Xfce guy than Cinnamon.
Thanks! Speaking of .docx files, I never actually encountered the issues with them on Linux. The only issue being macros not working great, so maybe that’s your case.
I can usually read them, though issues can range entirely from nothing to entirely broken. I otherwise haven’t tried creating a .docx file on Linux (I would usually use .odf instead) and seeing how it renders in MS Office, but when it comes to an assessment I’d prefer not to test that.
I see!
“I have 200 GB of unused space in the windows partition, I’ll just plug a live CD, divide that partition and merge it with the Linux one, ggez”
Yes, dividing the windows partition destroyed it. Yes, mixing the windows and ext destroyed Linux. I might have been able to recover something but I was like 18 and I just reinstalled windows in a fit of misdirected anger against Linux.
Don’t do that. Best option is to run windows in a VM. Second best option is to shrink windows in windows and the boot to a live system to grow linux
No shit, now I daily drive Linux and I just have two separate drives for each, with some extra drives for games and files and such. That was 10-ish years ago.
Everyone here is talking about rm, but when’s the last time you dd’ed the wrong thing by accident?
You can get tripped up by tab completion, hda vs sda, sda vs sdb, flipping the articles around, he’ll, I’ve even blasted a good drive with /dev/random because I did t pay attention to what computer I’m logged into.
My killer app for multiple terminals open at once, weather through several ttys, xterms, tmux or the other one I don’t use was to type out my dd commands with a ls or something safe making in front of it while I look back and forth compulsively to verify that all the targets are correct.
Only reason dd hasn’t bitten me is that in my head, if and of make perfect sense as input and output.
Doesn’t mean I won’t make that error tomorrow, ofc. But I tend not to alias except harmless stuff to avoid that very problem.
Yup, I did that last year. I wrote a Linux ISO to my hard drive instead of a flash drive. It was interesting watching my desktop slowly fail. Thankfully I was preparing a switch to a different distro, so I had backed up what I needed.
All my drives are nvme* now.
I feel so much safer punching in of=/dev/sdaX
I haven’t but I’m always terrified of doing it
deleted by creator
What did you send
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
My first experience with installing Linux on a hard drive involved wiping the wrong hard drive (my dad’s) and installing on it. Then panicking when Windows 95 didn’t boot up. Thank goodness my dad was understanding lol.
An older friend of mine told me years back about an incident that happened on a university VAX running Unix. In those days, everyone was using vt100 terminals, and the disk drives weren’t all that quick. He was working on his own terminal when without warning, he got this error when trying to run a common command (e.g.
ls
)So he went on over to the system admin’s office, where he found the sysadmin and his assistant, staring at their terminal in frozen horror. Their screen had something like:
A few seconds after hitting return, and the
rm
command not finishing immediately, he realised about the errant space, and then madly hammered Ctrl-C to try to stop it. It turns out that the disk was slow enough that not everything was lost, and by careful use of the commands that hadn’t been deleted, managed to copy the executables off another server without having to reinstall the OS.Oh no, that’s horrifying.