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

WIndows directory of the linux subsystem #402

Closed
ducminhnguyen opened this Issue May 20, 2016 · 37 comments

Comments

Projects
None yet
@ducminhnguyen

ducminhnguyen commented May 20, 2016

I cant find the windows path of the linux subsystem which is inconvenient as I want to copy files into the directory from windows.

@tills13

This comment has been minimized.

Show comment
Hide comment
@tills13

tills13 May 20, 2016

It's located under /mnt/ i.e. /mnt/c is your C drive.

tills13 commented May 20, 2016

It's located under /mnt/ i.e. /mnt/c is your C drive.

@ducminhnguyen

This comment has been minimized.

Show comment
Hide comment
@ducminhnguyen

ducminhnguyen May 20, 2016

What I mean is the subsystem path in the C directory. I want to access the subsystem path in WIndows Explorer.

ducminhnguyen commented May 20, 2016

What I mean is the subsystem path in the C directory. I want to access the subsystem path in WIndows Explorer.

@tills13

This comment has been minimized.

Show comment
Hide comment
@tills13

tills13 May 20, 2016

My mistake.

tills13 commented May 20, 2016

My mistake.

@ddfznt

This comment has been minimized.

Show comment
Hide comment
@ddfznt

ddfznt May 20, 2016

Under C:\Users\**user**\AppData\Local\lxss.
You will find:
root folder
home folder
and a hidden rootfsfolder (\bin, \boot, \dev, \etc...)

DON'T CHANGE ANYTHINK INSIDE! SERIOUSLY! 🚨

Access Windows files via /mnt/**letter**/bla bla bla partition, then cp -R . ~

EDIT:

symlinks are suported since 14342.
you can try
ln -s /mnt/**letter**/... ~/winFiles

ddfznt commented May 20, 2016

Under C:\Users\**user**\AppData\Local\lxss.
You will find:
root folder
home folder
and a hidden rootfsfolder (\bin, \boot, \dev, \etc...)

DON'T CHANGE ANYTHINK INSIDE! SERIOUSLY! 🚨

Access Windows files via /mnt/**letter**/bla bla bla partition, then cp -R . ~

EDIT:

symlinks are suported since 14342.
you can try
ln -s /mnt/**letter**/... ~/winFiles

@aseering

This comment has been minimized.

Show comment
Hide comment
@aseering

aseering May 20, 2016

Contributor

@ducminhnguyen -- copying directly into the Linux subsystem from Windows is not supported, according to discussion on other tickets. There is a directory under AppData somewhere (I forget where) that appears to contain the files for the WSL filesystem. But if you put new files there, or modify existing files there, your changes are not reflected correctly inside WSL.

My best guess is that Linux needs to store different metadata (and more caching information, etc, since its disk-buffering model is also different) about its files than Windows does, and that this is currently implemented by storing the master copy of the structure of the Linux filesystem in a database of some sort, and just using the Windows filesystem as a convenient BLOB-store for that database.

