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

Where did /mnt/c/ go? #1864

Closed
ghost opened this issue Apr 8, 2017 · 14 comments
Closed

Where did /mnt/c/ go? #1864

ghost opened this issue Apr 8, 2017 · 14 comments

Comments

@ghost
Copy link

ghost commented Apr 8, 2017

I did cd /mnt && ll, but I didn't find a c directory there, which I always found there.

As a Linux newbie, I can't explain it. Was c moved/removed from mnt in the last update?

It is extremely important for me to navigate to some locations inside C, especially as part of commands.

@aseering
Copy link
Contributor

aseering commented Apr 8, 2017

Hm... That directory is still there for me.

Was it there for you previously on this same computer / Windows installation?

If it was there before, what build were you running when it last worked? Also, I hate to ask, but have you tried simply rebooting?

If this is a new computer, or a fresh installation of Windows, could you check what type of file system your C drive uses? ("My Computer" -> right click on the "C" drive -> Properties -> what does it say next to "File system:"?) WSL only supports NTFS drives right now.

@ghost
Copy link
Author

ghost commented Apr 8, 2017

I've rebooted Windows and now it's there. And yes, it was always there previously in this computer. BTW, my build is 10.0.14393 and my c drive's file system is NTFS.

I never imagined there should be any association between a Windows reboot and appearance of c under /mnt.. Can you please give a few words so me and future readers of this thread could have an explanation here on why a Windows reboot helps with this?

@aseering
Copy link
Contributor

aseering commented Apr 8, 2017

So, I'm not an expert; someone on the WSL team can probably comment. But in general on Linux, the way that mountpoints work is, there's a directory, and the specified filesystem is mounted into that directory. The directory is often just a normal directory; it's possible (though not necessarily easy) to remove it. If you do manage to remove it, the mount becomes inaccessible.

WSL seems to create all of the /mnt/* directories when it first starts. (You can observe this because, if you remove a drive while WSL is running, its directory will still be there; it's just empty.) My guess is that some command that you ran somehow managed to remove the /mnt/c directory. So the fix was to re-create the directory and re-mount the magic DrvFs volume. I don't know how to manually re-mount a DrvFs volume, but I know it happens automatically on boot. So, "take one reboot and call me in the morning" :-)

@ghost
Copy link
Author

ghost commented Apr 9, 2017

I rebooted Windows again this time, and now there is no c under /mnt...

@ghost
Copy link
Author

ghost commented Apr 9, 2017

Okay I now rebooted WSL itself via reboot and got:

Connection to MY_VPS_IP closed by remote host.
Connection to MY_VPS_IP closed.

Now /mnt/c is back on place...

@ghost
Copy link
Author

ghost commented Apr 9, 2017

I think I found a bug in WSL:

Rebooting both Windows and WSL brings back /mnt/c but SSH tunneling into my VPS and running the following command set deletes mnt/c:

(
cd /var/www/html
mysqldump -u root --password --all-databases > ./db.sql
zip -r ./html.zip ./
scp db.sql html.zip /mnt/c/Users/USER/Desktop # Verify path!
rm ./html.zip ./db.sql
)

@ghost
Copy link
Author

ghost commented Apr 9, 2017

I assume this thread should be closed as it's not an isolated bug report targeted bug report. Mod's please reopen I'm wrong. Isolated bug report here:

#1868

@ghost ghost closed this as completed Apr 9, 2017
@CherryDT
Copy link

@Benosika

I think the misunderstanding here is that you apparently log into a remote machine using SSH and run commands there but expect your local paths to be present.

When you run ssh, you are then logged into another computer - you will see so by checking your command prompt, it will say a different computer name now. You will then see the remote computer's paths and everything. For all intents and purposes, you are now working not on your local computer anymore and on the remote computer.

You can exit from the remote session using the exit command. You will then see the command prompt change again to your local machine's name and the local paths being back.

The reason why reboot appeared to fix the problem was that you actually rebooted the remote server you were logged into and not WSL. Hence why it said Connection to MY_VPS_IP closed by remote host. - because you just instructed your VPS to shut down and reboot, and so it automatically kicked you out as well. It's a rather rude alternative to exit ;-)

@ghost
Copy link
Author

ghost commented Apr 11, 2017

Hello, CHerryDT, with all sincerity you got me wrong, or I explained myself in a not-enough clear way: I clearly distinguish between my local machine to remote one and fully know their paths are not the same; I just understood (and I might have understood wrong) that when using scp I should give the paths of the local machine (while in the remote machine) and this way transfer files to it. Also, I rebooted WSL and not my remote machine. Of course - If I would rebooted my remote machine, I would have to relogin.

Anyway, there seems to be a solution here:

http://askubuntu.com/questions/903038/how-to-move-files-from-ssh-session-to-local-session

@CherryDT
Copy link

CherryDT commented Apr 11, 2017

@Benoskia: In fact it's the opposite: with scp you can transfer things between the local and the remote machine, but you need to do it from the local machine. While working from the remote machine's prompt, the remote machine will be considered "local" so it cannot work. For scp, you can specify either a local path (local to the shell from where you ran scp, not necessarily local to your machine!), e.g. /tmp, or a remote path by prefixing it with the remote hostname, e.g. my.remote.server.com:/tmp.

However, I am still quite sure that you somehow confused the local and the remote machine, because it is not possible to "reboot" WSL (at least not from within WSL - you can run net stop lxssmanager & net start lxssmanager from Windows' shell). Running reboot will not work:

david@CHE-X1:~ $ reboot
Failed to connect to bus: No such file or directory
david@CHE-X1:~ $ sudo reboot
[sudo] password for david:
Failed to connect to bus: No such file or directory
Failed to talk to init daemon.

...and this is expected.

So, the fact that reboot did something, and even more the fact that you said it said Connection closed means that you ran reboot from within your remote VPS's shell, i.e. rebooting the VPS and not WSL.

@ghost
Copy link
Author

ghost commented Apr 11, 2017

I have heard scp can also work from remote as in:

scp /path/to/file/on/ComputerB ComputerAUser@ComputerA:/path/to/dump/file/on/ComputerA

I executed reboot on the local machine and I can't say what was the exact outcome even if it wasn't full reboot --- In any case, it made /mnt/c reappear; That's for sure and I've double tested this.

@jalbalah
Copy link

mount -t drvfs C: /mnt/c

remounting worked for me ;)

@blackflame007
Copy link

mount -t drvfs C: /mnt/c

I added these mount commands to my /etc/wsl.conf in Ubuntu and removed the auto mount command
now everything works perfect. My issue was weird if I typed wsl in my c drive it would keep me in the directory I was in but there would be nothing in /mnt/c and /mnt/d and I if did pwd id get blackflame007@Laptop:/ /c/Users/blackflame007$. Just like that with a space. Didn't see anyone else that had that issue. Hope this post helps someone. Here is my /etc/wsl.conf file

mount -t drvfs C: /mnt/c
mount -t drvfs D: /mnt/d
root = /
options = "metadata"

@zkrhm
Copy link

zkrhm commented Nov 5, 2020

remounting worked for me ;)

@jalbalah deserved a medal you rocks man

This issue was closed.
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

5 participants