* bug#35553: getlogin and getlogin_r fail with error ENXIO
@ 2019-05-03 23:03 Bruno Haible
2019-05-04 13:13 ` Danny Milosavljevic
0 siblings, 1 reply; 5+ messages in thread
From: Bruno Haible @ 2019-05-03 23:03 UTC (permalink / raw)
To: 35553
Hi,
Running the guix-1.0 installation image
(guix-system-vm-image-1.0.0.x86_64-linux) in qemu, I find that the
glibc functions getlogin() and getlogin_r() fail with error ENXIO.
Using the gnulib programs test-getlogin and test-getlogin_r I can see
that the program is reading the contents of the file /proc/self/loginuid
and its contents is "4294967295". Indeed, the file
glibc/sysdeps/unix/sysv/linux/getlogin_r.c contains this code:
/* If there is no login uid, linux sets /proc/self/loginid to the sentinel
value of, (uid_t) -1, so check if that value is set and return early to
avoid making unneeded nss lookups. */
if (uid == (uid_t) -1)
{
__set_errno (ENXIO);
return ENXIO;
}
Is it the xfce4 desktop which is not setting a loginuid? Or is it the lack
of a login screen?
It's the first Linux distro I've seen where getlogin() and getlogin_r()
fail when the user is running a normal desktop environment.
Bruno
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#35553: getlogin and getlogin_r fail with error ENXIO
2019-05-03 23:03 bug#35553: getlogin and getlogin_r fail with error ENXIO Bruno Haible
@ 2019-05-04 13:13 ` Danny Milosavljevic
2019-05-04 13:26 ` Bruno Haible
2019-05-09 10:13 ` Ludovic Courtès
0 siblings, 2 replies; 5+ messages in thread
From: Danny Milosavljevic @ 2019-05-04 13:13 UTC (permalink / raw)
To: Bruno Haible, 35553
[-- Attachment #1: Type: text/plain, Size: 748 bytes --]
http://man7.org/linux/man-pages/man8/pam_loginuid.8.html suggests that we should
use that for all "entry point"s for the user. I guess we can add it.
Are you logging in using gdm?
We don't refer to pam_loginuid.so anywhere, so it's understandable that
/proc/self/loginuid is not set either.
Apparently, Ubuntu has the following:
/etc/pam.d/common-session-noninteractive:
session [default=1] pam_permit.so
session requisite pam_deny.so
session required pam_permit.so
session required pam_unix.so
session optional pam_winbind.so
session required pam_loginuid.so
And then they @include the file above in /etc/pam.d/gdm
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#35553: getlogin and getlogin_r fail with error ENXIO
2019-05-04 13:13 ` Danny Milosavljevic
@ 2019-05-04 13:26 ` Bruno Haible
2019-05-07 10:18 ` Ludovic Courtès
2019-05-09 10:13 ` Ludovic Courtès
1 sibling, 1 reply; 5+ messages in thread
From: Bruno Haible @ 2019-05-04 13:26 UTC (permalink / raw)
To: Danny Milosavljevic; +Cc: 35553
Danny Milosavljevic wrote:
> Are you logging in using gdm?
I'm using the guix-1.0 installation image
(guix-system-vm-image-1.0.0.x86_64-linux). It shows a screen "Logging in..."
for less than one second and then starts the user's desktop immediately.
Bruno
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#35553: getlogin and getlogin_r fail with error ENXIO
2019-05-04 13:26 ` Bruno Haible
@ 2019-05-07 10:18 ` Ludovic Courtès
0 siblings, 0 replies; 5+ messages in thread
From: Ludovic Courtès @ 2019-05-07 10:18 UTC (permalink / raw)
To: Bruno Haible; +Cc: 35553
[-- Attachment #1: Type: text/plain, Size: 1183 bytes --]
Hi Bruno!
Bruno Haible <bruno@clisp.org> skribis:
> Danny Milosavljevic wrote:
>> Are you logging in using gdm?
>
> I'm using the guix-1.0 installation image
> (guix-system-vm-image-1.0.0.x86_64-linux). It shows a screen "Logging in..."
> for less than one second and then starts the user's desktop immediately.
This is the VM image (not the installation image), and it uses SLiM:
https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/system/examples/vm-image.tmpl
Danny wrote:
> We don't refer to pam_loginuid.so anywhere, so it's understandable that
> /proc/self/loginuid is not set either.
Is it the only way to get that done? (That something has to write some
number to /proc/self/loginuid looks very clunky to me.)
I’ve tested the patch below and confirmed that after logging in at the
tty, running Guile and calling ‘getlogin’ at the REPL now returns the
right thing.
We’d have to do that for all the relevant services (graphical log-in
managers, SSH daemons, anything else?). Perhaps we can simply add a
keyword to ‘unix-pam-service’ to make it less verbose.
Thoughts?
Thanks for the bug report, Bruno!
Ludo’.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 1187 bytes --]
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 952f6f9ab2..30e50f4b9a 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -829,11 +829,18 @@ Return a service that sets up Unicode support in @var{tty} and loads
(define (login-pam-service config)
"Return the list of PAM service needed for CONF."
;; Let 'login' be known to PAM.
- (list (unix-pam-service "login"
- #:allow-empty-passwords?
- (login-configuration-allow-empty-passwords? config)
- #:motd
- (login-configuration-motd config))))
+ (let ((base (unix-pam-service
+ "login"
+ #:allow-empty-passwords?
+ (login-configuration-allow-empty-passwords? config)
+ #:motd
+ (login-configuration-motd config))))
+ (list (pam-service
+ (inherit base)
+ (session (cons (pam-entry
+ (control "required")
+ (module "pam_loginuid.so"))
+ (pam-service-session base)))))))
(define login-service-type
(service-type (name 'login)
^ permalink raw reply related [flat|nested] 5+ messages in thread
* bug#35553: getlogin and getlogin_r fail with error ENXIO
2019-05-04 13:13 ` Danny Milosavljevic
2019-05-04 13:26 ` Bruno Haible
@ 2019-05-09 10:13 ` Ludovic Courtès
1 sibling, 0 replies; 5+ messages in thread
From: Ludovic Courtès @ 2019-05-09 10:13 UTC (permalink / raw)
To: Danny Milosavljevic; +Cc: Bruno Haible, 35553-done
Hello,
Danny Milosavljevic <dannym@scratchpost.org> scribes:
> We don't refer to pam_loginuid.so anywhere, so it's understandable that
> /proc/self/loginuid is not set either.
I proceeded as discussed:
https://git.savannah.gnu.org/cgit/guix.git/commit/?id=e6b1a2248ff164e14d1b2f495224faf8a8326142
https://git.savannah.gnu.org/cgit/guix.git/commit/?id=af55ca481d9e6c1d1e06632f96d550b42f33210f
Thanks,
Ludo’.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-05-09 10:15 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-03 23:03 bug#35553: getlogin and getlogin_r fail with error ENXIO Bruno Haible
2019-05-04 13:13 ` Danny Milosavljevic
2019-05-04 13:26 ` Bruno Haible
2019-05-07 10:18 ` Ludovic Courtès
2019-05-09 10:13 ` Ludovic Courtès
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).