bashrc_dispatch icon indicating copy to clipboard operation
bashrc_dispatch copied to clipboard

Can't login to X11

Open chigh opened this issue 12 years ago • 9 comments

When using this bashrc_dispatch, I noticed that I am unable to login to X11. I haven't had the opportunity to check on other Linux distributions, but it certainly happens on Ubuntu 12.10, and 13.04.

This is what's logged in ~/.xsession-errors:

/usr/sbin/lightdm-session: 15: /home/userid/.bashrc_interactive: shopt: not found
/usr/sbin/lightdm-session: 34: [: 1000: unexpected operator
/usr/sbin/lightdm-session: 46: [: ==: unexpected operator
/usr/sbin/lightdm-session: 46: [: ==: unexpected operator
/usr/sbin/lightdm-session: 41: [: unexpected operator
/usr/sbin/lightdm-session: 40: [: unexpected operator
/usr/sbin/lightdm-session: 46: /home/userid/.profile: [[: not found
/usr/sbin/lightdm-session: 42: /home/userid/.profile: shopt: not found
/usr/sbin/lightdm-session: 73: export: Illegal option -f

I've narrowed it down to the last error. When logging in, and the shell it hits the following lines in the .bashrc_dispatch:

    $fn_cmd -f shell_is_linux
    $fn_cmd -f shell_is_osx
    $fn_cmd -f shell_is_login
    $fn_cmd -f shell_is_interactive
    $fn_cmd -f shell_is_script

that error is logged and the X11 session is terminated and brought back to the login screen. If I comment those lines out, I can login (the previous errors are still logged, but apparently are not fatal to the X11 session), but I cannot tell if I'm missing any functionality.

I am hardly a shell expert, so are those lines absolutely necessary? What exactly do they do? Is there something that can be done to work around them?

Thanks.

chigh avatar May 24 '13 13:05 chigh

It looks like bashrc_dispatch is being read by Dash instead of Bash. bashrc_dispatch uses options available only in Bash, as the name implies.

How did you install bashrc_dispatch?

gioele avatar May 24 '13 20:05 gioele

bashrc_dispatch is a file and .bashrc .bash_login .bash_profile and .profile are symlinks to bashrc_dispatch.

These are located in my home directory.

On May 24, 2013, at 16:51, Gioele [email protected] wrote:

It looks like bashrc_dispatch is being read by Dash instead of Bash. bashrc_dispatch uses options available only in Bash, as the name implies.

How did you install bashrc_dispatch?

— Reply to this email directly or view it on GitHub.

chigh avatar May 24 '13 23:05 chigh

You have hit this bug in GDM and LightDM:

https://bugs.launchpad.net/ubuntu/+source/lightdm/+bug/1097903 https://bugs.launchpad.net/ubuntu/+source/gdm/+bug/678421

I will commit a work around soon. In the meantime you can add

[ -n "$BASH_VERSION" ] && exit

at the beginning of bashrc_dispatch.

gioele avatar May 25 '13 00:05 gioele

That doesn't seem to help and prevents me from logging in X11 or otherwise (e.g. via su - user or ssh).

chigh avatar May 25 '13 02:05 chigh

Can you please try adding the following at the beginning of bashrc_dispatch?

[ -n "$BASH_VERSION" ] && return

gioele avatar May 25 '13 06:05 gioele

I apologize; that was one of the modifications I didn't try on my own. When I use that, I am able to login to X, but all of the shells (terminal, ssh, etc) do not load any of the rc files, thus no variables are set, and no functions or aliases are loaded.

If this is helpful to you, I can continue. If not, I can just work around this problem.

chigh avatar May 25 '13 12:05 chigh

This is also true when logging into a BASH shell on OSX (in Terminal, ssh, etc). If the [ -n "$BASH_VERSION" ] && return is set, I am dropped to shell with only the system rc files having been sourced.

chigh avatar May 31 '13 15:05 chigh

As a work-around, I have reconfigured sh to be bash instead of dash. However, I may not be able to do this to systems to which I do not have root access. So, if there's a better fix as a normal user, I'd like to use it.

dpkg-reconfigure dash

chigh avatar May 31 '13 15:05 chigh

I found a bit of a better work-around for this. At the beginning of .bashrc_dispatch:

export OLD_DISPLAY=$DISPLAY
[[ $SESSION = ubuntu && ! -z $DISPLAY ]] && unset DISPLAY

And at the end of .bashrc_dispatch

if [[ $SESSION = ubuntu ]]; then
    export DISPLAY="$OLD_DISPLAY"
fi

chigh avatar Sep 25 '15 22:09 chigh