How to change hdparm APM = 254 permanently? [Solved]

If you are new to Linux or new to Sabayon Linux and just not sure where to post, here ya go. Post without fear of being told to RTFM :)

Moderator: Moderators

Post Reply
kris-kris
Baby Hen
Posts: 19
Joined: Mon May 04, 2020 19:45
Location: Poland, Warsaw

How to change hdparm APM = 254 permanently? [Solved]

Post by kris-kris » Tue May 05, 2020 7:02

Each time the system is restarted or turned on from sleep, hdparm APM = 128 is set. I have to manually enter the command in the terminal $ sudo hdparm -B 254 / dev / sda. How do you always make APM = 254? Ubuntu always has APM = 254 set by default, so somehow it can be done, but I don't know how to get it in Sabayon.
Last edited by kris-kris on Fri May 08, 2020 18:37, edited 2 times in total.

User avatar
sabayonino
Sagely Hen
Posts: 3540
Joined: Sun Sep 21, 2008 1:12
Location: Italy
Contact:

Re: How to change hdparm APM = 254 permanently?

Post by sabayonino » Tue May 05, 2020 8:44

see /etc/conf.d/hdparm config file

set

Code: Select all

all_args="-B 254"

kris-kris
Baby Hen
Posts: 19
Joined: Mon May 04, 2020 19:45
Location: Poland, Warsaw

Re: How to change hdparm APM = 254 permanently?

Post by kris-kris » Tue May 05, 2020 10:50

I did as you wrote. I put the system to sleep. I started the system and APM=128. So this way doesn't work.

User avatar
sabayonino
Sagely Hen
Posts: 3540
Joined: Sun Sep 21, 2008 1:12
Location: Italy
Contact:

Re: How to change hdparm APM = 254 permanently?

Post by sabayonino » Tue May 05, 2020 12:25

Did you restart hdparm or reboot the system after changes ?

kris-kris
Baby Hen
Posts: 19
Joined: Mon May 04, 2020 19:45
Location: Poland, Warsaw

Re: How to change hdparm APM = 254 permanently?

Post by kris-kris » Tue May 05, 2020 13:03

It works with OpenRC. And there is systemd at Sabayon and it doesn't work with it anymore. Another way is needed.
There are instructions on the internet on how to do many things in OpenRC, and how little to do on systemd. And now systemd is ubiquitous.
I used a few instructions and realized that they are not useful, because for OpenRC.

Fitzcarraldo
Sagely Hen
Posts: 8218
Joined: Sat Mar 10, 2007 5:40
Location: United Kingdom
Contact:

Re: How to change hdparm APM = 254 permanently?

Post by Fitzcarraldo » Thu May 07, 2020 9:13

You could use a udev rule. See the following section in the Arch Linux Wiki article on hdparm:

hdparm - Persistent configuration using udev rule

If the configuration is lost after system suspension/hibernation, it can be reapplied using systemd-sleep:

hdparm - Reapplying configuration after wakeup

kris-kris
Baby Hen
Posts: 19
Joined: Mon May 04, 2020 19:45
Location: Poland, Warsaw

Re: How to change hdparm APM = 254 permanently?

Post by kris-kris » Fri May 08, 2020 13:38

I'm doing something wrong because it doesn't work. I don't know if I understood everything correctly from this manual. In / user / lib / systemd I created the system-sleep directory because it wasn't there. In this directory, I created the hdparm file and pasted the content from the #! / bin / sh and gave this file the permission chmod + x. I restarted the system and it doesn't work.

Fitzcarraldo
Sagely Hen
Posts: 8218
Joined: Sat Mar 10, 2007 5:40
Location: United Kingdom
Contact:

Re: How to change hdparm APM = 254 permanently?

Post by Fitzcarraldo » Fri May 08, 2020 14:43

Code: Select all

# locate system-sleep
/lib/systemd/system-sleep
# cd /lib/systemd/system-sleep
It's /lib/systemd/system-sleep in SL. Useful to install mlocate so that you can search for things easily:

Code: Select all

# equo install mlocate
# updatedb # (Do this periodically to update database/list of files)
Also, note location of binary is different in SL:

Code: Select all

# locate hdparm | grep bin
/sbin/hdparm
# ls -la /sbin/hdparm
-rwxr-xr-x 1 root root 139336 Aug  2  2019 /sbin/hdparm

kris-kris
Baby Hen
Posts: 19
Joined: Mon May 04, 2020 19:45
Location: Poland, Warsaw

Re: How to change hdparm APM = 254 permanently?

Post by kris-kris » Fri May 08, 2020 15:19

Thanks a lot! Works perfectly! Now I understand and see how easy it is when you know how. Beautiful! I am satisfied!

Post Reply