2

According to linuxaudio.org, I should add the command echo 3072 >/sys/class/rtc/rtc0/max_user_freq to my startup scripts.

In previous versions, I've done this by adding the line to the file /etc/rc.local, however as I understand, this does not work in 18.04 anymore.

Then, I found an answer that mentions creating a startup script in /etc/systemd/system/ like so:

[Unit]
Description=RTC Max User Freq

[Service]
ExecStart=echo 3072 >/sys/class/rtc/rtc0/max_user_freq
Type=oneshot
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

The script was found by the systemctl autocomplete command and I enabled it successfully, however it does not come into effect upon reboot.

What do I have to do in Ubuntu 18.04 to execute this command on startup?

Edit: The solution to this issue is a simple syntax change, the code in the .service-file when using systemd to run the script on startup should actually be:

[Unit]
Description=RTC Max User Freq

[Service]
ExecStart=/bin/bash -c "echo 3072 >/sys/class/rtc/rtc0/max_user_freq"
Type=oneshot
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

After wrapping the command in /bin/bash -c "...", the script worked immediately.

8
  • 1
    Wrap that in a shell and you should be good to go.
    – muru
    Dec 16, 2018 at 4:31
  • @muru, thank you for the link - wrapping the command was the way to do it, but how is this a duplicate question? By the phrasing of the one you've linked, I'd never have found the answer. Dec 16, 2018 at 11:55
  • 1
    @Prototype700 that's the point of duplicates, isn't it? Different phrasings of the same underlying question.
    – muru
    Dec 16, 2018 at 11:56
  • 1
    @Prototype700 they're both about using parts of shell syntax. That could be wildcards (that question), redirection (your question), pipes (example from manpage in my answer to that question), brace expansion, who knows what else, etc.
    – muru
    Dec 16, 2018 at 12:07
  • 1
    @Prototype700 I edited the dupe's title.
    – muru
    Dec 16, 2018 at 12:14

0

Browse other questions tagged .