If you really need to do this, a workaround would be to write a drag'n'drop .bat script or somesuch that does bash.exe -c "mv %1 /home/$USER/". (You'll have to do some clever work with sed and tr, probably, to translate %1 to a valid WSL path.)

Alternatively -- could you put your files in a Windows directory and, within WSL, do "cd ~; ln -s /mnt/c/path/to/my/files" to make them appear to be in your WSL homedir?

Contributor

aseering commented May 20, 2016

@ducminhnguyen -- copying directly into the Linux subsystem from Windows is not supported, according to discussion on other tickets. There is a directory under AppData somewhere (I forget where) that appears to contain the files for the WSL filesystem. But if you put new files there, or modify existing files there, your changes are not reflected correctly inside WSL.

My best guess is that Linux needs to store different metadata (and more caching information, etc, since its disk-buffering model is also different) about its files than Windows does, and that this is currently implemented by storing the master copy of the structure of the Linux filesystem in a database of some sort, and just using the Windows filesystem as a convenient BLOB-store for that database.

If you really need to do this, a workaround would be to write a drag'n'drop .bat script or somesuch that does bash.exe -c "mv %1 /home/$USER/". (You'll have to do some clever work with sed and tr, probably, to translate %1 to a valid WSL path.)

Alternatively -- could you put your files in a Windows directory and, within WSL, do "cd ~; ln -s /mnt/c/path/to/my/files" to make them appear to be in your WSL homedir?

@ducminhnguyen

This comment has been minimized.

Show comment
Hide comment
@ducminhnguyen

ducminhnguyen May 20, 2016

@ddfznt yeah I wont change anything. I am just tired of typing cp command.
@aseering yeah that could work. I will try it later. Thanks for the suggestion.

ducminhnguyen commented May 20, 2016

@ddfznt yeah I wont change anything. I am just tired of typing cp command.
@aseering yeah that could work. I will try it later. Thanks for the suggestion.

@totalknowledge

This comment has been minimized.

Show comment
Hide comment
@totalknowledge

totalknowledge Jul 15, 2016

Are there any best practices around file storage when installing tools or programs that you want to be available in the wls?

totalknowledge commented Jul 15, 2016

Are there any best practices around file storage when installing tools or programs that you want to be available in the wls?

@voltagex

This comment has been minimized.

Show comment
Hide comment
@voltagex

voltagex Aug 3, 2016

As of 1611, %localappdata%\lxss doesn't seem to exist

voltagex commented Aug 3, 2016

As of 1611, %localappdata%\lxss doesn't seem to exist

@DJviolin

This comment has been minimized.

Show comment
Hide comment
@DJviolin

DJviolin Aug 3, 2016

What if someone is trashed his Ubuntu subsystem and wants a fresh start? Is it safe to remove C:\Users\**user**\AppData\Local\lxss then? Does this mean a "freash start" when I start again the Bash window?

DJviolin commented Aug 3, 2016

What if someone is trashed his Ubuntu subsystem and wants a fresh start? Is it safe to remove C:\Users\**user**\AppData\Local\lxss then? Does this mean a "freash start" when I start again the Bash window?

@benhillis

This comment has been minimized.

Show comment
Hide comment
@benhillis

benhillis Aug 3, 2016

Member

If you want a fresh start use lxrun.exe /uninstall /full

Reinstall by running bash.exe when that completes.

Member

benhillis commented Aug 3, 2016

If you want a fresh start use lxrun.exe /uninstall /full

Reinstall by running bash.exe when that completes.

@DJviolin

This comment has been minimized.

Show comment
Hide comment
@DJviolin

DJviolin Aug 3, 2016

Thank You! Meanwhile I already found out this in the documentation. I'm using these commands:

# Windows folder:
# C:\Users\[user]\AppData\Local\lxss

# Uninstall with keeping root dir
# lxrun /uninstall

# Uninstall completely:
# lxrun /uninstall /full /y

# New install (root user created):
# lxrun /install /y

Is there any way to make a backup from an actual state (like before package installs)? If I zipping the C:\Users\**user**\AppData\Local\lxss folder that's enough for actual state backups?

DJviolin commented Aug 3, 2016

Thank You! Meanwhile I already found out this in the documentation. I'm using these commands:

# Windows folder:
# C:\Users\[user]\AppData\Local\lxss

# Uninstall with keeping root dir
# lxrun /uninstall

# Uninstall completely:
# lxrun /uninstall /full /y

# New install (root user created):
# lxrun /install /y

Is there any way to make a backup from an actual state (like before package installs)? If I zipping the C:\Users\**user**\AppData\Local\lxss folder that's enough for actual state backups?

@onomatopellan

This comment has been minimized.

Show comment
Hide comment
@onomatopellan

onomatopellan Aug 3, 2016

Only lxrun.exe can create that folder. It's a special folder with Extended Attributes so copying it manually won't work.
I also like to have a "base" backup without any package installed. You can do this.

  • close any bash window and go to %LocalAppData%
  • enable see hidden and system folders
  • rename folder lxss to lxss.base
  • now from an admin CMD type lxrun /uninstall and lxrun /install and add same username as before.

After finishing installing there will be lxss and lxss.base folders. If you want to use the "lxss.base" folder you just have to rename it back to lxss before launching bash.

onomatopellan commented Aug 3, 2016

Only lxrun.exe can create that folder. It's a special folder with Extended Attributes so copying it manually won't work.
I also like to have a "base" backup without any package installed. You can do this.

  • close any bash window and go to %LocalAppData%
  • enable see hidden and system folders
  • rename folder lxss to lxss.base
  • now from an admin CMD type lxrun /uninstall and lxrun /install and add same username as before.

After finishing installing there will be lxss and lxss.base folders. If you want to use the "lxss.base" folder you just have to rename it back to lxss before launching bash.

@DJviolin

This comment has been minimized.

Show comment
Hide comment
@DJviolin

DJviolin Aug 3, 2016

So what you saying is lxss folder can be copied but can't be zipped? I read somewhere symlinking this folder into a vmdk, which seems to be the best option if you cannot do any modification inside lxss from any windows text editors and you cannot copy any file into it.

For creating a new dev environment, I use a massive shell script, which is not nice, but I think this is the nearest let's say for a Dockerfile.

For a dev environment, BashOnWindows is great, but reading from so many people how many times they recreating this from scratch (including me), I definitely not want to store any database inside WSL.

EDIT:

Nope, you have to put the entire local folder into a new drive or a vmdk, which I definitely not want. Is there a way to put only lxss folder into a VMDK symlink?

If this file system so restricted and basically you cannot do anything inside it from Windows, why not packaged into a VHD(X) on the first-place? For maintaining it would be much better.

DJviolin commented Aug 3, 2016

So what you saying is lxss folder can be copied but can't be zipped? I read somewhere symlinking this folder into a vmdk, which seems to be the best option if you cannot do any modification inside lxss from any windows text editors and you cannot copy any file into it.

For creating a new dev environment, I use a massive shell script, which is not nice, but I think this is the nearest let's say for a Dockerfile.

For a dev environment, BashOnWindows is great, but reading from so many people how many times they recreating this from scratch (including me), I definitely not want to store any database inside WSL.

EDIT:

Nope, you have to put the entire local folder into a new drive or a vmdk, which I definitely not want. Is there a way to put only lxss folder into a VMDK symlink?

If this file system so restricted and basically you cannot do anything inside it from Windows, why not packaged into a VHD(X) on the first-place? For maintaining it would be much better.

@onomatopellan

This comment has been minimized.

Show comment
Hide comment
@onomatopellan

onomatopellan Aug 3, 2016

lxss can't be a symlink anymore since build 14388. It will install but at launching bash it will show error 0x80070003.

Before that it was easy attaching a VHDX file to the lxss folder for example.

Anyway Microsoft knows about this problem and they are already thinking about different solutions.

Windows 10 Image System backup can create an image of the entire system drive with lxss folder and its attributes intact but of course it will be a huge image file that also contains Windows.

onomatopellan commented Aug 3, 2016

lxss can't be a symlink anymore since build 14388. It will install but at launching bash it will show error 0x80070003.

Before that it was easy attaching a VHDX file to the lxss folder for example.

Anyway Microsoft knows about this problem and they are already thinking about different solutions.

Windows 10 Image System backup can create an image of the entire system drive with lxss folder and its attributes intact but of course it will be a huge image file that also contains Windows.

@fjanoos

This comment has been minimized.

Show comment
Hide comment
@fjanoos

fjanoos Sep 28, 2016

is there a way to change the windows folder into which lxss installs ? my c:/ is running very low on space, I am trying to move all my stuff on to my d:

fjanoos commented Sep 28, 2016

is there a way to change the windows folder into which lxss installs ? my c:/ is running very low on space, I am trying to move all my stuff on to my d:

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Dec 27, 2016

Hi, I use Win10 and went to C:\Users\[user]\AppData\Local but couldn't find lxss folder. I am able to see hidden files. Where is the lxss folder than? Thanks,

ghost commented Dec 27, 2016

Hi, I use Win10 and went to C:\Users\[user]\AppData\Local but couldn't find lxss folder. I am able to see hidden files. Where is the lxss folder than? Thanks,

@benhillis

This comment has been minimized.

Show comment
Hide comment
@benhillis

benhillis Dec 27, 2016

Member

It is marked as system as well. Keep in mind you should not modify anything in that directory.

Member

benhillis commented Dec 27, 2016

It is marked as system as well. Keep in mind you should not modify anything in that directory.

@sourcevault

This comment has been minimized.

Show comment
Hide comment
@sourcevault

sourcevault Feb 2, 2017

@benhillis use command line to access it. Or type it in the address bar

sourcevault commented Feb 2, 2017

@benhillis use command line to access it. Or type it in the address bar

@benhillis

This comment has been minimized.

Show comment
Hide comment
@benhillis

benhillis Feb 2, 2017

Member

@partially-applied - I don't follow your comment. I'm just warning people that they should not do it.

Member

benhillis commented Feb 2, 2017

@partially-applied - I don't follow your comment. I'm just warning people that they should not do it.

@davidalbertonogueira

This comment has been minimized.

Show comment
Hide comment
@davidalbertonogueira

davidalbertonogueira Feb 15, 2017

I agree with @benhillis. Don't edit files there or add new ones (it wouldn't be visible/accessible from ubuntu anyway). Access to that folder should be read-only.

davidalbertonogueira commented Feb 15, 2017

I agree with @benhillis. Don't edit files there or add new ones (it wouldn't be visible/accessible from ubuntu anyway). Access to that folder should be read-only.

