You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -103,20 +103,6 @@ Podman 4.0 or later is required.
103
103
104
104
Rootless Podman runs containers without root privileges. This is the default mode on Fedora and RHEL 9+ and the recommended configuration for desktops and laptops.
105
105
106
-
### Enable the Podman Socket
107
-
108
-
OpenShell communicates with Podman through a Unix socket. Enable the rootless socket for your user:
109
-
110
-
```console
111
-
$ systemctl --user enable --now podman.socket
112
-
```
113
-
114
-
Verify the socket exists:
115
-
116
-
```console
117
-
$ ls $XDG_RUNTIME_DIR/podman/podman.sock
118
-
```
119
-
120
106
### Configure Cgroup Delegation
121
107
122
108
OpenShell runs an embedded k3s cluster inside the gateway container. k3s needs to manage cgroup controllers for pod resource isolation. Without cgroup delegation, the gateway fails to start.
The output should include `cpuset cpu io memory pids`.
142
128
143
-
### Enable Login Lingering (Headless Systems)
129
+
### Headless Systems Prerequisites
144
130
145
131
:::{note}
146
-
**Headless/SSH systems only.**Skip this step on desktops and laptops where you log in directly. On those systems, your user session persists and systemd user services stay running.
132
+
**Headless/SSH systems only.**If you log in directly at a desktop session, skip ahead to [Enable the Podman Socket](#enable-the-podman-socket). Desktop sessions handle login lingering, `XDG_RUNTIME_DIR`, and the D-Bus session bus automatically via PAM.
147
133
:::
148
134
149
-
On headless systems accessed only over SSH, systemd terminates all user services when the last SSH session disconnects. This kills the Podman socket and any running gateway container. Login lingering tells systemd to keep your user services alive regardless of active sessions:
135
+
On headless systems (accessed only over SSH, or when switching users with `su`/`sudo su`), three things must be configured before `systemctl --user` will work. Complete these steps in order.
136
+
137
+
**Enable login lingering.** Without lingering, systemd does not start a user session manager for your account. This means there is no D-Bus session bus, no user socket directory, and `systemctl --user` cannot function:
150
138
151
139
```console
152
-
$ loginctl enable-linger $USER
140
+
$ sudo loginctl enable-linger $USER
153
141
```
154
142
155
-
Verify:
143
+
Verify lingering is active:
156
144
157
145
```console
158
146
$ loginctl show-user $USER --property=Linger
159
147
Linger=yes
160
148
```
161
149
162
-
### Verify XDG_RUNTIME_DIR (Headless Systems)
163
-
164
-
:::{note}
165
-
**Headless/SSH systems only.** Desktop sessions set `XDG_RUNTIME_DIR` automatically via PAM. This step is only needed if you access the system exclusively over SSH.
166
-
:::
150
+
Lingering also keeps your user services alive when all SSH sessions disconnect, which prevents the Podman socket and gateway container from being killed.
167
151
168
-
Some SSH configurations do not set `XDG_RUNTIME_DIR`, which prevents the rootless Podman socket from being found. Check whether it is set:
152
+
**Set XDG_RUNTIME_DIR and DBUS_SESSION_BUS_ADDRESS.**`systemctl --user` needs these two environment variables to find the user session bus. Direct SSH logins with PAM enabled set them automatically. If you access the system via `su -` or `sudo su`, they are not set. Check whether they exist:
169
153
170
154
```console
171
155
$ echo$XDG_RUNTIME_DIR
156
+
$ echo$DBUS_SESSION_BUS_ADDRESS
172
157
```
173
158
174
-
If the output is empty, add the following to your`~/.bashrc` (or equivalent shell profile):
159
+
If either is empty, add the following to `~/.bashrc` (or equivalent shell profile):
`DBUS_SESSION_BUS_ADDRESS` references `$XDG_RUNTIME_DIR` in its value. You must set `XDG_RUNTIME_DIR` first. If you run `export DBUS_SESSION_BUS_ADDRESS=unix:path=$XDG_RUNTIME_DIR/bus` when `XDG_RUNTIME_DIR` is empty, the path expands to `unix:path=/bus`, which is invalid. Always source both exports together (e.g., `source ~/.bashrc`), or set `XDG_RUNTIME_DIR` on its own line before `DBUS_SESSION_BUS_ADDRESS`.
174
+
175
+
Login lingering must also be enabled before these variables are useful. The bus socket at `$XDG_RUNTIME_DIR/bus` is only created when systemd starts the user session manager, which requires lingering.
176
+
:::
177
+
178
+
### Enable the Podman Socket
179
+
180
+
OpenShell communicates with Podman through a Unix socket. Enable the rootless socket for your user:
181
+
182
+
```console
183
+
$ systemctl --user enable --now podman.socket
184
+
```
185
+
186
+
Verify the socket exists:
187
+
188
+
```console
189
+
$ ls $XDG_RUNTIME_DIR/podman/podman.sock
190
+
```
191
+
186
192
### Verify Subuid and Subgid
187
193
188
194
Rootless containers require subordinate UID and GID ranges for user namespace mapping. Most distributions configure these automatically when a user account is created. Verify your entries exist:
@@ -338,22 +344,94 @@ Common causes:
338
344
339
345
### Podman socket not found
340
346
341
-
If OpenShell reports that no container runtime is available:
347
+
If OpenShell reports "Podman is installed but its API socket is not active," the Podman binary is present but the systemd socket unit that exposes its API is not running. This is common on fresh installs where `dnf install podman` or `apt install podman` does not enable the socket automatically.
342
348
343
-
For rootless mode, verify the socket is running:
349
+
For rootful mode, enable the system socket:
344
350
345
351
```console
346
-
$ systemctl --user status podman.socket
347
-
$ ls $XDG_RUNTIME_DIR/podman/podman.sock
352
+
$ sudo systemctl enable --now podman.socket
348
353
```
349
354
350
-
For rootful mode, verify the system socket:
355
+
For rootless mode, enable the user socket:
351
356
352
357
```console
353
-
$ sudo systemctl status podman.socket
354
-
$ ls /run/podman/podman.sock
358
+
$ systemctl --user enable --now podman.socket
359
+
```
360
+
361
+
If this fails with `$DBUS_SESSION_BUS_ADDRESS and $XDG_RUNTIME_DIR not defined` or `No such file or directory`, see the [systemctl --user fails](#systemctl-user-fails-with-not-defined-or-no-such-file-or-directory) section below.
362
+
363
+
Verify the socket is active:
364
+
365
+
```console
366
+
$ systemctl --user status podman.socket # rootless
367
+
$ sudo systemctl status podman.socket # rootful
368
+
```
369
+
370
+
After enabling the socket, retry `openshell gateway start`.
371
+
372
+
### systemctl --user fails with "not defined" or "No such file or directory"
373
+
374
+
`systemctl --user` can fail with two related errors:
375
+
376
+
**Error: variables not defined**
377
+
378
+
```
379
+
Failed to connect to user scope bus via local transport: $DBUS_SESSION_BUS_ADDRESS and $XDG_RUNTIME_DIR not defined
380
+
```
381
+
382
+
Neither environment variable is set. This happens when you switch users with `su -` or `sudo su`, or when your SSH server does not run PAM session modules.
383
+
384
+
**Error: No such file or directory**
385
+
386
+
```
387
+
Failed to connect to user scope bus via local transport: No such file or directory
355
388
```
356
389
390
+
The variables are set but the D-Bus bus socket they point to does not exist. There are two common causes:
391
+
392
+
-**`XDG_RUNTIME_DIR` was empty when `DBUS_SESSION_BUS_ADDRESS` was set.** Because the `DBUS_SESSION_BUS_ADDRESS` export references `$XDG_RUNTIME_DIR`, running `export DBUS_SESSION_BUS_ADDRESS=unix:path=$XDG_RUNTIME_DIR/bus` when `XDG_RUNTIME_DIR` is empty produces `unix:path=/bus`, which does not exist. Check the current value:
393
+
394
+
```console
395
+
$ echo $DBUS_SESSION_BUS_ADDRESS
396
+
```
397
+
398
+
If it shows `unix:path=/bus` (missing the `/run/user/<uid>` prefix), this is the problem.
399
+
400
+
-**Login lingering is not enabled.** Without lingering, systemd does not start a user session manager, so the bus socket at `/run/user/<uid>/bus` is never created.
401
+
402
+
**Fix for both errors:**
403
+
404
+
Run these three steps in order. Each step depends on the one before it:
405
+
406
+
1. Enable login lingering. This starts the systemd user session manager, which creates the bus socket:
407
+
408
+
```console
409
+
$ sudo loginctl enable-linger $USER
410
+
```
411
+
412
+
2. Set `XDG_RUNTIME_DIR`**first**, then `DBUS_SESSION_BUS_ADDRESS`. The second variable references the first, so the order matters:
To make this permanent, add both lines (in this order) to `~/.bashrc` or equivalent.
420
+
421
+
3. Verify and retry:
422
+
423
+
```console
424
+
$ echo $DBUS_SESSION_BUS_ADDRESS
425
+
unix:path=/run/user/1000/bus
426
+
$ systemctl --user enable --now podman.socket
427
+
```
428
+
429
+
The `echo` output should show the full path including `/run/user/<uid>`. If it shows `unix:path=/bus`, go back to step 2.
430
+
431
+
:::{tip}
432
+
If you SSH directly as the target user (rather than `su` from root), most distributions set these variables automatically via PAM. If you still see this error after a direct SSH login, check that `UsePAM yes` is set in `/etc/ssh/sshd_config`.
433
+
:::
434
+
357
435
### Permission denied in rootless mode
358
436
359
437
If you see permission errors when starting containers, verify your subuid/subgid configuration:
0 commit comments