su - ignoramus; No such file or directory.
by chrislewis79 from LinuxQuestions.org on (#54D25)
Using Linux Lite, on a 2007 Thinkpad T60. Working through the LFS book, upto Ch5, building the temporary system.
TLDR;
Problem: "su - lfs" can't find shell because it is called "binbash"
Solution: Change it to "/bin/bash"
Help request: where am I not already looking?
Fuller version
Upto the first time you use the new lfs user. Had some fiddling earlier could not get update-alternatives to point to an appropriate version of gcc/g++, but that works now when you run the version-check script.
When I do
Code:chris@T60:~$ su - lfs
Password:
env: 'binbash': No such file or directory
So this error looks smack in the face obvious, I *must* have written somewhere "binbash" where I meant to write "/bin/bash". I just can't find where.
So first off it must be the lfs usr ~.bash_profile or .bashrc so lets have a look:
Code:chris@T60:~$ cat /home/lfs/.bash_profile
exec env -i HOME=$HOME TERM=$TERM PS1='\u:\w\$ ' \bin\bashand .bashrc?
Code:chris@T60:~$ cat /home/lfs/.bashrc
set +h
umask 022
LFS=/mnt/lfs
LC_ALL=POSIX
LFS_TGT=i686-lfs-linux-gnu
PATH=/tools/bin:/bin:/usr/bin
export LFS LC_ALL LFS_TGT PATHok so just like out of the book. hmm calling it from 'chris' so what about user 'chris'?
Code:chris@T60:~$ cat .profile
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.
# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022
# if running bash
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi
# set PATH so it includes user's private bin directories
PATH="$HOME/bin:$HOME/.local/bin:$PATH"
export LFS=/mnt/lfs
chris@T60:~$Nope. No accidental "binbash" in there. What about .bash_rc for user 'chris'?
Code:chris@T60:~$ cat .bashrc
# enable bash completion in interactive shells
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
alias usage='du -sk * | sort -n | perl -ne '\''($s,$f)=split(m{\t});for (qw(K M G)) {if($s<1024) {printf("%.1f",$s);print "$_\t$f"; last};$s=$s/1024}'\'
alias ls="ls --color"
chris@T60:~$Again, no "binbash" there. Hmm. Several months back I was working through LFS and mashed up the install because I was not pointing at the new partition for compiling having not shut down right previously. Took advice and included some "export LFS=/mnt/lfs" in a start up script and began again - full fresh host installation. Oddly it did not appear in user 'chris' start up profile after I put it there but seemed to zoom itself to the root profiles. Lets check the root profiles:
Code:root@T60:~# cat .bashrc
# enable bash completion in interactive shells
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u@\h\[\033[00m\]:\[\033[01;31m\]\w\[\033[00m\]\$ '
alias usage='du -sk * | sort -n | perl -ne '\''($s,$f)=split(m{\t});for (qw(K M G)) {if($s<1024) {printf("%.1f",$s);print "$_\t$f"; last};$s=$s/1024}'\'
alias ls="ls --color"root@T60:~#Hmm no "binbash" there. What about .profile?
Code:root@T60:~# cat .profile
# ~/.profile: executed by Bourne-compatible login shells.
if [ "$BASH" ]; then
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
fi
mesg n || true
root@T60:~#Hmm, no "binbash" there. Well there are no other users. And none of these files have been edited on windows so none of them end with a "^M". Usually done with commend line utils or with nano or sometimes a Linux Lite gui text editor.
I have googled this a bit, bu this seems pointless as it is just a single line of text, and I must be able to find it somewhere.
I wondered a bit about the $PATH, so here they are: (which appear above)
Code:root@T60:~# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
root@T60:~#and
Code:chris@T60:~$ echo $PATH
/home/chris/bin:/home/chris/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
chris@T60:~$Ican't log in as lfs so I can't echo $PATH as lfs usr, but then it is listed above.
I read through the Man page for su, not sure that is telling me where else to look. I figured out su is part of the sudo package,so I downloaded the sudo source and started searching the src files with nano and a search function for "No such file or Directory". (Yes I should have used grep on the lot). Not looked at all on them only the "ENV" ones or likely equivalent.
Thanks for your time, This is begging for me to find it - be kind in your reply, I will be kicking myself about it for weeks.


TLDR;
Problem: "su - lfs" can't find shell because it is called "binbash"
Solution: Change it to "/bin/bash"
Help request: where am I not already looking?
Fuller version
Upto the first time you use the new lfs user. Had some fiddling earlier could not get update-alternatives to point to an appropriate version of gcc/g++, but that works now when you run the version-check script.
When I do
Code:chris@T60:~$ su - lfs
Password:
env: 'binbash': No such file or directory
So this error looks smack in the face obvious, I *must* have written somewhere "binbash" where I meant to write "/bin/bash". I just can't find where.
So first off it must be the lfs usr ~.bash_profile or .bashrc so lets have a look:
Code:chris@T60:~$ cat /home/lfs/.bash_profile
exec env -i HOME=$HOME TERM=$TERM PS1='\u:\w\$ ' \bin\bashand .bashrc?
Code:chris@T60:~$ cat /home/lfs/.bashrc
set +h
umask 022
LFS=/mnt/lfs
LC_ALL=POSIX
LFS_TGT=i686-lfs-linux-gnu
PATH=/tools/bin:/bin:/usr/bin
export LFS LC_ALL LFS_TGT PATHok so just like out of the book. hmm calling it from 'chris' so what about user 'chris'?
Code:chris@T60:~$ cat .profile
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.
# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022
# if running bash
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi
# set PATH so it includes user's private bin directories
PATH="$HOME/bin:$HOME/.local/bin:$PATH"
export LFS=/mnt/lfs
chris@T60:~$Nope. No accidental "binbash" in there. What about .bash_rc for user 'chris'?
Code:chris@T60:~$ cat .bashrc
# enable bash completion in interactive shells
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
alias usage='du -sk * | sort -n | perl -ne '\''($s,$f)=split(m{\t});for (qw(K M G)) {if($s<1024) {printf("%.1f",$s);print "$_\t$f"; last};$s=$s/1024}'\'
alias ls="ls --color"
chris@T60:~$Again, no "binbash" there. Hmm. Several months back I was working through LFS and mashed up the install because I was not pointing at the new partition for compiling having not shut down right previously. Took advice and included some "export LFS=/mnt/lfs" in a start up script and began again - full fresh host installation. Oddly it did not appear in user 'chris' start up profile after I put it there but seemed to zoom itself to the root profiles. Lets check the root profiles:
Code:root@T60:~# cat .bashrc
# enable bash completion in interactive shells
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u@\h\[\033[00m\]:\[\033[01;31m\]\w\[\033[00m\]\$ '
alias usage='du -sk * | sort -n | perl -ne '\''($s,$f)=split(m{\t});for (qw(K M G)) {if($s<1024) {printf("%.1f",$s);print "$_\t$f"; last};$s=$s/1024}'\'
alias ls="ls --color"root@T60:~#Hmm no "binbash" there. What about .profile?
Code:root@T60:~# cat .profile
# ~/.profile: executed by Bourne-compatible login shells.
if [ "$BASH" ]; then
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
fi
mesg n || true
root@T60:~#Hmm, no "binbash" there. Well there are no other users. And none of these files have been edited on windows so none of them end with a "^M". Usually done with commend line utils or with nano or sometimes a Linux Lite gui text editor.
I have googled this a bit, bu this seems pointless as it is just a single line of text, and I must be able to find it somewhere.
I wondered a bit about the $PATH, so here they are: (which appear above)
Code:root@T60:~# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
root@T60:~#and
Code:chris@T60:~$ echo $PATH
/home/chris/bin:/home/chris/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
chris@T60:~$Ican't log in as lfs so I can't echo $PATH as lfs usr, but then it is listed above.
I read through the Man page for su, not sure that is telling me where else to look. I figured out su is part of the sudo package,so I downloaded the sudo source and started searching the src files with nano and a search function for "No such file or Directory". (Yes I should have used grep on the lot). Not looked at all on them only the "ENV" ones or likely equivalent.
Thanks for your time, This is begging for me to find it - be kind in your reply, I will be kicking myself about it for weeks.