@iFreilicht

This comment has been minimized.

Show comment
Hide comment
@iFreilicht

iFreilicht Mar 17, 2017

@partially-applied I think you meant to mention @Benosika. Thank you so much for this, I was going crazy over why I couldn't see this folder and the whole internet seemingly disagreeing with me on the existence of it.

iFreilicht commented Mar 17, 2017

@partially-applied I think you meant to mention @Benosika. Thank you so much for this, I was going crazy over why I couldn't see this folder and the whole internet seemingly disagreeing with me on the existence of it.

@devloprs

This comment has been minimized.

Show comment
Hide comment
@devloprs

devloprs May 2, 2017

how do I get a windows program that requires node.js to use the wsl installed version? :) To clarify I have node installed in wsl and would like my windows programs, like sublime text to see it. It needs it to run prettify js amongst other things.

devloprs commented May 2, 2017

how do I get a windows program that requires node.js to use the wsl installed version? :) To clarify I have node installed in wsl and would like my windows programs, like sublime text to see it. It needs it to run prettify js amongst other things.

@aseering

This comment has been minimized.

Show comment
Hide comment
@aseering

aseering May 2, 2017

Contributor

Folks here may have suggestions (I know this is discussed on other tickets and others have made it work in some cases), but you might also want to ask the Sublime developers. Linux interpreters may have behavior or features that are different from their Windows counterparts, so a really feature-complete integration would require them to know to use the interpreter's Linux interface.

