Remote access to the Linux login screen at boot, lock screen and blanked screen: running GNOME (Wayland and Xorg) unattended
A Linux machine in a server room or an office sits at the GDM login screen after a power cut or a reboot, with nobody logged in; later the screen locks or blanks and the desktop is out of reach. To run unattended, you need to see the screen and type the password remotely in all of these states. On Wayland there are three hard parts: someone at the machine has to click “allow screen sharing” on every connection; locking the screen shuts the remote desktop down; and at the login screen after boot, the user's own programs are not running yet. RockDesk 1.0.18 handles all three. This post explains where each problem comes from, what we do, the settings a machine needs to run unattended, and the pitfalls we hit on Ubuntu 22.04 and 24.04.
- after a power cut the machine starts up by itself, RockDesk is online at the GDM login screen, and you can see it, pick the user, type the password and log in remotely;
- the lock screen stays visible and you can unlock it remotely;
- when the display blanks on idle, Wayland keeps producing frames and a remote mouse move wakes the display;
- with a remote desktop session open, logging in, locking, logging out and switching users never drop the viewer: the picture follows to the new session;
- no “allow sharing” prompt, ever. Wayland and Xorg both work; tested on Ubuntu 22.04 (GNOME 42) and 24.04 (GNOME 46).
The unattended path, step by step
- Power comes back: the machine starts up by itself, following the “power on after AC loss” setting in the BIOS.
- The system service goes online first: systemd starts RockDesk's system service (root) at boot, which connects to the server with the same device ID; terminal, files and port forwarding already work.
- A capture agent in the login screen: once GDM shows the login screen, the service sees the greeter session on seat0 through logind, waits for its gnome-shell, and starts a capture agent as the gdm user with that session's environment; the GNOME Shell extension in the package lets the login screen allow remote desktop.
- Typing the password remotely: the login screen is visible remotely; pick the user, type the password and log in, with no “allow sharing” prompt.
- After login: the user's session comes up, the service starts a new capture agent in it and moves the remote desktop over; the viewer stays connected.
Where the three hard parts come from
1. The “allow screen sharing” prompt
On Wayland, the general way to capture the screen and inject input is the ScreenCast / RemoteDesktop interfaces of the desktop portal (xdg-desktop-portal). The portal is designed to ask the person at the screen every time, which is a dead end when nobody is there.
GNOME's compositor, Mutter, has its own D-Bus interfaces for this: org. and org., the ones GNOME's built-in remote desktop uses. A program in the same user session can call them without a prompt: frames come through PipeWire, input is injected through the same session, and GNOME shows a sharing indicator in the top bar. On GNOME, RockDesk uses these directly instead of the portal.
2. The view dies when the screen locks or blanks
It is the lock, not the blanking. GNOME Shell runs in “session modes”: the normal desktop is user, the lock screen is unlock-dialog, the login screen is gdm. In the last two, allowScreencast is false, and on every mode change gnome-shell makes Mutter inhibit remote access: open remote sessions are closed and new ones get Session creation inhibited. GNOME locks the screen when it blanks on idle, which is why it looks like “blanking kills the remote view”.
3. No way in at the login screen
The GDM login screen is a separate GNOME session of the gdm user, with its own gnome-shell and, on Wayland, a private D-Bus bus started by gdm (not /run/user/<uid>/bus). Your own remote access program runs in your session, which does not exist before you log in, and could not reach the login screen's session even if it did.
What RockDesk does
A root system service that starts a capture agent per logind session
RockDesk installs as a systemd system service (root, starts at boot). The server connection, access control, terminal, files, port forwarding and VPN all live in the service, so the machine is online before anyone logs in. Screen capture and input have to happen inside a graphical session, so they go to capture agents:
- The service watches logind (
/run/systemd/seats/seat0,/run/systemd/sessions/*) and starts one capture agent in every graphical session on seat0 — the GDM login screen and every logged-in user's desktop — as that session's user, and stops it when the session goes away. - The agent's environment is taken from the session: a process in the session's scope that knows the session bus address (on the login screen, gnome-shell and its private bus). A user's gnome-shell runs in
user@<uid>.service, outside the session scope, soWAYLAND_DISPLAY,DISPLAYandXAUTHORITYcome from the user's systemd instance. On the GNOME login screen the agent waits until gnome-shell is up; before that, Mutter's interfaces do not exist yet. - Agents register with the service, which only accepts processes it started whose user matches the session; the service then connects to the agent for each piece of work.
- The remote desktop follows the current session on seat0: on login, logout or a user switch the service moves the stream to the new session's agent, and the viewer stays connected.
A 20-line GNOME Shell extension
The inhibition on the lock and login screens is done by gnome-shell's JavaScript; Mutter only does what it is told. RockDesk ships a tiny extension: right before gnome-shell emits updated on a mode change, it sets allowScreencast to true, so main.js does not inhibit. The capture agent enables it in its own session (as the session's user, on the session bus, so gnome-shell loads it on the spot) and asks gnome-shell a few seconds later whether it is active. GNOME 45 moved extensions to ES modules, so there are two copies: one for 45 and later, one for 42–44. The core is just this:
enable() {
const mode = Main.sessionMode;
const orig = mode.emit;
mode.emit = function (name, ...args) {
if (name === 'updated')
this.allowScreencast = true; // allowed on the lock and login screens too
return orig.call(this, name, ...args);
};
resyncLater(); // let main.js re-evaluate when idle (see the pitfalls below)
}
Blanked display
Turning the display off (DPMS) does not matter by itself: on Wayland Mutter keeps producing frames, the remote side sees the lock screen, and any remote mouse or key input wakes the display. On Xorg the picture is black while the display is off; the first remote input wakes it and the lock screen appears.
Running unattended: settings the machine needs
| Setting | Why |
|---|---|
| Turn on power-on after AC loss in the BIOS / UEFI (often called Restore on AC Power Loss or AC Power Recovery; set it to Power On) | The machine starts up by itself when power returns. This lives on the mainboard; software cannot change it, so set it once in the BIOS. |
| No full-disk encryption (LUKS) | Boot first asks for the disk passphrase at the screen, before the system is running, where nothing can connect. |
| Network available before login: wired is best; on Wi-Fi, the connection must be available to all users | A Wi-Fi connection kept for one user only connects after that user logs in, so there is no network at the login screen. Restart once and check the network icon while still at the login screen. |
Settings → Power: turn automatic suspend off (Ubuntu's default on AC power is already off); on a laptop, do not suspend on lid close (HandleLidSwitch=ignore in /etc/systemd/logind.conf) | A suspended machine is off the network and cannot be reached. |
| Leave display blanking alone | On Wayland the screen can still be viewed while the display is off, and remote input wakes it (see “Blanked display” above). |
| Install RockDesk as a system service, then log out once | Online at boot before anyone logs in; logging out once lets GNOME load the extension. |
Pitfalls we hit
- Never call
_sync()synchronously from the extension's enable() / disable(). When GNOME 42 locks, it disables extensions that do not support the lock screen (Ubuntu's dock, for one) and, inside the extension system's own call stack, disables and re-enables every extension ordered after them. A synchronousupdatedfrom disable() makes the extension system disable it again: infinite recursion, a frozen gnome-shell, and 29 GB written to/var/log/syslogin seven minutes. The extension now re-syncs fromGLib.idle_add; repeated lock/unlock cycles on both versions log no errors. GNOME 46 changed that code path, so testing only on a new GNOME would never show it. - gnome-shell scans the extension directories only when it starts. A session that started before the extension was installed (fresh package, fresh service) does not know it and cannot load it: log out once, or restart. The app says so after installing the service.
- After gnome-shell crashes or is killed, GNOME disables all of the user's extensions (
disable-user-extensionsbecomes true). The capture agent logs it clearly but does not flip it back, because the user may have turned extensions off on purpose in the Extensions app. - An unattended agent must never fall back to the desktop portal. Right after the login screen starts, Mutter's interfaces may not be registered yet; an “automatic” fallback to the portal then waits for someone to click allow, and all input queues up behind it. Agents started by the system service only use Mutter's interfaces and simply retry a bit later.
- The login screen and the desktop use different D-Bus buses. The Wayland login screen uses gdm's private bus, the Xorg login screen gdm's systemd bus, a user's desktop
/run/user/<uid>/bus, so the environment has to be found per session, never hard-coded. - Do not test logout with
loginctl terminate-session: on Xorg, GDM's session worker ignores SIGTERM and the new login screen only appears after systemd's 90-second stop timeout. Usegnome-session-quit --logout, which is what clicking “Log Out” does.
Test results
On Ubuntu 22.04 and 24.04 virtual machines, driven from another computer with remote screenshots, clicks and typing, with a remote desktop stream kept open throughout to catch any drop:
| Scenario | 24.04 (GNOME 46) | 22.04 (GNOME 42) |
|---|---|---|
| Log in remotely at the login screen after a reboot (Wayland and Xorg login screens) | ✅ | ✅ |
| Wayland login screen → Wayland desktop: log in, lock, unlock remotely, log out, log in again, stream never drops | ✅ | ✅ |
| Wayland login screen → Xorg desktop (picked with the gear on the login screen) | ✅ | ✅ |
| Xorg login screen → Xorg desktop | ✅ | ✅ |
| View and wake remotely after the display blanks on idle | ✅ | ✅ |
| Installed from the .deb, system service, remote login after reboot | ✅ | ✅ |
| After a hard reset (like a power cut, no clean shutdown): the system service comes up by itself; the login screen is visible remotely and a remote password login reaches the Wayland desktop | ✅ | ✅ |
How to use it
- Install the RockDesk .deb (Ubuntu 20.04 and later, x86_64 / arm64).
- Open RockDesk → Settings → “System service (reachable before login)” → “Install system service” and enter the administrator password in the system prompt (it can be typed remotely too). Or in a terminal:
sudo rockd service install --migrate ~/.config/rockd --user $USER. The device ID stays the same. - Log out once (or restart) so GNOME loads the extension. From then on the login screen, the lock screen and a blanked display are all reachable.
- Apply the settings above: power-on after AC loss in the BIOS, no full-disk encryption, network before login, no automatic suspend.
- Cut the power or restart once, connect from another device, and check that you can see the login screen and log in remotely.
Remote access to the login and lock screens currently needs GNOME (GDM), Ubuntu's default desktop; other desktops work normally after login. For Macs, see Mac mini remote access.
FAQ
Can I log in to a Linux machine remotely after a power cut?
Yes. Turn on power-on after AC loss in the BIOS, use no full-disk encryption, make the network available before login, and install RockDesk as a system service: it is online at boot before anyone logs in, the GDM login screen is visible remotely and you can type the password to log in. We tested it on Ubuntu 22.04 and 24.04 with a hard reset, which is the same as a power cut.
Why does remote desktop on Wayland ask “allow screen sharing” every time?
Because it goes through the desktop portal (xdg-desktop-portal), which is designed to ask the person at the screen each time. On GNOME, RockDesk calls Mutter's own remote desktop and screen cast D-Bus interfaces (the ones GNOME's built-in remote desktop uses), which do not prompt for a program in the same user session; GNOME only shows a sharing indicator in the top bar.
Why does the remote view stop when the screen locks or blanks?
It is the lock, not the blanking. In the lock screen and login screen modes GNOME Shell sets allowScreencast to false and makes Mutter inhibit remote access: open remote sessions are closed and new ones get Session creation inhibited. RockDesk ships a small GNOME Shell extension that keeps it allowed in those two modes. Turning the display off does not matter: on Wayland Mutter keeps producing frames, and remote input wakes the display.
Why can't I connect while the machine is at the GDM login screen?
The login screen is a separate GNOME session of the gdm user, with its own gnome-shell and D-Bus bus; your own remote access program is not part of it. RockDesk's systemd system service (root) watches logind and starts a capture agent in every graphical session on seat0, as that session's user and with that session's environment, so the login screen is reachable right after boot.
Which distributions and desktops are supported?
The login screen and the lock screen need GNOME (GDM), on Wayland or Xorg; tested on Ubuntu 22.04 (GNOME 42) and 24.04 (GNOME 46). Other desktops work normally after login; their login and lock screens are not supported yet. After installing the system service, log out once (or restart) so GNOME loads the extension.
Keep your Linux machine reachable, unattended, across power cuts
Every new device gets a 10-day free trial. Windows, macOS (Apple silicon and Intel), Linux (x86_64 / arm64), Android and iOS.
Download RockDeskMac mini