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.

So, I was performing an Ubuntu Server upgrade from 11.04 to 11.10.

I forgot about it in the background, and my SSH client timed out and disconnected (putty on Windows, go figure). The last thing on my terminal was a question about keeping an old config, etc.

When I logged back in to the server, aptitude files were locked by another process, so I assume this upgrade process is sat there waiting for my input.

How I can interact with this process and continue the upgrade? If possible.

Thanks

share|improve this question
    
possible duplicate of Reconnect ssh session when disconnected without screen –  quanta Oct 14 '11 at 15:53

3 Answers 3

up vote 15 down vote accepted

The process actually runs in a screen or byobu session as the root user. reconnect to the server with putty on port 22 or the failsafe 1022. sudo su - or su - into your root account and resume the screen with byobu or a screen -r and resume where you left.

oh and yes i found out the hard way ;-)

share|improve this answer
    
Woah thanks! I was actually running a release upgrade from 11.10 to 12.04 in byobu and then it closed when byobu was upgraded but I was able to reconnect to the root screen session and watch the upgrade finish! I nearly tried to forcefully kill the upgrade but luckily I read this response in time. –  Ibrahim Jan 13 '13 at 9:32
1  
On a stalled install, it said the screen was already attached, so I force the screen detach, the I could reattach. The command is screen -D Information from here: kb.iu.edu/data/ahrm.html –  David Jun 7 '13 at 16:25
    
Using screen -r <id> also works, and you only need to type a few characters of the ID for it to work. –  Daniel May 27 at 19:37

You can't. Find the upgrade process by doing

lsof /var/lib/dpkg/lock

Kill it, fix any interrupted upgrades with

dpkg --configure --pending

and restart the upgrade.

share|improve this answer
2  
Is this safe with the process being a do-release-upgrade? –  Stephen Melrose Oct 14 '11 at 16:02
    
@StephenMelrose It is never safe. But it is reasonably safe, and the only remaining option. –  Teddy Jan 28 at 10:53

cryopid (found via this question) might help unless the current "one process, not a tree of processes" is a problem in this instance.

The files may be locked because the process was unceremoniously killed and didn't get chance to clean up after itself, so confirm that aptitude is actually still running. Use lsof /var/lib/dpkg/lock as suggested in Teddy's answer to check - this will tell you the pid to try cryopid on too.

In future I recommend to try running through screen where-ever possible. I have made a habit of screen (or byobu, which is a wrapper around screen that defines some useful behaviours) being the first thing I run when SSHing to anywhere then I can reconnect if there are issues. You can set it up to start or reattach automatically, though I've never got around to doing that anywhere - there are a number of examples online (this one for instance) if you want to try that.

share|improve this answer
    
Incidentally, I preempted this and did a do-release-upgrade over ssh by using byobu, but when byobu was upgraded it killed my session! I wonder if using screen directly would have prevented this. But the other answer to this question answered my situation, seems like the installer is smart and runs its own screen session anyway :D –  Ibrahim Jan 13 '13 at 9:24

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.