Contributor

aseering commented May 2, 2017

Folks here may have suggestions (I know this is discussed on other tickets and others have made it work in some cases), but you might also want to ask the Sublime developers. Linux interpreters may have behavior or features that are different from their Windows counterparts, so a really feature-complete integration would require them to know to use the interpreter's Linux interface.

@dreamcat4

This comment has been minimized.

Show comment
Hide comment
@dreamcat4

dreamcat4 May 3, 2017

@aseering I have commented on the Sublime issue today.

dreamcat4 commented May 3, 2017

@aseering I have commented on the Sublime issue today.

@oneduality

This comment has been minimized.

Show comment
Hide comment
@oneduality

oneduality Jul 19, 2017

One option would be to install nfsd and export the rootfs on ubuntu, then you'd need to activate client for nfs under programs & features, configure the service and launch it.. well, you obviously need to know how to get the nfs daemon configured as well but there's plenty of documentation online for that.

I have toyed around and got apache2 with PHP and MySQL running, you just have to manually start the services and then remember to shut them down before you exit or you could have some database corruption... but that's entirely unrelated =)

UPDATE:

I gave it a shot, it doesn't work because the ubuntu kernel doesn't support it

oneduality commented Jul 19, 2017

One option would be to install nfsd and export the rootfs on ubuntu, then you'd need to activate client for nfs under programs & features, configure the service and launch it.. well, you obviously need to know how to get the nfs daemon configured as well but there's plenty of documentation online for that.

I have toyed around and got apache2 with PHP and MySQL running, you just have to manually start the services and then remember to shut them down before you exit or you could have some database corruption... but that's entirely unrelated =)

UPDATE:

I gave it a shot, it doesn't work because the ubuntu kernel doesn't support it

@f0ster

This comment has been minimized.

Show comment
Hide comment
@f0ster

f0ster Aug 11, 2017

I have win10 Build 16241 , with ubuntu installed through the "store", and the lxss directory no longer exists in C:\Users\[user]\AppData\Local

f0ster commented Aug 11, 2017

I have win10 Build 16241 , with ubuntu installed through the "store", and the lxss directory no longer exists in C:\Users\[user]\AppData\Local

@benhillis

This comment has been minimized.

Show comment
Hide comment
@benhillis

benhillis Aug 11, 2017

Member

@f0ster - Each distribution you install through the store is installed to that application's appdata directory. For example: C:\Users\<username>\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState

Member

