hippy
Posts: 12309
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

~/.asoundrc disappeared ?

Tue Dec 15, 2020 3:55 pm

Since rebooting after a recent update/upgrade it seems my '~/.asoundrc' file is being deleted automatically - Does anyone know what's deleting it or how to prevent that ?

I am going to invest time and effort in updating my apps to use PulseAudio but it hadn't been a priority as they were still working. Now they aren't working because they are dependent on '~/.asoundrc' being present and it's not.

User avatar
kerry_s
Posts: 3927
Joined: Thu Jan 30, 2020 7:14 pm

Re: ~/.asoundrc disappeared ?

Tue Dec 15, 2020 4:01 pm

because the pulseaudio update already came & it's the current default.

fruitoftheloom
Posts: 27225
Joined: Tue Mar 25, 2014 12:40 pm

Re: ~/.asoundrc disappeared ?

Tue Dec 15, 2020 4:04 pm

kerry_s wrote:
Tue Dec 15, 2020 4:01 pm
because the pulseaudio update already came & it's the current default.

https://www.raspberrypi.org/blog/new-ra ... mber-2020/
Take what I advise as advice not the utopian holy grail, and it is gratis !!

hippy
Posts: 12309
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: ~/.asoundrc disappeared ?

Tue Dec 15, 2020 4:09 pm

kerry_s wrote:
Tue Dec 15, 2020 4:01 pm
because the pulseaudio update already came & it's the current default.
I am well aware of that; it was about a week ago. After sorting out the problems that caused my apps were still working, have been ever since that change, '~/.asoundrc' was still persisting across reboots. Now something is deleting '~/.asoundrc' and that's what's broken my apps.

Code: Select all

pi@Pi3B:~ $ echo > .asoundrc
pi@Pi3B:~ $ echo > .asoundrc-xxx
pi@Pi3B:~ $ ls -l .as*
-rw-r--r-- 1 pi pi 1 Dec 15 16:15 .asoundrc
-rw-r--r-- 1 pi pi 1 Dec 15 16:15 .asoundrc-xxx
pi@Pi3B:~ $ sudo reboot

Code: Select all

pi@Pi3B:~ $ ls -l .as*
-rw-r--r-- 1 pi pi 1 Dec 15 16:15 .asoundrc-xxx

ejolson
Posts: 9602
Joined: Tue Mar 18, 2014 11:47 am

Re: ~/.asoundrc disappeared ?

Tue Dec 15, 2020 5:49 pm

hippy wrote:
Tue Dec 15, 2020 4:09 pm
kerry_s wrote:
Tue Dec 15, 2020 4:01 pm
because the pulseaudio update already came & it's the current default.
I am well aware of that; it was about a week ago. After sorting out the problems that caused my apps were still working, have been ever since that change, '~/.asoundrc' was still persisting across reboots. Now something is deleting '~/.asoundrc' and that's what's broken my apps.

Code: Select all

pi@Pi3B:~ $ echo > .asoundrc
pi@Pi3B:~ $ echo > .asoundrc-xxx
pi@Pi3B:~ $ ls -l .as*
-rw-r--r-- 1 pi pi 1 Dec 15 16:15 .asoundrc
-rw-r--r-- 1 pi pi 1 Dec 15 16:15 .asoundrc-xxx
pi@Pi3B:~ $ sudo reboot

Code: Select all

pi@Pi3B:~ $ ls -l .as*
-rw-r--r-- 1 pi pi 1 Dec 15 16:15 .asoundrc-xxx
In my opinion no part of the boot or login process should delete files in the user account. That this is happening sounds like severe misjudgement.

To pile layers of workarounds upon bugs you could always modify your user profile to automatically recreate a new .asoundrc file each time upon login. Maybe that same script could automatically send an email each time the file was deleted so someone can keep track of what's going on.

PhilBr
Posts: 102
Joined: Tue Oct 31, 2017 5:28 pm

Re: ~/.asoundrc disappeared ?

Tue Dec 15, 2020 8:31 pm

I had a similar problem with a video config file being overwritten. It was not a pi - Ubuntu and mythtv but the principle is the same.
I would have preferred to understand why but solved it by making the file immutable.
Fixed the problem but I have to remember to reverse the change if I want to re-purpose the disk.
Hth
Phil

renice123
Posts: 358
Joined: Tue Oct 15, 2019 3:56 pm

Re: ~/.asoundrc disappeared ?

Wed Dec 16, 2020 9:13 am

This is because you are using a standard graphical shell. Which deletes the file. I also tried to do something about it, but the amount of glitches in the standard graphical shell made me switch to another graphical shell. Since then, my Raspberry does not freeze due to the rampage of the built-in buggy file manager and files do not self-delete. Just take a note - LXDE is not the best shell.

hippy
Posts: 12309
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: ~/.asoundrc disappeared ?

Wed Dec 16, 2020 9:44 am

