My shortlink which used to work suddenly is shown as broken after I restarted the PC having Ubuntu 22.04.2 LTS. I moved the "Documents" directory to another disk which is HDD and made a shortlink so that HDD location can be accessed by ~/Documents
. Please see below:
$ ll ~/Documents
lrwxrwxrwx 1 user user 20 Mar 26 22:36 /home/user/Documents -> /media/hdd/Documents
When I tried accessing the documents in HDD, it shows the following eror:
$ cd /media/hdd/Documents
bash: cd: /media/hdd/Documents: Too many levels of symbolic links
From GUI also, a similar error is shown:
This location could not be displayed.
Sorry, could not display all the contents of "Documents": Error opening directory '/home/user/Documents': Too many levels of symbolic links
Suprisingly, I see an strange shortlink inside HDD, which I don't remember creating. See below, please:
$ ll /media/hdd/Documents
lrwxrwxrwx 1 user user 45 May 13 23:31 /media/hdd/Documents -> /home/user/../../../../../media/hdd/Documents
I don't know how the above shortlink created. Furthermore, there shouldn't be any shortlink inside HDD in the first place. Next, I tired updating the shortlink but no success:
$ ln -sfn /media/hdd/Documents /home/user/new_link
$ cd /home/user/new_link
bash: cd: /home/user/new_link: Too many levels of symbolic links
How to access the documents inside HDD? Additionally, the /etc/fstab
is shown below:
$ cat /etc/fstab
# /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/nvme0n1p5 during installation
UUID=fa9dfc51-436e-4717-b3be-0c0c561ad21d / ext4 errors=remount-ro 0 1
# /boot/efi was on /dev/nvme0n1p1 during installation
UUID=BE66-E552 /boot/efi vfat umask=0077 0 1
/dev/disk/by-uuid/cb108681-34a7-4009-85de-4653cb4a5047 /media/hdd/ ext4 nosuid,nodev,nofail,x-gvfs-show 0 0
/swapfile none swap sw 0 0