benhillis commented Aug 11, 2017

@f0ster - Each distribution you install through the store is installed to that application's appdata directory. For example: C:\Users\<username>\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState

@AdrielleKiz

This comment has been minimized.

Show comment
Hide comment
@AdrielleKiz

AdrielleKiz Aug 24, 2017

I'm using the linux subsystem in windows 10 with ubuntu installed
Sorry,noob here
How do I access the Desktop
cd~/Desktop is not working for me
My current dir is at /home/USERNAME
Tried ls in the my current dir and it shows up nothing while ls -a got some hits but it seems that they're all hidden files ,not directories.

AdrielleKiz commented Aug 24, 2017

I'm using the linux subsystem in windows 10 with ubuntu installed
Sorry,noob here
How do I access the Desktop
cd~/Desktop is not working for me
My current dir is at /home/USERNAME
Tried ls in the my current dir and it shows up nothing while ls -a got some hits but it seems that they're all hidden files ,not directories.

@sunilmut

This comment has been minimized.

Show comment
Hide comment
@sunilmut

sunilmut Aug 25, 2017

Member

@AdrielleKiz - Try "ls /mnt/<system drive>/Users/<user name>/Desktop"

Member

sunilmut commented Aug 25, 2017

@AdrielleKiz - Try "ls /mnt/<system drive>/Users/<user name>/Desktop"

@AdrielleKiz

This comment has been minimized.

Show comment
Hide comment
@AdrielleKiz

AdrielleKiz commented Aug 31, 2017

@sunilmut Thanks !

@cec

This comment has been minimized.

Show comment
Hide comment
@cec

cec commented Jan 11, 2018

@benhillis lifesaver

@danielschmitz

This comment has been minimized.

Show comment
Hide comment
@danielschmitz

danielschmitz Jan 29, 2018

Open a windows terminal and:

subst l: c:\Users\path\to\rootfs

result: a L: drive mapping to your linux root

image

danielschmitz commented Jan 29, 2018

Open a windows terminal and:

subst l: c:\Users\path\to\rootfs

result: a L: drive mapping to your linux root

image

@r3lik

This comment has been minimized.

Show comment
Hide comment
@r3lik

r3lik Apr 13, 2018

when I copy/move files in my home directory using the explorer, the changes aren't reflected in my terminal. Anyone know how to solve this?

r3lik commented Apr 13, 2018

when I copy/move files in my home directory using the explorer, the changes aren't reflected in my terminal. Anyone know how to solve this?

@davidalbertonogueira

This comment has been minimized.

Show comment
Hide comment
@davidalbertonogueira

davidalbertonogueira Apr 13, 2018

@r3lik , you are now allowed to do that. You should access that folder in a read-only scope.

davidalbertonogueira commented Apr 13, 2018

@r3lik , you are now allowed to do that. You should access that folder in a read-only scope.

@r3lik

This comment has been minimized.

Show comment
Hide comment
@r3lik

r3lik Apr 14, 2018

@davidalbertonogueira it wasn't working for me when I wanted to edit things in c:\Users\path\to\rootfs. I ended up just setting HOME="/mnt/c/Users/r3lik" in my .profile as a workaround.

r3lik commented Apr 14, 2018

@davidalbertonogueira it wasn't working for me when I wanted to edit things in c:\Users\path\to\rootfs. I ended up just setting HOME="/mnt/c/Users/r3lik" in my .profile as a workaround.

@shawnz

This comment has been minimized.

Show comment
Hide comment
@shawnz

shawnz May 31, 2018

Changing your home variable like that is strongly not recommended @r3lik. Why don't you just copy your files from inside WSL as recommended in the docs?

shawnz commented May 31, 2018

Changing your home variable like that is strongly not recommended @r3lik. Why don't you just copy your files from inside WSL as recommended in the docs?

@jcklpe

This comment has been minimized.

Show comment
Hide comment
@jcklpe

jcklpe Aug 7, 2018

I can't answer for him @shawnz but I can say that at least for myself it's a pain in the ass. Learned a lot of Linux stuff using WSL, now I'm starting to think that I should just go fully Linux and drop the windows thing all together, haha

jcklpe commented Aug 7, 2018

I can't answer for him @shawnz but I can say that at least for myself it's a pain in the ass. Learned a lot of Linux stuff using WSL, now I'm starting to think that I should just go fully Linux and drop the windows thing all together, haha

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment