79

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
113
+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.

do-release-upgrade starts a backup SSH session on port 1022 and a backup screen session. If you do not have screen installed this will NOT be available.

You can get the screen session by running:

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.

  • 1
    I dont have screen installed... and i cannot install one with apt-get (file locked) – inemanja Apr 27 at 17:18
  • This is extremely helpful. It might be an even better answer if you just added short mention that do-release-upgrade indeed automatically starts a screen session (you had me reread the question for a second to look for any mention of having started the upgrade process via screen) – polynomial_donut May 3 at 6:23
  • 1
    I'm amazed this question keeps getting +1s it's so old – Alex R May 6 at 8:39
  • @AlexR It's still relevan and just saved me today! The magic of Stack* sites! – Luis Lobo Borobia May 24 at 14:07
30

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
2

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.