74

I accidentally pressed Ctrl+C during Ubuntu Server's do-release-upgrade process. I'd dropped to a shell to compare a .conf file in /etc/. When I pressed Ctrl-C, it asked whether I wanted to try to reattach to the upgrade process, but it failed to do so.

So I quit, and now there's a hanging dpkg process which is holding onto the apt lock. This is a virtualised server with no GUI frontend...

Is it possible to recover the upgrade process, or do I have to kill the dpkg process and start again?

  • 2
    Does screen -list still list the upgrade process? If so, screen -r might reattach it again. What was the exact error when trying to reattach? – arjarj May 9 '12 at 18:50
  • I later tried screen -RD, but it didn't work. There wasn't any screen daemon running, so there was nothing to re-connect to. Exact error? I had a choice of 'r' or 'q' I think (reconnect or quit) at the bottom of a curses-like app. Sorry, I can't be more helpful than that. I was using VirtualBox, and without a tmux or screen session running I had no scrollback and the curses-like interface kept clearing the screen. Reconnect didn't work, so I just quit. – Alex Leach May 9 '12 at 20:46
  • 1
    I should add that I did try screen -R -D as both sudo user and my normal user.. – Alex Leach May 9 '12 at 20:48
  • possible duplicate of Ubuntu Server upgrade over SSH hang – Michael Hampton Sep 13 '12 at 9:52
  • 2
    Yes! dpkg configure -a is the right answer. That happened to me and the really bad thing was that bind9 was not correctly setup (i.e. the Ctrl-C must have stopped that process and it couldn't start anymore!) Once I fixed bind9 then the apt-get update + upgrade + dist-upgrade ran like a charm and after that I rebooted and it all worked. – Alexis Wilke Oct 7 '12 at 16:34
107
+50

I usually do release upgrades over VPN, so I've tried this a few times. Whenever it updates my openvpn package I lose connection, so I reconnect afterwards and do this:

ssh into the box, if SSH does not work there is a backup SSH session on port 1022.

Do a

sudo screen -list
There is a screen on:
    2953.ubuntu-release-upgrade-screen-window   (09/13/2012 04:48:02 AM)    (Detached)
1 Socket in /var/run/screen/S-root.

Then to reattach do:

sudo screen -d -r root/2953.ubuntu-release-upgrade-screen-window

Using the previously listed screen after root/

You should be back to where you lost connection.

26

I had the same issue while upgrading to quantal. Unfortunately for me, like the original poster, the screen was killed as well because of ctrl+c.

Killing the dpkg and restarting it with "--configure -a" solved the problem.

Thanks

  • Thank you thank you thank you. This worked for me. – firebush Apr 23 '18 at 19:45
1

I'm more of a CentOS / RHEL person myself but in my experience you're pretty much always better of killing and starting the process over. The downloads, syncs, etc should already be complete and not need to be redone. Since that is what takes the majority of time there shouldn't be much lost going this route.

  • Yea, there's not much else that can be done I think. I could probably have used reptyr to reattach to the pty/tty (I never know the difference), but it's easier starting from scratch. And you're right; it's much quicker the second time round! – Alex Leach May 9 '12 at 17:48

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

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