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

WSL Bash - .profile is not read #1298

Closed
oskargargas opened this issue Oct 24, 2017 · 15 comments
Closed

WSL Bash - .profile is not read #1298

oskargargas opened this issue Oct 24, 2017 · 15 comments
Labels

Comments

@oskargargas
Copy link

@oskargargas oskargargas commented Oct 24, 2017

Versions

ConEmu build: 170910 x64
OS version: Windows 10 x64, 1709, 16299.19
Used shell version: WSL, Bash 4.3.48(1)-release (not sure how to check WSL version but it's fully updated for the day of this post)

Problem description

.profile is not read by ConEmu {bash} shell which leads to problems like default $PATH is not set.

In PATH folders set by default in .profile in Ubuntu/WSL Python pip things are installed. Of course one can modify path .bashrc but those are by default in .profile.

Steps to reproduce

  1. Add echo (or whatever) to .profile
  2. Open new shell in ConEmu
  3. Verify that .profile was not read

Actual results

.profile is not read by ConEmu {bash} shell

Expected results

.profile is read by shell in ConEmu like it's read by default WSL terminal.

@Maximus5
Copy link
Owner

@Maximus5 Maximus5 commented Oct 24, 2017

What did you compare with? Where.profile is working

@oskargargas
Copy link
Author

@oskargargas oskargargas commented Oct 24, 2017

Default terminal installed with WSL (exactly Ubuntu from Windows Store after recent Fall Creators update). The one with ubuntu-like icon. And apparently windows tells me it's called Ubuntu. Yeah, for sure it is it.

@Maximus5
Copy link
Owner

@Maximus5 Maximus5 commented Oct 25, 2017

This looks like Microsoft bug.
If you run wsl.exe there's no way to trigger .profile.

@Maximus5 Maximus5 added the other-wsl label Oct 25, 2017
@Maximus5
Copy link
Owner

@Maximus5 Maximus5 commented Oct 25, 2017

If you had installed previously bash.exe (legacy WSL), did you uninstall it by lxrun /uninstall?
As for me, legacy version blocked .profile from loading by wsl.exe.

Maximus5 added a commit that referenced this issue Oct 26, 2017
  Connector was updated. But it's recommended to uninstall legacy version
  of ‘Bash on Ubuntu on Windows’, use command `lxrun /uninstall`.

  * https://msdn.microsoft.com/commandline/wsl/install-win10
  * https://msdn.microsoft.com/en-us/commandline/wsl/reference
@mhofman
Copy link

@mhofman mhofman commented Nov 4, 2017

FYI, this might be coming natively: rprichard/wslbridge#18

@athrunsun
Copy link

@athrunsun athrunsun commented Nov 4, 2017

@Maximus5 My windows 10 is version 1703, how do I install wsl.exe? I don't have that one in my system.

@mhofman
Copy link

@mhofman mhofman commented Nov 5, 2017

Update to the Windows 10 Fall Creator Update (1709).

@mhofman
Copy link

@mhofman mhofman commented Nov 7, 2017

Until this is supported natively by wslbridge, I've managed to get .profile to execute, i.e. get an interactive login shell by executing the connector this way:

%ConEmuBaseDirShort%\conemu-msys2-64.exe --wsl -cur_console:pm:/mnt - -t -- /bin/bash -i -l

The -t is to get wslbridge to open a pty since we're executing a command.
Of course the -i -l is to get Bash's interactive login shell.
Anything after the first - is the args passed to wslbridge.exe.
Anything after the -- is the command executed by wslbridge-backend.

@Maximus5
Copy link
Owner

@Maximus5 Maximus5 commented Nov 7, 2017

The same is done automatically by connector. 12 days ago.

@mhofman
Copy link

@mhofman mhofman commented Nov 7, 2017

Correct, but I didn't see a new connector release with that code change.

Also, still useful information for anyone who wants to run a different shell, since wslbridge doesn't respect the user's default shell.
Also, since the connector now explicitly sets the command to execute, when wslbridge does get around to natively support login shell or user's default shell, this change will have to be undone.

@Maximus5
Copy link
Owner

@Maximus5 Maximus5 commented Nov 8, 2017

Connector is bundled into ConEmu. Wasn't it updated in alpha?

@mhofman
Copy link

@mhofman mhofman commented Nov 8, 2017

I'm running the preview channel.

@rolandas-valantinas
Copy link

@rolandas-valantinas rolandas-valantinas commented Mar 7, 2018

Latest alpha - .inputrc is not used from ~/ directory. Contents of .inputrc

$include /etc/inputrc
"\e[A": history-search-backward # Arrow Up
"\e[B": history-search-forward  # Arrow Down

Found this Maximus5/cygwin-connector#3 (comment) and it works. Any reason normal Ubuntu keys not working? I have AppKeys and XTerm selected.

However, it stops working after few minutes or few lines and arrows return to their previous function - really annoying! Gonna switch back to Mintty as it doesn't have any of these issues

Also terminals still starts in /mnt/c/Users not in ~/

@Maximus5
Copy link
Owner

@Maximus5 Maximus5 commented Mar 8, 2018

@rolandas-valantinas Your question is offtopic because your .inputrc is read definitely.
"Normal" Ubuntu keys have two encoding modes, and when you have checked AppKeys you get ^[OA, when AppKeys are off - ^[[A.

@Maximus5
Copy link
Owner

@Maximus5 Maximus5 commented Mar 8, 2018

The issue is closed due to

@Maximus5 Maximus5 closed this Mar 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.