Running the right command on the wrong SSH session/machine.
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
I set a different background color on all my machines because of exactly this while using VNC/RDP
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.
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.
-
have an nvidia GPU
-
have Fedora
-
download RPM package of drivers for Red Hat (after all, Fedora and Red Hat are... compatible, right?)
-
Everything goes fine
-
Six months later, upgrade to a new version of Fedora
-
oops, kernel panic at boot after the upgrade, and no video to troubleshoot after UEFI boot
-
figure out how to boot into a recovery partition from UEFI
-
figure out how to enable a serial console over a USB device
-
figure out how to connect to the serial console from another computer using another USB device
-
figure out what the kernel panic is from (not the upgrade, but the driver which wasn't upgraded)
-
figure out how to uninstall the incorrectly installed driver
-
figure out how to install the correct driver
That was a fun three week OS upgrade.
I have a super-n00b question, and I apologize in advance, but, uh...yeah, what is a serial console?
rm *.c
when I meant rm *.o
I tried to install an OS to a USB stick. This is Kubuntu specific.
You need to create a GPT partition on the stick, then you should be able to just use the installer and install on another USB stick.
I went through it, selected the usb stick... was not sure if everything was right and went a menu back, was correct, went forth again, past the install target selection and installed.
Well... turns out the Kubuntu installer (Calamares) selects the first disk always. And that selection seems to reset to default when going a menu back....
I deleted my complete normal disk, with like everything I had.
No Backup no mercy. Luckily did one only a few weeks before. The first since half a year! Damn... had my uni stuff on Nextcloud, a lot of personal stuff synced to my phone with syncthing.
ntfsclone /dev/sdc /dev/sdb
/dev/sdb was a blank filesystem and /dev/sdc was my Windows filesystem.
It ran for less than a second and didn't take me long to figure out what happened. That's the story of how I stopped using Windows.
If you count Android too, then this: I got my first Android phone when I was 10 or 11 and rooted it on the first day of having it. This was during a time when we were all still using ClockworkMod because TWRP didn't exist yet, and I somehow ended up with a system without a kernel. Panic ensued, and I spent that entire night (like 10 hours) digging through xda in order to find a tutorial on how to get this damn phone to run again. Imagine having to tell your parents "I broke my phone I got yesterday." I did get it working at like 6:30 AM. Fun times.
what's the fun in modding if not the two hours where you think you've bricked everything and you're scrambling through a 52 page post on XDA trying to find someone with your same problem
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.
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
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
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. >_<
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.
I’m still stuck in vi
:q
Is that the “licking my own nose” emoticon?
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.
Way back when I was just beginning to experiment with Linux back in the 90s I installed ZipSlack, which was a GUIless 100MB distro based on Slackware that ran from a folder on Windows. It was okay but I couldn't really do much with it and back then 100MB was a chunk of space, so i went to delete it. But i thought I would give it one last hurrah by deleting it from Linux. So I made use of the infamous rm -rf
and sat there thinking "this is taking a long time"... then realised I had my Windows drive mounted as a sub folder and I was in the process of wiping my hard drive of everything!
I once removed all groups from my user by using usermod -g
instead of usermod -G
I once tried to restore replication on a broken MySQL cluster by restoring the backup on the only good, running node.
How I lost a Postgres database:
- Installed Postgres container without configuring a volume
- Made a mental note that I need to configure a volume
- After a few days of usage, restarted the container to configure the volume
- ...
- Acceptance
Trusting tab-completion and pressing enter just a tiny bit too early, resulting in overwriting the work of at least four hours, because the files' names started the same. That whilst trying to initiate a git repository to prevent that kind of mistake....
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.
You know, I'm in a constant battle with bootloaders. I've both deleted grub multiple times and windows boot manager by accident and by believing "I could fix it by re-generating it"... More like re-installing.
I have a faint memory of once uninstalling python2 on an Ubuntu system trying to switch to python3. That was a fun learning moment.
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
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.
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.
Deleted the certs from the sshd daemon which locked me out of a remote server that required and a 2 hour drive to fix.
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.
"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.
I distrohopped once and wanted to try OpenSuse Tumbleweed. Would have went really well if I didn't by accident deleted all my partitions...
I lost all of my curated music files I gathered over the span of the last 15 years.
I'll never get those back.
Always do an echo first before you put rm in a script. You know the story.
I installed timeshift
to have a way to create restore points just in case I mess something up while fiddling with my Archbox.
I used it for a while before I decided to remove it. After that, I realized it didn't remove the "restore points" (I didn't fully understand how it worked) and thought it would be good idea to rm -rf /run/timeshift
.
My whole /home
was smited (it uses symlinks to create these "restore points"). Before I realized, it removed gigabytes of data.
Lesson learned: always understand how something works and always be careful when using rm -rf.
I accidentally overwrote /etc/passwd once and I allowed /boot to run out of space during a kernal update and I created a local user with the same user that was also on the realm/domain that I had joined and various bash script issues.
Some stuff I've had to fix that someone else did:
- named a file rm -rf
- rm -rf /bin instead of ./bin -- Also the fact that they had sudo was crazy and also I guess this was the second time
- chmod -R 777 /
- Various software bugs running swap out of space or hitting the inode limit by creating files over and over again with a timestamp in the filename and having to remove all of them because there was no backup to the OS
- Someone disabled SELinux because something wasn't working but didn't tell anyone -- ugh
- Compiled java because they googled some issue and followed some old tutorial without understanding anything instead of using
alternatives
and symlinked the old java from /bin to /home/theiruser/java -- had sudo because he was a Windows domain admin. - Cybersecurity guy didn't know what some VMs did so he turned them off and figured he'd find out if/when someone complained. Caused a massive core services outage.
- Same Cybersecurity guy deleted a bunch of data because he wanted to see how the sysadmins would respond and witness backup restorations. He did not inform anyone.
- Cybersecurity guy above still has Domain Admin and sudo everywhere. I would have personally removed his privileged access regardless of what 'CyberSecurity' management thought but I was leaving for a new job by then anyway so I figured I'd just let them eventually lie in the bed they made.
There's more but I don't want to keep going because it is Sunday and I don't want to ruin it.
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.
apt
something that ended up removingsudo
. 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 patternchown
/chmod
on/bin
and/or/usr/bin
- Removed everything in
/etc
I mounted a disk of a server in rescue mode, since I needed to extract everything (the provider didn't have the option to dump everything as a zip). Then installed an FTP server, added a user/pass, it worked.
But I couldn't access the files of the original disk, even though I could see them. So I just chgrp/chown the original files, since the disk was just "mounted" in the rescue disk /mnt, I thought it was alright (at the time I thought permissions were volatile, stored separately from the files). I could now download the entire disk, yay!
Upon booting the original disk again, a bunch of errors: shell not starting, tools not running, because they were owned by user and not root...
Well we reinstalled all the server from scratch that day.
Tip: don't put important things in just 1 place.
That aside!
Years ago when I first tried out Linux (I was around the age of 10), I didn't really pay much attention while installing Linux back then, so I wiped my entire data disk D:...
I like the 3-2-1-1-0 backup rule personally.
tl;dr:
- 3 copies of your data
- on 2 different media
- at least 1 offsite copy
- 1 copy offline (preferably air-gapped)
- 0 errors (IE verified backups)
(For the super important stuff, obviously. I'm more lax about other things.)
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.