1
Welcome Everyone (lemmy.zip)
submitted 3 years ago by [M] to c/linuxscripts@lemmy.zip
 
 

Welcome to Linux Troubleshooting and Scripts. This community is for providing scripts that help with installing or maintaining Linux computers, primarily Home computers with desktop Linux. You can also post scripts or ask for support on home servers.

this is a community for sharing your scripts that help when working with Linux as well a general troubleshooting.

Rules

  • Absolutely NO NSFW posts. break this rule and you will be removed from this community. NO EXCEPTIONS!

  • Only post scripts that help yourself and others. All scripts will be tested on my machine personally, any malicious scripts will be removed immediately.

  • This community is for the benefit of other Linux users. no bigotry, hate, nudes, malicious scripts or politics allowed.

Feel free to ask any kind of support questions, as we grow more succinct answers will be available. Let’s make this community grow.

We are important to one another, not only in the Linux world but also in the Fediverse as a whole. Feel free to reach out to me with questions or concerns, as we grow bigger I will look into adding mods. (This section will be updated as needed.)

2
 
 

Just wanted to ask if anyone has some idea where i can even start looking for reasons why this happens and how to fix it.

Situation is as follows:

When i switch from any window with potential text input using alt-tab to another window, MOST of my keyboard stops working until i alt-tab back and forth between these windows again, sometimes multiple times. Keys that keep working are the W key, and most of the right-hand side of the keyboard. When i activate Caps Lock, i can use all keys (while being forced to use upper case -.-). After getting back my input, single keys cause double outputs or no outputs for a single activation, returning to normal function afterwards. Switching to another terminal using Ctrl-Alt-F does also not fix it.

This issue is not Keyboard-Hardware related and keeps occurring regardless of the used USB port. Switching out the keyboard (or disconnecting/reconnecting it) does not restore normal function.

