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

Unable to launch bash prompt using custom wsl.conf root mount path #1538

Closed
nickjj opened this issue Apr 30, 2018 · 12 comments
Closed

Unable to launch bash prompt using custom wsl.conf root mount path #1538

nickjj opened this issue Apr 30, 2018 · 12 comments
Projects

Comments

@nickjj
Copy link

nickjj commented Apr 30, 2018

Versions

ConEmu build: 180429 x32
OS version: Windows 10 Pro 1803 Build 17134.1
Used shell version: WSL (Ubuntu 16.04)

Problem description

The Spring 2018 stable edition of Windows now supports adding in a wsl.conf file where you can customize the root mount location. It defaults to /mnt, but I wanted to change it to / so I can avoid having to bind mound /c in my bashrc, mainly because Docker for Windows expects things to exist at /c instead of /mnt/c when it comes to mounting volumes.

Steps to reproduce

  1. Configure /etc/wsl.conf inside of WSL like this:
[automount]
enabled = true
root = /
  1. Open Bash::bash terminal in ConEmu

Actual results

ConEmu will fail to load bash because it says wslbridge.exe is not found, and the failing path includes /mnt/e/path/to/where/conemu/is/installed. I am using the portable installer and it happens to be on my e drive.

I went into the ConEmu task settings and went to edit this Bash::bash task:

set "PATH=%ConEmuBaseDirShort%\wsl;%PATH%" & %ConEmuBaseDirShort%\conemu-cyg-64.exe --wsl -cur_console:pm:/cur_console:pm:/mnt

to be:

set "PATH=%ConEmuBaseDirShort%\wsl;%PATH%" & %ConEmuBaseDirShort%\conemu-cyg-64.exe --wsl -cur_console:pm:/cur_console:pm:/

and still received the same results (I changed the /mnt path at the end).

Is there something else I would need to edit for it to use a different wslbridge path? I was just poking around and changing things in hopes it would work.

Expected results

A bash terminal prompt to open as it does without a custom wsl.conf file.

@Maximus5
Copy link
Owner

Maximus5 commented May 5, 2018

Both -cur_console:pm:/cur_console:pm:/mnt and -cur_console:pm:/cur_console:pm:/ are illegal.
You pass p and m switches twice.

And both help page -new_console and About/-new_console show you proper syntax: m:""
https://conemu.github.io/en/NewConsole.html#syntax

m:/ is illegal too, don't you want to get //c/path instead of /c/path?

@nickjj
Copy link
Author

nickjj commented May 5, 2018

I just wanted ConEmu to launch a bash prompt and correctly find the wslbridge using the /e mount path instead of /mnt/e. What would the correct syntax be for that?

@nickjj
Copy link
Author

nickjj commented May 5, 2018

Also I do think this is a ConEmu issue.

Because if I change my wsl.conf file to use the root = / path I can run ubuntu from Windows and use their terminal. Then my c and e drives are mounted at / successfully.

But with ConEmu I see:

wslbridge error: failed to start backend process
note: backend error output: /bin/bash: /mnt/e/apps/ConEmu/App/ConEmu/ConEmu/wsl/wslbridge-backend: No such file or directory


ConEmuC: Root process was alive less than 10 sec, ExitCode=0.
Press Enter or Esc to close console...

This is with using /cur_console:pm:"" or /cur_console:pm:/mnt.

It's like that bridge path is hard coded to always look in /mnt.

@Maximus5
Copy link
Owner

Maximus5 commented May 5, 2018

I see now.
You talked about m switch, but it is intended only for conversion of paths on paste.
But your issue is about wslbridge in fact, nit ConEmu.
Actually, it's a question to @rprichard - how to run wslbridge properly in your case.

@Maximus5 Maximus5 reopened this May 5, 2018
@nickjj
Copy link
Author

nickjj commented May 5, 2018

It looks like some work has been done to address this at rprichard/wslbridge#22.

I don't know if it's in a release or how to use it tho.

By the way, other terminals such as wsltty work with custom WSL mount points using the latest wslbridge (from master).

@Maximus5
Copy link
Owner

Maximus5 commented May 5, 2018

Try these binaries

https://www.dropbox.com/s/i8z8gm80wfrcr91/wslbridge-wslpath.7z?dl=0

@nickjj
Copy link
Author

nickjj commented May 5, 2018

Nice work!

It works great now while using /cur_console:pm:/mnt. But should I still switch that to ""?

I also logged out of Windows completely to make sure my mounts were clear.

Here's /etc/wsl.conf:

[automount]
root = /
options = "metadata,umask=0022"

And the output of running mount -l:

C: on /c type drvfs (rw,noatime,uid=1000,gid=1000,umask=22,metadata)
D: on /d type drvfs (rw,noatime,uid=1000,gid=1000,umask=22,metadata)
E: on /e type drvfs (rw,noatime,uid=1000,gid=1000,umask=22,metadata)

Accessing /e produces my mounted drive's file system as expected.

Accessing /mnt/e is an empty folder. Not sure if this is expected. I would have expected /mnt to be completely empty instead of listing each drive's folder with empty content.

Edit: It's also worth pointing out that my .bashrc has no manual bind mounts happening, so this is definitely working well. Docker for Windows volume mounts also work out of the box.

@Maximus5
Copy link
Owner

Maximus5 commented May 5, 2018

It works great now while using /cur_console:pm:/mnt. But should I still switch that to ""?

As I said, this options is used for pasting paths only. Your choice.

Accessing /mnt/e is an empty folder. Not sure if this is expected.

Ask this in Microsoft/WSL tracker. May be that is a WSL bug.

@nickjj
Copy link
Author

nickjj commented May 5, 2018

Ok, thanks.

So for 100% clarity, I should do something like this if I wanted to goto my e drive by default:

set "PATH=%ConEmuBaseDirShort%\wsl;%PATH%" & %ConEmuBaseDirShort%\conemu-cyg-64.exe --wsl -new_console:d:E:\ 

That -new_console flag comes out when I choose the startup dir from your dialog box. But I completely removed the current console flag since it didn't seem to do anything with new console set?

@Maximus5
Copy link
Owner

Maximus5 commented May 5, 2018

You may use any option

  • -dir E:\ in the Task parameters
  • -new_console:d:"E:\" in Task commands
  • or special wslbridge switch -C/e/

@Maximus5 Maximus5 added this to To Do in ConEmu via automation May 5, 2018
@Maximus5 Maximus5 moved this from To Do to In progress in ConEmu May 5, 2018
@Maximus5 Maximus5 moved this from In progress to Ready for Testing in ConEmu May 5, 2018
@nickjj
Copy link
Author

nickjj commented May 6, 2018

@Biswa96 Certain apps don't respect symlinks.

Before this patch I just ran sudo mount --bind /mnt/c /c in my ~/.bashrc, but with the patched wslbridge and wsl.conf, it's a much cleaner solution.

@mundey
Copy link

mundey commented Dec 27, 2019

Try these binaries

https://www.dropbox.com/s/i8z8gm80wfrcr91/wslbridge-wslpath.7z?dl=0

at my side, since default mount option umask was 644, wslbridge-* was not executable and giving issues. All i had to do is open wsl from default terminal and add executable permissions and then conemu was working

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

No branches or pull requests

3 participants