1

I got a Lenovo Yoga 7i, there is a known issue with its audio card on the current kernels where it wont output sound through the speakers.

There is, however, a hackish solution described here where, after doing the setup, you run this script and the audio works

#!/bin/bash
sudo rtcwake -m mem -s 1
while true
do
  echo -n -e '\x00' | padsp tee /dev/audio
  sleep 5
done

The problem with this script is that in order to run rtcwake, you seem to need to run it as sudo, meaning you need to input the password making it useless as a startup script. But running the script as root from the start means that the while loop outputs the error tee: /dev/audio: Connection refused over and over.

How can I run this script, that only uses parts of it as sudo, on startup from any user?

2
  • Yes. Read man sudoers, you can set up passwordless access to that single command.
    – waltinator
    May 21, 2021 at 23:15
  • What version Ubuntu?
    – heynnema
    May 22, 2021 at 0:00

1 Answer 1

1

What may work is to split the script: run the rtcwake -m mem -s 1 during startup as root. Nowadays, a crontab may be the most convenient way to do that (unless you fancy writing a systemd service):

sudo crontab -e

To open and edit the root crontab file, and add:

@reboot rtcwake -m mem -s 1

You then could run the next part in another script that you autostart on user login.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .