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

Try to fix bluechi-agent-user-bus test #1005

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

mkemel
Copy link
Member

@mkemel mkemel commented Dec 8, 2024

Test bluechi-agent-user-bus stopped working in GitHub CI as well, it was disabled in Testing Farm earlier.
Now it fails in both environments with the same error.

Related #900

@mkemel
Copy link
Member Author

mkemel commented Dec 8, 2024

Github CI Integration Tests and Testing Farm - error when running /usr/libexec/bluechi-agent -u
Locally the test works well

Dec 08 22:33:38 8327aadc5321 systemd[1]: Starting User Manager for UID 1000...
Dec 08 22:33:38 8327aadc5321 unix_chkpwd[51]: could not obtain user info (bluechiuser)
Dec 08 22:33:38 8327aadc5321 unix_chkpwd[52]: could not obtain user info (bluechiuser)
Dec 08 22:33:38 8327aadc5321 systemd[50]: PAM failed: Authentication service cannot retrieve authentication info
Dec 08 22:33:38 8327aadc5321 systemd[50]: [email protected]: Failed to set up PAM session: Operation not permitted
Dec 08 22:33:38 8327aadc5321 systemd[50]: [email protected]: Failed at step PAM spawning /usr/lib/systemd/systemd: Operation not permitted
Dec 08 22:33:38 8327aadc5321 systemd[1]: [email protected]: Main process exited, code=exited, status=224/PAM
Dec 08 22:33:38 8327aadc5321 systemd[1]: [email protected]: Failed with result 'exit-code'.
Dec 08 22:33:38 8327aadc5321 systemd[1]: Failed to start User Manager for UID 1000.
Dec 08 22:33:38 8327aadc5321 systemd[1]: Started Session 1 of User bluechiuser.
Dec 08 22:33:38 8327aadc5321 runuser[48]: pam_unix(runuser-l:session): session opened for user bluechiuser(uid=1000) by root(uid=0)
Dec 08 22:33:38 8327aadc5321 systemd[57]: systemd-hostnamed.service: PrivateNetwork=yes is configured, but network namespace setup failed, ignoring: Operation not permitted
Dec 08 22:33:38 8327aadc5321 systemd[1]: Starting Hostname Service...
Dec 08 22:33:38 8327aadc5321 systemd[1]: Started Hostname Service.
Dec 08 22:33:38 8327aadc5321 bluechi-agent[73]: Final configuration used:
                                                ControllerPort=8420
                                                TCPKeepAliveCount=6
                                                HeartbeatInterval=2000
                                                LogLevel=DEBUG
                                                ControllerAddress=(null)
                                                LogTarget=journald
                                                NodeName=node-foo
                                                IPReceiveErrors=true
                                                TCPKeepAliveTime=1
                                                ControllerHeartbeatThreshold=0
                                                TCPKeepAliveInterval=1
                                                LogIsQuiet=False
                                                ControllerHost=10.1.0.119
Dec 08 22:33:38 8327aadc5321 bluechi-agent[73]: Starting bluechi-agent 0.10.0-0.202412082229.gitf646f4c
Dec 08 22:33:38 8327aadc5321 bluechi-agent[73]: Failed to connect to user bus: No such file or directory
Dec 08 22:33:38 8327aadc5321 bluechi-agent[73]: Failed to open api dbus
Dec 08 22:33:38 8327aadc5321 bluechi-agent[73]: Finalizing agent
Dec 08 22:33:39 8327aadc5321 runuser[48]: pam_unix(runuser-l:session): session closed for user bluechiuser
Dec 08 22:33:39 8327aadc5321 systemd[1]: session-1.scope: Deactivated successfully.
Dec 08 22:33:39 8327aadc5321 systemd-logind[25]: Session 1 logged out. Waiting for processes to exit.
Dec 08 22:33:39 8327aadc5321 systemd[1]: Stopping User Runtime Directory /run/user/1000...
Dec 08 22:33:39 8327aadc5321 systemd-logind[25]: Removed session 1.
Dec 08 22:33:39 8327aadc5321 systemd[1]: [email protected]: Deactivated successfully.
Dec 08 22:33:39 8327aadc5321 systemd[1]: Stopped User Runtime Directory /run/user/1000.
Dec 08 22:33:39 8327aadc5321 systemd[1]: Removed slice User Slice of UID 1000.

When run locally, this is the node-foo journal:

