SPDIF audio is completely broken. This can be fixed by unmuting (with 'M') via 'alsamixer'. Configurations here can be saved by 'sudo alsactl store 0'. SPDIF audio is still completly broken on start up. This can be fixed via 'sudo alsactl restore 0' but not 'alsactl restore 0' because it needs to overwrite '/var/lib/alsa/asound.state'. I leanrt how to script and wrote this for startup:
HASH!/bin/bash HASHUnumtes SPDIF on start up by retoring saved alsamixer/alsactl defaults sleep 3 sudo alsactl restore 0
Do I place sudo in the script like that? Obviously the restore won't happen as I won't be entering the password. The sleep is because 'pulseaudio' reverts alsa changes on start up. After some reading I went to '/etc/sudoer' to solve the admin problem. I added this to the end:
The script doesn't work with this addition. Once beaten, this 3 part audio probelm (this is part 2) will stop being in the way of Linux as a daily driver. So is this the best approach? It feels insecure. Is this an okay place to store my script? How can I make this work? Why is optical audio even a problem for Linux in 2016 (Manjaro KDE)? After I get some sound on start-up I'll have to look into being able to change the level via the speaker icon. Right now i'm dealing with the 0% off 1 - 100% on bullshit.
Thanks for helping me out with this mammoth problem guys, I appreciate it.
It would be easier to run the script as root, if your run sudo contab -e and add @reboot /path/to/script.sh that should work.
But to do it the way you are doing it now (with sudo in the script) you need to add the command to the sudoers file, not the script. so change it to this: xolotl All=(ALL) NOPASSWD: alsactl (you may need to use the absolute path to alsactl, whatever it is)
So they are both going and as far as I can tell, essential. I read up on people with the same problem and restarting alsa seems to me like the best solution.
Contab command wasn't recognised and changing it to /bin/alsactl didn't help. Alsactl is in other locations too, I'll try those but what to do if that doesn't work?
there was a typo in the command. sudo crontab -e is the proper command. Also, if you're not familiar with vim, you may want to use EDITOR=nano sudo crontab -e instead, as nano is more friendly to people who aren't in the know.
Thanks Sgt. It worked the first time but it doesn't work on most boots. Do you have a way to fix this? I would fix it by changing the script to only restore after pulseaudio is running. Not sure how to do that. Also when does sleep begin from? Login-splash screen, before, after? EDIT: How long spent on splash screen seems to determine script's success.
"@reboot /home/xolotl/Scripts/alsaSPDIF.sh" still in crontab
● pulseaudio.service - Sound Service Loaded: loaded (/usr/lib/systemd/user/pulseaudio.service; disabled; vendor preset: enabled) Active: active (running) since
After Enable/Start ● pulseaudio.service - Sound Service Loaded: loaded (/usr/lib/systemd/user/pulseaudio.service; disabled; vendor preset: enabled) Active: active (running) since
You could add a longer sleep time to the scripts, or to the cron entry @reboot sleep 20; /your/script.sh but using systemd to run it after pulseaudio has loaded might be a better option, but I'm not sure how to configure that.