I'm planning a system upgrade from Eoan to Focal on a remote machine where I only have SSH access. I've previously dealt with broken packages causing the system to boot into rescue mode, so I want to ensure whatever happens I can keep my access to the server. To further secure the process, I'm doing a rehearsal using a local virtual machine running the target system.
With my knowledge in Ubuntu, I did the following tasks beforehand:
systemctl edit ssh.serviceand insertDefaultDependencies=noto [Unit] section andWantedBy=rescue.targetto [Install] section, thensystemctl enable ssh.service. Systemd reports "created symbolic link".systemctl edit rescue-ssh.targetand insertWantedBy=rescue.targetto [Install] section, thensystemctl enable rescue-ssh.target.
Then I edited grub to enable boot menu, update-grub then systemctl reboot, and use e to edit the default entry. I scrolled down to the first linux line and appended rescue and booted this entry with Ctrl-X, which led to this screen:
Everything seems fine here as I can SSH into this VM right at this point.
My question begins:
I tried again in a different way to test SSH availability in rescue mode. First I booted the system normally into graphical mode (with GNOME and whatever), started a terminal and ran systemctl isolate rescue.target. I see the same prompt text again, but when trying to SSH into the VM, I got the following result:
ubuntu@WSL:~ $ ssh root@vmwares
Warning: Permanently added '192.168.2.5' (ECDSA) to the list of known hosts.
Timeout, server 192.168.2.5 not responding.
255|ubuntu@WSL:~ $
Running systemctl status ssh.service highlighted the following text:
pam_systemd(sshd:session): Failed to create session: Failed to activate service 'org.freedesktop.login1': timed out (service_start_timeout=25000ms)
Restarting systemd-logind.service makes no difference. Going back to graphical interface with systemctl isolate default.target brings everything back to normal again.
Question: Why can't I login to SSH when the rescue target is isolated from graphical.target? How to I resolve this?
I think there's something to do with "isolating targets", but apparently things have gone beyond my knowledge.