renice123 wrote:
Wed Dec 16, 2020 9:13 am
This is because you are using a standard graphical shell. Which deletes the file.
Seems you are right. When I use 'raspi-config' to boot to console rather than boot to desktop my '~/.asoundrc' persists across reboots. As soon as I execute 'startx' it is deleted.

Thanks for that insight.

It then adds another dimension to the issue; whether '~/.asoundrc' should be deleted or not -

If it is not necessary to delete '~/.asoundrc'; why is it being deleted when the desktop is used ?

If it is necessary to delete '~/.asoundrc'; why is it not being deleted when the desktop is not used ?

renice123
Posts: 358
Joined: Tue Oct 15, 2019 3:56 pm

Re: ~/.asoundrc disappeared ?

Wed Dec 16, 2020 9:52 am

As far as I remember, the answer is simple - alsa saves the settings in a file (somewhere in the var directory) and the volume control on the other panel and panel widgets are used to "change" alsa. It is easy to check this if you "switch" from one sound card to another while LXDE is running. The asoundrc file will at least be corrupted. I think now that pulseaudio is working, the number of errors will increase even more.
Kill the volume control and all the soundbar widgets and see what happens.

hippy
Posts: 12309
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: ~/.asoundrc disappeared ?

Wed Dec 16, 2020 10:43 am

renice123 wrote:
Wed Dec 16, 2020 9:52 am
As far as I remember, the answer is simple - alsa saves the settings in a file (somewhere in the var directory) and the volume control on the other panel and panel widgets are used to "change" alsa. It is easy to check this if you "switch" from one sound card to another while LXDE is running. The asoundrc file will at least be corrupted.
In the Good Old Days, before this PulseAudio change happened a week or so ago, the desktop volume applet used to change '~/.asoundrc'. That could be read and written from the command line or program to determine or alter audio routing programmatically.

Now '~/.asoundrc' is deleted when the desktop launches and it isn't recreated when the PulseAudio volume applet is adjusted. There may be something in /var which is the equivalent of '~/.asoundrc' but I have no idea where or what.
renice123 wrote:
Wed Dec 16, 2020 9:52 am
I think now that pulseaudio is working, the number of errors will increase even more.
Probably. It seems the focus may have been on making Chromium work with less consideration given to other things. I still have no audio from Firefox-ESR and of course my own issues.
renice123 wrote:
Wed Dec 16, 2020 9:52 am
Kill the volume control and all the soundbar widgets and see what happens.
I think I'll pass on that as I have busked round the issue, have my apps working for now, and don't want to mess things up.

It's hard enough running on shifting sands without digging a trench to fall into :P

HiassofT
Posts: 333
Joined: Fri Jun 30, 2017 10:07 pm
Location: Salzburg, Austria

Re: ~/.asoundrc disappeared ?

Wed Dec 16, 2020 1:54 pm

Oh dear...

Code: Select all

root@raspberrypi:~# strings /usr/lib/arm-linux-gnueabihf/lxpanel/plugins/volumepulse.so | grep asoundrc
rm -f ~/.asoundrc
root@raspberrypi:~# apt-get source lxplug-volumepulse
...
root@raspberrypi:~# grep -r -1 asoundrc lxplug-volumepulse-0.2
lxplug-volumepulse-0.2/plugins/volumepulse/volumepulse.c-    /* Delete any old ALSA config */
lxplug-volumepulse-0.2/plugins/volumepulse/volumepulse.c:    vsystem ("rm -f ~/.asoundrc");
lxplug-volumepulse-0.2/plugins/volumepulse/volumepulse.c-

I guess you should file a bug report and/or just uninstall the downstream RPiOS lxplug-volumepulse package. This is definitely not something a desktop plugin should be doing.

so long,

Hias

hippy
Posts: 12309
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: ~/.asoundrc disappeared ?

Wed Dec 16, 2020 3:05 pm

HiassofT wrote:
Wed Dec 16, 2020 1:54 pm
... /plugins/volumepulse/volumepulse.c: vsystem ("rm -f ~/.asoundrc");
Many thanks for tracking that down.

Seems I installed the version with the deletion in it a few days ago but it didn't break things at the time.

I often reboot to make sure update/upgrade haven't broken my apps so I guess what happened was '~/.asoundrc' persisted through that reboot so my apps continued working, the desktop started and then the applet deleted '~/.asoundrc'. Only after this more recent reboot was it missing and my apps failed.

ejolson
Posts: 9602
Joined: Tue Mar 18, 2014 11:47 am

Re: ~/.asoundrc disappeared ?

Wed Dec 16, 2020 5:00 pm

HiassofT wrote:
Wed Dec 16, 2020 1:54 pm
Oh dear...

Code: Select all

