GNOME Bugzilla – Bug 107534
leaves ghosts on system
Last modified: 2006-04-12 09:11:36 UTC
Hi, http://bugs.debian.org/183035 gnome-terminal does not remove entries from /var/run/utmp properly. After running exiting a ghost of that user on that pty is left on the system.
I can't reproduce this.
Hi, I did an strace and I see a that. Any idea what's wrong ? 16521 access("/usr/lib/libvte4/gnome-pty-helper", X_OK) = 0 16521 open("/dev/null", O_RDONLY) = 16 16521 open("/dev/null", O_RDONLY) = 17 16521 socketpair(PF_UNIX, SOCK_STREAM, 0, [18, 19]) = 0 16521 close(16) = 0 16521 close(17) = 0 16521 fork() = 16522 16522 --- SIGSTOP (Stopped (signal)) @ 0 (0) --- 16522 getpid() = 16522 16522 getrlimit(0x3, 0xbffff360) = 0 16522 setrlimit(RLIMIT_STACK, {rlim_cur=RLIM_INFINITY, rlim_max=RLIM_INFINITY}) = 0 16522 getrlimit(0x7, 0xbffff378) = 0 [...] 16522 close(15) = 0 16522 close(16) = -1 EBADF (Bad file descriptor) 16522 close(17) = -1 EBADF (Bad file descriptor) 16522 close(18) = 0 16522 close(20) = -1 EBADF (Bad file descriptor) 16522 close(21) = -1 EBADF (Bad file descriptor) 16522 close(22) = -1 EBADF (Bad file descriptor) 16522 close(23) = -1 EBADF (Bad file descriptor) 16522 close(24) = -1 EBADF (Bad file descriptor)
That looks correct. The parent is closing one end of the socket pair (it uses one end, and the gnome-pty-helper child uses the other).
How I can debug that ?
Try firing up gnome-terminal, attaching strace to the gnome-pty-helper which it starts up, and exiting the terminal. That should let you see just what the pty-helper does when the parent asks it to shut down a terminal. Thanks!
Apparently gnome-pty-helper doesn't write /var/run/utmp when I quit gnome-terminal : read(0, 0xbffff5e0, 4) = ? ERESTARTSYS (To be restarted) --- SIGTERM (Terminated) @ 0 (0) ---
Okay, should be fixed in CVS now. Please reopen if you continue to see problems.
Still here in 0.11.4 Even worse now gnome-pty-helper doesn't write a new entry in utmp
Can you strace it again and see what's going on in the helper?
Created attachment 16202 [details] strace log file
I did a strace (3 gnome-terminals are launched) and gnome-pty-helper is unable to write the utmp file : 29403 access("/var/run/utmpx", F_OK) = -1 ENOENT (No such file or directory) 29403 open("/var/run/utmp", O_RDWR) = -1 EACCES (Permission denied) 29403 open("/var/run/utmp", O_RDONLY) = 3 Of course gnome-pty-helper is correctly setgid : $ ls -l /usr/lib/libvte4 total 652 -rwxr-xr-x 1 root root 284 avr 29 16:22 decset -rwxr-sr-x 1 root utmp 8536 avr 29 16:22 gnome-pty-helper
What are the permissions on /var/run/utmp? Is it writable by the utmp group?
Yes : ls -l /var/run/utmp -rw-rw-r-- 1 root utmp 6144 mai 2 19:08 /var/run/utmp
Aargh, please attach to the helper process after the terminal has been started instead of running it directly under strace. If you as an unprivileged user attempt to strace a setuid or setgid process, the kernel will start the process without elevated privileges.
Created attachment 16218 [details] Helper strace
Ah OK. I attached another strace to the helper and opened/closed different gnome-terminal.
Reopening after new information was given.
Created attachment 37472 [details] strace Attaching a non-gzipped version to make it easier to look at it.
This has been fixed a long time ago. The problem was that vte sends SIGTERM to gnome-pty-helper upon termination, and gnome-pty-helper was not handling the signal, so it was getting killed before getting the chance to clean up. It handles the signal and cleans up correctly now.