Symlink created in all XDG user directories

Asked by David

Ubuntu 22.04 LTS
Firefox 126.0 (64-Bit) (snap)

I recently opened several image files with Firefox from Nautilus (right click open with Firefox) but after I did this there are now symlinks inside all XDG user directories (Desktop, Documents, Downloads, Music, Pictures, Public, Templates, Videos) these symlinks point to themselves like Downloads points to Downloads (inside the Downloads dir is a symlink pointing to Downloads) I cannot reproduce this problem but it happened and inside the syslog at the same time the symlinks were created are the following unusual lines:

kernel: [] audit: type=1400 audit(): apparmor="DENIED" operation="capable" class="cap" profile="/usr/lib/snapd/snap-confine" pid=x comm="snap-confine" capability=12 capname="net_admin"
kernel: [] audit: type=1400 audit(): apparmor="DENIED" operation="capable" class="cap" profile="/usr/lib/snapd/snap-confine" pid=x comm="snap-confine" capability=38 capname="perfmon"
org.gnome.Nautilus[]: /snap/firefox/4259/gnome-platform/command-chain/desktop-launch: line 31: /dev/null: Operation not permitted

You could create a symlink with "ln -s /home/<user>/Downloads/ Downloads", which has the same effect, but it will be created for all XDG user directories as mentioned above.

Do you know why this happened? It's never happened before, I don't know if it's a bug in Snap or Firefox or something else.

Question information

Language:
English Edit question
Status:
Expired
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

No idea about the fix. Are there bugs reported?

Instead of <user> in your post, you could use the BASH variable $USER which will expand in the shell for you. There is also $HOME which expands to /home/$USER

Revision history for this message
David (david431) said :
#2

I haven't reported the bugs yet and haven't found anyone who has, but I found something similar? on Ask Ubuntu, but his XDG user folders have been replaced by symlinks it seems, and only the empty ones (not Firefox). I don't know whether to report it to Firefox or Snap or both, and I can't reproduce it at the moment. thanks for the $USER var

Revision history for this message
Manfred Hampl (m-hampl) said :
#3

For diagnostic purposes, what is the outptu of the following commands:

ls -ld ~/D*
cat ~/.config/user-dirs.dirs
cat ~/.config/user-dirs.locale
locale

Revision history for this message
David (david431) said :
#4

$ ls -ld ~/D*
drwxr-xr-x 8 david david 4096 Mai 20 22:17 /home/david/Dokumente
drwxr-xr-x 3 david david 4096 Mai 19 13:38 /home/david/Downloads

$ cat ~/.config/user-dirs.dirs
# This file is written by xdg-user-dirs-update
# If you want to change or add directories, just edit the line you're
# interested in. All local changes will be retained on the next run.
# Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped
# homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an
# absolute path. No other format is supported.
#
XDG_DESKTOP_DIR="$HOME/Schreibtisch"
XDG_DOWNLOAD_DIR="$HOME/Downloads"
XDG_TEMPLATES_DIR="$HOME/Vorlagen"
XDG_PUBLICSHARE_DIR="$HOME/Öffentlich"
XDG_DOCUMENTS_DIR="$HOME/Dokumente"
XDG_MUSIC_DIR="$HOME/Musik"
XDG_PICTURES_DIR="$HOME/Bilder"
XDG_VIDEOS_DIR="$HOME/Videos"

$ cat ~/.config/user-dirs.locale
de_DE

$ locale
LANG=de_DE.UTF-8
LANGUAGE=
LC_CTYPE="de_DE.UTF-8"
LC_NUMERIC="de_DE.UTF-8"
LC_TIME="de_DE.UTF-8"
LC_COLLATE="de_DE.UTF-8"
LC_MONETARY="de_DE.UTF-8"
LC_MESSAGES="de_DE.UTF-8"
LC_PAPER="de_DE.UTF-8"
LC_NAME="de_DE.UTF-8"
LC_ADDRESS="de_DE.UTF-8"
LC_TELEPHONE="de_DE.UTF-8"
LC_MEASUREMENT="de_DE.UTF-8"
LC_IDENTIFICATION="de_DE.UTF-8"
LC_ALL=

Revision history for this message
Bernard Stafford (bernard010) said :
#5

https://linuxconfig.org/how-to-create-symlink-in-linux
"To remove a symbolic link, just use the rm command like you would to delete a file. You can also use the unlink command."

Revision history for this message
David (david431) said :
#6

I have already deleted these symlinks thanks, I just want to know why this might have happened or any ideas on how to reproduce it.

Revision history for this message
Manfred Hampl (m-hampl) said :
#7

I do not really understand how you can have a symlink "Downloads" in your home directory that points to itself, if there is a directory file with that name.

There concept of directory naming is language-aware and allows naming your documents folder either "Documents" (English) or "Dokumente" (German). It can make sense to have a link from the English name to the German one, to cater for programs that use the English name hard-coded, instead of using the XDG names.

Revision history for this message
David (david431) said :
#8

It works I tested it I may would not recommend to test it with a directory that is important but it works, you can link a directory to a directory and when you do it it creates a symlink inside the directory that points to the directory

mkdir Test && ln -s /home/$USER/Test/ Test

Revision history for this message
David (david431) said :
#9

And no English symlinks were created, all symlink names were German, like the XDG user directories.

Revision history for this message
Manfred Hampl (m-hampl) said (last edit ):
#10

The command that you give creates a link /home/$USER/Test/Test inside the directory /home/$USER/Test
That is different from /home/$USER/Test being a link.

Revision history for this message
David (david431) said :
#11

The command I gave is an example of how it looked when the bug occurred, but as mentioned this happened for all XDG user directories, not with a directory called Test. I would not recommend running the ln command on an important directory because of this, the following command creates a Test directory and links to it.

mkdir Test && ln -s /home/$USER/Test/ Test
| |
| \_____ Links the Test directory with the Test directory
|
\_____ This creates a directory called Test

Revision history for this message
David (david431) said :
#12

Sorry, the comment was stripped of all my spaces
first command: mkdir Test
second command: ln -s /home/$USER/Test/ Test

Revision history for this message
Manfred Hampl (m-hampl) said :
#13

"first command: mkdir Test"

The effect of this command is creating a new directory below the current directory, so it is important to know what the current directory was when executing this command.

Revision history for this message
David (david431) said :
#14

If you see a command without specifying an absolute path, you should assume that the working directory is your home directory (~).

And in my example, if you look at the second command /home/$USER, you would know that. (You should never execute a command that you have not read/know)

Revision history for this message
Launchpad Janitor (janitor) said :
#15

This question was expired because it remained in the 'Open' state without activity for the last 15 days.