this post was submitted on 21 Apr 2024
264 points (97.8% liked)

Linux

48185 readers
1112 users here now

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.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

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.

(page 2) 50 comments
sorted by: hot top controversial new old
[–] [email protected] 12 points 6 months ago

i accidentally mark iwd as dependency rather than explicit. after that someday im removing a package depends on iwd, iwd itself been removed as a dependency as well. and im been blocked out of my remote machine until someday i have physical acces to it

[–] [email protected] 12 points 6 months ago

Wiping out Windows trying to install Linux seems to be a common thing. Did that while trying to install Ubuntu as a teen.
Funnily, I didn't check which Ubuntu iso I downloaded and ended up installing Ubuntu server. I should've noticed with the gui-less installer, but then I thought that it was just Linux being hightech.

[–] [email protected] 12 points 6 months ago (3 children)

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.

load more comments (3 replies)
[–] [email protected] 11 points 6 months ago

Mine falls along with the people who were distracted. Was doing two deployments for work on night and on one I need to clear a cache. As I was typing the cd command, I happened to glance at the instructions for the other deployment and for some reason my mind switched to the deployment folder. I then typed out rm -rf *, and as I hit return realized I wasn't in the cache subdir. Blew away our prod environment and it took hours to get it all restored. The restore kept asking the guy to go pull tape #xxx. It was nerve wracking because depending on the tape, there was a chance it was moved offsite. Got it all restored and turned it back on, and then had to start back from the beginning since the backup was from the night before. The other people doing deployments weren't too happy, but I owned up immediately and we ended up changing the procedure. First, the cache clearing was done via a script after that, and I won my argument about not having to do two deployments simultaneously!

[–] [email protected] 11 points 6 months ago* (last edited 6 months ago) (2 children)

My biggest thing when switching to Linux was understanding why I didn't have permission to alter half of my file structure. I was trying to take ownership of my /usr directory as a user and had to have multiple people explain why that was a bad idea (and why simply making any changes as a super user via terminal was more than adequate for the results I wanted).

My mindset was a result of so many user files being spread across dozens of branches of the Windows file structure. Some very close to the root of the drive, some a few directories deeper. I didn't really understand the benefit of having all my stuff in /home (and am now a full convert. Just thinking about navigating a Windows drive makes my skin crawl now).

load more comments (2 replies)
[–] [email protected] 11 points 6 months ago (1 children)

chmod'd all my home directory's files and folders recursively. First to 600, which prevented me from listing any folders, then to 700, which broke a few programs, then to 755, which broke ssh.

load more comments (1 replies)
[–] [email protected] 11 points 6 months ago (2 children)

The Arch installation tutorial I followed originally advised using LVM to have separate root and user logical volumes. However, after some time my root volume started getting full, so I figured I would take 10GB off of my home volume and add it to the root one. Simple, right?

It turns out that lvreduce --size 10G volgroup0/lv_home doesn't reduce the size by 10GB, it sets the absolute size to 10GB, and since I had way more than 10GB in that volume, it corrupted my entire system.

There was a warning message, but it seems my past years of Windows use still have me trained to reflexively ignore dire warnings, and so I did it anyway.

Since then I have learned enough to know that I really don't do anything with LVM, nor do I see much benefit to separate root/home partitions for desktop Linux use, so I reinstalled my system without LVM the next time around. This is, to date, the first and only time I have irreparably broken my Linux install.

load more comments (2 replies)
[–] [email protected] 11 points 6 months ago (1 children)

I was setting up fail2ban on an sftp server at work.

Guess who got admin permanently banned from that machine.

load more comments (1 replies)
[–] [email protected] 10 points 6 months ago

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 or sudo

Fortunately there is little that can't be fixed by booting from a live image.

[–] [email protected] 9 points 6 months ago* (last edited 6 months ago) (4 children)

Not me but a colleague of mine wrote a bash script that had something like this and ran it on a server:

FOO="/home/bar"

... Many lines later ...

