Score:0

Why ubuntu doesn't start from the first bash

cn flag

I guess I accidentally created some subshell and realized that I can't reach Conda anymore. Then, I did some search and used bash. And now I'm able to reach Conda again. But the problem is now every time I open the Ubuntu terminal, I have to bash once. I guess pstree would explain the situation better than me. I don't know why it doesn't start from the first bash anymore. here

enter image description here

I think before this all happened pstree was like this: enter image description here

hr flag
What does `echo $0` say before and after you type `bash`? My guess is that the first case is a login shell (which will read your `.profile` or `.bash_profile`) whereas the second is a non-login shell that reads your `.bashrc`. Is this WSL by any chance?
Baran Aldemir avatar
cn flag
Yeah I am using WSL2. I also added the results of `echo $0` before and after `bash`.
user535733 avatar
cn flag
Do not beg specific volunteers for assistance. Comments are intended to help you improve your question until it is answerable. When you question is answerable, and somebody knows the answer, then somebody will answer it.
Score:1
hr flag

Apparently WSL starts bash as a login shell. Among other things, this means it reads (in order of preference) your ~/.bash_profile and .profile files. Your subsequently invoked bash command is invoked as an interactive non-login shell and hence ignores those startup files and instead reads your ~/.bashrc (which is presumably where you have done your conda setup).

Regular desktop Ubuntu tries to make non-login and login shells more similar by adding a section to the default ~/.profile that

  • checks if the shell is bash (not sh, or zsh, or some other shell)

  • if so sources the user's ~/.bashrc file

WSL appears to provide its own minimal ~/.profile that does not do this - but if it bothers you, you could

  • backup your current file: cp ~/.profile ~/.profile.bak

  • copy the default Ubuntu one from the /etc/skel directory: cp /etc/skel/.profile ~/

or (possibly better), create a ~/.bash_profile if you haven't already got one, and source ~/.bashrc from there.

Score:0
cn flag

I found a temporary solution from a Github post. Although this is not the real solution since it doesn't fix the 2*[{init}] problem, it does the work.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.