Bug 213369

Summary: konsole does not register to utmp (again)
Product: [Fedora] Fedora Reporter: Ville Skyttä <scop>
Component: kdebaseAssignee: Than Ngo <than>
Status: CLOSED RAWHIDE QA Contact:
Severity: urgent Docs Contact:
Priority: urgent    
Version: 6CC: chris.stone, covex, dennis, kzak, laurent.rineau__fedora, pomec, rdieter, sandmann, umar
Target Milestone: ---Keywords: Regression
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-02-14 17:33:20 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Ville Skyttä 2006-11-01 06:28:41 UTC
konsole fails to register users in utmp/wtmp again in FC6's original kde and the
3.5.5-0.2 update.  Bug 205767 seems indicate that libkdecore should maybe be
linked with libutempter.so.* but it is not:

$ rpm -q kdelibs
kdelibs-3.5.5-0.2.fc6.x86_64
$ rpm -qR kdelibs | grep utemp
$

Additionally, kdecore/kpty.cpp has some code which tries to execute
/usr/sbin/utempter which doesn't exist in libutempter, and libutempter's
/usr/libexec/utempter/utempter and the dir it is in have so restrictive
permissions that normal users won't be able to execute it anyway (I wonder if
that's on purpose?).

Comment 1 Rex Dieter 2006-12-06 15:44:49 UTC
Sure enough, even though kdelibs includes
BuildRequires: libutempter-devel
and
%configure --with-utempter
and configure checks:
checking for addToUtmp in -lutempter... yes

It doesn't actually link against it.  

As Ville pointed out, the only reference to it anywhere in kdelibs is
kdecore/kpty.cpp, and that's only for directly using (the non-existent)
/usr/sbin/utempter


Comment 2 Adam Pribyl 2006-12-26 09:11:12 UTC
FYI: xterm also does not update utmp when run as anybody else than root.

Comment 3 Ville Skyttä 2006-12-26 09:31:23 UTC
Any ETA for a fix?  This is something that affects quite a few things.

Comment 4 Christopher Stone 2007-01-13 20:39:07 UTC
*** Bug 216562 has been marked as a duplicate of this bug. ***

Comment 5 Dennis Gilmore 2007-01-13 20:41:14 UTC
I am seeing this also.

Changing priority and status.  This should be considered a security issue. 