rm -rf $FOOT/*

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

load more comments (4 replies)
[–] [email protected] 9 points 6 months ago* (last edited 6 months ago) (7 children)

$ grub-mkconfig -o /boot/grub/grub.conf

Thaaat... took me a stupid amount of time to fix.

load more comments (7 replies)
[–] [email protected] 9 points 6 months ago (1 children)

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.

load more comments (1 replies)
[–] [email protected] 9 points 6 months ago (7 children)

I once just uninstalled sudo and replaced it with doas. Turns out, the shutdown process needs sudo and a lot more. So I am still using my system since then, without shutting down.

No joking, I use Fedora Atomic and can not break my system... unless you mess up your dotfiles, and a lot more.

I also put a drive into my /etc/fstab once without the nofail argument.

No idea why that is not set by default, but when removing that drive my system couldnt boot and I exited to a very scary dracut shell.

load more comments (7 replies)
[–] [email protected] 9 points 6 months ago (1 children)

For this very reason, I have aliased rm -rf with trash-cli

load more comments (1 replies)
[–] [email protected] 8 points 6 months ago

Was trying to get corectrl configured and I was blindly copying text to paste into config files.

Next thing I know, I can't get my system to boot up again. 🤣

Time to reinstall. Again. 😅

[–] [email protected] 8 points 6 months ago

Force uninstalled glibc on my Gentoo, which basically broke every shell and binary on the system. Was able to repair in place because I

  1. Had already compiled busybox statically
  2. Still had a copy of the stage 3 tarball on / which I could use to 'restore' glibc libraries
[–] [email protected] 8 points 6 months ago (3 children)

I have a story that most of here might have faced. I ran dd on my external drive instead of my usb stick to create an iso. 1.8TB of data poof.

load more comments (3 replies)
[–] [email protected] 8 points 6 months ago* (last edited 6 months ago)
dir="$(something that ultimately resolved to "")"

rm -r $dir/*

on a company server

I also once completely destroyed the data in a db that wasn't backed up for that same company while trying to restore from a dump (which was deleted as part of the script i was running).

Luckily both of these mistakes happened on staging servers so no one really cared. (prod is backed up though so if i did it there, not that i have access to prod, it also wouldn't be catastrophic)

[–] [email protected] 8 points 6 months ago

I just finished doing a fresh install this morning, because my wifi card wasn't working. It honestly needed to be done anyway because I was out-of date, but the wifi card finally got me to back-up all my data and do it.

Fresh install, and wifi still won't even toggle-on. Was about to look for manual install of the driver, and so on and so forth... and then I noticed my folly

Fucking keyboard has a toggle switch to turn the wifi off. Not the worst and glad I didn't pull my hair out over it, but damn... felt pretty dumb this morning

[–] [email protected] 8 points 6 months ago* (last edited 6 months ago)

Run sudo apt dist-upgrade -y right after an upgrade to the Kubuntu 24.04 beta on a semi production system.

This is right after the xz thing happened. Also while Ubuntu made the t64 migration (Replaced packages with a 32 time variable with a 64 bit one, the packages are renamed. E.g. lib2geom1.2.0 to lib2geom1.2.0t64)

Packages based on the compromised xz had been removed from the repositories, but I already had some newer ones installed which where dependent on them. Also they already wanted the packages with the t64 addition, which by now where nowhere present in the system.

So dist-upgrade did what it could to upgrade 5 packages and bring the system into a consistent state: It uninstalled half of the system including some somewhat essential packages.

I noticed one of them scrolling by and hit CTRL+C. Afterwards I had the choice of saving the data and restoring from a backup a few weeks ago, or to patch it up by hand. So I did the second and created transitional packages like an empty lib2geom1.2.0t64 which depends on lib2geom1.2.0 which was in the repositories back then. 20 of these later I could install packages to get the GUI somewhat working and now weeks later all the t64 migrations are back in the repos and the system is fully functional again :)

Lessons learned:

  • Be very careful with dist-upgrade
  • Manually trigger a backup before a release upgrade

In now upgrade with
sudo apt-get update && sudo apt-get upgrade -yV && read -p "Flatpak Update? (yj/n): " choice && [[ $choice = [YyJj] ]] && sudo flatpak update --noninteractive
and equivs-build ( sudo apt install equivs) came in really handy in building the transitional packages fast.

[–] [email protected] 7 points 6 months ago

I updated my graphics card. Twice. On two different systems. Nvidia sucks. Both times resulted in reinstalling Linux entirely.

[–] [email protected] 7 points 6 months ago

I once spent a month automating the production of repositories for each kernel version supported on our HPC and rested every step exhaustively in isolation.

When I was satisfied I ran it with root permissions and hosed the VMs it was running on because a recursive chmod evaluated to /.

Oops.

[–] [email protected] 7 points 6 months ago (2 children)
  1. Have Nvidia card
  2. Change the driver to see if I can fix a weird graphical issue I was having.
  3. Rebooted computer and got stuck in boot loop because there was an error with the driver.
load more comments (2 replies)
[–] [email protected] 7 points 6 months ago* (last edited 6 months ago)

Typed "rm -r" in "/home/myuser" instead of "/home/myuser/Documents/ThingINoLongerNeed"

Used gparted to wipe and format the device mounted at "/" instead of the external drive I meant to reformat. I've done this one TWO WHOLE TIMES in my life, three if you count wiping a device that was mounted at "/home/myuser/MyTwoTBDrive4DocsPicsMusicGamesEtc".

[–] [email protected] 7 points 6 months ago* (last edited 6 months ago) (3 children)

Let a narcisist bipolar family member onto my home server for phaseI. For phaseII I granted too much access in sudo because I was busy. Fast forward a year or two and a downswing triggers the victim rage and he attempts to wreck my server after a minor argument -- would have, too, if I wasn't keenly aware of a conversation he had a few weeks before where he detailed "how to fuck with someone horribly" to a peer and I used that recollection to reverse the damage. It was a lucky thing, and 25 years on I have better security and backup processes.

I still regret that. #family, right?

load more comments (3 replies)
[–] [email protected] 7 points 6 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.

[–] [email protected] 7 points 6 months ago (1 children)
  • Accidentally did a partial upgrade of Arch Linux in which I upgraded libssl but not systemd (which depended on it) (which refused to start becuase one of its dependencies had been upgraded to an incompatible version) (which caused the kernel to panic immediately on bootup because the init process died) (writing init=bash on the kernel command line gave me a shell but not network access) (i had to boot off a liveusb, chroot into my /, and run pacman -Syu from there in order to fix it)
  • Use Ubuntu, at all, for anything, ever
load more comments (1 replies)
[–] [email protected] 7 points 6 months ago

There's a lot of gun refference in that school class. Are you by any chance in the US?

[–] [email protected] 7 points 6 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.

[–] [email protected] 7 points 6 months ago (1 children)

I've deleted my DE a couple of times from not reading the "The following packages will be REMOVED"-list.

load more comments (1 replies)
load more comments
view more: ‹ prev next ›