root@raspberrypi:~# strings /usr/lib/arm-linux-gnueabihf/lxpanel/plugins/volumepulse.so | grep asoundrc
rm -f ~/.asoundrc
root@raspberrypi:~# apt-get source lxplug-volumepulse
...
root@raspberrypi:~# grep -r -1 asoundrc lxplug-volumepulse-0.2
lxplug-volumepulse-0.2/plugins/volumepulse/volumepulse.c-    /* Delete any old ALSA config */
lxplug-volumepulse-0.2/plugins/volumepulse/volumepulse.c:    vsystem ("rm -f ~/.asoundrc");
lxplug-volumepulse-0.2/plugins/volumepulse/volumepulse.c-

I guess you should file a bug report and/or just uninstall the downstream RPiOS lxplug-volumepulse package. This is definitely not something a desktop plugin should be doing.

so long,

Hias
Good detective work!

There seems to be an astonishing lack of code review going on in those lx toolbars. Perhaps that's why so many of them also have memory leaks. Is there any window manager and desktop that is not infested with trolls pushing bad code?

Is there any public measure of the code quality of these open source projects?

renice123
Posts: 358
Joined: Tue Oct 15, 2019 3:56 pm

Re: ~/.asoundrc disappeared ?

Wed Dec 16, 2020 5:28 pm

Of all the shells, only a few meet your needs. As a rule, these are so-called tiled graphic shells. I am using Awesome and disable all extensions. No memory leaks, no freezes, and extremely fast performance. All other shells are built on the principle of "one shell on top of another, into which the third shell programs are embedded in order to run the fourth shell programs through third-party libraries." But high-speed and "non-buggy" shells require a special style of work. Difficult to switch from the standard one to https://awesomewm.org/ Another philosophy, but it is convenient for those who are used to the command line, but also want to use browsers, other graphic programs

ejolson
Posts: 9602
Joined: Tue Mar 18, 2014 11:47 am

Re: ~/.asoundrc disappeared ?

Wed Dec 16, 2020 6:11 pm

renice123 wrote:
Wed Dec 16, 2020 5:28 pm
Of all the shells, only a few meet your needs. As a rule, these are so-called tiled graphic shells. I am using Awesome and disable all extensions. No memory leaks, no freezes, and extremely fast performance. All other shells are built on the principle of "one shell on top of another, into which the third shell programs are embedded in order to run the fourth shell programs through third-party libraries." But high-speed and "non-buggy" shells require a special style of work. Difficult to switch from the standard one to https://awesomewm.org/ Another philosophy, but it is convenient for those who are used to the command line, but also want to use browsers, other graphic programs
I knew a student a couple years ago who used Awesome. Sometimes I think I should have watched how it was actually used. Personally, I'm used to a stacking window manager where I can
  • Type in the window not on top.
    • Move and resize the windows while not changing their stacking order.
    While an increasing number of programs insist on raising themselves, grabbing focus or making weird popups that bypass window-manager policies, things still work well enough.

    At the same time, someday I might retire my current configuration and switch. Hopefully I can find something without memory leaks that doesn't intentionally erase my files. Since lx is out, maybe it's time to make an awesome choice.

    silky_milk
    Posts: 2
    Joined: Sat Dec 12, 2020 12:08 pm

    Re: ~/.asoundrc disappeared ?

    Sat Dec 19, 2020 9:56 am

    I had my .asoundrc in the home folder too and it disappeared on reboot. I heard you can also put it in the etc folder so I tried this and it worked after reboot !! remember for the etc folder you need the sudo commands.

    Code: Select all

    cd ../../etc
    sudo touch .asoundrc
    sudo nano .asoundrc
    
    then copy the contents and save.
    EDIT: My suggestion was not ideal. I ended up ditching .asoundrc and using pulseaudio as of new update. PA is still causing problems for me though...
    Last edited by silky_milk on Wed Jan 20, 2021 5:22 am, edited 1 time in total.

    wkeeling
    Posts: 150
    Joined: Fri Aug 25, 2017 2:16 pm
    Location: Houston Texas

    Re: ~/.asoundrc disappeared ?

    Sun Jan 10, 2021 10:01 pm

    anyone find a fix for this issue? I tried putting a copy in /etc is was not removed but is was also not used by the pi user.
    Willie Keeling

    User avatar
    HawaiianPi
    Posts: 7216
    Joined: Mon Apr 08, 2013 4:53 am
    Location: Aloha, Oregon USA

    Re: ~/.asoundrc disappeared ?

    Mon Jan 11, 2021 12:31 am

    What kind of "apps" are not working? Were they installed from the RPiOS repos or something you wrote yourself?

    I upgraded my system to the latest Pulseaudio based system following the instructions in the December Blog post and most things just worked. I seem to recall having to go into the settings for Audacious and manually changing it to Pulseaudio, but everything else was working fine.

    Whatever apps you have that are not working probably just need to be set to use Pulseaudio.

    I know Pulseaudio used to be a hot mess, and I was skeptical when I read about the change, but it's working great for me.
    My mind is like a browser. 27 tabs are open, 9 aren't responding,
    lots of pop-ups, and where is that annoying music coming from?

    Return to “Troubleshooting”