Re: su gets stuck for root

From: Harald Dunkel
Date: Sun May 18 2008 - 13:57:19 EST

Alan Cox wrote:
If I run "su someuser" as root, then it gets stuck. No prompt. I cannot
interrupt it with ^C or ^Z either. /var/log/auth.log says:

Is it then killable remotely, can you gdb it ?

Attaching to the running stty failed:

# gdb stty 26465
GNU gdb 6.8-debian
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu"...
Attaching to program: /var/tmp/coreutils-6.10/coreutils-6.10/src/stty, process 26465
/tmp/buildd/gdb-6.8/gdb/linux-nat.c:988: internal-error: linux_nat_attach: Assertion `pid == GET_PID (inferior_ptid) && WIFSTOPPED (status) && WSTOPSIG (status) == SIGSTOP' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.

I can kill it with -9, but INTR, SEGV, BUS, etc. don't interrupt
it. And if I run stty inside of the debugger (or on the command
line), then it doesn't get stuck.

I have changed stty.c to do some print statements, and changed
root's .bashrc to use it for "stty intr ^C": It gets stuck
inside tcsetattr():

printf("here we are\n");
if (tcsetattr (STDIN_FILENO, TCSADRAIN, &mode))
error (EXIT_FAILURE, errno, "%s", device_name);
printf("born to be kings\n");

The previous tcgetattr() to read the old terminal settings shows
no problem (AFAICS).

Replacing TCSADRAIN by 0 doesn't help.


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at