tell me the most ass over backward shit you do to keep your system chugging?
here’s mine:
sway struggles with my dual monitors, when my screen powers off and back on it causes sway to crash.
system service ‘switch-to-tty1.service’

[Unit]
Description=Switch to tty1 on resume
After=suspend.target

[Service]
Type=simple
ExecStart=/usr/local/bin/switch-to-tty1.sh

[Install]
WantedBy=suspend.target

‘switch-to-tty1.service’ executes ‘/usr/local/bin/switch-to-tty1.sh’ and send user to tty1

#!/bin/bash
# Switch to tty1
chvt 1

.bashrc login from tty1 then kicks user to tty2 and logs out tty1.

if [[ "$(tty)" == "/dev/tty1" ]]; then
    chvt 2
    logout
fi

also tty2 is blocked from keyboard inputs (Alt+Ctrl+F2) so its a somewhat secure lock-screen which on sway lock-screen aren’t great.

  • Drusenija@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    3 months ago

    I created an SMS to Email gateway back in 2011 when data was still expensive on phones and I was trying to see if I could turn an iPod Touch into an iPhone. (I was a poor student at the time, was trying to find ways to save money 😅)

    Basically I had a 3G modem plugged into a Linux server that could receive the messages, a prepaid SIM card with a long life credit expiry, a domain name set up with unknown email address capturing, and some tools to handle the actual SMS part.

    At the time I published the scripts I used online and apparently they’re still online 😅 This is on Whirlpool which is an Australian telecommunications forum.

    https://whrl.pl/RcXD5e

  • BrianTheeBiscuiteer@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    3 months ago

    Don’t remember the specifics but I had a key combo setup to force a soft reset in my DE. Occasionally a kernel or driver update would fuck up my video and make the system unusable but still live. I try to avoid hard resets.

  • delirious_owl@discuss.online
    link
    fedilink
    arrow-up
    0
    ·
    edit-2
    3 months ago

    My control key was broken, but I found that when I used an app and held down the space bar key, the CPU would get abnormally hot.

    So I wrote an Emacs interrupt to interpret a rapid CPU rise as “press the control button”.

    Unfortunately the dev pushed an update that broke space bar heating, which broke my workflow. I opened a bug report about it, though…

  • kate@lemmy.uhhoh.com
    link
    fedilink
    English
    arrow-up
    0
    ·
    edit-2
    3 months ago

    something kept messing with my dns and i’m too lazy to find out why so i hardcoded etc/resolv.conf and chmod +i on it

  • data1701d (He/Him)@startrek.website
    link
    fedilink
    English
    arrow-up
    0
    ·
    3 months ago

    Building a custom Buildroot Linux for a Pentium 2 laptop that can fit on a CD so I could back up a 2.5" IDE drive to a USB drive, probably.

    On another note, last night, I had to get a Google TV set up on my dorm Wi-Fi, which requires me to either go through a portal to set it up or to go into my account and add the device’s MAC address. The TV (which was brand new and doing OOBE stuff) wouldn’t let me go to settings to get the MAC address without a network connection. Even more infuriating, there was a button in the Google Home app that said “Show MAC address”, but when I pushed it, it would say “Can’t get MAC address.” What I ended up doing to get around that crap was setting up my Debian Thinkpad (which I am writing from now) to share its internet connection over ethernet to finish the setup process so I could get to settings and get the MAC address.

    On one hand, a funny experience, but on the other hand, I’m simultaneously both mad at Google and my dorm internet provider.

    • ReveredOxygen@sh.itjust.works
      link
      fedilink
      English
      arrow-up
      0
      ·
      3 months ago

      The Pixel watch has this problem too. However, it randomizes the MAC per network, so that strategy won’t even work. I’ve tried to get it from the debug log but failed I’ve resigned that it won’t be getting connected to the school network

        • ReveredOxygen@sh.itjust.works
          link
          fedilink
          English
          arrow-up
          0
          ·
          edit-2
          3 months ago

          Android is fine because you’re able to use a web browser to get an auth key. You have to register devices where you can’t do that, and it seems to be impossible in the case of the pixel watch

          Edit: Also, they’re not concerned about privacy. They want to know who every device belongs to

          • delirious_owl@discuss.online
            link
            fedilink
            arrow-up
            0
            ·
            3 months ago

            That never works for me on Android systems. It probably needs some shitty Google service.

            You have a right to privacy. Its your school. They work for you.

  • demesisx@infosec.pub
    link
    fedilink
    English
    arrow-up
    0
    ·
    3 months ago

    You guys will probably groan but lots of people in this comment section should look into NixOS. My old Ubuntu machine was loaded with hacks I got from stack overflow to get certain things working (a script that runs at boot and shutdown to mount and unmount some network drives I wanted to appear natively). But now, I just use NixOS and there’s nothing on my machines that is even remotely hackey now. I just declare the drives as I want them and when I boot they are there and work as needed.

    • Willdrick@lemmy.world
      link
      fedilink
      arrow-up
      0
      ·
      3 months ago

      Knowing myself, I shiver at the idea of my nix config… It’ll probably have more ductape than a 3M distribution center

  • pastermil@sh.itjust.works
    link
    fedilink
    arrow-up
    0
    ·
    3 months ago

    Not me personally, but in one of my past project, my boss was running a bunch of “services” by leaving it on GNU screen terminal sessions and detaching from them.

    Everytime I went in to debug something, I’d need to go thru a list of sessions, attach to one hoping that it’s the right one (sometimes they’d name 'em), then see the console output.

  • itslilith@lemmy.blahaj.zone
    link
    fedilink
    arrow-up
    0
    ·
    3 months ago

    For me it’s probably the way I self-host overleaf, a online LaTeX editor. The community version has a docker image that’s horribly maintained (because they want to sell enterprise, I reckon), and instead relies on a horrendous amalgamation of setup scripts that wrap docker compose.

    What I have is a Dockerfile that pulls the image, manually installs a second version of TeX with the right dependencies, unlinks the old one and links the second one. Then for the database, it uses Mongo replsets, which be to be manually initialized. So I wrote a health check for the container that checks if the repl set is initialized, and if that fails the health check initializes it.

    It’s horrendous, it’s disgusting, and it’s an all-in-one compose file to get overleaf running. Good enough.

  • Aceticon@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    3 months ago

    I got an Orange Pi 5 Plus to play with smallish AIs (because it has an NPU) and I normally access it remotely, so I have to know its IP address to do it.

    In order to easilly know the IP address of it, I’ve wired a little 128x64 monochrome OLED screen to it (Orange PIs, like Raspberry PIs have a pin connector giving access to GPIO and interfaces like I2C, Serial and SPI) which talks via I2C.

    Turns out those interfactes aren’t active in Linux by default (I.e. no /dev/i2c-x), so I figured out that I had to add a kernel overlay to activate that specific interface (unlike with the Raspberry PI whose Linux version has a neat program for doing it, in the Orange Pi you have to know how the low level details of activating those things), which I did.

    To actually render characters on that screen I went with an ARM Linux port of a graphics library for those screens I used before with Arduino, called u8g2)

    Then I made a program in C that just scans all network interfaces and prints their names and IP addresses on that screen, and installed it as a Cron job running once a minute.

    Now, as it turns out when you shutdown your Linux on that board, if you don’t disconnect it from power there is actually still power flowing through the pin connector to any devices you wire there, so after shutdown my screen would remain ON and showing the last thing I had put there, but because the OS was down it would naturally not get updated.

    So the last thing I did was another small C program which just sends to that screen the command for it to go into power saving mode, shutting it down. This program was then installed as a Systemd Service to run when Linux is shutting down.

    The result is now that there is a little screen hanging from the box were I put this board with Linux which lists its IP addresses and the info is updated if it connects other interfaces or reconnects and gets a new IP address. Curiously I’ve actually been using that feature because it’s genuinely useful, not just a funny little project.

    • flux@lemmy.ml
      link
      fedilink
      arrow-up
      0
      ·
      3 months ago

      Maybe consider static ip assignment in your DHCP server (e.g. internet router) if at all possible… Then you can add a name to it to /etc/hosts.

      Alternatively you could use Avahi to provide mdns names to your local network

  • NauticalNoodle@lemmy.ml
    link
    fedilink
    arrow-up
    0
    ·
    edit-2
    3 months ago

    I have a hardware malfunction with my secondary hard drive. Every once in the while it locks itself into read-only mode and corrupts a log file that crashes my system. My solution is to reboot Fn + Alt + Sysrq + ‘b’ and periodically delete the log files that exacerbate the issue. I need to replace the drive but that requires money and a backup solution, neither of which i currently have. It’s been an ongoing issue for at least 4 years now.

    • sploosh@lemmy.world
      link
      fedilink
      arrow-up
      0
      ·
      3 months ago

      Just write a script that runs periodically to check the log’s size and delete when its near the crash threahold.

  • WFH@lemm.ee
    link
    fedilink
    English
    arrow-up
    0
    ·
    3 months ago

    On my previous laptop, the trackpad had a bug that made it spam interrupts after waking up from sleep. It ruined battery life and basically kept one core at 100% permanently.

    So I duct-taped a systemd script that unbound and bound the trackpad after each wake up.

    #!/bin/sh
    case "$1" in
            post)
                    echo -n "i2c_designware.0" > /sys/bus/platform/drivers/i2c_designware/unbind
                    echo -n "i2c_designware.0" > /sys/bus/platform/drivers/i2c_designware/bind
            ;;
    esac
    
  • dosse91@lemmy.trippy.pizza
    link
    fedilink
    arrow-up
    0
    ·
    edit-2
    3 months ago

    I think this one beats them all.

    My home server keeps a few services up, including an instance of Jitsi Meet. The server runs nixos and the nixos package for jitsi is incomplete to say the least and doesn’t even support authentication, so I use the docker-compose version and I have a script that runs periodically to keep it updated. So far so good, right? Well, no.

    Because the server is at home, I have a dynamic external IP address, so I have to use a DDNS provider, but jitsi doesn’t expect this and uses a stun server at startup to determine the public IP of the server once, so if my connection goes down or is restarted and the IP changes, jitsi needs to be restarted or it won’t work anymore.

    The solution?

    • My router runs OpenWrt, so I am able to run a script that checks for external IP changes. When a change is detected, it uses SSH to connect to my server to restart jitsi
    • Because I don’t want the router to just be able to run any command, I created a jitsi-restart user that has no shell
    • When the router tries to log in with its pubkey, sshd creates a file called restartasap in the jitsi folder and closes the connection
    • On the server, there’s a systemd unit running a script as the jitsi user that periodically checks for that file, and if it exists it deletes it and restarts jitsi

    I’ve been running this setup since mid 2020 and I expect this to continue until IPv6 becomes the norm.

    • Norah - She/They@lemmy.blahaj.zone
      link
      fedilink
      English
      arrow-up
      0
      ·
      3 months ago

      why not just run the IP check script on the box jitsi is on? a quick google gave me this: dig +short myip.opendns.com @resolver1.opendns.com and this: wget -q -O - checkip.dyndns.org | sed -e 's/.\*Current IP Address: //' -e 's/<.\*$//'

      • dosse91@lemmy.trippy.pizza
        link
        fedilink
        arrow-up
        0
        ·
        3 months ago

        The jitsi user is a system user so it can’t login even if you set a key for it. Besides, I wouldn’t risk it anyway since that user is in the docker group, if it gets compromised somehow, the attacker would have very high privileges.

  • Trainguyrom@reddthat.com
    link
    fedilink
    English
    arrow-up
    0
    ·
    3 months ago

    About a decade ago I was playing a game on Linux and the game crashed and took the entire DE with it. So I went to a different tty and started a fresh x desktop session and started playing again until the game crashed again (I was running a bunch of mods so it would crash every couple of hours or so) and still didn’t feel like rebooting so I went to yet another tty and started yet another x desktop session. I did this about 3 times in total before I finally went “I should probably actually reboot because this has to be making a bigger mess of things”

  • OmegaLemmy@discuss.online
    link
    fedilink
    arrow-up
    0
    ·
    3 months ago

    I made a script to add a middle click scroll function with a toggle. I can share the script, it’s a really bash script

        • chtk@feddit.nl
          link
          fedilink
          arrow-up
          0
          ·
          3 months ago

          That’s not even a bad idea then.

          One of my machines has a boot partition that’s a bit too small, on an otherwise LVM setup.

            • chtk@feddit.nl
              link
              fedilink
              arrow-up
              0
              ·
              3 months ago

              Nah, it’ll be fine.

              I might have a large enough USB SSD laying around some where. I could probably use that instead.

              • extend VG with the USB PV
              • move LV’s to USB
              • shrink root LV
              • resize boot
              • move things back on a new internal PV
                • chtk@feddit.nl
                  link
                  fedilink
                  arrow-up
                  0
                  ·
                  3 months ago

                  Does your FS support online resizing?

                  Yeah. I mainly use btrfs; it supports online growing and shrinking.

                  Be super careful about partition sizes. […]

                  I know. I have done plenty of same device partition resizing. I know the pit falls, and for safety shrink the FS to below what the LV is going to be.

                  Have backups.

                  Thanks for the reminder. I’ve been meaning to set up snapshot backups for this machine using rsnapshot as an experiment. I mainly use Dirvish

    • tibi@lemmy.world
      link
      fedilink
      arrow-up
      0
      ·
      3 months ago

      Did it work? There’s a huge chance of data corruption if you are copying the disk of a running system.