this post was submitted on 21 Aug 2024
279 points (98.3% liked)

Linux

48740 readers
1209 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
[–] [email protected] 10 points 4 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.

[–] [email protected] 8 points 4 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.

[–] [email protected] 17 points 4 months ago

holy shit i was about to post about how i have automatic login and lock to start a program that refuses to work correctly on boot through systemd.

but then you guys are here casually posting some of the worst duct tape shit ive heard of so far. im not sure if i should reprimand or congratulate you for that jankiness.

[–] [email protected] 25 points 4 months ago* (last edited 4 months ago) (1 children)

I'm using Gentoo with systemd and a customized kernel, and additionally I have the /usr partition LUKS encrypted. Because /usr is absolutely essential for systemd to function, I configured dracut to make a specially crafted initrd which activates the luks lvm and prompts for the password to decrypt and mount /usr on startup before systemd init tries to run.

About a year or two ago, some update to dracut or some other dependency (assumption) caused the dracut generated initrd's to kernel panic. After multiple days of troubleshooting, I discovered that just copying forward an older initrd in /boot and naming it to match the new kernel, e.g. initramfs-6.6.38-gentoo.img , allows the system to boot normally .

So, my Gentoo is booting a kernel 6.6.something with a ramdisk generated in the 5.9 kernel era. I am dreading the day when this behavior breaks and I can no longer update my kernel 😳

[–] [email protected] 11 points 4 months ago

I can hear the ticking..

[–] [email protected] 17 points 4 months ago (1 children)

I have a Logitech mouse with extra buttons, I used Piper to set one of those buttons to be Play/Pause media button. It worked well, however for some reason it only worked when the mouse was connected via the dongle, via Bluetooth the button did nothing. So I configured to a random shortcut (don't remember what it is now, something like super+p) and configured that to call playctl play/pause.

Not as creative or duct tapey as others but it's what I remember now, pretty sure there are many others too hahaha

load more comments (1 replies)
[–] [email protected] 21 points 4 months ago

An old (now decommissioned) notebook of mine had a broken headphone jack. I didn't have BT headphones then. Audio output worked technically but the detection whether headphones were plugged in or not did no longer work.

I wrote a very short amixer script to force unmute the jack, set the volume to 50 or so percent and set the speaker volume to 0% but not "mute" state. I could then use my wired headphones again.

[–] [email protected] 4 points 4 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.

[–] [email protected] 97 points 4 months ago* (last edited 4 months ago) (4 children)

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...

[–] [email protected] 5 points 4 months ago (1 children)
load more comments (1 replies)
[–] [email protected] 6 points 4 months ago

This is an absolute winner IMHO. I’m imagining all the hotkeys that are accidentally activated when a CPU-intensive task spins up.

[–] [email protected] 82 points 4 months ago (1 children)
[–] [email protected] 10 points 4 months ago (1 children)
[–] [email protected] 19 points 4 months ago

Other way around.

[–] [email protected] 33 points 4 months ago (2 children)
[–] [email protected] 8 points 4 months ago

Just think how many children are holding down spacebar to keep warm in the winter. We need to keep this feature around.

[–] [email protected] 44 points 4 months ago

Hey, my setup works for me! Just add an option to enable CPU overheating in the next update!

[–] [email protected] 11 points 4 months ago

Wow, Lotta smart people here doin some.hacky shit

[–] [email protected] 12 points 4 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.

[–] [email protected] 12 points 4 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)
[–] [email protected] 47 points 4 months ago* (last edited 4 months ago) (5 children)

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.

[–] [email protected] 1 points 4 months ago (1 children)

Couldn't it be possible to set a script that restarts jitsi as that user's login shell?

[–] [email protected] 2 points 4 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.

load more comments (4 replies)
[–] [email protected] 13 points 4 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

load more comments
view more: ‹ prev next ›