this post was submitted on 21 Aug 2024
271 points (98.6% liked)

Linux

48356 readers
390 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
 

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.

(page 2) 50 comments
sorted by: hot top controversial new old
[–] TimeSquirrel@kbin.melroy.org 11 points 3 months ago (1 children)

I've set Raspberry Pis to auto-reboot themselves at night if they are being used for headless network services that need to be available 24/7, just to clear out memory leaks or other things that may have gotten locked up. Not sure if that's duct tape or just a standard practice. They aren't the most stable things sometimes. They're known for power supply and SD card issues.

load more comments (1 replies)
[–] savvywolf@pawb.social 11 points 3 months ago (1 children)

I one crossgraded a debian server from x86 to x86_64.

load more comments (1 replies)
[–] Drusenija@lemmy.world 10 points 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

[–] mrvictory1@lemmy.world 10 points 3 months ago (2 children)

I ran chmod 777 /dev/uinput so AntiMicroX worked on Wayland. The PC was intented to be used as an HTPC. A Dualshock 3 would be the remote and KDE Plasma Bigscreen would be used to launch Linux native apps ie. Firefox and Android apps via Waydroid, hence the Wayland requirement. AntiMicroX would bind gamepad inputs to arrow keys, enter, ESC, volume up/down, mouse navigation, left/right click etc. The whole setup was duct tape, user unfriendly and it ultimately did not solve the problem that sent me down this rabbit hole: Internet was unstable even with an ethernet cable so it had no advantage over the crappy Android TV stick that had trouble streaming anything but Chromecast. A close contender is having to disable Internet when launching a specific online only game otherwise performance halves. There is also a guide I uploaded to Reddit that describes how to import ringtones from Linux to iOS that has 8 steps and involves rebooting your phone. And another guide to run 2 games at once and stream one of thrm while playing the other locally.

I have a problem with half working duct tape solıtions.

load more comments (2 replies)
[–] Aceticon@lemmy.world 10 points 3 months ago (1 children)

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.

load more comments (1 replies)
[–] macattack@lemmy.world 10 points 3 months ago* (last edited 3 months ago) (2 children)

Prior to switching (upgrading?) to Wayland, Debian KDE crashed under X11 regularly when waking from hibernation and the taskbar would disappear. Restarting the plasma shell made it operable again, so I created an alias and regularly rebooted the DE shell 2-3x a day:

alias damnTaskbar='killall plasmashell ; kstart plasmashell &'

[–] eager_eagle@lemmy.world 6 points 3 months ago* (last edited 3 months ago)

I still occasionally need to use one of these two

# for plasma desktop
alias kplasma='plasmashell --replace & disown'

# when kwin crashes or acts weird
alias kbug='if [ "${XDG_SESSION_TYPE}" = "x11" ]; then kwin_x11 --replace & disown; else kwin_wayland --replace & disown; fi'
load more comments (1 replies)
[–] Shadow@lemmy.ca 10 points 3 months ago

Had a zfs array on an adaptec raid card. On reboot the partition table would get trashed and block the zfs pool from coming up, but running fdisk against the disk would recover it from the backup.

Had a script to run on reboot that just ran "fdisk -l" on every disk, then brought up the zfs pool. Worked great for years until I finally did a kernel upgrade that resolved it.

[–] allywilson@lemmy.ml 9 points 3 months ago

I had to upgrade some OL6 VMs to OL7 VMs running Oracle DBs and Apps (on OVMM no less). There was no appetite for buying additional storage, or restoring the environments with RMAN. Luckily, everything had been installed under /u01 which was on its own virtual disk.

So I built a new VM as OL7 (same hostname, etc.), installed the pre-req RPMs for Oracle DB, disconnected the virtual disk from the OL6 and attached it to the new OL7, synced users and home dirs - and it only bloody worked.

[–] delirious_owl@discuss.online 9 points 3 months ago

Wow, Lotta smart people here doin some.hacky shit

[–] mactan@lemmy.ml 8 points 3 months ago (2 children)

not sure if duct tape or brute force but if I can't stop a file from getting overwritten like resolv.conf I just make it immutable with chattr

[–] ramius345@sh.itjust.works 5 points 3 months ago

Fucking network daemons messing with my resolv.conf

load more comments (1 replies)
[–] mycodesucks@lemmy.world 8 points 3 months ago

My Nvidia card won't properly resume the display after suspend with the default suspend script, but if I correct the script file, every time aptitude updates the nvidia drivers, it restores the bad version of the configuration file. If you set the file immutable with chattr, aptitude throws a fit and goes into a broken state when it can't overwrite the file on a driver update.

So I keep a good copy of the script file in the directory, and in my pre-suspend script file I overwrite the main suspend script with the good version. Every single time.

[–] Head@lemmings.world 8 points 3 months ago

I was trying to customize shit and accidentally deleted my entire task bar. I couldn't figure out how I did it so I just installed a different one which needed to boot on startup.

[–] dditty@lemm.ee 8 points 3 months ago

I had an external hard drive enclosure that I stored my Plex content on before I built a nas, and the enclosure would go to sleep after 15 minutes and take the drives offline. So i had a cron script write a 1 kb file to each drive every 14 minutes. Worked well enough

[–] SimplyTadpole@lemmy.dbzer0.com 7 points 3 months ago

I'm not technically inclined at all, so the most duct tapey thing I can remember was hacking Gnome to use Nemo as my file browser instead of Gnome's default file browser once.

