source ~/.bash_history
Linux
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
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.
- No misinformation
- No NSFW content
- No hate speech, bigotry, etc
Related Communities
Community icon by Alpár-Etele Méder, licensed under CC BY 3.0
Dear god
That's the scariest horror story in 2 words I've seen so far
I'm genuinely having a chuckle at how shocked people are at my submission, made my day xD
I mean, it's simple, elegant, and destructive AF given the right circumstances. Basically a chaos grenade we didn't realize existed
Many many years ago I wanted to clean up my freshly installed Slackware system by removing old files.
find / -mtime +30 -exec rm -f {};
Bad idea.
Tried to convert Ubuntu to Debian by replacing the repos in sources.list and apt dist-upgrading. 💣 Teenagers...
sudo rm -f /lib /usr/share/backup/blah blah.tar.gz
Note the space.
Oh man, you really owned those libs
You need to use chown if you want to own the libs
First, the classical typo in a bash script:
set FOLDER=/some/folder
rm -rf ${FODLER}/
which is why I like to add a set -u at the begining of a script.
The second one is not with a Linux box but a mainframe running AIX:
If on Linux killall java kills all java processes, on AIX it just ignore the arguments and kill all processes that the user can kill. Adios the CICS region 😬 (on the test env. thankfully)
If on Linux killall java kills all java processes, on AIX it just ignore the arguments and kill all processes that the user can kill.
jfc, is ignoring arguments the intended behavior?
On a real UNIX (not only AiX) killall is part of the shutdown process - it gets called by init at that stage when you want to kill everything left before reboot/shutdown.
Linux is pretty unique in using that for something else.
I didn't know that, good to know.
They could have send a SIGTERM by default instead of a SIGKILL. I would not have corrupt everything 😅
killall typically sends SIGTERM by default. It accepts a single argument, the signal to send - so shutdown would call it once with SIGTERM, then with SIGKILL. killall is not meant to to be called interactively - which worked fine, until people who had their first contact with UNIX like systems on Linux started getting access to traditional UNIX systems.
It used to be common to discourage new Linux users from using killall interactively for exactly that reason. Just checked, there's even a warning about that in the killall manpage on Linux.
Yes: same command name, two different semantics:
Cross-Unix scripting is fun ☺️
Wow, the last one is quite unexpected. What a useful command
CTRL-C-ing apt because it looked stuck for more than 10 minutes. I don't recommend doing it.
Haven't used apt
in a while, is it not atomic? What happens if you mess with it?
I can't even remember how I did this, but overwriting the partition table on the main production server at our small startup (back when "the server" would usually live on the premises of the startup). I remember my boss starting to hyperventilate from panic while I reconstructed it from memory / notes, and all the filesystems came back and he calmed down.
Same job, they gave me a little embedded-systems unit for me to use to build a prototype on. I hooked it up, nothing worked. I brought it back to them.
Hey, this one doesn't work.
Huh... that's weird, it was working before. Did you break it?
I don't think so. Can I have one that works?
They literally told me, as they were handing me the second one: Okay, here's another one. Don't break it.
I figured it out literally seconds after breaking the second one... I was hooking it up to 12 volts of power when it needed 5. Second dead computer. Explaining that and that I needed a third one now was fun.
Before installing Arch on a USB flash drive, I disabled ext4 journaling in order to reduce disk reads and writes, being fully aware of the implications (file corruption after unexpected power loss). I was confident that I would never have to pull the plug or the drive without issuing a normal shutdown first. Unfortunately, there was one possibility I hadn't considered: sometimes, there's that one service preventing your PC from turning off, and at that stage there's no way to kill it (besides waiting for systemd to time out, but I was impatient).
So I pulled the plug. The system booted fine, but was missing some binaries. Unfortunately, I couldn't use pacman to restore them because some of the files it relied on were also destroyed.
This was not the last time I went through this. Luckily I've learned my lesson by now
First time trying Linux I went with an arch install because I Googled "best version of Linux" and went with arch. Followed a guide to the point of drive formatting and I decided to go with a setup with drive encryption. I didn't understand what I was doing, ended up locking myself out of my hard drives and couldn't get windows to reinstall on them. I used a MacBook for a week until I installed Ubuntu and managed to wipe and reset my drives and reinstalled. Needless to say I am going to read up a little more before I try that again.
Been there, and even without encryption: took me to reinstall a few times before I realized I can chroot again and repair 😅
I don't know if that counts, but on a fresh default Debian Stable system, my cat walked across the keyboard and the DE crashed.
I could still switch to another TTY and reboot via command line.
After the reboot, I was greeted by a blinking cursor and nothing else. Had to reinstall.
keyboard cat strikes again
Deleted my entire efi partition while trying to install some grub themes.
And then my backup didn't work when I tried to restore it.
I have pretty colours now though, so it was all worth it :)
This was pre-linux for me but something you can still do in most distros so I think it's a valid story.
In 1999 I was using Napster on computer running MS-DOS. I was 12 years old and an aspiring open media enthusiast/stupid script kiddie. I was using the file explorer interface in Napster and accidentally gave access to my entire C drive. I also had opened ports to share certain media and to fuck with my friends using daemon tools (back then you could do stupid stuff like control a friend's desktop with certain versions of daemon tools). Immediately I started receiving packages called things like "sleep.tight.tiny.mite" and I knew I was fucked so I clicked in the Napster interface and clicked "delete" and deleted my entire active drive.
I panicked and installed the only operating system we had which was a random copy of Red Hat. When my dad came home I pretended like it had always had Linux on it. I do think he was more impressed than mad.
I wanted to use fio to benchmark my root drive. I had seen a tutorial saying that the file=
parameter should point to the device file, so I pointed it at /dev/sda. As you might expect, the write test didn't go so well.
Somehow convinced a person to run sudo chmod -x /usr/bin/*
I don't remember the exact command so it could be a bit different but it did the job. It was a fun evening.
The first time I read this, i thought "shouldn't all that be executable anyway?"
And then I read it again and realized, minus x
An intern nuked their workstation by sudo chmod -R 777 /
. Turns out adding exec to everything isn't good either.
Daaem, I guess the poor dude at the receiving end did not consider it particularly fun. Well, at least they had sbin working, so probably possible to recover without a live cd. Huh, guess who's now spinning up a VM to check it out 🤣
Checked it out: on arch that results in inability to run tty on reboot, then you're dropped into initramfs's rescue shell where you can simply +x new_root's /usr/bin/* and be back up and running
Just straight up overwriting boot sector and superblock of my hard drive thinking it's the USB drive.
Udev tried to warn me, saying there's no permission, and I just typed sudo without thinking.
Then after a second I remembered USB block devices are usually writable by users, but it was too late.
Learned about the importance of trailing slashes in rsync by using the -delete flag.
I've broken systems far too many times in the last 24 years, since Mandrake 6.x, to count:
- I've dd a disk or more
- I've rm *
- I've chmod
- I've brought down the network, with every intention tar it would come back - on a remote box
- I've failed to RTFM far too many times
Oh, I just remembered another one or three. So, resizing the partitions. My install at the time had a swap partition that I didn't need anymore. Should be simple, right? Remove the partition and the corresponding fstab entry, resize root, profit. Well, the superblock disagreed. Fortunately, I was lucky enough to be able to re-create the scheme as it was, and then take my time to read the wiki and do the procedure properly (e2fsck, resize2fs and all that stuff).
Some people I've met since, unfortunately, weren't so lucky (as far as I remember, both tried to shrink and were past mkfs already) and had to reinstall. The moral is, one does simply mess with superblocks; read the wiki first!
Generated my grub configuration as grub.conf
This one took a stupid amount of time to debug - but on the other hand, when grub failed it did with "can't find any bootable thingy" and not "missing configuration file" as, in my later opinion, it should.
~~Life~~ Linux is a harsh mistresses, sometimes.
Nooo I have so many.. This one I can explain in English:
Xubuntu but blind
So, this is ~2016. Ubuntu is hip and a handful of my students use it. On my PCs I only use Debian and Suse. So to help them better I take out an old ASUS laptop and install Ubuntu on it. Try out Xubuntu instead.
At that time I was also huge into alternative keyboard layouts. I had a slightly modified Neo keyboard layout installed when I switched to Xubuntu.
Here the fun starts because the obscure internal graphics card built into the laptop didn't have driver support under Xubuntu. Black screen but I could hear it working. This was the hardest driver fix I ever did. No monitor and a keyboard layout I wasn't used to, under a Linux distro I wasn't used to. And I also was at the university library, so no hardware support or Debian stick in reach.
I copied a program into the /bin/ folder while in a file browser with sudo permissions and somehow overwrote every file except the one I was moving. It, of course, couldn't boot, but copying the bins from a live iso made it at least boot able. Reinstalled Linux after that, of course.
"Updating" a 5.2 RedHat install with a 6.0 Mandrake CD-ROM (or the opposite, can't remember right now...). Fun stuff.
So I am sort of an embedded developer, and I like to mess around with weird configurations. So the craziest experiment I did was trying to reflash a rasberry pi from a system running in the pi's RAM. It honestly might have worked, but during the prep work I forgot to resize the filesystem before mucking with the paritions and had to reflash the normal way before I could try again. Ended up just turning it into a pihole instead, but I still learned a lot about pivot_root
Not strictly Linux related, but in college I was an IT assistant. One day I was given a stack of drives to run through dariks boot and nuke.
I don't remember exactly what happened, but I think midway through, my laptop shut off.
Guess who picked the wrong drive to wipe with DBAN :)
At one point I had the coolest Ventoy USB; CyberRe, LABEL=hakr. But then I got a new computer and apparently the ssd was /dev/nvme0n1 instead of /dev/sda. While I was installing Arch, When I created a new GPT partition on /dev/sda, it wiped my beautiful Ventoy 😢
Oh, i have a brilliant one:
A few years ago i spent a lot of time converting .flac-files into .ogg-files in order to put on my oldschool iPod. As I did a lot of repetitive typing - entering $dir / for file in flac ; do convert etc / mkdir -p $somewhere/$artist/$album / mv $somewhere/.ogg->$new_dir/ and so on - I thought: "hm lets just write a loop over loops for all the artists here and then all the albums and at the same time create the nested directories somewhere else... hm actually in the home directory.... and later love everything on the iPod at once."
so i was in my music folder with the artists-folders i wanted to convert. i did something wrong
So i did my complicated script directly in the shell. I made something wrong and instead of creating a folder "~/artist/album" I created 3 folders in my current working directory: "~", "artist" and "album". hmph dammit gotta try again... but first : i have to clean up these useless folders in the current dir. so i type of course this: "$ rm -r ~ artist album " after about 5 seconds of wondering why it took so long i realized my error. o_O I stopped the running command, but it was (of course) too late and i bricked my current installation. All the half-deleted config files made or impossible to start normally and extremely tedious to repair it by hand, so i reinstalled.
dpkg-reconfigure sysvinit
I don't remember what I was trying to achieve, but it was a bad idea. I also didn't (and still don't) know how to fix the outcome of this, so - since my home was on a separate partition anyway - I just reinstalled Debian since that was much quicker anyway.
Installed python3 before it was made the native python on the dist. Half broke everything, including apt & python. So I uninstalled it, and then everything was broken. Finally got python3 reinstalled, and lived with it kindof working & awful distribution updates.
I have finally freed myself of that prison last month, by nuking everything and starting fresh.
Types
rm -r -f Presses strg+v (instead of strg + shift + v)
Hits enter
Maschine proceeds to delete the home folder as the garbage that comes when pressing normal strg+v gets interpreted so...