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.

  • @akash_rawal@lemmy.world
    link
    fedilink
    117 months ago

    How I lost a Postgres database:

    1. Installed Postgres container without configuring a volume
    2. Made a mental note that I need to configure a volume
    3. After a few days of usage, restarted the container to configure the volume
    4. Acceptance
    • @flubba86@lemmy.world
      link
      fedilink
      3
      edit-2
      7 months ago

      Well, that’s a dumb Docker thing, not necessarily a dumb Linux mistake. You could’ve made the same mistake on Windows or MacOS when running Docker.

      • @akash_rawal@lemmy.world
        link
        fedilink
        37 months ago

        Technically, containers always run in Linux. (Even on windows/OS X; on those platforms docker runs a lightweight Linux VM that then runs your containers.)

        And I wasn’t even using Docker.

  • @HarriPotero@lemmy.world
    link
    fedilink
    147 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.

  • @uzay@infosec.pub
    link
    fedilink
    117 months ago

    I have a faint memory of once uninstalling python2 on an Ubuntu system trying to switch to python3. That was a fun learning moment.

  • Laura
    link
    fedilink
    137 months ago

    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

  • @KISSmyOSFeddit@lemmy.world
    link
    fedilink
    167 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.

    • driftWood
      link
      fedilink
      67 months ago

      This weirdly makes sense to me. Not long ago would have done the same.

  • @jyte@lemmy.world
    link
    fedilink
    11
    edit-2
    7 months ago
    • apt something that ended up removing sudo. 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 pattern
    • chown / chmod on /bin and/or /usr/bin
    • Removed everything in /etc
  • @inetknght@lemmy.ml
    link
    fedilink
    297 months ago
    1. have an nvidia GPU

    2. have Fedora

    3. download RPM package of drivers for Red Hat (after all, Fedora and Red Hat are… compatible, right?)

    4. Everything goes fine

    5. Six months later, upgrade to a new version of Fedora

    6. oops, kernel panic at boot after the upgrade, and no video to troubleshoot after UEFI boot

    7. figure out how to boot into a recovery partition from UEFI

    8. figure out how to enable a serial console over a USB device

    9. figure out how to connect to the serial console from another computer using another USB device

    10. figure out what the kernel panic is from (not the upgrade, but the driver which wasn’t upgraded)

    11. figure out how to uninstall the incorrectly installed driver

    12. figure out how to install the correct driver

    That was a fun three week OS upgrade.

      • @inetknght@lemmy.ml
        link
        fedilink
        27 months ago

        https://en.wikipedia.org/wiki/Serial_console

        tl;dr:

        Serial ports are (for example) commonly RS-232, although other types of ports exist. Imagine it to be a very slow Ethernet device. Because it’s so slow (and the technology predates Ethernet and also has different requirements), it’s usually attached directly to a device instead of to a network. But you could connect a modem to it and it becomes connected to a network device.

        It could also be connected to a system console device. These are commonly called terminals. Such devices are often monochrome (especially older ones) because a serial connection is often bandwidth limited (eg, measured in kilobits per second instead of megabits or gigabits). Since it’s so slow, it’s not practical for video, so it’s generally just text-only.

        Note that your GPU might also output a system console but rendered on your display at very high resolution and with graphics-drawing capabilities. So a system console would be any console that connects to the system.

        What is a console? Well, Wikipedia presents several valid articles and the common theme as far as computers go is that a “console” is typically something that a human and a computer use to interact with each other.

        For serial consoles, you might find device files for them at /dev/tty*. But for general serial devices, it could be any of several different types of device files.

        Wikipedia’s article on /dev devices has a pretty decent listing of what kinds of devices you might find and several of them might be classified as a serial port. Any serial port might be connected to a serial console.

        So in my case, a serial console is:

        1. 2x USB-to-RS-232 (USB is a serial protocol and is basically “just” another (Universal) (and perhaps high speed) Serial port (Bus), so conversion is super cheap)
        2. 1x RS-232 null modem cable

        That’s pretty much it in a nutshell. Then

        1. System 1 (the failing system) UEFI boots into repair system partition on a separately attached disk (eg, boot from CD or live USB) to get a local system console
        2. System 1 repair system mounts the failing system partition
        3. System 1 modifies failing system grub configuration to enable a serial console on the attached USB-to-serial device file and saves changes, then unmounts failing system partition
        4. Power off System 1
        5. Remove repair partition device
        6. Open terminal window on System 2 (recovery system)
        7. Connect System 2 terminal to the attached USB-to-serial device file using screen (oh wow those were some old days)
        8. Power on System 1
        9. System 1 boot enters grub recovery menu which allows fixing the system remotely

        To be fair, a lot of that complexity could have been done by either reinstalling, or removing the hard drive and attaching it to another computer. But doing it this way allowed me to poke around and try different ways of solving the issue, rebooting, etc. It was a learning experience worth exploring.

        It was years ago though and I think there was some complication with trying to understand what device file (or device number or something) needed to be to work on the correct serial device (there are often multiple)

      • @AngryPancake@sh.itjust.works
        link
        fedilink
        37 months ago

        Adding to what DmMacniel said, it’s a hardware interface, often accessed via a USB port (which after all, is the universal serial bus).

        • @FigMcLargeHuge@sh.itjust.works
          link
          fedilink
          English
          47 months ago

          Christ you guys are making me feel old. I remember back in the day when a serial connection was made through an actual serial port. I know I have some serial cards around here somewhere. I have also used the tar command on an actual tape… Here’s a fun fact, if your tape drive (big reel to reel looking thing, not a cassette or other kind of ‘tape’) has an issue with rewinding, do not use your finger to manually spin the reel. Use a pencil. I finished reeling my tape back up once and realized I now had a blister on the end of my finger.

  • @deo@lemmy.dbzer0.com
    link
    fedilink
    137 months ago

    Due to some poorly placed quotes, I managed to create a subdirectory named ~ in my home folder. You can imagine what happened next. Luckily, I had just gotten my backup system up and running the day before, so nothing was lost.

  • unalivejoy
    link
    fedilink
    English
    157 months ago

    I once removed all groups from my user by using usermod -g instead of usermod -G

  • @thezeesystem@lemmy.world
    link
    fedilink
    English
    117 months ago

    Reformatted windows and installed Linux.

    Wait before the hate. This was the first time I did it and knew nothing about it and didn’t know it would wipe my system. So I lost everything.

  • Aniki 🌱🌿
    link
    fedilink
    English
    137 months ago

    I once tried to restore replication on a broken MySQL cluster by restoring the backup on the only good, running node.

  • @jdnewmil@lemmy.ca
    link
    fedilink
    97 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.