4

I am using Ubuntu Gnome 14.04 and gnome-settings-daemon-localeexec is not started on login. How can I debug why this is happening?

I've found this question: gnome-settings-daemon not starting when I login, but it is not really a solution for me, so I want to debug it and find the real problem and probably file a bug if needed.

I am an experienced linux user but I don't know how the gnome shell startup proces works and where to start.

EDIT:

These might be related questions:

EDIT 2:

I've opened a bug report on launchpad, lets see if that helps: gnome-settings-daemon-localeexec is not started on login

EDIT 3:

Found these other threads that might help:

  • 1
    +1 for a good research effort + well formatted question! :) – jobin May 18 '14 at 11:43
4
+100

Debugging is a process, so I will describe the process that I would use to attack such a problem. The questions are:

  • does it work for a new user account? (ie. is it a generic problem with the system, or with one account?)
  • how is it supposed to be started?
  • is it actually being started?
  • if so, is it crashing or otherwise failing? (This is perhaps more likely than it not being run in the first place, and the results are similar)

If it is a problem with an account (user config), and it works with a newly created account, then you can track the problem down by copying config files from the broken account to the working account, and testing login, until it breaks. (Or, alternatively, start with the broken account, and remove files and directories until it works.) Approach this as an iterative process - begin, copy a directory/file set, did it break the account yes/no, eliminate half the set, goto begin. It can be time consuming, so usually people will just reset the account and not bother to track down what broke.

If you want to track down the software source of the problem, first look in ~/.cache/gdm/session.log and /var/log/syslog to see if there are any obvious errors related to your problem. Then use the source:

$ apt-file search gnome-settings-daemon-localeexec
gnome-settings-daemon: /usr/lib/gnome-settings-daemon/gnome-settings-daemon-localeexec
$ apt-get source gnome-settings-daemon
$ cd gnome-settings-daemon-*
$ grep -r gnome-settings-daemon-localeexec
...
data/gnome-settings-daemon.desktop.in.in:Exec=@libexecdir@/gnome-settings-daemon-localeexec
$ cat data/gnome-settings-daemon.desktop.in.in
[Desktop Entry]
Type=Application
_Name=GNOME Settings Daemon
Exec=@libexecdir@/gnome-settings-daemon-localeexec
OnlyShowIn=GNOME;
NoDisplay=true
X-GNOME-Autostart-Phase=Initialization
X-GNOME-Autostart-Notify=true
X-GNOME-AutoRestart=true

So now we know gnome-settings-daemon-localeexec is run from a .desktop file called gnome-settings-daemon.desktop. Where is it installed?

$ locate gnome-settings-daemon.desktop
/usr/share/gnome/autostart/gnome-settings-daemon.desktop
$ file /usr/lib/gnome-settings-daemon/gnome-settings-daemon-localeexec
/usr/lib/gnome-settings-daemon/gnome-settings-daemon-localeexec: POSIX shell script, ASCII text executable
$ vi /usr/lib/gnome-settings-daemon/gnome-settings-daemon-localeexec
# it is just a wrapper around /usr/lib/gnome-settings-daemon/gnome-settings-daemon

Try to run it to see if there is a problem running the actual daemon (crashing etc.):

$ /usr/lib/gnome-settings-daemon/gnome-settings-daemon-localeexec

You can also try:

$ gnome-settings-daemon --debug

Is the autostart being run? Searching for "debug gnome autostart" results in this page, which suggests:

Enable=false

To enable debugging, set the debug/Enable key to "true" in the /gdm/custom.conf file and restart GDM.

So try that, and then check /var/log/syslog. Another alternative here is to modify /usr/lib/gnome-settings-daemon/gnome-settings-daemon-localeexec and add debug statements. It is just a shell script, so add something like echo "localeexec date $(date) env $(env)" > /tmp/log. Then log in and check /tmp/log.

(When debugging any given program there is usually a way to append your print statements to a "proper" log file, but opening your own log file is often easier and quicker, as it keeps your debugging separate, and does not require understanding the multiple layers of language/system/loglevel/filtering that are in place for any given program.)

The logging and debugging so far will probably have exposed the issue. For harder bugs, that lie in the compiled binaries, you will have to download the source with apt-get source, modify it to add some debugging code (print statements), compile the modified source and install it, and then test it. The great thing here is that the whole apt/dpkg system is designed to make this easy, quick and accessible with only a few commands. A debugger can be useful for examining complex internal program state, but using print statements is a faster process that works across all languages and systems, so that is usually my initial approach.

EDIT:

As a summary of the comments, I've replaced the line in /usr/lib/gnome-settings-daemon/gnome-settings-daemon-localeexec:

exec /usr/lib/gnome-settings-daemon/gnome-settings-daemon

with

nohup /usr/lib/gnome-settings-daemon/gnome-settings-daemon --debug >/tmp/gnome-settings-daemon.log 2>&1 &

in order to capture the process output

  • Thank you @bain. Just for your info, it also fails for newly created accounts so I'll try with the "logging approach". My feeling, as I don't know for sure, is that the script is not even launched. I'll let you know once I can confirm it. – adosaiguas May 20 '14 at 13:56
  • What I've found out by adding the echo to gnome-settings-daemon-localeexec and by enabling logging on gnome-shell is that gnome-settings-daemon-localeexec is launched when gnome-shell is started, but for some reason it dies/shutdown when the user logs in and that I have to start it manually after login (I've been doing this all the time). I understand that this is the bug and that from now on I should try to get help from the gnome team. Any other idea where I could continue debugging? Maybe attaching to the daemon with gdb before logging in? – adosaiguas May 20 '14 at 17:08
  • 1
    @adosaiguas Capture the output of the process ie. in g-s-d-localeexec instead of exec /.../gnome-settings-daemon do (/.../gnome-settings-daemon --debug)&>/tmp/gsd.log. That will also show you if the process gets a signal and dies. Alternatively you could wrap the whole script - mv g-s-d-localeexec to g-d-s-localeexec.real then in g-d-s.localeexec run the .real executable and redirect the output. – bain May 20 '14 at 17:32
  • 1
    @adosaiguas Another thing you might try is running it under strace: just put strace in front of the call to gnome-settings-daemon and make sure you redirect the output somewhere. It dumps quite a bit of output, but often if the process is suddenly dying you will see some the syscall that failed just before it dies. – bain May 20 '14 at 17:45
  • I've replaced the exec line by this one: (/usr/lib/gnome-settings-daemon/gnome-settings-daemon --debug)&>/tmp/gnome-settings-daemon.log 2>&1 and nothing is written to the log. I 'll try with that strace. – adosaiguas May 20 '14 at 17:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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