Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permission Denied For Folders in Mounted VHDX/VHD in WSL #1199

Closed
ghazi94 opened this issue Oct 12, 2016 · 51 comments
Closed

Permission Denied For Folders in Mounted VHDX/VHD in WSL #1199

ghazi94 opened this issue Oct 12, 2016 · 51 comments

Comments

@ghazi94
Copy link

ghazi94 commented Oct 12, 2016

I have created a VHDX/VHD (GUID/MBR type) file in Windows 10.
It is mounted as an NTFS formatted drive with drive letter X:. When I open the bash (Ubuntu on Windows 10/WSL), I am able to
cd /mnt/x
However, when I do ls, i get permission denied for all the files. Also, I am not able to create directory even with sudo. Same problem with chmod, chown, etc.

I have also tried to grant permissions to everyone through icacls in Windows through command line as well as through the GUI.

Attached the screenshots below:

Windows Explorer

Windows UI

### Bash

Bash

### Bash - Displaying permissions

permissions


I think the problem is that the way NTFS gets mounted on Windows. The mounted mode is being treated as a read-only mode by the Ubuntu Bash.

@fpqc
Copy link

fpqc commented Oct 12, 2016

@benhillis This used to work pre-Anniversary edition. Are there any plans to get it working again?

@ghazi94
Copy link
Author

ghazi94 commented Oct 12, 2016

This was working till yesterday. Today's update screwed it up! @fpqc

@benhillis
Copy link
Member

Interesting, I'll sync up with a couple people and see what is up here.

@benhillis
Copy link
Member

@ghazi94 - What build were you running before yesterday's update?

@fpqc
Copy link

fpqc commented Oct 12, 2016

@benhillis The case I am thinking of was where you mounted the vhdx as VolFS (mount to a folder inside LXSS, for example) rather than DriveFS, but it was a similar problem.

@ghazi94
Copy link
Author

ghazi94 commented Oct 13, 2016

