1

In my home/, the folders Desktop, Downloads, Public, and Templates cannot be accessed anymore. For some reasons, those XDG user directories turned into symbolic links.

ticjo@komputilo:~$ ls -l
total 52K
drwxr-xr-x  5 ticjo ticjo 4.0K Feb  9  2022  AndroidStudioProjects/
drwxr-xr-x  3 ticjo ticjo 4.0K Feb  9  2022  Audio_Books/
drwxr-xr-x  2 ticjo ticjo 4.0K Aug 11 16:17  Backup_launch/
lrwxrwxrwx  1 ticjo ticjo   19 Aug 30 08:16  Desktop -> /home/ticjo/Desktop
drwxr-xr-x  5 ticjo ticjo 4.0K Aug 11 13:52  Documents/
lrwxrwxrwx  1 ticjo ticjo   21 Aug 30 11:57  Downloads -> /home/ticjo/Downloads
drwxrwxr-x  5 ticjo ticjo 4.0K Aug  8 10:13  Logiciels/
drwxrwxr-x  6 ticjo ticjo 4.0K Aug  7 15:58  mount/
drwxr-xr-x  7 ticjo ticjo 4.0K Aug  3 16:50  Music/
drwxr-xr-x 26 ticjo ticjo 4.0K Aug  3 16:53  Pictures/
lrwxrwxrwx  1 ticjo ticjo   18 Aug 30 08:16  Public -> /home/ticjo/Public
drwxrwxr-x  3 ticjo ticjo 4.0K Aug  7 16:06  python_envs/
drwx------ 11 ticjo ticjo 4.0K Aug  9 11:34  snap/
drwxrwxr-x  2 ticjo ticjo 4.0K Aug  8 10:24 'System Volume Information'/
lrwxrwxrwx  1 ticjo ticjo   21 Aug 30 08:16  Templates -> /home/ticjo/Templates
drwxr-xr-x  5 ticjo ticjo 4.0K Aug  3 16:55  Videos/
drwxr-xr-x  3 ticjo ticjo 4.0K Aug  3 14:04  VirtualBox_VMs/
ticjo@komputilo:~$

When I try to cd to one of these folders I get the following error.

ticjo@komputilo:~$ cd /home/ticjo/Desktop
bash: cd: /home/ticjo/Desktop: Too many levels of symbolic links
ticjo@komputilo:~$

Note also that the folders of my home/ appear on my desktop. Desktop

A solution to resolve the problem temporarily is:

  1. Delete the symbolic links using rm Desktop Downloads Public Templates,
  2. Recreate the folders using mkdir Desktop Downloads Public Templates,
  3. Edit the file ~/.config/user-dirs.dirs from
XDG_DESKTOP_DIR="$HOME/"
XDG_DOWNLOAD_DIR="$HOME/"
XDG_TEMPLATES_DIR="$HOME/"
XDG_PUBLICSHARE_DIR="$HOME/"
XDG_DOCUMENTS_DIR="$HOME/Documents"
XDG_MUSIC_DIR="$HOME/Music"
XDG_PICTURES_DIR="$HOME/Pictures"
XDG_VIDEOS_DIR="$HOME/Videos"

to

XDG_DESKTOP_DIR="$HOME/Desktop"
XDG_DOWNLOAD_DIR="$HOME/Downloads"
XDG_TEMPLATES_DIR="$HOME/Templates"
XDG_PUBLICSHARE_DIR="$HOME/Public"
XDG_DOCUMENTS_DIR="$HOME/Documents"
XDG_MUSIC_DIR="$HOME/Music"
XDG_PICTURES_DIR="$HOME/Pictures"
XDG_VIDEOS_DIR="$HOME/Videos"

However, after some times, all the empty XDG user directories are turned into symbolic links again.

I'm using Ubuntu 23.04.

TVG
  • 143
  • 3

2 Answers2

1

Based on the comments in @Alex answer.

  1. Delete the symbolic links using rm Desktop Downloads Public Templates,
  2. Recreate the folders using mkdir Desktop Downloads Public Templates,
  3. Edit the file ~/.config/user-dirs.dirs from
XDG_DESKTOP_DIR="$HOME/"
XDG_DOWNLOAD_DIR="$HOME/"
XDG_TEMPLATES_DIR="$HOME/"
XDG_PUBLICSHARE_DIR="$HOME/"
XDG_DOCUMENTS_DIR="$HOME/Documents"
XDG_MUSIC_DIR="$HOME/Music"
XDG_PICTURES_DIR="$HOME/Pictures"
XDG_VIDEOS_DIR="$HOME/Videos"

to

XDG_DESKTOP_DIR="$HOME/Desktop"
XDG_DOWNLOAD_DIR="$HOME/Downloads"
XDG_TEMPLATES_DIR="$HOME/Templates"
XDG_PUBLICSHARE_DIR="$HOME/Public"
XDG_DOCUMENTS_DIR="$HOME/Documents"
XDG_MUSIC_DIR="$HOME/Music"
XDG_PICTURES_DIR="$HOME/Pictures"
XDG_VIDEOS_DIR="$HOME/Videos"
TVG
  • 143
  • 3
  • Unfortunately, this only solve the problem temporarily. After a few minutes, the directories turn into symbolic links again... – TVG Aug 31 '23 at 08:12
  • Please add that to your question. Actually, since this didn't solve the issue, please include this answer and the fact that it didn't work. You seem to have some misconfigured process that is recreating the symlinks and we need to find what. Does it still happen if you disable timeshift? – terdon Aug 31 '23 at 09:58
  • I've included this answer in my question. It seems that timeshift is not involved as the directories are transformed into links at times that don't match with the timeshit backup times. – TVG Aug 31 '23 at 10:50
0

Looks like these directories are linked to themselves. Try running the following:

unlink Desktop

And try accessing Desktop. Do the same for the rest.

Alex
  • 1,872
  • 2
  • 9
  • Why `unlink` instead of `rm`? Is there a benefit to using one over the other here? Won't both delete the file (the link) and so the user will need to also `mkdir ~/Desktop`? – terdon Aug 30 '23 at 13:26
  • I deleted the files using `rm` and recreated the Desktop and Downloads folders with `mkdir` (I don't need the other ones). However, those two folders have specific functions. Desktop should contain what's on the desktop and Downloads should contain what's downloaded. They also have specific icons. Here, I've simply created two regular folders. – TVG Aug 30 '23 at 14:02
  • Those specific functions lie 100% within gnome (or whatever desktop environment cares), the directories are 100% regular, I don't think you need to do more. – Henrik supports the community Aug 30 '23 at 14:18
  • I found the solution here: https://askubuntu.com/questions/116276/how-to-set-the-desktop-to-home-desktop#222333. – TVG Aug 30 '23 at 14:30