When connected via ssh or rpi-connect from a remote computer and then it can happen during and due to the update that the connection closes and this can stop the update.
To avoid this, use the program screen or tmux
Install it with sudo apt install screen. It creates a local terminal (screen session) using screen -S <name>, Commands can then be run.
To detach the local computer do Ctrl+a followed by d. The remote connection loss will not stop the running program. screen -ls shows the sessions and session ID's and later on re-attach screen -r or screen -r <session ID>
Ctrl+a ? gives help
Ctrl+a \ quits screen
When using rpi-connect it might happen that it is requested to run sudo dpkg --configure -a but this will crash. login via ssh not rpi-connect start screen -S <name> to have a screen session and then run sudo dpkg --configure -a
screen -S <id> -X quit to terminate it without attach.
tmux allows with one ssh session having multiple windows and has a console decoration showing that it is a tmux session
sudo apt install tmux
tmux new -s mysession to create new session
Ctrl-B, D to detach
tmux ls to list
tmux attach -t mysession
tmux kill-session -t mysession
Split the terminal:
Ctrl+B % vertical split
Ctrl+B " horizontal split
Ctrl+B arrow key to move to a window