XDG_RUNTIME_DIR set to a non-existing directory in sbuild

Bug #1964615 reported by Michał Sawicz
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
launchpad-buildd
Fix Released
High
Colin Watson
schroot (Debian)
Fix Released
Unknown
schroot (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Starting yesterday we started seeing failures in different builds in a PPA:

https://launchpad.net/~mir-team/+archive/ubuntu/dev/+build/23237481

I tracked it down to `XDG_RUNTIME_DIR` being set to `/run/user/$UID` all of a sudden. Some other variables also got set (comparison against a working build):

 APT_CONFIG=/var/lib/sbuild/apt.conf
+DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/2001/bus
 DEB_BUILD_OPTIONS=parallel=4
 HOME=/sbuild-nonexistent
 LANG=C.UTF-8
@@ -20,3 +21,7 @@
 TERM=unknown
 USER=buildd
 V=1
+XDG_RUNTIME_DIR=/run/user/2001
+XDG_SESSION_CLASS=background
+XDG_SESSION_ID=c81
+XDG_SESSION_TYPE=unspecified

Related branches

Michał Sawicz (saviq)
description: updated
Revision history for this message
Colin Watson (cjwatson) wrote :

This is extremely strange, and seems to be non-deterministic: different builders booted using the same VM image end up with different variables visible in launchpad-buildd's environment. My best guess is that the environment set up by su(1) is sensitive to some other bit of the boot process and thus causes launchpad-buildd's environment to vary depending on when it's started.

The simplest way to fix this may be to convert launchpad-buildd from an init script to a systemd service, since it's usually easier to control its environment that way: in particular, su(1) would no longer need to be involved.

affects: launchpad → launchpad-buildd
Colin Watson (cjwatson)
Changed in launchpad-buildd:
status: New → In Progress
importance: Undecided → High
assignee: nobody → Colin Watson (cjwatson)
Revision history for this message
Colin Watson (cjwatson) wrote :

Switching launchpad-buildd to a systemd service hasn't made this go away, unfortunately. On the other hand, I do seem to be able to reproduce this every time on dogfood (or at least six out of my last six builds), so I might be able to make headway there since I can SSH into those builders. I didn't make much progress figuring it out tonight, but I need sleep, so maybe I'll spot something with fresh eyes.

My next plan is to upload a package with a "sleep $lots" in its build process, which would allow me to get in and see exactly which bit of the process tree is setting these environment variables. I think it may be libpam_systemd via schroot, but I'm not certain.

Revision history for this message
Colin Watson (cjwatson) wrote :

This turns out to be an schroot bug. See https://bugs.debian.org/898949.

Changed in schroot (Debian):
status: Unknown → New
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package schroot - 1.6.10-12ubuntu3

---------------
schroot (1.6.10-12ubuntu3) jammy; urgency=medium

  * Don't create a logind session (closes: #898949, LP: #1964615).

 -- Colin Watson <email address hidden> Wed, 16 Mar 2022 15:30:36 +0000

Changed in schroot (Ubuntu):
status: New → Fix Released
Revision history for this message
Colin Watson (cjwatson) wrote :

We've deployed a cherry-pick of the schroot fix to focal.

Changed in launchpad-buildd:
status: In Progress → Fix Released
Changed in schroot (Debian):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.