3

I have clean installed windows 10 (build 1803). I have installed Ubuntu from the Microsoft Store and enabled Linux subsystem. I have done this several times in the past, and never have I had the following issue: my c directory is all messed up thanks to symbolic links. Take for example the output of dir in cmd and ls in WSL:

C:\Users\username>dir
 Volume in drive C has no label.
 Volume Serial Number is BC00-A6D5

 Directory of C:\Users\username
05/25/2018  12:01 AM    <DIR>          .
05/25/2018  12:01 AM    <DIR>          ..
05/25/2018  12:01 AM    <DIR>          3D Objects
05/25/2018  12:01 AM    <DIR>          Contacts
05/25/2018  01:19 AM    <DIR>          Desktop
05/25/2018  12:01 AM    <DIR>          Documents
05/25/2018  12:01 AM    <DIR>          Downloads
05/25/2018  12:01 AM    <DIR>          Favorites
05/25/2018  12:01 AM    <DIR>          Links
05/25/2018  12:01 AM    <DIR>          Music
05/25/2018  12:06 AM    <DIR>          OneDrive
05/25/2018  12:01 AM    <DIR>          Pictures
05/25/2018  12:01 AM    <DIR>          Saved Games
05/25/2018  12:01 AM    <DIR>          Searches
05/25/2018  12:01 AM    <DIR>          Videos
               0 File(s)              0 bytes
              15 Dir(s)  88,018,132,992 bytes free

name:/mnt/c/Users/username$ ls
ls: cannot read symbolic link 'Application Data': Permission denied
ls: cannot read symbolic link 'Cookies': Permission denied
ls: cannot read symbolic link 'Local Settings': Permission denied
ls: cannot read symbolic link 'My Documents': Permission denied
ls: cannot read symbolic link 'NetHood': Permission denied
ls: cannot read symbolic link 'PrintHood': Permission denied
ls: cannot read symbolic link 'Recent': Permission denied
ls: cannot read symbolic link 'SendTo': Permission denied
ls: cannot read symbolic link 'Start Menu': Permission denied
ls: cannot read symbolic link 'Templates': Permission denied
3D Objects            NTUSER.DAT{c9e9d809-5fd7-11e8-a0cd-4e0bbe2b78ad}.TM.blf
AppData               NTUSER.DAT{c9e9d809-5fd7-11e8-a0cd-4e0bbe2b78ad}.TMContainer00000000000000000001.regtrans-ms
Application Data      NTUSER.DAT{c9e9d809-5fd7-11e8-a0cd-4e0bbe2b78ad}.TMContainer00000000000000000002.regtrans-ms
Contacts              ntuser.dat.LOG1
Cookies               ntuser.dat.LOG2
[...]

Comparing the same directory--Ubuntu on the left and cmd on the right--you see that ls attempts to list symbolic links that aren't there! I have never had this issue and I have not altered any permissions or anything, so I have no idea what's happening. Can anyone help me with this?

Here is some possibly useful information:

Mount gives

mount
rootfs on / type lxfs (rw,noatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,noatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,noatime)
none on /dev type tmpfs (rw,noatime,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,noatime,gid=5,mode=620)
none on /run type tmpfs (rw,nosuid,noexec,noatime,mode=755)
none on /run/lock type tmpfs (rw,nosuid,nodev,noexec,noatime)
none on /run/shm type tmpfs (rw,nosuid,nodev,noatime)
none on /run/user type tmpfs (rw,nosuid,nodev,noexec,noatime,mode=755)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noatime)
C: on /mnt/c type drvfs (rw,noatime,uid=1000,gid=1000)

Then,

id -u
1000
id -g
1000

My /etc/wsl.conf file was non-existent at first, so I created one; but, I don't think this is the key to solving the issue, since mount has shown that c is correctly mounted. Right now it's this

[automount]
enabled = true

My question in short: there seems to be NO symlinks in my directories as confirmed from running dir in cmd. Yet, the Ubuntu command line shows symbolic links. Why is that? Oh, also, I cannot delete them (even with sudo rm) as permission is denied. This is sort of annoying!

  • This isn't really a Unix and Linux problem, as you can see. – JdeBP May 25 '18 at 7:49
  • Yes, not directly. But I'm desperate to fix this and I've already posted on superuser and askUbuntu. Also, I used the windows tags so those who know WSL will see it. I don't think I've posted an irrelevant question. – Ptheguy May 25 '18 at 7:52
  • Multi-posting across several sites (superuser.com/questions/1325694 askubuntu.com/questions/1040022) is a reason for question closure on this WWW site. See also unix.meta.stackexchange.com/questions/4086 – JdeBP May 25 '18 at 7:56
  • Ok thank you. I keep that in mind. I would appreciate if you didn't close my questions because someone might be able to help. – Ptheguy May 25 '18 at 8:00
  • This just started happening to me ( July 2019 ), no idea why, I did update one of my other WSLs to Debian Buster and my Ubuntu WSL installs started yelling about this. Yikes. – Brian Bulkowski Jul 27 at 17:24
2

as confirmed from running dir in cmd.

This did not confirm anything of the sort. Use the /a option to the dir command. How to use the dir command on a non-Unix non-Linux operating system is really beyond the scope of this WWW site. So I'll stop here after pointing out that this fundamental premise of the question is wrong.

  • Thank you for pointing that out. You are correct. The symlinks are there. Can you help me understand why ls is showing them now? I've never had this happen before, and to the best of my knowledge I have not changed any settings. – Ptheguy May 25 '18 at 7:56
0

I noticed that if you use:

ls --color=tty

in the directory /mnt/c, you'll get these error messages:

ls: cannot read symbolic link 'Documents and Settings': Permission denied                                               
ls: cannot access 'hiberfil.sys': Permission denied                                                                     
ls: cannot access 'pagefile.sys': Permission denied                                                                     
ls: cannot access 'swapfile.sys': Permission denied

but if you use simply /bin/ls without any arguments, you'll get a clean directory listing. So there's something about this command's attempting to colorize the types of files in the directory that triggers these error messages.

If you redirect stderr to /dev/null, this also inhibits the error messages:

alias ls='ls --color=tty 2>/dev/null'

Not always advisable, but it does clean up the noise.

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.