[–] 314xel@lemmy.world 6 points 3 months ago* (last edited 3 months ago)

I'm rebooting my router every week via a crontab because some dynamic dns update process fails from time to time and I find it hanging. No time to debug the actual problem.

[–] ving_thor@lemmy.world 6 points 3 months ago (1 children)

I wrote a systemd unit file to force my wireless keyboard to always switch the fn key to normal F-keys.

load more comments (1 replies)
[–] jbk@discuss.tchncs.de 6 points 3 months ago (2 children)

sometime ago I had my home directory managed by systemd-homed on Fedora (before 38 even afaik). the SELinux policy wasn't configured properly for it though, so I had to keep setting it to permissive mode. for some stupid reason I remember running the command to do that on every. single. boot. lol

load more comments (2 replies)
[–] MicrowavedTea@infosec.pub 6 points 3 months ago

Not exactly mine but I've used it. I have a fast but data-limited internet connection and a slower unlimited connection. When I need the faster connection to do something I connect to it through wifi while staying connected to the other through Ethernet. Then use this project to bind a specific app to wifi while everything else keeps using Ethernet. It uses LD_PRELOAD to link its own version of network connect that calls the real method. There's definitely a better way to do this with iptables but it's a good enough patch for when needed.

[–] dizzy@lemmy.ml 6 points 3 months ago

Couldn’t figure out how to access my headless server’s desktop environment via VNC without a monitor connected and turned on. I bought a hardware displayport dummy adapter to pretend to be a real display to get it to work.

A hardware solution to a software problem… felt really wrong.

I’ve since wrapped my head around tmux and managing all my services via command-line or web-ui so I have no need for it anymore.

[–] everett@lemmy.ml 6 points 3 months ago (1 children)

Possibly my light/dark mode scripts. They change my Plasma theme, which is honestly most of the job, but also set the matching GTK theme, set the new theme in running Konsole sessions, do a bunch of manual sed edits on conf files for applications that don't follow system theming, finally restarting plasmashell to clean up the occasional edge case where a tray icon is supposed to follow the theme but doesn't.

[–] iiGxC@slrpnk.net 5 points 3 months ago

Oh yeah I do this, I'll raise you that mine also sshs into my server to update the editor theme

[–] dotslashme@infosec.pub 6 points 3 months ago

Actually really few instances of jerry rigging, but I do remember during my distro-hopping days where I used a binary gcc package to compile a more optimized binary of gcc. At the time, that felt pretty weird, but looking back I see why.

[–] chameleon@fedia.io 6 points 3 months ago

Did a physical-to-virtual-to-physical conversion to upgrade and unbreak a webserver that had been messed up by simultaneously installing packages from Debian and Ubuntu.

[–] kate@lemmy.uhhoh.com 6 points 3 months ago* (last edited 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

[–] communist@lemmy.frozeninferno.xyz 5 points 3 months ago* (last edited 3 months ago)
bindntr=CTRL,C,exec,hyprctl dispatch closewindow alacrittyclipboard & hyprctl activewindow | rg -q "class: Wfica" && alacritty -qq --config-file ~/.config/alacritty/alacrittyclipboard.toml --class 'alacrittyclipboard' --title 'Office365 Desktop - Nexus (SSL/TLS Secured, 256 bit)' -e sh -c 'sleep .03 && xclip -o | wl-copy ; wl-paste | xclip -i'
windowrulev2 = float,class:(alacrittyclipboard)
windowrulev2 = stayfocused,class:(alacrittyclipboard)
windowrulev2 = noborder,class:(alacrittyclipboard)
windowrulev2 = noanim,class:(alacrittyclipboard)
windowrulev2 = noblur,class:(alacrittyclipboard)
windowrulev2 = opacity 0,class:(alacrittyclipboard)
windowrulev2 = maxsize 1 1,class:(alacrittyclipboard)

Fixes the fucking clipboard in citrix, no, I cannot figure out a better solution.

the move to aquamarine with hyprland mostly resolved this... but not completely and i'm going to have to write a new duct tape solution for that.

If you're wondering why I launch alacritty... it doesn't work without alacritty, wayland needs the window to be in focus, if alacritty isn't there there's no in focus window and it doesn't update the clipboard.

[–] Quackdoc@lemmy.world 5 points 3 months ago

I really needed to run a compositor from an arch chroot and systemd's udev is straight up broken in chroot, so I used libudev-zero and made sure that every time systemd updated I would delete the libudev .so file and plunk libudev-zero ontop of it, no i've moved on to greener pastures (Artix) but hey, it did work.

[–] StarlightDust@lemmy.blahaj.zone 4 points 3 months ago

gtk3-classic still doesn't work properly on Wayland and I doubt it will ever be fixed so I include WAYLAND_DISPLAY=0 in each shortcut file to force them into xwayland.

[–] popekingjoe@lemmy.world 4 points 3 months ago

In the earlier days of Plasma 6, it would crash on me when waking from sleep, so I had a small script that would basically restart plasmashell when waking so I didn't have to wait the several seconds for the system to realize that it was frozen before I had a functional desktop.

[–] Samueru@lemmy.ml 4 points 3 months ago (1 children)

It makes me mad to see the current state sway is in, I even bought an AMD GPU for nothing.

load more comments (1 replies)
[–] demesisx@infosec.pub 4 points 3 months ago (2 children)

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.

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