Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

UPDATE:-

AFAICT, there was no way to reattach to the upgrade process. However, it wasn't a disaster at all. I killed the hanging dpkg process, and then ran dpkg --configure -a. This walks you through reconfiguring all packages already installed on the system, tidying up any problems whilst it does so. After that, I used aptitude to upgrade the remaining packages, which had already been downloaded, but hadn't been installed or configured.

share|improve this question
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
    
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
    
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
add comment

3 Answers

up vote 13 down vote accepted
+50

I usually do release upgrades over VPN, so I'we tried this a few times. Whenever it updates my openvpn package I loose 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.

share|improve this answer
    
Thank you so much! This worked perfectly. –  Drew Noakes Apr 20 at 12:49
add comment

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

share|improve this answer
add comment

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.

share|improve this answer
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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