1 (edited by nparafe 2023-05-30 16:11:19)

Topic: Start powertop at boot

Hi,
this is a long post, so please be patient hmm  .

I am using a librebooted x200, so as described here, I need to install powertop and start it at boot.

As the instructions given in the site doesn't apply to an alternative init system like openrc, I needed to find another method.

Furthermore, I have to disable the use of powertop in two external usb devices, so the commands I need to run in boot time are:

/usr/sbin/powertop --auto-tune
echo 'on' > '/sys/bus/usb/devices/1-2.2/power/control';
echo 'on' > '/sys/bus/usb/devices/1-2.5/power/control';

I tried to add them in cron like this:

@reboot /usr/sbin/powertop --auto-tune
@reboot echo on | doas /sys/bus/usb/devices/1-2.2/power/control
@reboot echo on | doas /sys/bus/usb/devices/1-2.5/power/control

but although powertop starts, the 2nd and 3d command don't work. (Also I have tried more compinations with or without doas.)

What I ended up doing, and it worked, was to add the commands to ~/.xinitrc and also adjusting the /etc/doas.conf accordingly. I don't like messing with doas.conf though, and maybe there is something new for me to learn, so my question is if there is a better (more secure?) alternative for this.

let them build as many prisons as they want.
Even if the siege is closing in around us.
Our mind is like a wanderer, and will always be free.

2

Re: Start powertop at boot

Guessing so far: You have adjusted the doas.conf to grant your local user the right executing the command without entering the password? This is not per definition "wrong". If you dislike doing more modifications you can for example rebuild the package for providing only under /usr/bin instead of /usr/sbin and so granting you more access without editing the configuration. Also so far to see there is no binding for the init-system itself. It is more about he access-rights.

Also to note: powertop is Linux-exclusive and no BSD-support elsewhere.

Human being in favor with clear principles and so also for freedom in soft- and hardware!

Certainly anyone who has the power to make you believe absurdities has the power to make you commit injustices: For a life of every being full with peace and kindness, including diversity and freedom. Capitalism is destroying our minds, the planet itself and the universe in the end!

3

Re: Start powertop at boot

throgh wrote:

Guessing so far: You have adjusted the doas.conf to grant your local user the right executing the command without entering the password?

Correct!!

throgh wrote:

This is not per definition "wrong"

Thank you, for answering!
In the meantime, about the doas.conf subject, I found that inserting the full path: /usr/sbin/command and not the alias: command is a lot safer, so I am more confident using it now!

throgh wrote:

Also to note: powertop is Linux-exclusive and no BSD-support elsewhere.

I haven't tried bsd in x200 so I do not know if the high pich noise exists. I guess I'll have to find it out when hyperbola bsd makes it to alpha wink

let them build as many prisons as they want.
Even if the siege is closing in around us.
Our mind is like a wanderer, and will always be free.