Workaround for volume settings going to maximum after reboot

Solution 1:

To mute the sounds you could use this command:

pacmd set-sink-volume 0 0

The first 0 is the sink, and the second one is the volume you want to set it to. The volume ranges from 0 to 65536, so to set it to half-volume, you could simply use this:

pacmd set-sink-volume 0 32768

Here is a link to more information on using the PulseAudio CLI (pacmd)

Solution 2:

Download and extract ponymix from https://github.com/falconindy/ponymix

sudo apt-get install libpulse-dev
sudo make
sudo cp ponymix /usr/bin/ponymix
sudo chmod +x /usr/bin/ponymix

test if it is working

ponymix get-volume

make startup-script

sudo gedit /usr/bin/load-sound

add this to the file /usr/bin/load-sound:

#! /bin/sh
cat /opt/pulse-volume | xargs /usr/bin/ponymix set-volume
exit 0

activate logon script (load-sound) open “startup applications” click add name: Load pulseaudio volume command: load-sound

make logoff script (save-sound):

sudo gedit /usr/bin/save-sound

add this to the file /usr/bin/save-sound:

#! /bin/sh
su -c "/usr/bin/ponymix get-volume > /opt/pulse-volume" YOUR_CURRENT_USERNAME
exit 0

activate logoff script (will be run as root):

sudo gedit /etc/lightdm/lightdm.conf

add this to the file /etc/lightdm/lightdm.conf:

[SeatDefaults]
session-cleanup-script=/usr/bin/save-sound

Reboot.

Solution 3:

I have had this issue with my audio volume resetting to 100% after reboot ever since I started using Linux two years ago.

Basically the advice given above by GigabyteProductions is leading me to the right place, and it should really be working, but it isn't working on my system. So I had to look a little further, and I have learnt a great deal, albeit not without pain.

Referring to the bug report https://bugs.launchpad.net/ubuntu/+source/alsa-utils/+bug/449783 I found some useful clues to my problem. In the default /etc/pulse/default.pa you will find these entries:
### Automatically restore the volume of streams and devices load-module module-device-restore load-module module-stream-restore load-module module-card-restore

In the above mentioned bug report in comment#13 the user mentions that by adding load-module module-volume-restore to default.pa, had sorted out the issue for him, although in comment #16 it points out that pulseaudio started from the command line warns of the module being deprecated, and that module-stream-restore be used instead. Pulseaudio tries to load module-stream-restore twice, which then causes it to crash. At reboot pulseaudio doesn't initiate and the last ALSA master volumes are restored automatically. This isn't a good idea for various reasons. A better option would be to remove PulseAudio altogether, if the object is to only have the alsa volumes restored after reboot, or startup generally, rather than to have pulseaudio hanging/ crashing due to a deprecated module.

I ended up disgruntled and I actually removed PulseAudio, thinking that I could live without it, since I have a fairly basic sound setup, but it only took me a short while to discover the drawbacks, and I installed it again. Back at square one, I went through every available on-line resource to get the volumes restored with PulseAudio server simultaniously running. Nothing worked...

The ALSA volume settings are saved with the command:

# alsactl store

Volume settings are saved to /var/lib/alsa/asound.state by default. To save these settings, and to retrieve them with # alsactl restore you need root.

I set up a startup script in /etc/init.d (and updated update-rc.d) but it proved ineffective. The script would run correctly, but the result gets cancelled shortly after login by PulseAudio and you end up with volumes set to 100% again. I figured that the only way to get ahead of PulseAudio would be to kill the server, start it again and then restore the settings while the server is running, after login in, to restore the alsa settings.

Another approach is to instruct alsactl to store the volume setting to the home folder so you can run a script calling it without root. I created the directory /home/<user>/.config/alsa/ and I entered:

alsactl -f /home/<user>/.config/alsa/asound.state store

I added a new entry in my Settings -->Session-and-Startup menu by entering the name "alsa-restore" and the command alsactl restore -f /home/<user>/.config/alsa/asound.state and rebooted. Once again I had no luck, and I was getting close to running out of options, and patience.

But then, I saw the light! I wrote a shell script, named it sound-restore.sh and placed it in a folder in my home directory called /home/<user>/scripts/ containing these lines:

#! /bin/sh pulseaudio -k #just in case pulseaudio is already running pulseaudio -D alsactl -f /home/<user>/.config/alsa/asound.state restore

I made the file executable with sudo chmod+x and I went back to the Session and Startup dialog and changed the command in my autostart item to sh /home/<user>/scripts/sound-restore.sh. Make sure that the preset startup item named "PulseAudio Sound System" is unchecked. After the next reboot the volume settings were restored to the previous settings at last! I've been testing it for a while and it works perfectly fine, and with the pulseaudio daemon running happily in the background.

System:
Linux Mint 17.1 XFCE
hardware:
AthlonXP +2600
PCI soundcard: ESS Technology ES1938 Solo-1

Solution 4:

I know this is a really old question, but this may still help users in the future with this problem.

You need make sure that you have these two commands present at the beginning of your /etc/pulse/default.pa file:

load-module module-card-restore
load-module module-device-restore

These deal with saving the volumes of virtual pulseaudio cards and physical cards and restoring them when they come back onto the system.

I have many more modules in my default.pa to make pulseaudio act the way you'd want it to, so if anybody wants to see what default.pa usually looks like on a newly installed Ubuntu 14.04 system, here it is:

