mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
merge branch 'pr-3186'
Akihiro Suda (1): improve error message when dbus-user-session is not installed LGTMs: kolyshkin cyphar
This commit is contained in:
@@ -2,6 +2,7 @@ package systemd
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"sync"
|
||||
|
||||
systemdDbus "github.com/coreos/go-systemd/v22/dbus"
|
||||
@@ -52,7 +53,10 @@ func (d *dbusConnManager) getConnection() (*systemdDbus.Conn, error) {
|
||||
|
||||
conn, err := d.newConnection()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
// When dbus-user-session is not installed, we can't detect whether we should try to connect to user dbus or system dbus, so d.dbusRootless is set to false.
|
||||
// This may fail with a cryptic error "read unix @->/run/systemd/private: read: connection reset by peer: unknown."
|
||||
// https://github.com/moby/moby/issues/42793
|
||||
return nil, fmt.Errorf("failed to connect to dbus (hint: for rootless containers, maybe you need to install dbus-user-session package, see https://github.com/opencontainers/runc/blob/master/docs/cgroup-v2.md): %w", err)
|
||||
}
|
||||
dbusC = conn
|
||||
return conn, nil
|
||||
|
||||
Reference in New Issue
Block a user