after sudo su (su -), gnome-terminal [or a virtual terminal "-bash"] "exit"s ("logout"s) with any single keypress

Bug #224802 reported by Jim Baker
14
Affects Status Importance Assigned to Milestone
sudo
Invalid
Unknown
sudo (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Binary package hint: sudo

Description: Ubuntu 8.04
Release: 8.04

gnome-terminal:
  Installed: 2.22.1-0ubuntu2
  Candidate: 2.22.1-0ubuntu2
  Version table:
 *** 2.22.1-0ubuntu2 0
        500 http://ubuntu.mirror.frontiernet.net hardy/main Packages
        100 /var/lib/dpkg/status

sudo:
  Installed: 1.6.9p10-1ubuntu3
  Candidate: 1.6.9p10-1ubuntu3
  Version table:
 *** 1.6.9p10-1ubuntu3 0
        500 http://ubuntu.mirror.frontiernet.net hardy/main Packages
        100 /var/lib/dpkg/status

Here's how to duplicate the bug:
-Open a gnome terminal from Applications->Accessories->Terminal-
-or-
-Open a virtual terminal using Ctrl-Alt-F2 (for example)-
-then enter the following command
sudo su
-or-
sudo su -
-after entering your password and receiving the # prompt all is well, but, then type-
exit
-and then try get the root prompt again, as follows-
sudo su
-or-
sudo su -
-you will get a root prompt, but the very first key you press, any key, will immediately either-
"exit"
-or-
"logout"
-respectively-

Here's a cut/paste of a sample session.
Below I hit the "j" key at the root prompt and get kicked out of root.
Entering "sudo -k" temporarily allows the use of "sudo su (or sudo su -)" again.
It is necessary to type "exit" and leave root, then try to get in again, in order to see the bug.

jim@jim-desktop:~$ sudo su
[sudo] password for jim:
root@jim-desktop:/home/jim# blah
bash: blah: command not found
root@jim-desktop:/home/jim# exit
exit
jim@jim-desktop:~$ sudo su
root@jim-desktop:/home/jim# jexit
jim@jim-desktop:~$ sudo su -
root@jim-desktop:~# jlogout
jim@jim-desktop:~$ sudo -k
jim@jim-desktop:~$ sudo su
[sudo] password for jim:
root@jim-desktop:/home/jim# blah
bash: blah: command not found
root@jim-desktop:/home/jim# sudo su
root@jim-desktop:/home/jim# sudo su -
root@jim-desktop:~# exit
logout
root@jim-desktop:/home/jim# exit
exit
root@jim-desktop:/home/jim# exit
exit
jim@jim-desktop:~$ sudo su
root@jim-desktop:/home/jim# jexit
jim@jim-desktop:~$ sudo su -
root@jim-desktop:~# jlogout

Revision history for this message
Kelvin Gardiner (kelvingardiner) wrote :

I can confirm this. Status changed to confirmed.

Changed in sudo:
status: New → Confirmed
Revision history for this message
Martin Pitt (pitti) wrote :

I cannot replicate this. Do you have a nonstandard /root/.bashrc or ~/.bashrc?

Do you get this with a fresh user profile or just with your own user?

Changed in sudo:
status: Confirmed → Incomplete
Revision history for this message
[redacted] (frozenfire-deactivatedaccount) wrote :

Same here, got it lots o'times.
sudo -i always works.
maybe something with su?
anything else works. (cat, ls, sleep,nano)

nathan@vixen:~$ sudo su
root@vixen:/home/nathan# lexit
nathan@vixen:~$ sudo su
root@vixen:/home/nathan# lexit
nathan@vixen:~$ sudo -i
root@vixen:~# ls
root@vixen:~# exit
logout
nathan@vixen:~$

Revision history for this message
[redacted] (frozenfire-deactivatedaccount) wrote :

BTW: gnome-terminal is not related, I use yakuake.
And same over ssh. And same with text terminal (ctrl+alt+f1).

Revision history for this message
Anthony Fok (foka) wrote :

I ran into this problem several weeks ago, but then it became normal for some time.

Today, just now, I run into this problem again, on a Debian sid that was "apt-get dist-upgrade" as of today.

Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

Although I use Gentoo (and not Ubuntu), I can confirm this bug too. The version of sudo I'm using:

sergio@miki ~ $ sudo -V
Sudo version 1.6.9p16

Also, I've oppened a bug in sudo's bugzilla. You can follow it here:

http://www.gratisoft.us/bugzilla/show_bug.cgi?id=304

I'd like to emphasize the following comment:

http://www.gratisoft.us/bugzilla/show_bug.cgi?id=304#c2

I don't know if anybody has noticed this, but I think it's worth mentioning.

Thanks.

Changed in sudo:
status: Unknown → In Progress
Revision history for this message
Guido Jäkel (guido-jaekel) wrote :

I'm also don't observe this currently on my Unbutu workstations, but with "su -" on some of my Gentoo Server's, too. And this type of problem is also reported by users of other distributions!

After switching to another user via "su - foo" i eithter get kicked out immediately (the shell writes "exit" or "logout") or just after the first keypress, if this isn't CR. Pressing CR will proceed to the next prompt, any other will act like receiving a SIGHUP from somewhere. Note that the pressed key is displayed before logout.

But sometime after leaving the system alone for a while or after rebooting, all will work fine as expected for one try. With the next try, the problem occurs again.

And more, sometime it will work with user account a, but not with b and othertimes vice versa.

In addition, one of two nominal nearly-cloned boxes of one of my clusters show the problem, the other one works flawless.

Some other guys wrote, that this only will happen with bash -- i don't check it. But i don't think it's realy related to bash, su or sudo in core.

I also try to get a hint from 'strace su - foo'. But using this type of invocation, everythink works well, again! From this, i think it's some very strange kind of a race condition. Maybe on slow hardware, maybe just -- as another one reports -- on *single* (non-HT) CPU systems.

I observe it on my test boxes, which holds simple 1.6GHz P4 boards.

Martin Pitt (pitti)
Changed in sudo:
status: Incomplete → Confirmed
Revision history for this message
toxygen (toxygen1) wrote :

Definitely not the bug of sudo, but su or bash.

both debian & fedora & ubuntu

http://bugs.gentoo.org/show_bug.cgi?id=232630
"su from root to another user will exit after pressing a key."

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=476519
"su - nobody sometimes logged back out instantly"

such@vpn:~$ su -
vpn:~# alogout
such@vpn:~$ su
vpn:/home/such# aexit

I would like to stress the difference it uses exit and logout w/ or w/o -.

Any ideas how to debug this? With strace, it never occurs.

Revision history for this message
[redacted] (frozenfire-deactivatedaccount) wrote :

I don't think it's su, as su is something like 10 lines.
All it does is check the password, setuid() and setgid(), and exec().
I suspect bash.
It _could_ be PAM though.

Revision history for this message
toxygen (toxygen1) wrote :

Happening with ksh and tcsh (though, zsh seems to be resistant to this).
I got hint it could be kernel, I use Debian 5 xen default (Linux vpn 2.6.26-1-xen-686 #1 SMP Sat Jan 10 22:52:47 UTC 2009 i686 GNU/Linux)

Changed in sudo:
status: In Progress → Invalid
Revision history for this message
Gary (gary-geisbert) wrote :

This is still happening, it appears to be related to "su" and not sudo. Has anyone been able to figure out what causes this? I'm having this issue on real hardware and not a VPS, so it's not the xen kernel...

Revision history for this message
[redacted] (frozenfire-deactivatedaccount) wrote :

I recently wrote a little C program that was essentially su, without password stuff.
Did the same thing randomly. PAM isn't to blame.

Revision history for this message
JT Justman (jt-signless) wrote :

I just had this problem when I enabled

Defaults mail_always

in sudoers. Other sudo commands worked fine, but when doing any variation of 'sudo su -' or 'sudo su $USER', the sytem would echo 'logout' on first keypress.

Could be unrelated, but still gathering information.

Revision history for this message
Gary (gary-geisbert) wrote :

I don't think the problem is in your sudoers config, since It does this when using "/bin/su -" without sudo. I still for the life of me can't figure this one out, but figured I'd comment here to help troubleshoot it.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.