#!/usr/bin/pulseaudio -nF
#
# This file is part of PulseAudio.
#
# PulseAudio is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# PulseAudio is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with PulseAudio; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.

# This startup script is used only if PulseAudio is started per-user
# (i.e. not in system mode)

.nofail

### Load something into the sample cache
#load-sample-lazy x11-bell /usr/share/sounds/gtk-events/activate.wav
#load-sample-lazy pulse-hotplug /usr/share/sounds/startup3.wav
#load-sample-lazy pulse-coldplug /usr/share/sounds/startup3.wav
#load-sample-lazy pulse-access /usr/share/sounds/generic.wav

.fail

### Automatically restore the volume of streams and devices
load-module module-device-restore
load-module module-stream-restore
load-module module-card-restore

### Automatically augment property information from .desktop files
### stored in /usr/share/application
load-module module-augment-properties

### Should be after module-*-restore but before module-*-detect
load-module module-switch-on-port-available

### Load audio drivers statically
### (it's probably better to not load these drivers manually, but instead
### use module-udev-detect -- see below -- for doing this automatically)
#load-module module-alsa-sink
#load-module module-alsa-source device=hw:1,0
#load-module module-oss device="/dev/dsp" sink_name=output source_name=input
#load-module module-oss-mmap device="/dev/dsp" sink_name=output source_name=input
#load-module module-null-sink
#load-module module-pipe-sink

### Automatically load driver modules depending on the hardware available
.ifexists module-udev-detect.so
load-module module-udev-detect
.else
### Use the static hardware detection module (for systems that lack udev support)
load-module module-detect
.endif

.ifexists module-android-audio-hal.so
load-module module-android-audio-hal
.endif

### Automatically connect sink and source if JACK server is present
.ifexists module-jackdbus-detect.so
.nofail
load-module module-jackdbus-detect channels=2
.fail
.endif

### Automatically load driver modules for Bluetooth hardware
.ifexists module-bluetooth-policy.so
load-module module-bluetooth-policy
.endif

.ifexists module-bluetooth-discover.so
load-module module-bluetooth-discover
.endif

### Load several protocols
.ifexists module-esound-protocol-unix.so
load-module module-esound-protocol-unix
.endif
load-module module-native-protocol-unix

### Network access (may be configured with paprefs, so leave this commented
### here if you plan to use paprefs)
#load-module module-esound-protocol-tcp
#load-module module-native-protocol-tcp
#load-module module-zeroconf-publish

### Load the RTP receiver module (also configured via paprefs, see above)
#load-module module-rtp-recv

### Load the RTP sender module (also configured via paprefs, see above)
#load-module module-null-sink sink_name=rtp format=s16be channels=2 rate=44100 sink_properties="device.description='RTP Multicast Sink'"
#load-module module-rtp-send source=rtp.monitor

### Load additional modules from GConf settings. This can be configured with the paprefs tool.
### Please keep in mind that the modules configured by paprefs might conflict with manually
### loaded modules.
.ifexists module-gconf.so
.nofail
load-module module-gconf
.fail
.endif

### Automatically restore the default sink/source when changed by the user
### during runtime
### NOTE: This should be loaded as early as possible so that subsequent modules
### that look up the default sink/source get the right value
load-module module-default-device-restore

### Automatically move streams to the default sink if the sink they are
### connected to dies, similar for sources
load-module module-rescue-streams

### Make sure we always have a sink around, even if it is a null sink.
load-module module-always-sink

### Honour intended role device property
load-module module-intended-roles

### Automatically suspend sinks/sources that become idle for too long
load-module module-suspend-on-idle

### If autoexit on idle is enabled we want to make sure we only quit
### when no local session needs us anymore.
.ifexists module-console-kit.so
load-module module-console-kit
.endif
.ifexists module-systemd-login.so
load-module module-systemd-login
.endif

### Enable positioned event sounds
load-module module-position-event-sounds

### Cork music/video streams when a phone stream is active
#load-module module-role-cork

### Modules to allow autoloading of filters (such as echo cancellation)
### on demand. module-filter-heuristics tries to determine what filters
### make sense, and module-filter-apply does the heavy-lifting of
### loading modules and rerouting streams.
load-module module-filter-heuristics
load-module module-filter-apply

# X11 modules should not be started from default.pa so that one daemon
# can be shared by multiple sessions.

### Load X11 bell module
#load-module module-x11-bell sample=bell-windowing-system

### Register ourselves in the X11 session manager
#load-module module-x11-xsmp

### Publish connection data in the X11 root window
#.ifexists module-x11-publish.so
#.nofail
#load-module module-x11-publish
#.fail
#.endif

### Make some devices default
#set-default-sink output
#set-default-source input

If you want to have a modified default.pa for your login account, you save it into ~/.config/pulse/default.pa. That one will be loaded instead of the master /etc/pulse/default.pa (so remember to put everything that's in the master one for card detecting and such).

But, since Linux and a lot of its distributions have made a lot of progress since when this question was posted, everyone's system should come with a correctly set-up /etc/pulse/default.pa .

Solution 5:

Sorry to labour the point, but I've gone through my answer and found it full of gaps. I have written a full tutorial on the linux mint forum, to which I would like to refer anyone looking for this particular answer. So, here is the link.

[Solved] Fix for ALSA Volume reset to 100% at boot/ reboot