After login, desktop hangs for ~20s before showing Unity. Bootchart suggests pactl. Help?

After I log in to my Ubuntu 14.04 desktop, I see my desktop background for approximately 20 seconds before the actual Unity desktop loads. I installed bootchart and that suggests that the problem is that pactl is being called and taking a long time to do something, and that the main desktop startup is blocked on that:

enter image description here

How can I identify where this pactl call is, and why it might be taking a long time?

Logs from pulseaudio startup are at: http://kryogenix.org/random/pulseverbose/.


For Diagnosis (not the solution) you should enable logging on pactl module:

  • edit (with sudo) following file

    /etc/pulse/client.conf
    
  • and add following line to the file

    extra-arguments = -vvvv --log-target=newfile:/tmp/pulseverbose.log --log-time=1
    
  • After reboot log in /tmp/pulseverbose.log will hopefully contain potential problem of pulse audio control. There could be more than one file.

  • Come back and paste it here and we can give you additional hints.

  • Remove! the line from /etc/pulse/client.conf after you finish.

For Solution I would first try to reinstall pulseaudio, but after we will see logs, possibly this will change. Therefore give us your logs first. Eventually steps to reinstall pulseaudio and alsa could be:

sudo apt-get remove --purge alsa-base pulseaudio
sudo apt-get install alsa-base pulseaudio
sudo alsa force-reload

but this can be helpless for example if your drivers are wrong/crippled by wrong settings etc.

Update: Diagnosis from log files: Core of your problem lies here

D (   0.005|   0.000)  [pulseaudio] module-udev-detect.c: Loading module-alsa-card with arguments 'device_id="0" name="pci-0000_00_03.0" card_name="alsa_card.pci-0000_00_03.0" namereg_fail=false tsched=yes fixed_latency_range=no ignore_dB=no deferred_volume=yes use_ucm=yes card_properties="module-udev-detect.discovered=1"'
D (   3.010|   3.004)  [pulseaudio] reserve-wrap.c: Unable to contact D-Bus session bus: org.freedesktop.DBus.Error.NoServer: Failed to connect to socket /tmp/dbus-zgX6izEp13: Connection refused

followed by many errors like this:

I (   3.011|   0.000)  [pulseaudio] alsa-util.c: Error opening PCM device hw:0: No such file or directory

which takes your time on startup.

Proposed solutions:

  1. xxx Looks like there is a temporary socket left open and pulseaudio does not make it over. Please check if there is a /tmp/dbus-zgX6izEp13 file and if yes, remove it by sudo rm /tmp/dbus-zgX6izEp13 and try to reboot if there is a change.

    -- Update: there is not such a file, means that it is created just before the pulseaudio wants to use it or something wants to write it simultaneously. Some configuration could be michmached/doubled.

  2. You can try to purge and reinstall pulseaudio. See the text above.

Please give a short reply if something helps.