Tymoti
Posts: 4
Joined: Tue Aug 30, 2016 9:16 pm

my asoundrc is modified every reboot

Tue Aug 30, 2016 9:19 pm

I have a raspberry pi 3 with usb dac for plug my microphone and I have a usb speacker too.

I installed on my pi, mopidy and other litle project.

I modified my `~/.asoundsrc` for

Code: Select all

pcm.!default {
      type asym
       playback.pcm {
         type plug
         slave.pcm "hw:1,0"
       }
       capture.pcm {
         type plug
         slave.pcm "hw:0,0"
       }
    }
Everything work and when I reboot I have a new configuration added in the end of my .asoundrc file

Code: Select all

pcm.!default {
          type asym
           playback.pcm {
             type plug
             slave.pcm "hw:1,0"
           }
           capture.pcm {
             type plug
             slave.pcm "hw:0,0"
           }
        }
        
        
        
        pcm.!default {
                type hw
                card 2
        }
        
        ctl.!default {
                type hw
                card 2
        }
With this modification, my litle project doesn't work, I must to delete

Code: Select all

pcm.!default {
            type hw
            card 2
    }
    
    ctl.!default {
            type hw
            card 2
    }
Do you know why, this configuration is added every reboot ?

Maybe this, can you help you to help me :)

Code: Select all

cat /proc/asound/modules
       0 snd_usb_audio
       1 snd_usb_audio
       2 snd_bcm2835
Thanks

blownelco
Posts: 10
Joined: Wed Nov 11, 2015 9:52 pm

Re: my asoundrc is modified every reboot

Mon Oct 24, 2016 11:01 am

Hello,

I have the same problem, anyone who know's what is modifying this file?

thanks

Tymoti
Posts: 4
Joined: Tue Aug 30, 2016 9:16 pm

Re: my asoundrc is modified every reboot

Wed Oct 26, 2016 12:38 pm

Hi blownelco,


David Flanagan answer my question in Stack Exchange

Tell me if this solution resolve your problem ;)

blownelco
Posts: 10
Joined: Wed Nov 11, 2015 9:52 pm

Re: my asoundrc is modified every reboot

Wed Oct 26, 2016 6:55 pm

Hello,

I switched of all internal audio in to the /boot/config.txt and it stoped also.

your method will also work i think

thanks for the answer

Tymoti
Posts: 4
Joined: Tue Aug 30, 2016 9:16 pm

Re: my asoundrc is modified every reboot

Thu Oct 27, 2016 1:27 pm

Ah nice,

Do you have an example ? Because I don't understand your solution.

Thanks

davclark
Posts: 3
Joined: Wed Nov 30, 2016 4:32 pm

Re: my asoundrc is modified every reboot

Wed Nov 30, 2016 5:04 pm

Does no-one actually know what's going on? Disabling audio might fix the issue, but what is modifying that asoundrc file?

User avatar
flatmax
Posts: 336
Joined: Thu May 26, 2016 10:36 pm

Re: my asoundrc is modified every reboot

Fri Jun 02, 2017 10:09 am

I just want to rehash this topic ... we see this a lot.
Does anyone have any knowledge on this problem ?

thanks
Matt
Check the Ultra 2 sound card - use our shop instead of Amazon Europe (Amazon USA is live).
Sound card for the Raspberry Pi with inbuilt microphone : www.audioinjector.net
Audio Inector Octo multitrack GPIO sound card

User avatar
topguy
Posts: 5784
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: my asoundrc is modified every reboot

Fri Jun 02, 2017 12:47 pm

There is an "auditd" service that could have been used to see which process that opens and changes a file, unfortunately the "audit" feature is not enabled in the kernel so the service fails to start.
I've also took a look at "inotify-tools" but those tools just give an event when a file is being accessed, not info about which process that does it.

SteveSpencer
Posts: 351
Joined: Thu Mar 28, 2013 9:19 am
Location: Nottingham, UK

Re: my asoundrc is modified every reboot

Fri Jun 02, 2017 12:55 pm

From reading the StackExchange thread, the key seems to be forcing the audio out to either 3.5mm or HDMI.
If the default behaviour is "auto", then on booting, something on the audio side is determining if the connected HDMI device supports audio, or not, and then modifying the asoundrc accordingly.

By fixing it to one or other output, this isn't done, and the file doesn't get changed. If you disable onboard audio altogether, then the change should also be suppressed, but it depends how the check and update actually works.
Steve S
No, I can't think of anything funny that won't offend someone if they want it to...

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2384
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: my asoundrc is modified every reboot

Tue Jun 06, 2017 10:30 am

The volumealsa lxpanel plugin (source here) expects to be able to read and set the default sound card. The default is determined by searching for a "card" and "type" within a "pcm.!default" section. If the default is found, changing the sound card will update the existing default by patching the "type" and "card" properties; if there is no default (or if the card or type is missing) then a new default is appended.

The default is updated under the following circumstances:
1. When the user changes the current soundcard via the GUI. Note that Analog and HDMI are implemented by the same audio device, so switching between them does not count as changing the card.
2. When the GUI starts and can't find either a valid default card or an internal (Analog or HDMI) card.

If you think that the rules the plugin uses can be improved then please create an Issue or Pull Request in the LXPanel repo.

SteveSpencer
Posts: 351
Joined: Thu Mar 28, 2013 9:19 am
Location: Nottingham, UK

Re: my asoundrc is modified every reboot

Tue Jun 06, 2017 1:05 pm

Ah, thanks Phil. That explains why I haven't come across this behaviour. The only machines I have which care about asoundrc (or ALSA in general) are headless, so no GUI, and hence, no changes.
Steve S
No, I can't think of anything funny that won't offend someone if they want it to...

RAndyB
Posts: 3
Joined: Tue Feb 05, 2013 11:09 am
Location: Herefordshire, UK

Re: my asoundrc is modified every reboot

Thu Mar 08, 2018 1:41 pm

Exactly the same problem.
Using ALSA to crossover and equalise active speakers via usb amplifiers. This works excellently.
A workaround - which will fail at a major software upgrade, probably - is to comment out the line in /usr/share/alsa/alsa.conf that includes the .asoundrc in home directory.

User avatar
E3V3A
Posts: 26
Joined: Sun Apr 17, 2016 7:13 am
Location: -∇φ

Re: my asoundrc is modified every reboot

Fri Apr 27, 2018 8:10 pm

There is some kind of bug in the lxpanel volume applet, that keep on thinking that your sound is not working, and then attempt to replace the .asoundrc with some working default settings, ignoring if there already is one. Do this:

* Remove the volume applet from the lxpanel
* replace the correct .asoundrc
* alsactl kill save_and_quit
* sudo shutdown now

Lotti
Posts: 1
Joined: Sat Nov 03, 2018 10:25 pm

Re: my asoundrc is modified every reboot

Sat Nov 03, 2018 10:27 pm

I find a way to disable the overwrite of ~/.asoundrc.... simply by removing writing perm!! :D

Now the fun part: once rebooted... the taskbar doesn't appear (the one with the start button plus tray icon).

Any idea? :D

Return to “Troubleshooting”