Trying various ways to install Docker on Buster I have now run into this.

I get the message that E: dpkg was interrupted and to run the sudo dpkg --configure -a command.

When I do I get this:

Created symlink /etc/systemd/system/multi-user.target.wants/containerd.service -> /lib/systemd/system/containerd.service.

and after a couple of minutes my ssh session disconnects to that Raspberry Pi 4. I can ssh back into it immediately but does anyone know what to do to get past it?

  • Try running it in the background by adding &. sudo dpkg --configure -a &
    – Botspot
    Sep 23, 2019 at 19:28

2 Answers 2


You should make sure, if there is any doubt, that the system is not actually rebooting due to brown-out as implied by other commentators (check uptime if you are unsure).

I always use tmux when initiating updates. In a nutshell, this is a tool that allows you to (amongst other things) start a command, send it to the background, then check in on it later even after logging out.

Of course, you can background and foreground processes using the jobs protocol in the shell, but the "even after logging out part" can be a gotcha, meaning, it may work, but don't expect consistency in this regard. Conversely, tmux is very safe.

There are lots of introductions, etc., to tmux online (and no you do not need one written for Raspberry Pi users, it is the same tmux as anywhere1). I will only demonstrate this particular task.

sudo apt install tmux
tmux new-session -s updates

Here "updates" is just a label, you can use anything. You will probably now see a solid bar across the bottom of the terminal (ssh or otherwise) with that label on the left.

sudo apt update && sudo apt upgrade

The usual will happen. While that's going on, hit Ctrl-b, then d. The output and bar will disappear and you will be back at the prompt where you entered the tmux command.

Do whatever. Log out. Come back tomorrow. As long as the system hasn't rebooted, you should be able to enter:

tmux list-sessions

And see a line about the "update" session from before.

tmux attach-session -t update

Where "update" is the actual label. You'll be back at the scene of the apt upgrade. If it's still proceeding, you can Ctrl-b, then d to leave again.

If not, and you want to close the session, just enter exit.

Two quick tips about tmux:

  • Normal scrolling doesn't work; if you want to scroll back, you have to Ctrl-b (all the tmux commands are entered this way) and [. To exit that mode just hit q.

  • The default mode is not the same 256 or 16M colour mode used by most contemporary terminal interfaces, which can be irritating if you use tools that exploit such. To counter that:

    echo "set -g default-terminal 'xterm-256color'" >> ~/.tmux.conf

  1. But there is one such thing from our now defunct blog: https://raspberrypise.tumblr.com/post/143463394889/tmux-102-getting-to-know-tmux There's also a very in depth man tmux.

Something unrelated to my other answer is to boister ssh connectivity a bit, which may or may not help. Add this to /etc/ssh/sshd_config on the pi:

TCPKeepAlive yes
ClientAliveInterval 120
ClientAliveCountMax 15

These are explained in man sshd_config but in short a "keep alive" is an occasional packet sent so an otherwise quiet connection does not time out, and the the second two determine when a connection is deemed dead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.