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.

  • HarriPotero@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    5 months ago

    Not me, and not Linux, but a school mate found the following bash snippet online :(){ :|:& };:.

    Naturally, he tried it on the SunOS servers we had access to for schoolwork. He got his account suspended for the rest of the year.

    I think most Linux distros are configured to kill fork bombs nowadays.

  • pmk@lemmy.sdf.org
    link
    fedilink
    arrow-up
    1
    ·
    5 months ago

    I wanted to try inserting and removing kernel modules, so I looked around and thought “well, I don’t have a USB stick in right now so I can safely try removing the usb kernel module.” So I did that, and after pressing enter I realized my keyboard is connected with USB.

    • flubba86@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      5 months ago

      I was smug thinking “I haven’t done anything so silly as the people commenting in this thread”, then I came across this one. I’ve actually done this one, and it was earlier this year, and I’ve been using Linux since 2004, 20 years.

  • rolandtb303@lemmy.ml
    link
    fedilink
    arrow-up
    1
    ·
    5 months ago

    was too incompetent to install arch one time so i used archinstaller and created a separate home partition. couple years later that root partiton’s close to filled up, and i do an update after deleting come programs to free up space. then some weird text appeaerrs in terminal, and so i try to update again (this time specifically wine), says loads of files already exist in filesystem. i think “this is weird”, so i restart.

    what instantly gets my attention is this text greeting me on boot

    loading Linux linux… error: file ‘/vmlinuz-linux’ not found. Loading initial ramdisk… error: you need to load the kernel first.

    Press any key to continue.

    yup, i just borked my install, so i hastily whipped out an outdated arch USB, updated it using a spare laptop and am now on a reinstall (luckily i keep the important files on a separate drive, so not all is lost). extra insult to injury was that my previous install had my drive LUKS encrypted, so i couldn’t evne get in there to possibly backup anything if i tried lol. but it’s feels refreshing starting anew though.

  • MonkeMischief@lemmy.today
    link
    fedilink
    arrow-up
    1
    ·
    edit-2
    5 months ago

    Ha! I just did something like that. I thought I had “orphaned” BTRFS snapshots taking up space.

    I opened a file explorer as root…I deleted this one that wasn’t listed.

    Oh wait…“Writable snapshot”…? Oh…no.

    Yeah suddenly no programs or anything worked. Sadly there was no snapshot restoring out of that one! (That I would be capable of, anyway!)

    So yeah, I managed to deliberately bumble past several safeguards into the “I should know what I’m doing” area, and found a magical way to rm -rf / from the GUI, essentially. Wee!

    Thankfully, /home was its own partition, so aside from minor inconveniences bringing .configs back over and other little tweaks I’d implemented, I have reinstalled OpenSUSE Tumbleweed leaner, meaner, and cleaner. ¯_(ツ)_/¯

    ACTUALLY, glad I backed up /home before the reinstall because the first reinstall attempt failed and wiped it!

    Backups, kids. They really are the difference between “Aw darn, live and learn.”…and complete heartbreaking despair.

  • toddestan@lemm.ee
    link
    fedilink
    arrow-up
    1
    ·
    edit-2
    5 months ago

    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 that installpkg 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.

    • jwt@programming.dev
      link
      fedilink
      arrow-up
      1
      ·
      5 months ago

      And then accidentally copy/pasting the failed attempt code snippets of the OP describing the situation.

      • ilinamorato@lemmy.world
        link
        fedilink
        arrow-up
        1
        ·
        5 months ago

        I’ve regularly found a solution to my problem on SO, only to discover that I need to figure out how to break my system exactly the same way the asker did before the fix will work.

  • KISSmyOSFeddit@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    5 months ago

    The dumbest must have been when I went through the list of installed packages on Debian and removed everything named “python-…” since I don’t program in python.

  • jdnewmil@lemmy.ca
    link
    fedilink
    arrow-up
    1
    ·
    5 months ago

    Using sudo when it isn’t necessary, and the real cannon: sudo su… Adding sudo to your command lines indiscriminately causes files you create to be owned by root even though they are in your home directory, and then you end up using sudo to make changes to the files… and then the filesystem permissions cannot prevent you from successfully running an accidental “sudo rm -rf /” command.

    Seriously… sudo is not a “habit” to develop in order to avoid dealing with filesystem permissions problems.

    • luciferofastora@lemmy.zip
      link
      fedilink
      arrow-up
      1
      ·
      5 months ago

      I regularly find myself trying to tweak some system config and opening the file read-only because I forgot to sudo vim it.

      Doesn’t help that my everyday user account doesn’t have sudo privileges, so I need to su to my admin account first.

  • fxdave@lemmy.ml
    link
    fedilink
    arrow-up
    1
    ·
    5 months ago

    I deleted /lib64/ld-linux-x86-64.so.

    I did it because valgrind had a problem with it. I thought I can fix it with reinstalling the package. I tried to lookup which package is it from, but the command I used was wrong and I didn’t get any result. So I thought, what if I created it, maybe I just forgot it.

    the moment I deleted it everything stopped working. It was fixable only from a pendrive.

  • ThetaDev@lemmy.dbzer0.com
    link
    fedilink
    arrow-up
    1
    ·
    edit-2
    5 months ago

    Attempting to resize the system partition without backing the system up first (right after I spent the whole day setting everything up). Gparted failed, the system did not boot any more so I had to stay up the night to redo the whole setup. No personal data loss since the system was fresh, though.

    Since I got into Linux via virtual machines and Raspberry Pi before using it as my daily driver, I made most of my stupid beginner mistakes (like changing permissions on systen files) where it did not really matter.

  • markstos@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    5 months ago

    Once I omitted a semicolon after an “rm -rf”and the next command. The script was supposed to reduce downtime vs typing the commands manually, but instead it deleted the production site and the “.bak” backup of the site instantly.

      • markstos@lemmy.world
        link
        fedilink
        arrow-up
        1
        ·
        5 months ago

        This was hosted on bare metal on a file system that didn’t support snapshots. And the backup system? A state of the art tape drive. That’s why I was creating my own backup as part of the launch.

        We recovered by using the staging site content.

  • mlg@lemmy.world
    link
    fedilink
    English
    arrow-up
    1
    ·
    5 months ago

    I already posted this before but a friend did chmod -R user /usr/bin and broke every suid and guid bin including sudo lol.

    Personally have accidentally shadow deleted /home via an incorrect bind mount so I couldn’t log into my own user.

    • Archr@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      5 months ago

      I did something similar (that my professor still talks about in class as a cautionary tale)

      I ran chown -R user .* (intending to target all hidden files in the folder) and for people that don’t know .* also matches .. (.. was / in this case) which changed the permissions on all files on the system to that user, including sudo.

      We fixed it by mounting the root of the file system in a docker container which effectively gave us root.

      • circular@lemmy.ml
        link
        fedilink
        English
        arrow-up
        1
        ·
        5 months ago

        I’ve also been hit by .* matching ... First of all, I find this really really jarring. It makes sense and doesn’t at the same time. I also wonder how to properly only glob the hidden files but I’m too afraid to experiment.

  • ChaoticNeutralCzech@feddit.de
    link
    fedilink
    arrow-up
    1
    ·
    5 months ago

    Wanted to customize GRUB and tried the GUI program. I wanted it to boot without delays unless a key is being held, and also add a “Shutdown” option (GRUB script halt), in case I open the laptop and didn’t want it turned on. The edits looked alright in GRUB Customizer but I should not have made them both at once, because it made “Shutdown” the default option somehow, so the OS would never boot and holding none of the special keys worked. I failed to update or reinstall GRUB using a live USB and ended up having to reinstall the entire distro.

  • slembcke@lemmy.ml
    link
    fedilink
    arrow-up
    1
    ·
    edit-2
    5 months ago

    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. >_<

    • AnarchistArtificer@slrpnk.net
      link
      fedilink
      English
      arrow-up
      1
      ·
      5 months ago

      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)

  • mackwinston@feddit.uk
    link
    fedilink
    arrow-up
    1
    ·
    5 months ago

    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)

    $ ls -l
    sh: ls: command not found
    

    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:

    # rm -rf / tmp/*.log
    ^C^C^C^C^C^C^C^C^C^C
    # ls -l
    sh: ls: command not found
    # stat /bin/ls
    sh: stat: command not found
    

    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.