Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test-login failure with running elogind #108

Closed
markhindley opened this Issue Dec 14, 2018 · 20 comments

Comments

Projects
None yet
2 participants
@markhindley
Copy link
Contributor

markhindley commented Dec 14, 2018

Sven,

Hi.

test-login fails for me if there is elogind running on the system:

130/136 test-login FAIL 0.02 s (killed by signal 6 SIGABRT)

--- command ---
PATH='/home/mark/src/devuan/build/elogind-239.3/build:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11' /home/mark/src/devuan/build/elogind-239.3/build/test-login
--- stderr ---
/* Information printed is from the live system */
sd_pid_get_slice(0, …) → ""
sd_pid_get_session(0, …): No such file or directory
sd_get_seats(…) → [1] "seat0"
Assertion 'IN_SET(r, 0, -ENODATA)' failed at ../src/libelogind/sd-login/test-login.c:209, function test_login(). Aborting.

Compare this with build on a system without elogind running:

130/136 test-login OK 0.01 s

--- command ---
PATH='/home/mark/src/devuan/build/elogind-239.3/build:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11' /home/mark/src/devuan/build/elogind-239.3/build/test-login
--- stderr ---
/* Information printed is from the live system */
sd_pid_get_slice(0, …) → "n/a"
sd_pid_get_session(0, …): No data available
Seems we are not running in a session, skipping some tests.
sd_get_seats(…) → [0] ""
sd_seat_get_active(NULL, …) (active session on current seat) → (null)
sd_get_sessions(…) → [0] ""
sd_get_uids(…) → [0] {}
sd_get_machines(…) → [0] ""

Mark

@Yamakuzure

This comment has been minimized.

Copy link
Collaborator

Yamakuzure commented Dec 14, 2018

All tests ran just fine on my system with elogind running. Once I am able to, I'll look into it.

@Yamakuzure

This comment has been minimized.

Copy link
Collaborator

Yamakuzure commented Dec 14, 2018

Does loginctl from the live system show any sessions when the test fails?

@markhindley

This comment has been minimized.

Copy link
Contributor Author

markhindley commented Dec 14, 2018

@markhindley

This comment has been minimized.

Copy link
Contributor Author

markhindley commented Dec 14, 2018

@Yamakuzure

This comment has been minimized.

Copy link
Collaborator

Yamakuzure commented Dec 14, 2018

Yes. The assertion suggests that there is no active session.

So either elogind was started and just could not log any user login, yet (and has not been called to create session), or the user has logged in with pam_elogind.so being disabled.

@markhindley

This comment has been minimized.

Copy link
Contributor Author

markhindley commented Dec 16, 2018

Hi,

Since this is quite easy to trigger, I have implemented the following work around. You may want to include it.

https://git.devuan.org/LeePen/elogind/commit/338e4827184362a6dd23d4637e92df35b71ae27f

Mark

@Yamakuzure

This comment has been minimized.

Copy link
Collaborator

Yamakuzure commented Dec 17, 2018

@markhindley : That patch looks fine to me! 👍

This is yet another situation where the systemd devs have no need to deal with something like this. Their system would have been powered by systemd anyway, so whatever you do, systemd-logind will have at least one active session. Guaranteed.

Thank you very much for your help!

@markhindley

This comment has been minimized.

Copy link
Contributor Author

markhindley commented Dec 19, 2018

@Yamakuzure

This comment has been minimized.

Copy link
Collaborator

Yamakuzure commented Dec 19, 2018

@markhindley Chroots are always fishy. See #45

@markhindley

This comment has been minimized.

Copy link
Contributor Author

markhindley commented Dec 21, 2018

@Yamakuzure

This comment has been minimized.

Copy link
Collaborator

Yamakuzure commented Jan 2, 2019

@markhindley Happy new year!

I am back from the yearly christmas-to-new-year-family-vacation-marathon. I need two weeks of work to recover from that! 😉

This was a damn good find of yours! Upstream seems to have done something to the return values I missed. I'll go an take a look whether this happened elsewhere, too.
Maybe we can solve this and #45 after all! 👍

Yamakuzure added a commit that referenced this issue Jan 5, 2019

Prep v239.4: Fix cg_path_get_session() error return
When no session could be found, the systemd code returns -ENXIO,
while the elogind specific part returns -ENOENT.
The problem is, that the first is understood as a simple lack of data
and is not considered to be a hard error in calling functions, while
the latter is wreaking havoc.

This ultimately led to:
Bug: #45 #108
Signed-Off-By: Sven Eden <sven.eden@prydeworx.com>
@Yamakuzure

This comment has been minimized.

Copy link
Collaborator

Yamakuzure commented Jan 5, 2019

Unfortunately this isn't enough.
When I run make test without elogind running and with /run/systemd removed, I now get:

--- stderr ---
/* Information printed is from the live system */
sd_pid_get_slice(0, …) → "11"
sd_pid_get_session(0, …) → "11"
Assertion 'sd_pid_get_owner_uid(0, &u2) == 0' failed at ../src/libelogind/sd-login/test-login.c:71, function test_login(). Aborting.

What I can not test at the moment is to run the test in a chroot while elogind is running on the live system.

@markhindley

This comment has been minimized.

Copy link
Contributor Author

markhindley commented Jan 6, 2019

@Yamakuzure

This comment has been minimized.

Copy link
Collaborator

Yamakuzure commented Jan 7, 2019

@markhindley : Thanks for testing!

Although the "11" above is not an errno but the session ID (😉), it is good to know that it has to do something with my system.

And I think I know what happened: As NetworkManager is running in the background, it might have questioned elogind over dbus, which then restarted elogind.

I have to test with all services, which could make dbus starting elogind, being disabled.

@markhindley

This comment has been minimized.

Copy link
Contributor Author

markhindley commented Jan 7, 2019

@markhindley

This comment has been minimized.

Copy link
Contributor Author

markhindley commented Jan 8, 2019

@Yamakuzure Yamakuzure self-assigned this Jan 21, 2019

@Yamakuzure Yamakuzure added the bug label Jan 21, 2019

@Yamakuzure

This comment has been minimized.

Copy link
Collaborator

Yamakuzure commented Jan 21, 2019

When I have finished migrating the last wave of systemd commits, this has to be tested again.

Yamakuzure added a commit that referenced this issue Feb 20, 2019

Prep 239.4: Fix test-login when elogind hasn't run before
When elogind is built, it might be a fresh install.
The test-login program might then crash if /run/systemd is either
absent or not populated.

This patch checks for these circumstances and skips tests that can
succeed.

Bug: #45
Bug: #108
Signed-off-by: Sven Eden <sven.eden@prydeworx.com>

Yamakuzure added a commit that referenced this issue Feb 20, 2019

Prep 239.4: Fix test-login when elogind hasn't run before
When elogind is built, it might be a fresh install.
The test-login program might then crash if /run/systemd is either
absent or not populated.

This patch checks for these circumstances and skips tests that can
succeed.

Bug: #45
Bug: #108
Signed-off-by: Sven Eden <sven.eden@prydeworx.com>
@Yamakuzure

This comment has been minimized.

Copy link
Collaborator

Yamakuzure commented Feb 20, 2019

@markhindley : I think I have solved this issue. Could you please test with latest v239-stable?

@markhindley

This comment has been minimized.

Copy link
Contributor Author

markhindley commented Mar 1, 2019

@Yamakuzure

This comment has been minimized.

Copy link
Collaborator

Yamakuzure commented Mar 1, 2019

Yes, finally! 😁

@Yamakuzure Yamakuzure closed this Mar 1, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.