Editing ~/.config/user-dirs.dirs does not permanently change user directory locations

6,851

I figure it is bad form to leave my question without an answer. I eventually resolved all issues by following bessman's solution by the letter. He made it much clearer than the official docs how I was supposed to modify fstab - and now I also know how to create backups before I do so and got rid of the "documents inside a documents folder" issue - so triple props to his step-by-step solution. I wish I could upvote him twice since nothing else seemed to work.

Share:
6,851

Related videos on Youtube

Frikster
Author by

Frikster

Updated on September 18, 2022

Comments

  • Frikster
    Frikster about 1 year

    So it appears the same is happening to me on Ubuntu 14.04 as has previously been reported as a bug here

    A difference though is I am trying to move the Home directory folders to a separate drive and am simply trying to follow the instructions here (scroll down to Configure Your Subfolders (Linux))

    TL;DR: Attempt 1 and 2 are the important ones that really show my problem. Rest just there to show what else I've tried.

    Attempt 1

    I found a question with no accepted answer that has what appears to be precisely my problem.

    Following the first suggested solution I tried using symbolic links:

    cornelis@Bob:~$ ln -s /media/cornelis/Storage/Home/Documents /home/cornelis/Documents
    

    This created the folder that linked to my other drive. I then tried modifying the user-dirs.dirs file as before such that XDG_DOCUMENTS_DIR="$HOME/Documents/Documents" where the symbolic link folder was created. I logged out and logged back in and presto! It worked! I see that the Documents shortcut links to $HOME/Documents/Documents, the user-dirs.dirs file is still appropriately modified. Looks like the change is permanent. Though less than ideal since I have to use a Documents inside a Documents folder. I cannot do something as follows that I had hoped would redirect the Documents folder directly:

    cornelis@Bob:~$ ln -s /media/cornelis/Storage/Home/Documents /home/cornelis
    ln: failed to create symbolic link ‘/home/cornelis/Documents’: File exists
    

    I reboot. Disaster. Click image below.

    enter image description here

    1. The Documents folder is missing from the Places shortcut
    2. The original Documents folder is now vanilla
    3. The symbolic link inside the Documents folder is broken

    Also, this reverted again: XDG_DOCUMENTS_DIR="$HOME/"

    I used xdg-user-dirs-update --force to reset Documents back to its default.

    Attempt 2

    Finally, I looked at the second suggested solution and I guess I can now safely assume that my problem is that my second drive isn't being mounted automatically upon boot. Since I have no issue creating symbolic links from logging off and logging in deduce I need an automatic systemwide mount. And this I'm afraid is where I'm pretty lost, seems quite the dense read though I did try to make heads and tails of it. I think I'm supposed to Edit Ubuntu's filesystem table, but I don't know what entry to add and the example they provide doesn't make it clear to me how I can automatically mount a drive on startup.

    Here is my fstab file. Perhaps you can tell me what I need to modify here or how to arrive at knowing what to add here? My 1TB HDD drive that I want my Documents folder to be in is on sda3

    # /etc/fstab: static file system information.
    #
    # Use 'blkid' to print the universally unique identifier for a
    # device; this may be used with UUID= as a more robust way to name devices
    # that works even if disks are added and removed. See fstab(5).
    #
    # <file system> <mount point>   <type>  <options>       <dump>  <pass>
    # / was on /dev/sda5 during installation
    UUID=<hidden> /               ext4    errors=remount-ro 0       1
    # swap was on /dev/sda6 during installation
    UUID=<hidden> none            swap    sw              0       0
    /Storage/16GiB.swap  none  swap  sw  0 0
    

    Attempt 3

    If I change XDG_DOCUMENTS_DIR="$HOME/Documents" to XDG_DOCUMENTS_DIR="/media/cornelis/Storage/Home/Documents" it becomes XDG_DOCUMENTS_DIR="$HOME/" upon reboot.

    Changing user-dirs.conf such that enabled=False I had hoped that

    "When set to False, xdg-user-dirs-update will not change the XDG"

    so something else is causing changes in user-dirs.dirs to be impermanent?

    Attempt 4

    I ran xdg-user-dirs-update after saving my changes in user-dirs.dirs. Nothing is displayed and a reboot results in the same problem as before. I also tried

    cornelis@Bob:/etc/xdg$ xdg-user-dirs-update --force
    Moving DOCUMENTS directory from /media/cornelis/Storage/Home/Documents to Documents
    

    And sure enough, this results in what I changed in user-dirs.dirs. to revert back, which doesn't seem to make sense since the documentation states:

       --force
           Update existing user-dirs.dir, but force a full reset. This means:
           Don't reset nonexisting directories to HOME, rather recreate the
           directory. Never use backwards compatible non-translated names.
           Always recreate user-dirs.locale.
    

    Attempt 5

    This also didn't work:

    cornelis@Bob:~$ xdg-user-dirs-update --set DOCUMENTS /media/cornelis/Storage/Home/Documents
    cornelis@Bob:~$ 
    

    Attempt 6

    I Crawl into the fetal position and beg for help from Ask Ubuntu. Help me Ask Ubuntu, you are my only hope.

    • Jacob Vlijm
      Jacob Vlijm over 7 years
      You mention auto mount is needed (which is true), even provide the link. What is unclear in the link?
    • Frikster
      Frikster over 7 years
      I ended up following the solution here and it worked like a charm: askubuntu.com/a/110187/452147 Nothing else seemed to work. What's unclear about the link is what I have to read, also there's no example so I wasn't clear at all on how to modify fstab. It is pretty dense so I'm glad @bessman gave such a clear answer, props to him/her.
  • AlwaysTalkingAboutMyDog
    AlwaysTalkingAboutMyDog over 7 years
    Looks like OP already solved his problem, but this might help others if his solution didn't work. Thanks!