The remote shell server is racing against Tails Greeter
_Originally created by @anonym on [#8941 (Redmine)](https://public-redmine-archive.tails.boum.org/code/issues/8941)_
The `autotest_remote_shell.py` is started after Tails Greeter
(`/etc/rc2.d/S05rc.local` vs `/etc/rc2.d/S03gdm3`) which is fragile
given how we wait for the remote shell to be ready (we “ask” if it’s up
as soon as we see that Tails Greeter is running). In particular, in the
`test/7821-tor` branch (for tails/tails#7821) a tiny change to the remote shell
server (commit 1a55905e5d51d0f578b5ab3732a8ac0453ac6363 (“Create the
environment for remote shell calls more realisitcally.”)) exposes this
race.
To eliminate this race we should:
- migrate the remote shell startup to a dedicated initscript, that
acts as a no-op unless `autotest_never_use_this_option` is passed on
the kernel command-line
- set `X-Start-Before: $x-display-manager gdm gdm3` in the remote
shell initscript
- in `autotest_remote_shell.py`, touch some file after `port.open()`
has succeeded
- patch the `gdm3` initscript to wait for that file to appear, when
`autotest_never_use_this_option` is passed on the kernel
command-line, before it actually starts GDM.
(above adapted from https://gitlab.tails.boum.org/tails/tails/-/issues/7821#note_97929)
Feature Branch: bugfix/8941-start-remote-shell-before-greeter
Parent Task: tails/tails#8539
### Related issues
- **Related to** tails/tails#7821
- **Related to** tails/tails#5491
- **Related to** tails/tails#9057
issue