Linux Lite Forums

Software - Support => Installing Software => Topic started by: MS on February 06, 2019, 05:19:23 PM

Title: How to maintain custom tweaks after reboot/sleep
Post by: MS on February 06, 2019, 05:19:23 PM
Hello,

I have applied certain custom settings, regarding the swappiness value, as well as the overclock of an amdgpu associated device. The swappiness value stays after system waking from the sleep mode, but resets after each reboot. When it comes to the amdgpu overclock parameters, they reset already after system waking from the sleep mode. I would like to have these maintained. I believe a script could do. Where do I put respective scripts, what extra instructions should they include to be maintained by the system?

These are the regular commands that I use to introduce changes - inserted values are theoretical:

Code: [Select]
sudo echo "10" > /proc/sys/vm/swappiness
Code: [Select]
sudo bash -c 'echo "20" > /sys/class/drm/card1/device/pp_sclk_od && echo "20" > /sys/class/drm/card1/device/pp_mclk_od'
Title: Re: How to maintain custom tweaks after reboot/sleep
Post by: firenice03 on February 06, 2019, 06:12:51 PM
@MS
 To keep swappiness..


you can vi/nano as root
Code: [Select]
/etc/sysctl.conf
Then change/add the line -
Code: [Select]
vm.swappiness = 10You'll need to reboot to take effect..



Can do while running with
Code: [Select]
sysctl vm.swappiness=10


As for the Overclocking, I would suggest similarly editing the files (vi/nano - most likely as root) directly vs. echoing the desired input..
*Added - on a second thought - you could go to 'session and startup' the 'application autostart' tab to add the script... Remember to make the script executable.



Also instead of vi/nano, one can open the folder(s) as administrator(rt click) and edit the files with leadpad...
Title: Re: How to maintain custom tweaks after reboot/sleep
Post by: MS on February 06, 2019, 06:43:04 PM
As for the Overclocking, I would suggest similarly editing the files (vi/nano - most likely as root) directly vs. echoing the desired input..
*Added - on a second thought - you could go to 'session and startup' the 'application autostart' tab to add the script... Remember to make the script executable.

Also instead of vi/nano, one can open the folder(s) as administrator(rt click) and edit the files with leadpad...
I did edit the amdgpu target files couple of times but similarly as with echoing, the values get nullified on every occasion. For adding the scripts to autostart, I imagine it will apply only per boot, but what about waking from the sleep mode? Will need to test it out.
Title: Re: How to maintain custom tweaks after reboot/sleep
Post by: MS on February 06, 2019, 07:07:26 PM
I have read something somewhere about putting the scripts to /etc/init.d/ location, is that any way to go?

Attempted to issue the commands without prior root prefixes at the "session and startup", but understandably, it did not go. I am uncertain how this "session and startup" works, I mean, are these programs initiated after the first logging in - which would mean, too late - or does the first logging in already unlock the root access needed to start the applications requiring it? If so, it would make sense to issue the commands with root prefixes.
Title: Re: How to maintain custom tweaks after reboot/sleep
Post by: trinidad on February 07, 2019, 10:22:38 AM
Perhaps this explains.

https://unix.stackexchange.com/questions/404780/cant-overclock-gpu-using-amdgpu-driver-on-archlinux

TC
Title: Re: How to maintain custom tweaks after reboot/sleep
Post by: MS on February 08, 2019, 03:26:24 AM
Perhaps this explains.

https://unix.stackexchange.com/questions/404780/cant-overclock-gpu-using-amdgpu-driver-on-archlinux

TC
I am uncertain whether we are on the same frequency here, as I was asking for how to imprint these changes as to make them system default, per each boot and per each session, awakening from suspend or other. But maybe I have missed out on something. If so, please quote.
Title: Re: How to maintain custom tweaks after reboot/sleep
Post by: firenice03 on February 08, 2019, 08:25:22 AM
This may give some insight to running a script at resume.... Not sure about the overclocking... But for a script...
https://askubuntu.com/questions/92218/how-to-execute-a-command-after-resume-from-suspend (https://askubuntu.com/questions/92218/how-to-execute-a-command-after-resume-from-suspend)


Script should be executable and not just an .sh extension (if globally needed) - same as a startup
Code: [Select]
chmod uga +x NameOfFile


Title: Re: How to maintain custom tweaks after reboot/sleep
Post by: MS on February 09, 2019, 12:29:45 AM
Thanks @firenice03, but having looked up the answers you have linked and the proposed conditions required to make a competent looking script for the system resume from suspend, I thought that I would not know what am I doing with it, so I guess that I will just pass on this.