2024-07-24
How To Remove X11 And Qt Dependencies For A Headless Ubuntu System

Make desktop ubuntu headless

1
2
3
4
sudo apt-get purge libx11.* libqt.*
sudo apt-get autoremove -y
sudo apt-get clean

Read More

2024-06-19
Run Gui Programs Under Cron, Monitor Root Filesystem Disk Usage And Send Alarm

the ultimate solution:

copy all current user environment variables to crontab.


to run notify-send you have to set DBUS_SESSION_BUS_ADDRESS


to run other gui programs you set DISPLAY and XAUTHORITY


wall works for tmux and ssh sessions but not gnome-terminal.

in kde everything works fine. install konsole instead.


script for monitoring disk usage:

1
2
3
4
5
6
7
8
9
10
11
#!/bin/bash
used_percentage=$(df / | awk 'NR==2 {sub(/%/, "", $5); print $5}')
alarm_message="Root filesystem has less than 10% free space."
# Compare the percentage with the number 90
if [ "$used_percentage" -lt 90 ]; then
echo "Disk is ok."
else
wall $alarm_message
notify-send $alarm_message
fi

Read More

2023-09-26
Maintaining Stability With Mount --Bind: Detaching And Reattaching Linux Disks

linux disk detach and reattach, how to maintain stability

use mount --bind

Read More

2023-08-08
Exploring Alternative Linux Cd Managers: Goto, Go-Shell, Up, And Autojump

cd manager Linux alternative

goto supports bash and zsh (compdef needed)

go-shell supports powershell

up navigates to parent directory, supports fish, bash, zsh

autojump

Read More

2022-12-15
Reset Usb

the same for /sys/bus/usb/drivers/*.


in case kali failed to detect presence of hard disks, shall you pop up a dialog for us to decide whether to reset to usb or not.

reset-usb.sh

1
2
3
4
#!/bin/bash
reset-ahci-controllers.sh
reset-xhci-controllers.sh

reset-ahci-controllers.sh

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/bash
# this freaking works.
# Script to reset all local xHCI (USB) controllers
# Based on: http://billauer.co.il/blog/2013/02/usb-reset-ehci-uhci-linux/
if [[ ${EUID} != 0 ]]; then
echo This must be run as root!
exit 1
fi
for xhci in /sys/bus/pci/drivers/ahci; do
if ! cd ${xhci}; then
echo "Weird error. Failed to change directory to ${xhci}."
exit 1
fi
echo "Resetting devices from ${xhci}..."
for i in ????:??:??.?; do
echo -n "${i}" > unbind
echo -n "${i}" > bind
done
done

reset-xhci-controllers.sh

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/bash
# this freaking works.
# Script to reset all local xHCI (USB) controllers
# Based on: http://billauer.co.il/blog/2013/02/usb-reset-ehci-uhci-linux/
if [[ ${EUID} != 0 ]]; then
echo This must be run as root!
exit 1
fi
for xhci in /sys/bus/pci/drivers/?hci_hcd; do
if ! cd ${xhci}; then
echo "Weird error. Failed to change directory to ${xhci}."
exit 1
fi
echo "Resetting devices from ${xhci}..."
for i in ????:??:??.?; do
echo -n "${i}" > unbind
echo -n "${i}" > bind
done
done

Read More

2022-08-11
Linux Fan Not Spinning, Gpu Fan Not Spinning

everytime the fucking machine restarts, it fails devastatingly.

the word: Giving the fans some time to reach full speed...

the script:

1
2
3
4
5
6
7
#!/usr/bin/expect
spawn pwmconfig
#expect "Giving the fans some time to reach full speed..."
expect "If you do not want to do this hit control-C now!!!"
send "\03"
expect eof

hope this shit works?

1
2
3
echo 255 | sudo tee /sys/class/hwmon/hwmon6/pwm3
echo 255 | sudo tee /sys/class/hwmon/hwmon6/pwm1

i have install something other than that. like i8kctl, some thermal controllers by intel (thermald)? but still gpu fan not spinning till now.

1
2
3
4
apt install -y lm-sensors fancontrol
sensors-detect
pwmconfig

already have cpu frequency under control by running temp_throttle.sh

notes: found controllers dell_smm-isa-0000

1
2
3
4
Found the following PWM controls:
hwmon6/pwm1 current value: 255
hwmon6/pwm3 current value: 255

Read More

2022-07-25
Cpu Overheating (Temperature Too High)

linux

cpufrequtils

throttling cpu frequencies by temperature incrementally

the desired temperature is 60.

usually when one throttles the CPU temperature, the GPU cannot be overheated.

it is turning my core i7 into a pentium 3! but not entirely cumbersome.

Read More

2022-05-06
Boot Into Linux Commandline (Tty)

when xorg fails, one must use commandline to debug problems.

put ‘3’ after the longest line of boot commands.

use ssh to collect logs even if the main interface is stuck somehow (like libinput faliure)

reference:

https://www.linuxandubuntu.com/home/how-to-boot-into-linux-command-line/amp

Read More