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.
Hmm, `logname` does show my username. Can you try to compare xfce4- and gnome-terminal settings to see what might be causing the difference?
This looks relevant: https://stackoverflow.com/questions/50633892/is-getlogin-implemented-by-reading-from-var-run-utmp
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.
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?
(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 ...
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.
No, this does not solve my problem.
`read(3, "4294967295", 12) = 10` is still present.
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
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.
-- 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