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

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

3 Answers 3

up vote 3 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.... –  belacq 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. –  belacq 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 . –  belacq 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 at 15:00

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

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.