This has been going on for a while, predating even the Fedora 44 update (can't remember the exact time, but i'd say somewhere around the release of Nobara 42.

inxi -Fzx :

System:  
  Kernel: 7.2.0-202.nobara.fc44.x86_64 arch: x86_64 bits: 64 compiler: gcc  
    v: 16.2.1  
  Desktop: KDE Plasma v: 6.7.4 Distro: Nobara Linux 44 (KDE Plasma Desktop  
    Edition) base: Fedora 44  
Machine:  
  Type: Desktop Mobo: ASRock model: AB350 Pro4 serial: <superuser required>  
    Firmware: UEFI vendor: American Megatrends v: P10.43 date: 06/26/2025  
CPU:  
  Info: 16-core model: AMD Ryzen 9 5950X bits: 64 type: MT MCP arch: Zen 3+  
    rev: 2 cache: L1: 1024 KiB L2: 8 MiB L3: 64 MiB  
  Speed (MHz): avg: 4612 min/max: 582/5086 boost: enabled cores: 1: 4612  
    2: 4612 3: 4612 4: 4612 5: 4612 6: 4612 7: 4612 8: 4612 9: 4612 10: 4612  
    11: 4612 12: 4612 13: 4612 14: 4612 15: 4612 16: 4612 17: 4612 18: 4612  
    19: 4612 20: 4612 21: 4612 22: 4612 23: 4612 24: 4612 25: 4612 26: 4612  
    27: 4612 28: 4612 29: 4612 30: 4612 31: 4612 32: 4612 bogomips: 217191  
  Flags-basic: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a  
    ssse3 svm  
Graphics:  
  Device-1: NVIDIA GB205 [GeForce RTX 5070] vendor: CardExpert driver: nvidia  
    v: 610.57.04 arch: Lovelace bus-ID: 0a:00.0  
  Display: wayland server: Xwayland v: 24.1.13 compositor: kwin_wayland  
    driver: gpu: nv_platform,nvidia,nvidia-nvswitch resolution: 2560x1440~180Hz  
  API: EGL v: 1.5 drivers: nvidia,swrast platforms:  
    active: gbm,wayland,x11,surfaceless,device inactive: device-1  
  API: OpenGL v: 4.6.0 compat-v: 4.6 vendor: nvidia mesa v: 610.57.04  
    glx-v: 1.4 direct-render: yes renderer: NVIDIA GeForce RTX 5070/PCIe/SSE2  
  API: Vulkan v: 1.4.341 drivers: nvidia,llvmpipe surfaces: N/A devices: 2  
  Info: Tools: api: clinfo, eglinfo, glxinfo, vulkaninfo  
    de: kscreen-console,kscreen-doctor gpu: nvidia-settings,nvidia-smi  
    wl: wayland-info x11: xdriinfo, xdpyinfo, xprop, xrandr  
Audio:  
  Device-1: NVIDIA GB205 High Definition Audio driver: snd_hda_intel v: kernel  
    bus-ID: 0a:00.1  
  Device-2: Advanced Micro Devices [AMD] Starship/Matisse HD Audio  
    vendor: ASRock driver: snd_hda_intel v: kernel bus-ID: 0c:00.4  
  API: ALSA v: k7.2.0-202.nobara.fc44.x86_64 status: kernel-api  
  Server-1: aRts v: 1.5.10 status: off  
  Server-2: JACK v: 1.9.22 status: off  
  Server-3: PipeWire v: 1.6.8 status: active  
Network:  
  Device-1: MEDIATEK MT7922 802.11ax PCI Express Wireless Network Adapter  
    vendor: AzureWave ASUS PCE-AXE59BT driver: mt7921e v: kernel bus-ID: 07:00.0  
  IF: wlp7s0 state: up mac: <filter>  
  Device-2: Realtek RTL8111/8168/8211/8411 PCI Express Gigabit Ethernet  
    vendor: ASRock driver: r8169 v: kernel port: d000 bus-ID: 09:00.0  
  IF: enp9s0 state: up speed: 1000 Mbps duplex: full mac: <filter>  
  IF-ID-1: br-1d77995a534e state: up speed: 10000 Mbps duplex: unknown  
    mac: <filter>  
  IF-ID-2: br-224a1b052b89 state: down mac: <filter>  
  IF-ID-3: docker0 state: up speed: 10000 Mbps duplex: unknown mac: <filter>  
  IF-ID-4: veth549dfd5 state: up speed: 10000 Mbps duplex: full  
    mac: <filter>  
  IF-ID-5: veth55163a6 state: up speed: 10000 Mbps duplex: full  
    mac: <filter>  
Bluetooth:  
  Device-1: IMC Networks Wireless_Device driver: btusb v: 0.8 type: USB  
    bus-ID: 1-8:3  
  Report: btmgmt ID: hci0 rfk-id: 2 state: up address: <filter> bt-v: 5.3  
    lmp-v: 12  
Drives:  
  Local Storage: total: 39.18 TiB used: 33.95 TiB (86.6%)  
  ID-1: /dev/nvme0n1 vendor: Western Digital model: WDS100T2B0C-00PXH0  
    size: 931.51 GiB temp: 36.9 C  
  ID-2: /dev/sda vendor: Mushkin model: MKNSSDTR512GB-3DL size: 476.94 GiB  
  ID-3: /dev/sdb vendor: Toshiba model: MG07ACA14TE size: 12.73 TiB  
  ID-4: /dev/sdc vendor: ASMedia model: T106x- V0Volume size: 1.86 TiB  
  ID-5: /dev/sdd vendor: Seagate model: ST16000NM001G-2KK103 size: 14.55 TiB  
  ID-6: /dev/sdf vendor: Seagate model: ST3000VN000-1H4167 size: 2.73 TiB  
    type: USB  
  ID-7: /dev/sdg vendor: Seagate model: ST3000VN000-1H4167 size: 2.73 TiB  
    type: USB  
  ID-8: /dev/sdh vendor: Seagate model: ST3000VN000-1H4167 size: 2.73 TiB  
    type: USB  
  ID-9: /dev/sdi vendor: Phison model: ESMP512GMB47C3-E13TS size: 476.94 GiB  
    type: USB  
Partition:  
  ID-1: / size: 441.25 GiB used: 249.83 GiB (56.6%) fs: btrfs dev: /dev/sda3  
  ID-2: /boot size: 973.4 MiB used: 666.7 MiB (68.5%) fs: ext4  
    dev: /dev/sda2  
  ID-3: /boot/efi size: 299.4 MiB used: 76.6 MiB (25.6%) fs: vfat  
    dev: /dev/sda1  
  ID-4: /home size: 441.25 GiB used: 249.83 GiB (56.6%) fs: btrfs  
    dev: /dev/sda3  
Swap:  
  ID-1: swap-1 type: zram size: 8 GiB used: 4.7 GiB (58.8%) dev: /dev/zram0  
  ID-2: swap-2 type: partition size: 34.39 GiB used: 1.03 GiB (3.0%)  
    dev: /dev/sda4  
Sensors:  
  System Temperatures: cpu: 49.0 C mobo: 34.0 C  
  Fan Speeds (rpm): fan-1: 0 fan-2: 2532 fan-3: 0 fan-4: 1603 fan-5: 0  
  Power: 12v: N/A 5v: N/A 3.3v: 3.31 vbat: 3.26  
Info:  
  Memory: total: 64 GiB note: est. available: 62.7 GiB used: 19.73 GiB (31.5%)  
  Processes: 871 Uptime: 8d 12h 12m Init: systemd  
  Packages: 151 Compilers: clang: 22.1.8 gcc: 16.2.1 Shell: Bash v: 5.3.9  
    inxi: 3.3.41  

3
submitted 2 years ago by [M] to c/linuxscripts@lemmy.zip
 
 

Just want to wish everyone a safe and happy new year. If you go out partying/drinking tonight, play it safe and use a cab to get home. Cheaper all around, no tickets to pay for DUI, no insurance increases because of a car wreck and no concern of how to replace your car if you get in one and last but not least, Your family gets to keep you around a little longer if you don't drive home drunk.

Happy New Year and see y'all in 2025

4
5
KDE 6.1 Released Today (9to5linux.com)
submitted 2 years ago by [M] to c/linuxscripts@lemmy.zip
 
 

Today KDE released 6.1. Now we wait for the distros to put it in their repos.

6
 
 

So, I was doing this:

ffmpeg -i /media/johann/5461-000B/DCIM/100MEDIA/IMAG0079.AVI -ss 00:00:00 -t 00:00:20 ~/Public/240321/240321_0079.avi ; rm /media/johann/5461-000B/DCIM/100MEDIA/IMAG0079.AVI

one at a time changing the IMAG0079 to IMAG0080 etc every time. I am sure there must be a way to perform two actions (ffmpg) and (rm) on each file in a folder. Can anyone help (For next time)

Thanks!

7
8
 
 

I use this in Hyprland to quickly switch between the headphone jack and a USB wireless dongle. Executing the script will show a dialog that lists all available audio sinks, with the active sink selected. It requires pulseaudio or pipewire-pulse for the pactl program, and kdialog for the dialog.

9
 
 

Hello everyone…I’m getting these integrity and confit errors during startup. Nothing seems broken. Does anyone know a fix or should i just ignore? Thanks!

10
11
 
 

Alright everyone, let’s get this party started. The title asks the question pretty well. What is the main use of your Linux install? Is it gaming, programming, just to dump windows etc…

Let’s have some fun everyone.

12
submitted 3 years ago by [M] to c/linuxscripts@lemmy.zip
 
 

Hey everyone, just wanted to touch base with y’all. I’m really a little worried about our community.

As of this writing we have 295 members, but we only have 11 posts, including this one. We really need to get some quality posting going on here.

So this is what I was thinking, let’s start a mega thread of conversations around Linux in general. I would like to see what we can get going here. Also please talk to your friends that are on here and invite them to the group.

I know a lot of us, myself included, tend to just lurk until something pops up for us to interact with. I’m asking everyone here to help interact with our community. We aren’t just a help desk here, we can also have fun conversations.

13
submitted 3 years ago* (last edited 3 years ago) by [M] to c/linuxscripts@lemmy.zip
 
 

Hi all, I really appreciate the number of member we have here at linuxscripts, and we have had a few posts besides my own on here.

What I would really like is for some of you to post things if you have them, and of course let others know about our existence.

You don’t have to post content to o be a member here, but please help contribute in any manner you can. I am opening the community up to more content today allowing for memes and crossposts of news surrounding Linux. If you cross post please denote that in your post so others know. I do ask that you don’t cross post unsolved help posts unless it is your own. However, if you get a solution to your problem and it’s not on here please let me know so it can be locked.

Thanks everyone.

14
submitted 3 years ago by [M] to c/linuxscripts@lemmy.zip
 
 

This is a database script i made to trigger when database events trigger a database lockup.

# Make sure to change your database info and what instance of DB you are using (i.e. sqlite3, mysql, postgres etc...)
# This script will rotate for a total of 5 logs so you can compare previous errors with current one without taking unnecessary space

# There's no strict requirement to place it in the root directory of the server, but you have some options for where to put it:

# Root Directory: Placing the script in the root directory could work, but it's generally not recommended to clutter the root directory
# with scripts. It's better to create a specific directory for your application and put the script there.

# Custom Directory: Create a specific directory for your application, and place the script there. 
# For example, you could create a directory called "my_app" or "database_error_logger" and place the script in that directory.

# Scripts Directory: Some servers have a designated directory for executable scripts. 
# You might check if your server has a "scripts" directory where you can place your script.

# Regardless of the location, it's essential to consider file permissions. 
# Ensure that the script has the necessary permissions to execute. You may need to use the chmod command to set the appropriate 
# permissions, depending on your server's configuration.

# Lastly, consider setting up a virtual environment for your Python script to isolate dependencies and avoid conflicts with other 
# applications on the server. This can help ensure that the required Python libraries are installed locally for your script
# without interfering with system-wide packages.    

# This script was created by Edward Freeman and is covered under GPL V3. You can modify this script as you need
# However, you must retain this GPL V3 standard, and leave credit where credit is due to the original author.

import logging
from logging.handlers import RotatingFileHandler
import sqlite3 #Make sure you change this to the correct Database provider (sqlite3, mysql, postgres etc..)
import sys

# Configure logging with rotating file handler
log_file = 'database_errors.log'
log_handler = RotatingFileHandler(log_file, maxBytes=1024 * 1024, backupCount=5)
log_formatter = logging.Formatter('%(asctime)s - %(levelname)s: %(message)s')
log_handler.setFormatter(log_formatter)
logger = logging.getLogger('DatabaseErrorLogger')
logger.setLevel(logging.ERROR)
logger.addHandler(log_handler)

def perform_database_operation():
    try:
        # Replace the following line with your actual database connection and query
        connection = sqlite3.connect('your_database.db')
        cursor = connection.cursor()

        # Replace the following line with your actual database operation
        cursor.execute('SELECT * FROM your_table;')

        # Don't forget to commit the changes if you are performing write operations
        connection.commit()

        connection.close()
    except Exception as e:
        # Log the error with the traceback using the logger
        logger.exception("Error occurred while performing the database operation.")
        raise  # Raising the error again allows the script to terminate or handle it at a higher level if needed

def custom_exception_handler(exctype, value, traceback):
    # Log uncaught exceptions using the logger
    logger.exception("Uncaught exception occurred.", exc_info=(exctype, value, traceback))

# Set the custom exception handler for uncaught exceptions
sys.excepthook = custom_exception_handler

# Call the function to perform the database operation
try:
    perform_database_operation()
except Exception as e:
    print("Error occurred during the database operation:", str(e))
15
 
 

Hi, I am new to linux and started off with Nobara KDE, updated to latest and facing a problem with my new bluetooth keyboard. It can store upto 3 devices and can switch between them. Whenever I switch out of the system to my work laptop it force mutes all playback device without interfering with media and I have to toggle it back on manually. I have pulse audio and but I believe only pipewire-pulse is running under process. I am adding some screen shots with imgur hoping that would help. Would appreciate some help or hints on how this cant be fixed. Thanks.

16
 
 

If you have a dual boot setup like mine and want to utilize Linux systemd-boot for managing the Windows dual boot, I've put together a concise guide for myself, which may also be of interest to a few people. Here are the steps you can follow:

  1. Find the partition of the Windows EFI system with lsblk. (The partition must be around 100Mo)
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda           8:0    0 465,8G  0 disk
├─sda1        8:1    0   100M  0 part
├─sda2        8:2    0    16M  0 part
├─sda3        8:3    0   465G  0 part
└─sda4        8:4    0   639M  0 part
zram0       254:0    0     4G  0 disk [SWAP]
nvme0n1     259:0    0 931,5G  0 disk
├─nvme0n1p1 259:1    0   511M  0 part /boot
└─nvme0n1p2 259:2    0   931G  0 part /var/log
                                      /var/cache/pacman/pkg
                                      /home
                                      /.snapshots
                                      /
  1. Mount this partition with sudo mkdir /mnt/windows-boot && sudo mount /dev/sda1 /mnt/windows-boot. (In this example sda1 is the partition needed)

  2. Copy the needed directory to boot folder with sudo cp -r /mnt/windows-boot/EFI/Microsoft /boot/EFI/Microsoft.

  3. Create the needed entrie config file

su -
cd /boot/loader/entries
touch windows.conf

and put this code inside :

title Windows 11
efi /EFI/Microsoft/Boot/bootmgfw.efi
  1. Reboot

This guide is specifically tailored for an Arch Linux installation, but it can be easily adapted to suit other Linux distributions.

Please note that the steps provided in this guide are primarily focused on configuring dual boot using Linux systemd-boot. While the overall process may be similar across various distributions, there might be slight variations in specific commands or file paths. Therefore, it's recommended to consult your distribution's documentation or community resources for any distro-specific instructions.

17
submitted 3 years ago* (last edited 3 years ago) by to c/linuxscripts@lemmy.zip
 
 

Run the "Basic Lemmy API login script" (see here) first to get value for 'jwt'

#!/bin/bash

# Basic get unread replies script for Lemmy API

# CHANGE THESE VALUES
my_instance=""			# e.g. https://feddit.nl/
my_username=""			# e.g. freamon
my_password=""			# e.g. hunter2

jwt=""			# run basic login script to get this

########################################################

# Lemmy API version
API="api/v3"

########################################################

# Turn off history substitution (avoid errors with ! usage)
set +H

########################################################

# Get inbox messages
get_unread_replies() {
	end_point="user/replies"
	www_data="auth=$jwt&unread_only=true"

	url="$my_instance/$API/$end_point?$www_data"

	curl "$url"
}

get_unread_replies

Personally, I'd use the 'jq' program to de-serialize the reply, e.g.

get_unread_replies.sh | jq '.replies[].comment.content'

My next plan is to use a script like this with a notification service like PUSHOVER, so it can ding my phone if I've an unread message

For each API method, whether it's GET or POST and end_point can be found here, and then each method has a click-through to see what parameters it can take.

18
submitted 3 years ago* (last edited 3 years ago) by to c/linuxscripts@lemmy.zip
 
 
#!/bin/bash

# Basic login script for Lemmy API

# CHANGE THESE VALUES
my_instance=""			# e.g. https://feddit.nl/
my_username=""			# e.g. freamon
my_password=""			# e.g. hunter2

########################################################

# Lemmy API version
API="api/v3"

########################################################

# Turn off history substitution (avoid errors with ! usage)
set +H

########################################################

# Login
login() {
	end_point="user/login"
	json_data="{\"username_or_email\":\"$my_username\",\"password\":\"$my_password\"}"

	url="$my_instance/$API/$end_point"

	curl -H "Content-Type: application/json" -d "$json_data" "$url"
}

login

# Make note of "jwt" from reply

This'll reply with JSON data, that includes a value for "jwt", to be used in other scripts that require you to be logged in.

Personally, I'd use the 'jq' program to de-serialize the JSON data, but I thought I'd keep the script simple for now

19
 
 

Hello, I use Ubuntu 22.04.2 LTS and I got a strange problem without knowingly changing anything: Every now and then my primary display turns black for a second and then back on. My secondary display is working fine. My speakers are also connected to the display, so I'll hear a sound from them when it happens. I can't make out exactly what causes the turning off/on, but when I don't touch anything, it happens less frequently than when I'm working, switches windows, etc. Furthermore while my display works well with 144Hz refresh rate, my mouse input works at a noticably much lower refresh rate. I tried restarting my PC and replugging my DP-Cable and power cables. I'm relatively new to Linux so I don't know what the causes could be. I hope someone can help me :)

20
 
 

Thank you for subscribing. Pleeas help me populate this by posting tuts you have used or scripts you may have made. Also please designate what distro you re using them on to help newbies.