! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
logname reports "no login name" in xfce4-terminal
Status:
RESOLVED: MOVED
Product:
Xfce4-terminal
Component:
General

Comments

Description Hongxu 2019-12-21 10:04:27 CET
While using `logname` command (whatever zsh/bash/sh) in xfce4-terminal emulator, it reports "logname: no login name".
I assume this is an issue of xfce4-terminal since in gnome-terminal or tty, `logname` correctly prints the name.
Comment 1 Igor editbugs 2019-12-21 21:43:30 CET
Hmm, `logname` does show my username.

Can you try to compare xfce4- and gnome-terminal settings to see what might be causing the difference?
Comment 3 Hongxu 2019-12-23 03:14:44 CET
Indeed I tried another machine (Ubuntu 18.04LTS) with fresh gnome-terminal and xfce4-terminal, both output my username.
The machine where xfce4-terminal keeps working incorrectly is an Xubuntu 19.10. I didn't change the settings significantly, but just a few configurations e.g., "Run command as login shell" (which does not matter as I tried) and others in the "Appearance" tab.
Comment 4 Igor editbugs 2020-01-10 16:57:55 CET
I started seeing the problem on my Ubuntu 18.04 system, although I'm sure it wasn't there when I last checked it. `logname` doesn't show my username in xfce4-terminal anymore but still shows it in gnome-terminal.

While strace'ing `logname`, I noticed that the following lines are different between x-t and g-t runs:
gnome-terminal:
openat(AT_FDCWD, "/proc/self/loginuid", O_RDONLY) = 3
read(3, "1000", 12)                     = 4
xfce4-terminal:
openat(AT_FDCWD, "/proc/self/loginuid", O_RDONLY) = 3
read(3, "4294967295", 12)               = 10

So it kinda makes sense that `logname` cannot determine my username in x-t since the user id is invalid - it's "-1", while when in g-t, it shows the correct value "1000".

Do you see the same problem with "/proc/self/loginuid" on your system?
Comment 5 Hongxu 2020-01-10 17:04:59 CET
(In reply to Igor from comment #4)
> I started seeing the problem on my Ubuntu 18.04 system, although I'm sure it
> wasn't there when I last checked it. `logname` doesn't show my username in
> xfce4-terminal anymore but still shows it in gnome-terminal.
> 
> While strace'ing `logname`, I noticed that the following lines are different
> between x-t and g-t runs:
> gnome-terminal:
> openat(AT_FDCWD, "/proc/self/loginuid", O_RDONLY) = 3
> read(3, "1000", 12)                     = 4
> xfce4-terminal:
> openat(AT_FDCWD, "/proc/self/loginuid", O_RDONLY) = 3
> read(3, "4294967295", 12)               = 10
> 
> So it kinda makes sense that `logname` cannot determine my username in x-t
> since the user id is invalid - it's "-1", while when in g-t, it shows the
> correct value "1000".
> 
> Do you see the same problem with "/proc/self/loginuid" on your system?

Yes, I see the same problem on my system.
...
close(3)                                = 0
openat(AT_FDCWD, "/proc/self/loginuid", O_RDONLY) = 3
read(3, "4294967295", 12)               = 10
close(3)                                = 0
openat(AT_FDCWD, "/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 3
...
Comment 6 Igor editbugs 2020-01-10 20:04:28 CET
I seem to have been able to fix the problem on my system (it had nothing to do with xfce4-terminal).
The following links suggested the solution:
https://linux-audit.redhat.narkive.com/mTXdCUES/why-auid-always-unset
https://bugzilla.redhat.com/show_bug.cgi?id=1328947

My system uses lightdm as a login manager. "/etc/pam.d/lightdm" had the
session required        pam_loginuid.so
string commented out, so I uncommented it, rebooted the system and boom - is`logname` able to return my username since "/proc/self/loginuid" has correct user id.

Please let me know if the recipe works for you as well.
Comment 7 Hongxu 2020-01-11 10:19:16 CET
No, this does not solve my problem.
Comment 8 Hongxu 2020-01-11 10:20:10 CET
`read(3, "4294967295", 12)               = 10` is still present.
Comment 9 Igor editbugs 2020-01-12 20:36:13 CET
Interesting!
Could you post the output of `grep -r loginuid /etc/`? Below is the output of the command on my Arch Linux system where `logname` works. You could also compare the outputs on your Ubuntu 18.04 and 19.10 systems.

$ grep -r loginuid /etc/
/etc/pam.d/system-login:session    optional   pam_loginuid.so
/etc/pam.d/rlogin:session    required     pam_loginuid.so
/etc/pam.d/systemd-user:session  required pam_loginuid.so
/etc/pam.d/system-services:session   optional    pam_loginuid.so
/etc/pam.d/rsh:session    required     pam_loginuid.so
Comment 10 Hongxu 2020-01-13 03:51:02 CET
Hi, the output (Xubuntu 19.10) is:

/etc/pam.d/login:# Sets the loginuid process attribute
/etc/pam.d/login:session    required     pam_loginuid.so
/etc/pam.d/systemd-user:session  required pam_loginuid.so
/etc/pam.d/sshd:# Set the loginuid process attribute.
/etc/pam.d/sshd:session    required     pam_loginuid.so
/etc/pam.d/lightdm:session required        pam_loginuid.so
/etc/pam.d/cron:# Sets the loginuid process attribute
/etc/pam.d/cron:session    required     pam_loginuid.so
/etc/pam.d/lightdm-autologin:#session required        pam_loginuid.so

I don't know whether I need to uncomment other lines.
Comment 11 Git Bot editbugs 2020-05-24 23:46:23 CEST
-- GitLab Migration Automatic Message --

This bug has been migrated to xfce.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.xfce.org/apps/xfce4-terminal/-/issues/44.

Please create an account or use an existing account on one of our supported OAuth providers. 

If you want to fork to submit patches and merge requests please continue reading here: https://docs.xfce.org/contribute/dev/git/start#gitlab_forks_and_merge_requests

Also feel free to reach out to us on the mailing list https://mail.xfce.org/mailman/listinfo/xfce4-dev

Bug #16290

Reported by:
Hongxu
Reported on: 2019-12-21
Last modified on: 2020-05-24

People

CC List:
1 user

Version

Attachments

Additional information