@benhillis I will update the build number before and after the update as soon as I reach home (It's my personal pc)

@ghazi94 ghazi94 changed the title Permission Denied For Folders in Mounted VHDX in WSL Permission Denied For Folders in Mounted VHDX/VHD in WSL Oct 13, 2016
@wimpunk
Copy link

wimpunk commented Oct 13, 2016

I got here because I got the same problem as @ghazi94... Using the latest normal version worked until yesterday. I've got a windows update today and now it is broken. Don't know the version numbers.

@ghazi94
Copy link
Author

ghazi94 commented Oct 14, 2016

@benhillis Current build is 14393.321
Couldn't find how to get the build number before the update.

@Manouchehri
Copy link
Contributor

Manouchehri commented Oct 14, 2016

The permissions seem to be identical between my VHD and physical partition, but WSL cannot access the VHD.

PS T:\> [Environment]::OSVersion

Platform ServicePack Version      VersionString
-------- ----------- -------      -------------
 Win32NT             10.0.14942.0 Microsoft Windows NT 10.0.14942.0

VHD

Windows PowerShell
Copyright (C) 2016 Microsoft Corporation. All rights reserved.

PS T:\> icacls T:\
T:\ BUILTIN\Administrators:(F)
    BUILTIN\Administrators:(OI)(CI)(IO)(F)
    NT AUTHORITY\SYSTEM:(F)
    NT AUTHORITY\SYSTEM:(OI)(CI)(IO)(F)
    NT AUTHORITY\Authenticated Users:(M)
    NT AUTHORITY\Authenticated Users:(OI)(CI)(IO)(M)
    BUILTIN\Users:(RX)
    BUILTIN\Users:(OI)(CI)(IO)(GR,GE)

Successfully processed 1 files; Failed processing 0 files
dave@universal:~$ df -h /mnt/t
Filesystem      Size  Used Avail Use% Mounted on
T:              997M   15M  983M   2% /mnt/t
dave@universal:~$ mount | grep '/mnt/'
C: on /mnt/c type drvfs (rw,noatime)
G: on /mnt/g type drvfs (rw,noatime)
T: on /mnt/t type drvfs (rw,noatime)
dave@universal:~$ ls -l /mnt/t/
ls: cannot access /mnt/t/$RECYCLE.BIN: Permission denied
ls: cannot access /mnt/t/System Volume Information: Permission denied
ls: cannot access /mnt/t/usertest: Permission denied
total 0
d????????? ? ? ? ?            ? $RECYCLE.BIN
d????????? ? ? ? ?            ? System Volume Information
d????????? ? ? ? ?            ? usertest
dave@universal:~$ touch /mnt/t/test.txt
touch: cannot touch ‘/mnt/t/test.txt’: Permission denied

Physical Partition

G:\ BUILTIN\Administrators:(F)
    BUILTIN\Administrators:(OI)(CI)(IO)(F)
    NT AUTHORITY\SYSTEM:(F)
    NT AUTHORITY\SYSTEM:(OI)(CI)(IO)(F)
    NT AUTHORITY\Authenticated Users:(M)
    NT AUTHORITY\Authenticated Users:(OI)(CI)(IO)(M)
    BUILTIN\Users:(RX)
    BUILTIN\Users:(OI)(CI)(IO)(GR,GE)

Successfully processed 1 files; Failed processing 0 files
dave@universal:~$ df -h /mnt/g
Filesystem      Size  Used Avail Use% Mounted on
G:              7.9G   29M  7.8G   1% /mnt/g
dave@universal:~$ mount | grep '/mnt/'
C: on /mnt/c type drvfs (rw,noatime)
G: on /mnt/g type drvfs (rw,noatime)
T: on /mnt/t type drvfs (rw,noatime)
dave@universal:~$ ls -l /mnt/g/
total 64
drwxrwxrwx 0 root root 0 Oct  4 13:53 $RECYCLE.BIN
d--------- 0 root root 0 Oct  4 15:20 System Volume Information
dave@universal:~$ touch /mnt/g/test.txt
dave@universal:~$ ls -l /mnt/g/
total 64
drwxrwxrwx 0 root root 0 Oct  4 13:53 $RECYCLE.BIN
d--------- 0 root root 0 Oct  4 15:20 System Volume Information
-rwxrwxrwx 1 root root 0 Oct 14 10:41 test.txt

@mheden
Copy link

mheden commented Oct 17, 2016

I also see the problem on my VHD drive as described above (all files/directories have messed up permissions), but my physical drive also seems to have some problems (even though most of the directories are fine):

user@machine:/mnt/c$ ls -lF
ls: cannot access hiberfil.sys: Permission denied
ls: cannot access pagefile.sys: Permission denied
ls: cannot access swapfile.sys: Permission denied
total 524
drwxrwxrwx 2 root root      0 Oct  5 09:37 bin/
dr-xr-xr-x 2 root root      0 Jun 22 20:40 Boot/
-r-xr-xr-x 1 root root 400228 Oct 30  2015 bootmgr*
-r-xr-xr-x 1 root root      1 Oct 30  2015 BOOTNXT*
drwxrwxrwx 2 root root      0 Aug 25 17:03 DRIVERS/
drwxrwxrwx 2 root root      0 Aug 16 17:10 $GetCurrent/
-????????? ? ?    ?         ?            ? hiberfil.sys
drwxrwxrwx 2 root root      0 Jun 22 21:35 Intel/
-????????? ? ?    ?         ?            ? pagefile.sys
drwxrwxrwx 2 root root      0 Jul 16 13:47 PerfLogs/
drwxrwxrwx 2 root root      0 Oct  6 11:28 ProgramData/
dr-xr-xr-x 2 root root      0 Sep 20 10:33 Program Files/
dr-xr-xr-x 2 root root      0 Sep 26 19:11 Program Files (x86)/
drwxrwxrwx 2 root root      0 Aug 26 13:51 Python27/
d--------- 2 root root      0 Aug 16 18:06 Recovery/
drwxrwxrwx 2 root root      0 Aug 17 11:39 $Recycle.Bin/
-????????? ? ?    ?         ?            ? swapfile.sys

@benhillis
Copy link
Member

@mheden - What you are seeing is actually expected. hiberfil.sys, pagefile.sys, and swapfile.sys are protected files.

@Manouchehri
Copy link
Contributor

Manouchehri commented Oct 17, 2016

@benhillis But all VHDs shouldn't be protected? #1199 (comment)

@benhillis
Copy link
Member

@Manouchehri I'm surprised you're able to see VHD's at all in bash. I thought we only exposed fixed NTFS drives.

@Manouchehri
Copy link
Contributor

Manouchehri commented Oct 17, 2016

Moved to #1220 since I think I've found another issue.

@IL2
Copy link

IL2 commented Oct 23, 2016

Same permission problems on 14951 and VHD drive automounted at boot (via VHDAttach):

user@wind:~$ sudo ls -l /mnt/d/
ls: cannot access '/mnt/d/$RECYCLE.BIN': Permission denied
ls: cannot access '/mnt/d/dev': Permission denied
ls: cannot access '/mnt/d/Downloads': Permission denied
ls: cannot access '/mnt/d/System Volume Information': Permission denied
total 0
d????????? ? ? ? ?            ? dev
d????????? ? ? ? ?            ? Downloads
d????????? ? ? ? ?            ? $RECYCLE.BIN
d????????? ? ? ? ?            ? System Volume Information
user@wind:~$ sudo ls -l /mnt/d/Downloads
ls: cannot access '/mnt/d/Downloads': Permission denied

I could remember it worked some build ago.

@ivivanov-bg
Copy link

ivivanov-bg commented Oct 24, 2016

The last working version is: 14393.0

(Uninstalling KB3194798 removes also the issue)

@fpqc
Copy link

fpqc commented Oct 24, 2016

@ivivanov-bg Good stuff! Thanks for rolling back to all those timebombed updates. How'd you do it?

@ivivanov-bg
Copy link

ivivanov-bg commented Oct 24, 2016

As I'm NOT on the insider program - this was the only update for windows which was installed - so - uninstalling it through the control panel (the old school one) and rebooting.

As all my stuff is on VHDX disk - accessing it in WSL is very very important to me - so I guess I have to live for a while without this update.

(Let's hope it won't be for very long)

@ivivanov-bg
Copy link

Wrong Id - the one that was uninstalled is actually: KB3194798

@ghazi94
Copy link
Author

ghazi94 commented Oct 24, 2016

thanks a lot @ivivanov-bg !!

@andrewfinnell
Copy link

Ditto problem here. No longer able to access a mounted VHDX drive.. So unfortunate the little things that stop us from being productive. What did that KB update do?

@ghazi94
Copy link
Author

ghazi94 commented Oct 28, 2016

Yeah .... especially when an update messes up a working application 👎

@andrewfinnell
Copy link

Unrelated.. (but really.. it's related), the latest Insider Preview update, which took 2 hours to install had made the OS almost unusable. I can no longer sign into my domain account when it's off the network. I get a "password changed by a different device" error when entering my password . Which is untrue as I can verify my domain account other ways.
Context menus are broken. VHD access is broken in WSL. There's a definite issue with this latest patch.

@0xbadfca11
Copy link

@benhillis Windows says that mounted vhdx is fixed drive.

PS C:\> Get-Disk | Format-List FriendlyName,Model,BusType,Location,Path

FriendlyName : Virtual HD
Model        : Virtual HD
BusType      : ATA
Location     : PCI Slot 0 : Adapter 0 : Channel 0 : Device 0
Path         : \\?\ide#diskvirtual_hd______________________________1.1.0___#5&2d5f53a1&0&0.0.0#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}

FriendlyName : Msft Virtual Disk
Model        : Virtual Disk
BusType      : File Backed Virtual
Location     : C:\temp.vhdx
Path         : \\?\scsi#disk&ven_msft&prod_virtual_disk#2&1f4adffe&0&000001#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}

PS C:\> Get-Disk | Get-Partition

   DiskPath: \\?\scsi#disk&ven_msft&prod_virtual_disk#2&1f4adffe&0&000001#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}

PartitionNumber  DriveLetter Offset                                        Size Type
---------------  ----------- ------                                        ---- ----
1                E           1048576                                     127 GB IFS


   DiskPath: \\?\ide#diskvirtual_hd______________________________1.1.0___#5&2d5f53a1&0&0.0.0#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}

PartitionNumber  DriveLetter Offset                                        Size Type
---------------  ----------- ------                                        ---- ----
1                            1048576                                     500 MB IFS
2                C           525336576                                126.51 GB IFS

PS C:\> Get-Disk | Get-Partition | Get-Volume

DriveLetter FileSystemLabel FileSystem DriveType HealthStatus OperationalStatus SizeRemaining      Size
----------- --------------- ---------- --------- ------------ ----------------- -------------      ----
                            NTFS       Fixed     Healthy      OK                    465.62 MB    500 MB
E                           NTFS       Fixed     Healthy      OK                    126.89 GB    127 GB
C                           NTFS       Fixed     Healthy      OK                    100.48 GB 126.51 GB

PS C:\> mkdir E:\test1,E:\test2,E:\test3 | Out-Null
PS C:\> bash -c "ls -l /mnt/e"
ls: cannot access /mnt/e/System Volume Information: Permission denied
ls: cannot access /mnt/e/test1: Permission denied
ls: cannot access /mnt/e/test2: Permission denied
ls: cannot access /mnt/e/test3: Permission denied
total 0
d????????? ? ? ? ?            ? System Volume Information
d????????? ? ? ? ?            ? test1
d????????? ? ? ? ?            ? test2
d????????? ? ? ? ?            ? test3

@ivivanov-bg
Copy link

Any progress on this ??
It's a second updated rolled out which contains this issue (so I had to uninstall it manually again)

@ghazi94
Copy link
Author

ghazi94 commented Nov 21, 2016

It's still not labelled as an Issue yet!

@jcar87
Copy link

jcar87 commented Dec 7, 2016

Problem for me as well. used to work fine on Anniversary Update

@ivivanov-bg
Copy link

Anyone tried the latest updates: KB3200970 and KB3176929 ?
Is the issue still present there ?

@ghazi94
Copy link
Author

ghazi94 commented Dec 17, 2016

Yes .. its still present @ivivanov-bg

@ivivanov-bg
Copy link

anyone any idea if this will ever be fixed ?

I see it's still present in KB3213986

@TheRealDuckboy
Copy link

Still an issue as of 14393.693 (all updates installed but pending reboot for KB3216755).

Any news, anyone?

@sunilmut
Copy link
Member

@TheRealDuckboy - Only security and critical fixes for WSL will be pushed out to the 14393 build. All of the major updates are currently only available to the Windows Insider builds (see our release notes). These updates will also make it to the Creators Update release.

@aseering
Copy link
Contributor

@sunilmut -- just verifying -- did you notice that this is not a regular bug report, it's a regression report?

If a hotfix to Anniversary inadvertently breaks part of WSL, what's your policy on fixing it? I would advocate that such fixes should be prioritized if at all possible -- y'all want people applying your hotfixes, and they're not going to if hotfixes introduce regressions and start being perceived as risky.

@sunilmut
Copy link
Member

@aseering - No, I did not notice that. I would agree with you assessment. Thanks for bringing it to my notice. Not much has gone for WSL in KB article(s). So, probably something outside of WSL changed that broke this (my initial view). Let me run this internally with the team.

@sunilmut
Copy link
Member

I had a word about this with the team. It appears that this is a known issue, and, regressed because of an update outside of WSL. Irrespective, we understand that this is a regression. Unfortunately, and as I have been informed, the bug bar to get this fixed in Anniversary Update is high and this won't make the cut. Also, because the Creators Update release is around the corner which has a fix for this. We do owe an apology here.

@fpqc
Copy link

fpqc commented Jan 31, 2017

@sunilmut are you sure this is fixed in CU? It wasn't in CU a while back. This broke right before RTM of AU.

@sunilmut
Copy link
Member

@fpqc That's what I have been informed by @SvenGroot. If someone here is willing to try it out in a recent Insider build, we can know for sure.

@fpqc
Copy link

fpqc commented Jan 31, 2017

@sunilmut Installation and extraction works, but when you try to run bash.exe, it fails with error:
0x80070003.

Repro steps: Create an empty vhdx, attach it, create a new volume formatted with ntfs, create %localappdata%\lxss, and mount the vhdx on that directory. Then lxrun /install. The installation and extraction works fine, but you get the error when you go to set up your unix accounts and also if you try to run bash.exe.

@ghazi94
Copy link
Author

ghazi94 commented Feb 1, 2017

I can confirm that this issue is still not resolved by the latest insider build. Same issue as mentioned in the description.

@0xbadfca11
Copy link

Fixed in 15025.

@dbsavage
Copy link

dbsavage commented Mar 9, 2017

Oxbadfca11: really? i just checked and i'm still getting the permission denied issue.... i'm pretty sure i'm on the latest version.... did you do anything else?

@0xbadfca11
Copy link

0xbadfca11 commented Mar 10, 2017

@dbsavage I checked below with build 10.0.15042 I clean installed

  • NTFS on MBR on Fixed VHD
  • NTFS on MBR on Fixed VHDX
  • NTFS on MBR on Dynamic VHD
  • NTFS on MBR on Dynamic VHDX
  • NTFS on GPT on Fixed VHD
  • NTFS on GPT on Fixed VHDX
  • NTFS on GPT on Dynamic VHD
  • NTFS on GPT on Dynamic VHDX
  • ReFS on MBR on Fixed VHD
  • ReFS on MBR on Fixed VHDX
  • ReFS on MBR on Dynamic VHD
  • ReFS on MBR on Dynamic VHDX
  • ReFS on GPT on Fixed VHD
  • ReFS on GPT on Fixed VHDX
  • ReFS on GPT on Dynamic VHD
  • ReFS on GPT on Dynamic VHDX

Everything OK.
I guess you are not using Insider Preview build?
If you not using Insider Preview build you have to wait for next release, aka Creators Update.
Please check your build number.

@dbsavage
Copy link

Oxbadfca11 - that's totally it.... my bad, apologize for jumping on this thread and not realizing it was for the preview builds....

@dimo414
Copy link

dimo414 commented May 25, 2017

I started running into "Permission denied" issues once I upgraded to the Creators Update (everything was working fine before), then I started seeing things like:

$ ls data/h2
ls: cannot open directory data/h2: Permission denied

I found a strange "Deny" entry in the folder's permission in Windows Explorer (Right Click > Properties > Security > Advanced) denying my account "Special" access. Below it was an identical looking "Allow" entry. Removing the "Deny" entry allowed Bash to access the directory again.

I'm not sure where that entry came from, but I don't think it's related to WSL (it does seem new with the Creators Update though). I just wanted to share that troubleshooting step here since I initially thought it was a WSL issue. I could still access the directory normally from Explorer, so it might only crop up for people using Bash.

@benhillis
Copy link
Member

Following up on this thread. Are people still seeing similar failures on the 1803 build?

@fpqc
Copy link

fpqc commented Jun 22, 2018

@benhillis It's not really practical to even test this anymore, since it's not just mounting a vhdx on lxss but you'd have to mount it on the app's directory. I would like to see an option to launch an lx environment off an ntfs vhdx for portability, but doing it the way we did at the beginning is pretty much a dead end now.

@onomatopellan
Copy link

onomatopellan commented Jun 22, 2018

@benhillis No more permission problems on my end on 1803. It also follows my wsl.conf properly as other DrvFs mounts do.

@bitcrazed
Copy link
Contributor

bitcrazed commented Aug 6, 2018

Hey @benhillis - reopening because Heath Yates is running on 1803 and posted this on Reddit, and pinged us on Twitter re. same.

image

Handing-off to @tara-raj to triage with y'all.

@bitcrazed bitcrazed reopened this Aug 6, 2018
@therealkenc
Copy link
Collaborator

That's #2779

@SvenGroot
Copy link
Member

Confirmed, Heath Yates's issue is not related to this one, but to #2779 and is "by design". Closing again.

@bitcrazed
Copy link
Contributor

bitcrazed commented Aug 6, 2018

Great, thanks for taking a look @therealkenc & @SvenGroot :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests