When a new version of Ubuntu is released, and you need to upgrade a server or a desktop, you can not access directly, the only option you have is to use the terminal and a ssh connection.
As soon as you are logged in, run:
This will take care of everything. It will open a terminal session, and it will start a second instance of ssh, in case the first one is upgraded and failed to be restarted as part of the upgrading process.
The screen session, will allow you to close the terminal window and recover the session later by issuing:
sudo screen -x
Run the above command when you reconnect to the server, if for some reason, the ssh stopped working run:
ssh firstname.lastname@example.org -p 1022
And then the prior mentioned command