Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

I recently upgraded my Dell E6510 laptop to 12.04 (Ubuntu with Unity). I've noticed that after every reboot, the volume always resets itself to a maximum level.

While I try to work out whether this is a bug, I'd like to know if there is something I can do at login or startup that will mute (or perhaps just reduce) the system volume.

After checking reverendj1's answer, I tried pacmd set-sink-volume 0 0 and then sudo alsactl store, after the first command failed to work.

I also did a right-click on the volume indicator and went to Sound Settings..." -- from there, I selected Built-in Audio Analog Output on the Output tab (it was my only choice, but it wasn't highlighted for some reason).

During this troubleshooting process, I rebooted a few times. I'm not 100% sure whether any of the Analog Output settings had ever been altered from the install defaults, but I'm documenting the setting for posterity, in case someone else runs into this:

Analog Output Settings

share|improve this question
2  
i'm really tired of this issue, pulse just does not save volume (tried 2 soundcards and 1 usb headset, tried ubuntu, xubuntu, lubuntu). Does pulse work at all? I would try ponymix as a last resort. –  kemsky Mar 13 '13 at 23:10
    
I've worst case than yours, volume randomly goes to maximum when some dialogues pop up, e.g. kdiff3/konsole dialogue, this sudden high volume did hurt my ears . I'm use Fedora though. –  林果皞 Jul 10 at 7:59

5 Answers 5

up vote 4 down vote accepted

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)

share|improve this answer
1  
Also, here is some information on how to create a boot script if you do not know: http://en.kioskea.net/faq/3348-ubuntu-executing-a-script-at-startup-and-shutdow‌​n –  reverendj1 May 14 '12 at 14:29
    
My understanding is that a sink is a sound card, but you can have virtual sinks too. 0 should be your default. You can list them with this command: pacmd list-sinks –  reverendj1 May 14 '12 at 14:34
    
Argh -- the command seems to work (sets volume to 0), but I still have sound coming from the laptop speakers. Doesn't seem right.... –  belacqua May 15 '12 at 21:58
    
When you say that you have sound coming through the speakers, do you mean the login sound or something, and then it mutes after? Or do you meant that it just SHOWS that the sound is muted, and sound still plays? I just saw that alsa actually calls PulseAudio on startup. I was under the impression that PulseAudio replaced alsa. Alsa is supposed to save the current volume at shutdown, and restore it on boot. I think this is not happening for you. Try this, set your volume to a low volume, then use the following command: sudo alsactl store –  reverendj1 May 16 '12 at 14:59
    
Sound was from an embedded web video (youtube, I think). Yes, it does show the sound at zero (not marked muted, however), but isn't really muted or at zero. Trying the alsactl store workaround. –  belacqua May 16 '12 at 17:49

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.

share|improve this answer
    
Thanks, I'll give this a shot. Hadn't heard of ponymix - apparently was previously 'pulsemix' -- bbs.archlinux.org/viewtopic.php?id=141324 . –  belacqua Oct 26 '12 at 15:43
    
You can run ponymix locally without using sudo, just to let you know. This also works on later versions of Ubuntu, presumably from 12.04 all the way up to 14.04 (which is what I'm using). –  Ehtesh Choudhury Mar 25 '14 at 15:00

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

share|improve this answer

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 .

share|improve this answer

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

share|improve this answer
    
Hi shellyfrank, while this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. Please take a look here: Why and how are some answers deleted? –  bummi Apr 30 at 14:27

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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