10

I have a weird problem with 12.04 LTS.

Regardless of what I do to the ~/.config/user-dirs.dirs file, whenever I login again the next time, that file gets all set to $HOME only. Something is happening during login using lightdm that overrides the contents of that file.

If I login and do a xdg-user-dirs-update --force then the contents of the file are OK. After I logout, the file is still OK. It's when I login again using lightdm that something goes wrong.

It's quite annoying.

2

5 Answers 5

2

There exists an autostart script

/etc/xdg/autostart/user-dirs-update-gtk.desktop

Which calls the program xdg-user-dirs-gtk-update, which appears to have no man page or --help explanation, but I am guessing might be the cause.

You can either delete this script (which appears to belong to the package xdg-user-dirs-gtk, and may be recreated if it is updated), or add a line Hidden=true to the autostart file, which should prevent it running (and you should be asked if you want to keep your modified copy during any future updates).

2
  • I did something similar, but created a script in /etc/X11/Xsession.d/ to overwrite the XDG resets.
    – sybreon
    Nov 21, 2012 at 4:51
  • The Comment field in my .desktop file says Update common folders names to match current locale. But that makes no sense why I'd want to switch my actual path depending on locale; I could see switching the display string for those folders, but not the filesystem path itself.
    – palswim
    Jan 7, 2019 at 23:00
0

Googling your problem led me to xdg-user-dirs, which may be installed from the Ubuntu Software Center. It claims the following feature:

This program reads a configuration file, and a set of default directories. It then creates localized versions of these directories in the users home directory and sets up a config file in $(XDG_CONFIG_HOME)/user-dirs.dirs (XDG_CONFIG_HOME defaults to ~/.config) that applications can read to find these directories.

The full documentation can be found here.

1
  • that's not the solution as the problem is that these files are somehow 'reset' after each login.
    – sybreon
    Nov 4, 2012 at 4:17
0

I suggest to check the following points:

  • Try to check if XDG_CONFIG_HOME is set to a different location as '~/.config`.
    • on shell level
    • via grep XDG_CONFIG_HOME /etc/*profile /etc/*rc ~/.*rc ~/.*profile /etc/X11/Xsession /etc/X11/Xsession.d/*

As as workaround use symbolic links between the standard and your custom directory names.

e.g.

 cd ${HOME}
 function link() {
 local dir=$1
 shift 1
 [ -e ${dir} ] || mkdir -p ${dir}
 for name in $*
 do
 if [ -L ${name} ]
 then
 if [ "$(readlink ${name})" = "${dir}" ]
 then
 [ -e  "${dir}" ] || mkdir -p "${dir}"
 echo "${name} allready converted to ${dir}"
 else
 echo "${name} (link) converted to ${dir}"
 [ -e  "${dir}" ] || mkdir -p "${dir}"
 mv -av ${name}/* ${dir}/ 2>/dev/null    || true # can be emtpy
 mv -av ${name}/.??* ${dir}/ 2>/dev/null || true # can be emtpy
 rm -f ${name}
 ln -svf ${dir} ${name}
 fi
 else
 if [ -d ${name} ]
 then
 mv -av ${name}/* ${dir}/ 2>/dev/null    || true # can be emtpy
 mv -av ${name}/.??* ${dir}/ 2>/dev/null || true # can be emtpy
 rmdir ${name}
 ln -sv ${dir} ${name};
 echo "${name} (dir) converted to ${dir}"
 else
 ln -sv ${dir} ${name};
 echo "${name} linked to ${dir}"
 fi
 fi
 done

 }


 #     real                DE          EN
 link  ~/data/templates    Vorlagen    Templates
 link  ~/data/public       Öffentlich  Public
 link  ~/data/documents    Dokumente   Documents
 link  ~/data/music        Musik       Music
 link  ~/data/photo        Bilder      Pictures
 link  ~/data/video        Videos
 link  ~/data/privat       Privat
1
  • for the moment, i've got a work-around to force the directories using a /etc/X11/Xsession.d/ script.
    – sybreon
    Nov 20, 2012 at 15:44
0

The entries would get reset if the custom dirs do not exist when the update runs. Is it possible that your home dir is not mounted until late in the login process? Maybe you can set the defaults in /etc/xdg/user-dirs.defaults so that it gets rewritten to the same paths anyway?

1
  • the user home dir is a glusterfs mount that is mounted during boot.. so, it's available when the user logs in.
    – sybreon
    Nov 20, 2012 at 15:44
0

After making the changes and saving the file but before you log back in, execute

echo "enabled=false" > ~/.config/user-dirs.conf

This creates user-dirs.conf that should prevent any further reset.

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.