Skip to content

Instantly share code, notes, and snippets.

@valmat
Last active April 21, 2022 06:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save valmat/6f59f9a087a01c133a82345869d2f043 to your computer and use it in GitHub Desktop.
Save valmat/6f59f9a087a01c133a82345869d2f043 to your computer and use it in GitHub Desktop.
Fix DELL freezes
#!/bin/bash
### BEGIN INIT INFO
# Provides: fixdell
# Required-Start: $local_fs $syslog $named
# Required-Stop: $local_fs $syslog $named
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Fix DELL freezes
# Description: startup script for Fix DELL freezes
### END INIT INFO
#
# /etc/init.d/fixdell -- startup script
#
# move this file to `/etc/init.d`
# Then do `chmod +x /etc/init.d/fixdell`
# update-rc.d fixdell defaults
#
# To remove do:
# update-rc.d fixdell remove
#
if [ "$UID" != "0" ]
then
echo "You must be root"
exit;
fi
case "$1" in
start)
for file in `ls /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor`; do
echo performance > $file
done;
# echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
;;
check)
nom=0
for file in `ls /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor`; do
echo "[$nom] $file : `cat $file`"
let "nom = nom + 1"
done;
# echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
;;
reset)
# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
;;
stop)
;;
restart)
;;
*)
echo "Please use start, stop, check, restart or reset as first argument"
;;
esac
@valmat
Copy link
Author

valmat commented Apr 20, 2022

I have two DELL laptops. And both are freeze randomly.
This startup script fixes freezes.

I found solving on following pages:
https://blog.hosni.me/2018/07/fix-linux-freezing-problem-on-dell.html
https://ixnfo.com/en/changing-cpu-scaling-governor-on-linux.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment