• rocky1138@sh.itjust.works
    link
    fedilink
    arrow-up
    15
    ·
    2 days ago

    I’m a million years old but I have something relevant! An amazing tale shamelessly copied from Unix Horror Stories, which you simply must read if you end up liking this story, copied below:

    Have you ever left your terminal logged in, only to find when you came back to it that a (supposed) friend had typed “rm -rf ~/*” and was hovering over the keyboard with threats along the lines of “lend me a fiver 'til Thursday, or I hit return”? Undoubtedly the person in question would not have had the nerve to inflict such a trauma upon you, and was doing it in jest. So you’ve probably never experienced the worst of such disasters…

    It was a quiet Wednesday afternoon. Wednesday, 1st October, 15:15 BST, to be precise, when Peter, an office-mate of mine, leaned away from his terminal and said to me, “Mario, I’m having a little trouble sending mail.” Knowing that msg was capable of confusing even the most capable of people, I sauntered over to his terminal to see what was wrong. A strange error message of the form (I forget the exact details) “cannot access /foo/bar for userid 147” had been issued by msg. My first thought was “Who’s userid 147?; the sender of the message, the destination, or what?” So I leant over to another terminal, already logged in, and typed grep 147 /etc/passwd only to receive the response /etc/passwd: No such file or directory.

    Instantly, I guessed that something was amiss. This was confirmed when in response to ls /etc I got ls: not found.

    I suggested to Peter that it would be a good idea not to try anything for a while, and went off to find our system manager.

    When I arrived at his office, his door was ajar, and within ten seconds I realised what the problem was. James, our manager, was sat down, head in hands, hands between knees, as one whose world has just come to an end. Our newly-appointed system programmer, Neil, was beside him, gazing listlessly at the screen of his terminal. And at the top of the screen I spied the following lines:

      # cd
      # rm -rf *
    

    Oh, shit, I thought. That would just about explain it.

    I can’t remember what happened in the succeeding minutes; my memory is just a blur. I do remember trying ls (again), ps, who and maybe a few other commands beside, all to no avail. The next thing I remember was being at my terminal again (a multi-window graphics terminal), and typing

       cd /
       echo *
    

    I owe a debt of thanks to David Korn for making echo a built-in of his shell; needless to say, /bin, together with /bin/echo, had been deleted. What transpired in the next few minutes was that /dev, /etc and /lib had also gone in their entirety; fortunately Neil had interrupted rm while it was somewhere down below /news, and /tmp, /usr and /users were all untouched.

    Meanwhile James had made for our tape cupboard and had retrieved what claimed to be a dump tape of the root filesystem, taken four weeks earlier. The pressing question was, “How do we recover the contents of the tape?”. Not only had we lost /etc/restore, but all of the device entries for the tape deck had vanished. And where does mknod live? You guessed it, /etc. How about recovery across Ethernet of any of this from another VAX? Well, /bin/tar had gone, and thoughtfully the Berkeley people had put rcp in /bin in the 4.3 distribution. What’s more, none of the Ether stuff wanted to know without /etc/hosts at least. We found a version of cpio in /usr/local, but that was unlikely to do us any good without a tape deck.

    Alternatively, we could get the boot tape out and rebuild the root filesystem, but neither James nor Neil had done that before, and we weren’t sure that the first thing to happen would be that the whole disk would be re-formatted, losing all our user files. (We take dumps of the user files every Thursday; by Murphy’s Law this had to happen on a Wednesday). Another solution might be to borrow a disk from another VAX, boot off that, and tidy up later, but that would have entailed calling the DEC engineer out, at the very least. We had a number of users in the final throes of writing up PhD theses and the loss of a maybe a weeks’ work (not to mention the machine down time) was unthinkable.

    So, what to do? The next idea was to write a program to make a device descriptor for the tape deck, but we all know where cc, as and ld live. Or maybe make skeletal entries for /etc/passwd, /etc/hosts and so on, so that /usr/bin/ftp would work. By sheer luck, I had a gnuemacs still running in one of my windows, which we could use to create passwd, etc., but the first step was to create a directory to put them in. Of course /bin/mkdir had gone, and so had /bin/mv, so we couldn’t rename /tmp to /etc. However, this looked like a reasonable line of attack.

    By now we had been joined by Alasdair, our resident UNIX guru, and as luck would have it, someone who knows VAX assembler. So our plan became this: write a program in assembler which would either rename /tmp to /etc, or make /etc, assemble it on another VAX, uuencode it, type in the uuencoded file using my gnu, uudecode it (some bright spark had thought to put uudecode in /usr/bin), run it, and hey presto, it would all be plain sailing from there. By yet another miracle of good fortune, the terminal from which the damage had been done was still su’d to root (su is in /bin, remember?), so at least we stood a chance of all this working.

    Off we set on our merry way, and within only an hour we had managed to concoct the dozen or so lines of assembler to create /etc. The stripped binary was only 76 bytes long, so we converted it to hex (slightly more readable than the output of uuencode), and typed it in using my editor. If any of you ever have the same problem, here’s the hex for future reference:

       070100002c000000000000000000000000000000000000000000000000000000
       0000dd8fff010000dd8f27000000fb02ef07000000fb01ef070000000000bc8f
       8800040000bc012f65746300
    

    I had a handy program around (doesn’t everybody?) for converting ASCII hex to binary, and the output of /usr/bin/sum tallied with our original binary. But hang on—how do you set execute permission without /bin/chmod? A few seconds thought (which as usual, lasted a couple of minutes) suggested that we write the binary on top of an already existing binary, owned by me…problem solved.

    So along we trotted to the terminal with the root login, carefully remembered to set the umask to 0 (so that I could create files in it using my gnu), and ran the binary. So now we had a /etc, writable by all. From there it was but a few easy steps to creating passwd, hosts, services, protocols, (etc), and then ftp was willing to play ball. Then we recovered the contents of /bin across the ether (it’s amazing how much you come to miss ls after just a few, short hours), and selected files from /etc. The key file was /etc/rrestore, with which we recovered /dev from the dump tape, and the rest is history.

    Now, you’re asking yourself (as I am), what’s the moral of this story? Well, for one thing, you must always remember the immortal words, DON’T PANIC. Our initial reaction was to reboot the machine and try everything as single user, but it’s unlikely it would have come up without /etc/init and /bin/sh. Rational thought saved us from this one.

    The next thing to remember is that UNIX tools really can be put to unusual purposes. Even without my gnuemacs, we could have survived by using, say, /usr/bin/grep as a substitute for /bin/cat.

    And the final thing is, it’s amazing how much of the system you can delete without it falling apart completely. Apart from the fact that nobody could login (/bin/login?), and most of the useful commands had gone, everything else seemed normal. Of course, some things can’t stand life without say /etc/termcap, or /dev/kmem, or /etc/utmp, but by and large it all hangs together.

    I shall leave you with this question: if you were placed in the same situation, and had the presence of mind that always comes with hindsight, could you have got out of it in a simpler or easier way? Answers on a postage stamp to:

    Mario Wolczko

  • cassandrafatigue@lemmy.dbzer0.com
    link
    fedilink
    arrow-up
    12
    ·
    2 days ago

    You can absolutely fuck your system up doing crazy shit with Linux, but it all reads like ‘I was exploring the uncharted cave, and did some dumb shit when i found a bear. So anyway, I found myself five hundred feet down impaled on a three different stalactites with one broken limb and two more completely crushed by a boulder, the cave starting to flood, and a justifiably angry bear waiting for me the way i came in. Didnt get back out like 6 am thanks the monsoon+sharknado. I had my trusty knife and my hair was long enough i could braid it into a serviceable rope, so I got out, but remember I hadnt sharpened it in a while and one of my arms was broken, plus I ran into a concentration camp on my way here so obviously I had to liberate that¹, and thats why i seem kind of tired today, thinking of skipping lunch in favor of a nap.’

    Windows: “hello, 911? I slept with my pillow an inch to the left and I can’t move now and my cpap machine is still working so I can breathe, thank God, but at least one possibly both lungs are punctured. Please send help. Oh god so much blood. I hope you’re close.”

    ¹with one functioning limb a now very dull knife and a few meters of hair-rope

    • filcuk@lemmy.zip
      link
      fedilink
      arrow-up
      4
      ·
      2 days ago

      Yes and no. Webview is a separate component. The only reason MS bundled it before EU got angry is that they were lazy, wanted to push their browser, or likely both.

  • Hadriscus@jlai.lu
    link
    fedilink
    arrow-up
    9
    arrow-down
    1
    ·
    4 days ago

    I so wish this were representative. I have been trying to install nvidia drivers on debian and doing so bricked my entire workstation lol. If you know anything about this don’t hesitate to chime in btw

    • Zink@programming.dev
      link
      fedilink
      arrow-up
      7
      ·
      3 days ago

      Mint has a driver manager application that makes installing nvidia drivers point-and-click simple.

      Come to think of it, the three PCs I use on a regular basis all have nvidia GPUs (970, 1080, discrete quadro in a dell laptop) and all are running Mint. No problems, even playing games.

      I even use that one script to unlock the number of simultaneous NVENC sessions after I update the driver.

    • adminofoz@lemmy.cafe
      link
      fedilink
      English
      arrow-up
      6
      arrow-down
      1
      ·
      3 days ago

      You should know nvidia is the worst and it is definitely an nvidia problem. Nothing else (even DNS) is, such a pain on linux. Nvidia routinely ships broken software on their stable branch even for their top of the line consumer cards.

      I have two 4k monitors and run many flavors of Linux as daily drivers. Plus I have a 4090. It’s not a super common setup but for a company as huge as nvidia they should be testing dual monitor setups and it is clear they do not. I have stopped updating my nvidia drivers after the 3rd time I lost basic functionality after a driver update.

      • B-TR3E@feddit.org
        link
        fedilink
        arrow-up
        1
        ·
        1 day ago

        You should know how dkms works or get a job that suits you better. That’s an amazing level of incompetence for someone in a professional position.

        • adminofoz@lemmy.cafe
          link
          fedilink
          English
          arrow-up
          1
          ·
          edit-2
          1 day ago

          No idea why you took this personal or why you assumed I didnt know why DKMS is. DKMS doesn’t work for every situation.

          Nvidia has the money to ship a product that works and is compatible with rolling updates like every other driver in existence. Ive never had to use dkms for my amd cards.

          • B-TR3E@feddit.org
            link
            fedilink
            arrow-up
            1
            ·
            1 day ago

            I didn’t take it personally but installing core software packages from websites instead of using your distro’s package manager is the worst possible practice. Absolutely nothing that should be recommended publically without anyone with a clue protesting. I don’t really believe the “DKMS doesn’t work for any situation” argument either, tbh. Either there is a miodule matching your kernel, compiler and glibc then DKMS will just work or there isn’t. In the latter case you better believe in your distro’s maintainers’ descisions or you really know what you’re doing - and the fact that you’re overriding package management in a production environment tells me that you don’t. Better someone on the internets is telling you than your boss, believe me.

            • adminofoz@lemmy.cafe
              link
              fedilink
              English
              arrow-up
              1
              ·
              1 day ago

              Bro I used Arch linux and installed via pacman. I think maybe you are confusing me for the guy telling people to visit nvidia.com and follow their instructions. Appreciate the lecture though.

      • Hadriscus@jlai.lu
        link
        fedilink
        arrow-up
        2
        ·
        3 days ago

        Yea I heard nvidia is terrible with Linux. Unfortunately in my line of work I don’t really have a choice… maybe with HIP-RT… in a few years… let’s see!

        I’ll be conservative with graphics updates then. Thanks a lot for the advice

    • JPAKx4@piefed.blahaj.zone
      link
      fedilink
      English
      arrow-up
      2
      ·
      3 days ago

      Sounds representative, it didn’t even try to stop you!

      Everyone else is saying secure boot should be correct. I was unable to load my nvidia driver until disabling secure boot, but I luckily had integrated graphics. What I think happened is you switched to to nvidia drivers that required proper secure boot before it would load. The drivers that are loaded before that don’t require secure boot to be setup so that’s why you had an output.

      This is just an nvidia thing unfortunately.

      • Hadriscus@jlai.lu
        link
        fedilink
        arrow-up
        1
        ·
        3 days ago

        lol, yes. Thank you I disabled secureboot and it boots ok now. Thanks for the feedback it does help understanding a bit about how this all works. If that wasn’t obvious enough I’m a big noob with Linux.

        Anyway, can I leave secureboot disabled and be fine? or is this MOK business something I should solve right now?

        Thanks again

        • JPAKx4@piefed.blahaj.zone
          link
          fedilink
          English
          arrow-up
          2
          ·
          2 days ago

          My understanding is secure boot is kinda worthless so it’s not that important to sort out. It let’s the bios trust the OS but that is a fairly limited attack vector. I don’t know enough about it though, so feel free to enroll the MOK keys bc it’s not that hard tbh, just annoying

          • Hadriscus@jlai.lu
            link
            fedilink
            arrow-up
            1
            ·
            2 days ago

            Ok thank you! I’d do it but I don’t fully understand the implications. Can I for instance re-generate a MOK key from whatever distro I install next and use that?

    • whoever loves Digit@piefed.socialOP
      link
      fedilink
      English
      arrow-up
      2
      ·
      3 days ago

      Good news is it’s much harder to accidentally wipe/fragment all your files than it is to break your system

      If anything is lost right now, you might be able to get it back just by booting from a live USB to explore your file system

      • B-TR3E@feddit.org
        link
        fedilink
        arrow-up
        2
        ·
        1 day ago

        Yes, but the problem is that it’s not that hard to wipe your personal files incidentially. An operating system can be replaced easily without deleting your /home partition (you did create an extra /home partition, did you?) but your personal stuff not so much.
        And that’s why there’s three things you should never forget:

        • have a backup
        • have an automated backup (or you’ll end up having no backup at all)
        • have a tested way to restore from backup

        Just argue against that fact, blame me of incompetence, know it all better, I’ll just laugh at you because you will as sure as the sun rises in the morning remember my words. Three times if you’re missing a single one of these three. Don’t ask why I am so definitely sure about that - let’s say it was a three step learning process…

          • B-TR3E@feddit.org
            link
            fedilink
            arrow-up
            2
            ·
            1 day ago

            Having a backup is not enough. Having an actual backup is better but still not enough. Having a tested recovery procedure is not trivial but usually is enough. I have not yet experienced the case when even that fails and I hope I never will.

      • Hadriscus@jlai.lu
        link
        fedilink
        arrow-up
        2
        ·
        3 days ago

        I see, well nothing is at risk really since I moved everything to a different drive before trying this whole thing, and did a full backup on an external drive as well. I’ve been burnt before! and I’m absolutely going to use a live image to wipe the disk because for some reason, I thought I had installed Nobara over Bazzite but I can still boot Bazzite… anyway, big mess

        Thanks for the help !!

      • Hadriscus@jlai.lu
        link
        fedilink
        arrow-up
        1
        ·
        3 days ago

        The secureboot is borked apparently, which prevents me from booting anything. Fortunately I just had to disable it from the UEFI. It boots now! I have other issues but everything in time! I think I can fix them from a live image actually. Thanks for the help!

    • WolfLink@sh.itjust.works
      link
      fedilink
      arrow-up
      1
      ·
      3 days ago

      SSH in and forcibly uninstall all Nvidia packages, then reinstall them fresh following Nvidia’s website.

      At least this has worked for me on Ubuntu on several occasions.

      • Hadriscus@jlai.lu
        link
        fedilink
        arrow-up
        1
        ·
        3 days ago

        Thanks, the issue was with secureboot actually, I found how to disable it and I can boot again. As for nvidia I will wipe the disk from a live image and start over, I am not familiar enough with what you suggested to tackle it (for now…). Thanks a lot for the suggestion.

  • 1985MustangCobra@lemmy.ca
    link
    fedilink
    English
    arrow-up
    2
    arrow-down
    10
    ·
    4 days ago

    also windows: “Can i use X app” “sure here’s a .exe”

    also Linux: “can i use X app?” “here’s an open source alternate that doesn’t work as well as the windows version, but you don’t care about that, you just wanna be cool!”

    • EnsignWashout@startrek.website
      link
      fedilink
      arrow-up
      9
      ·
      edit-2
      3 days ago

      1993 called and wants the inferior FOSS software you last tried back. Haha.

      I find that Linux apps for basic stuff are now well ahead of their Windows counterparts.

      It’s getting hard to find quality free software that is Windows native, and not just a recompile of a Mac or Linux tool.

      I’m happy to pay for software too, but the paid stuff has all been shit, for awhile, in my weird experiences. (Weird, in that I’m not doing music or video editing or non-developer power user stuff. I’ve heard mileage may vary with those.)

                • MadhuGururajan@programming.dev
                  link
                  fedilink
                  English
                  arrow-up
                  4
                  ·
                  3 days ago

                  And you hang out here and do what exactly? Either you’re happy with win11 or you’re not. Replying to random people’s comment by raging against linux in a linux memes community while supposedly running windows and liking it is a bit weird isn’t it?

                  And you sound like you havent touched a proper linux OS in the past 5 years. Things have genuinely gotten better. But I see you seem quite fixated on coming here to argue instead (again… quite weird to do so when you have no horse in the race)

            • swab148@lemmy.dbzer0.com
              link
              fedilink
              arrow-up
              12
              ·
              3 days ago

              I’m not a programmer, I’m a guitarist, and yet I still manage to use Arch (btw)! Linux isn’t just for programmers, it’s for people who don’t hate learning things, but do hate someone else controlling their machines.

        • ILikeBoobies@lemmy.ca
          link
          fedilink
          arrow-up
          1
          ·
          3 days ago

          It’s for people who aren’t tech literate. The people who don’t know/shouldn’t be using cli commands or editing the registry.

          • EnsignWashout@startrek.website
            link
            fedilink
            arrow-up
            1
            ·
            3 days ago

            It’s for people who aren’t tech literate.

            My experience installing Linux for tech illiterate parents and grandparents was lovely.

            They never noticed they’re not on Windows. They just wanted their two desktop icons - web and email.

            Edit: Funny related story - they (grandparents) always rebooted with the power button after Linux told them it had updated - which was almost never necessary. I always just told them “good job”, when they mentioned it, though.

    • yellow [she/her]@lemmy.blahaj.zone
      link
      fedilink
      English
      arrow-up
      6
      ·
      3 days ago

      If I may ask, what software are you referring to? The only software I could think of off the top of my head that doesn’t have suitable replacements for Linux is creative production software like the Adobe suite and DAWs, professional CAD software like AutoDesk, and, like, AutoHotKey.