I am working on a python program that I am having some issues with. When the user presses a button a video starts playing. I need the audio to come from the analog jack. It works perfectly when I run it from the terminal or in thonny.

The problem started when I tried to autorun it. I set it up to autorun with /etc/rc.local. It starts correctly, but there is no audio from the VLC player. I am using os.system("amixer sset 'Master' 100%") to set the volume and in my log I get the error amixer: Unable to find simple control 'Master',0. I tried adding os.system("amixer scontrols") to get a little more information, and I got the following: Simple mixer control 'HDMI',0 "Master" isn't mentioned there like it is when I run that command from a terminal.

So what is different here? Why is HDMI audio output my only option when starting from rc.local? I have tried starting with and without sudo and that made no difference.

  • Because the audio out is just like video out -- there's only one for the system, and things that run in the background (such as those started from rc.local) don't automatically get to access it. That said, I don't have the solution for this (but I am sure there is one).
    – goldilocks
    Feb 14, 2022 at 22:08
  • I'm sure you know that rc.local has been deprecated. I assume "autorun" means "start at boot"?? If so, maybe try another method for auto-starting - a systemd unit, or cron?
    – Seamus
    Feb 15, 2022 at 17:47
  • I did try cron, and it behaved exactly the same way. I am going to try another way tomorrow and see how it goes. Feb 16, 2022 at 5:11

1 Answer 1


I still don't understand why the other methods weren't working, but I solved the problem by starting the script from ~/.bashrc. It works perfectly now.

  • 1
    .bashrc is NOT intended to run scripts. It is run each time a non-login interactive shell is started and is used to configure the shell.
    – Milliways
    Feb 18, 2022 at 23:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.