Dec 08 23:01:25 59a46837b52f systemd[1]: Starting User Manager for UID 1000...
Dec 08 23:01:25 59a46837b52f systemd[51]: pam_unix(systemd-user:session): session opened for user bluechiuser(uid=1000) by root(uid=0)
Dec 08 23:01:25 59a46837b52f systemd[51]: Queued start job for default target Main User Target.
Dec 08 23:01:25 59a46837b52f systemd[51]: Created slice User Application Slice.
Dec 08 23:01:25 59a46837b52f systemd[51]: Started Daily Cleanup of User's Temporary Directories.
Dec 08 23:01:25 59a46837b52f systemd[51]: Reached target Paths.
Dec 08 23:01:25 59a46837b52f systemd[51]: Reached target Timers.
Dec 08 23:01:25 59a46837b52f systemd[51]: Starting D-Bus User Message Bus Socket...
Dec 08 23:01:25 59a46837b52f systemd[51]: Starting Create User's Volatile Files and Directories...
Dec 08 23:01:25 59a46837b52f systemd[51]: Finished Create User's Volatile Files and Directories.
Dec 08 23:01:25 59a46837b52f systemd[51]: Listening on D-Bus User Message Bus Socket.
Dec 08 23:01:25 59a46837b52f systemd[51]: Reached target Sockets.
Dec 08 23:01:25 59a46837b52f systemd[51]: Reached target Basic System.
Dec 08 23:01:25 59a46837b52f systemd[51]: Reached target Main User Target.
Dec 08 23:01:25 59a46837b52f systemd[51]: Startup finished in 54ms.
Dec 08 23:01:25 59a46837b52f systemd[1]: Started User Manager for UID 1000.
Dec 08 23:01:25 59a46837b52f systemd[1]: Started Session 3 of User bluechiuser.
Dec 08 23:01:25 59a46837b52f runuser[49]: pam_unix(runuser-l:session): session opened for user bluechiuser(uid=1000) by root(uid=0)
Dec 08 23:01:25 59a46837b52f systemd[1]: Starting Hostname Service...
Dec 08 23:01:25 59a46837b52f systemd[64]: systemd-hostnamed.service: PrivateNetwork=yes is configured, but network namespace setup failed, ignoring: Operation not permitted
Dec 08 23:01:25 59a46837b52f systemd[1]: Started Hostname Service.
Dec 08 23:01:26 59a46837b52f bluechi-agent[80]: Final configuration used:
                                                ControllerPort=8420
                                                TCPKeepAliveCount=6
                                                HeartbeatInterval=2000
                                                LogLevel=DEBUG
                                                ControllerAddress=(null)
                                                LogTarget=journald
                                                NodeName=node-foo
                                                IPReceiveErrors=true
                                                TCPKeepAliveTime=1
                                                ControllerHeartbeatThreshold=0
                                                TCPKeepAliveInterval=1
                                                LogIsQuiet=False
                                                ControllerHost=192.168.31.200
Dec 08 23:01:26 59a46837b52f bluechi-agent[80]: Starting bluechi-agent 0.10.0-0.202412051354.gitbdc597e
Dec 08 23:01:26 59a46837b52f bluechi-agent[80]: Connected to user bus
Dec 08 23:01:26 59a46837b52f systemd[51]: Starting D-Bus User Message Bus...
Dec 08 23:01:26 59a46837b52f dbus-broker-launch[82]: Policy to allow eavesdropping in /usr/share/dbus-1/session.conf +31: Eavesdropping is deprecated and ignored
Dec 08 23:01:26 59a46837b52f dbus-broker-launch[82]: Policy to allow eavesdropping in /usr/share/dbus-1/session.conf +33: Eavesdropping is deprecated and ignored
Dec 08 23:01:26 59a46837b52f systemd[51]: Started D-Bus User Message Bus.
Dec 08 23:01:26 59a46837b52f dbus-broker-lau[82]: Ready
Dec 08 23:01:26 59a46837b52f bluechi-agent[80]: Connected to user bus

@mkemel mkemel force-pushed the user-test branch 5 times, most recently from fe93280 to d3975bc Compare December 9, 2024 07:02
Run agent as subprocess as user and not via systemd

Signed-off-by: Mark Kemel <[email protected]>
@engelmi
Copy link
Member

engelmi commented Dec 9, 2024

Couldn't we simply create a user in the container, e.g. via

RUN useradd bluechi

and use that instead of stitching it together on the fly?
As long as we don't add USER bluechi we still run as root by default, but are able to use the user bus for bluechi user, e.g. via

systemctl --user -M bluechi@ status bluechi-agent

The specific test could then be changed to listen on the connection state, then calling this systemctl command and exit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants