Fixing reseting refresh rate on Ubuntu after reboot
Problem
If you have recently installed Ubuntu or Zorin OS (or any other Ubuntu derivatives really) with NVIDIA drivers, you may have noticed that after rebooting your system, your screen refresh rate resets back to 60Hz
or something lower than that.
Even after explicity setting the refresh rate, I still got the same issue and most resources on the web were pretty old and mostly irrelevant.
Solution
One of the solutions that worked for me was to set a cron job to run xrandr
everytime I reboot my system.
You can do this as below:
1. Setting up the script
- Open a terminal and make a new bash script (name it whatever you want, I named mine
rr.sh
) - Inside the bash script, type:
xrandr --output eDP-1-1 --mode 1920x1080 --rate 120
- Here, you can replace
eDP-1-1
with the name of your monitor.- If you don’t know what is the name of your monitor, just do
xrandr -q
and in the output, check for which output has the word “connected” in it. Mine iseDP-1-1
. - For a custom refresh rate, change the
--rate
flag to whatever rate you want. Mine is 120. - Same goes with the
--mode
flag (which basically sets the resolution). Mine is 1920x1080.
- If you don’t know what is the name of your monitor, just do
- Here, you can replace
- Once you are done making changes to the file, save it and make it executable using the following command:
chmod +rwx rr.sh
.
2. Setting up the cron job
- Open a terminal and run the following command:
crontab -e
- Now if this is the first time you running this command, cron will ask you to choose an editor. I chose
nano
. - Now in the editor, scroll down to the bottom and add the following line:
@reboot sleep 900 ~/.rr.sh
- Here you can change the
~/.rr.sh
to the name and the location of the script you made earlier. - You can also play with the sleep parameter but in my case, setting it too low will not take effect and too high might interrupt your workflow at some point in the middle.
Once all this is done, save the file and close the editor.
Now you can reboot your system and you should see your screen refresh rate set to 120Hz or whatever you wanted it to be.
I hope you found this blog helpful, if you have any questions, you can mail them to me.