Comment 6 Lubomir Kundrak 2007-01-15 12:16:59 UTC
(In reply to comment #5)
> I am seeing this also.
> 
> Changing priority and status.  This should be considered a security issue. 

Could you clarify why do you think this is a security issue?


Comment 7 Dennis Gilmore 2007-01-15 12:59:54 UTC
It could give a sysadmin a false sense that no one is logged in and doing 
anything.  resulting in them not checking on what users are doing. If a system 
is configured to use gdm   kde sessions dont show up  at all  w  shows 0 
users. 

Comment 8 Lubomir Kundrak 2007-01-15 14:34:25 UTC
(In reply to comment #7)
> It could give a sysadmin a false sense that no one is logged in and doing 
> anything.  resulting in them not checking on what users are doing. If a system 
> is configured to use gdm   kde sessions dont show up  at all  w  shows 0 
> users. 

utmp is _not_ a reliable source of imformation about what are people doing,
it is just informative, for users' convenence. There's no way to force user
to have an utmp entry. If he wants he can start a program, and log off
from terminal (emulator)?. If an operator wants to see what's going on, he
uses ps(8).

I am removing the Security keyword.

Comment 9 Rex Dieter 2007-01-15 16:45:22 UTC
Re: comment #7, Dennis, (at least afaik) it is only shells started from konsole
that are missing from utmp.

Comment 10 Dennis Gilmore 2007-01-15 17:00:41 UTC
Rex,  I did not test bt it was reported in #fedora-extras  that if you use gdm  
your whole session fails to register.  and if you do a w it will show  0 users

Comment 11 Christopher Stone 2007-01-15 17:02:57 UTC
(In reply to comment #9)
> Re: comment #7, Dennis, (at least afaik) it is only shells started from konsole
> that are missing from utmp.

# w
 22:08:07 up 11 min,  0 users,  load average: 0.10, 0.24, 0.20
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT

You can get this result by using gdm and running w from within a konsole, so is
gdm broken also?  When I switched to kdm I see the login for kdm.

Has anyone tried using xdm and xterms?  I bet those dont work either.

Comment 12 Rex Dieter 2007-01-15 17:13:38 UTC
RE: gdm
Hmm, offhand, sounds like a gdm buglet to me.  Regardless, that's a
another/separate (but related, of course) issue to *this* one.

Comment 13 Adam Pribyl 2007-01-19 20:45:32 UTC
The external bug is reported against freebsd. It could be that its the same
thing however, just need to extend the platforms/OS.

Comment 14 Sammy 2007-01-26 16:30:43 UTC
For whoever is in charge of this bug and Fedora CVS:

I have built all packages of KDE 3.5.6 for FC6+updates.

The utmp registration works fine without any patches for me.

When I add the patch you just checked into cvs Patch41, it
no longer works!

FYI

Comment 15 Than Ngo 2007-01-29 10:24:24 UTC
Sammy, i assume you have changed libutempter. It cannot work if you are using 
libutempter-1.1.4-3.fc6. Could you please check where the utempter is installed
on your machine? Thanks

Comment 16 Sammy 2007-01-30 15:43:50 UTC
Well, I am using:
=====================================
$ rpm -q -a | grep libutempter
libutempter-1.1.4-3.fc6
libutempter-devel-1.1.4-3.fc6
libutempter-devel-1.1.4-3.fc6
libutempter-1.1.4-3.fc6
======================================
The "w" command at this instant shows:
======================================
$ w
 09:28:29 up 20:03,  5 users,  load average: 4.66, 2.89, 1.33
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
umar     :0       -                08:32   ?xdm?   3:32   0.03s /bin/sh
/usr/bin/startkde
umar     pts/0    -                08:32   55:59   0.00s  0.25s kded --new-startup
umar     pts/1    -                08:33    0.00s  0.04s  0.00s w
umar     pts/2    -                09:19    6:48   1.31s  0.02s /bin/bash
umar     pts/3    -                09:22    5:42   0.13s  0.02s /bin/bash
==============================================
The spec files are essentially the same. I just added few patches from svn
commits that does not have anything to do with this. When I used the above
patch the "w" command produced nothing.

Comment 17 Sammy 2007-01-30 15:56:01 UTC
I rechecked the final version of kpty.cpp file and it is the
unpatched one (all the lines deleted in that patch are there).
The last command is also showind all the sessions as login.

The config.log file sais:
=======================================
configure:41982: gcc -o conftest -DNDEBUG -O2  -O2 -g -pipe -Wall
-Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4
-m64 -mtune=generic  -DQT_THREAD_SUPPORT  -D_REENTRANT  conftest.c -lutempter   >&5
configure:41988: $? = 0
configure:41992: test -z
                         || test ! -s conftest.err
configure:41995: $? = 0
configure:41998: test -s conftest
configure:42001: $? = 0
configure:42014: result: yes
===============================================================
ac_cv_lib_utempter_addToUtmp=yes
===============================================================
LIBUTEMPTER='-lutempter'
===============================================================

Comment 18 Sammy 2007-01-30 16:06:10 UTC
My /usr/include/utempter.h file has:
====================================================================
/* New interface. */

extern int utempter_add_record (int master_fd, const char *hostname);
extern int utempter_remove_record (int master_fd);
extern int utempter_remove_added_record (void);
extern void utempter_set_helper (const char *pathname);

/* Old interface. */

extern void addToUtmp (const char *pty, const char *hostname, int master_fd);
extern void removeFromUtmp (void);
extern void removeLineFromUtmp (const char *pty, int master_fd);
======================================================================

Comment 19 Christopher Stone 2007-02-13 22:09:52 UTC
xterm and kdm seem to be working now with the latest update today.  konsole
still not working.

Comment 20 Sammy 2007-02-13 23:16:08 UTC
This bug is very puzzling to me. I build the rpm "without" the patch
and it worked for konsole. Today I rebuilt it and now it is not
working for konsole on i386 and working for kdm on x86_64. I will
check konsole at the office on x86_64 tomorrow. I have been noticing
this behavior though, it sometimes works and sometimes doesn't
(meaning from one build to another).

Comment 21 Sammy 2007-02-14 16:38:33 UTC
OK. Some more info: I build FC6 kdelibs with the NEW utempter patch used
in rawhide. Now, the kdelibs is explicitly linked with libutempter. Also,
if you do ldd /usr/bin/konsole it shows link to libutempter. However,

1. For root logins everything is working correctly (including konsole).
2. For ordinary users only kdm is showing and no konsole.

FYI
Umar

Comment 22 Laurent Rineau 2007-02-14 16:52:06 UTC
(In reply to comment #21)
> 1. For root logins everything is working correctly (including konsole).
> 2. For ordinary users only kdm is showing and no konsole.

What is your SELinux status? (Use "getenforce" to display the status of 
SELinux on you system.)

Comment 23 Sammy 2007-02-14 16:54:22 UTC
$ getenforce
Disabled


Comment 24 Sammy 2007-02-14 17:00:05 UTC
$ getenforce
Disabled

Comment 25 Sammy 2007-02-14 17:22:02 UTC
More info. Startring xterms as a user registers with utmp correctly.
Both xterm and konsole are linked with libutempter. However, checking
permissions:

-rwxr-sr-x 1 root utempter 359136 Jan 18 08:52 /usr/bin/xterm
-rwxr-xr-x 1 root root 4352 Feb 14 08:37 /usr/bin/konsole

making konsole's group and mode same as xterm results in a working
konsole registration. Is this what it should be?

Comment 26 Than Ngo 2007-02-14 17:33:20 UTC
Correct, the permission of konsole should be changed like xterm.
It's now fixed rawhide. I will build new kdebase inncluding this fix for FC6 soon.


Comment 27 Christopher Stone 2007-04-03 05:01:17 UTC
Just a friendly reminder that this appears to still need fixing in FC6.