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.



3 Answers 3


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 ;-)

  • 1
    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, 2013 at 9:32
  • 3
    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, 2013 at 16:25
  • 2
    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, 2014 at 19:37
  • 2
    This doesn't work for me, as it says that screen is not installed. May 14, 2016 at 10:53
  • 5
    Newer Ubuntu use sudo screen -D -r after sudo su - (if not root).
    – B. Shea
    Apr 21, 2017 at 2:26

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.

  • 3
    Is this safe with the process being a do-release-upgrade? Oct 14, 2011 at 16:02
  • 2
    @StephenMelrose It is never safe. But it is reasonably safe, and the only remaining option.
    – Teddy
    Jan 28, 2014 at 10:53
  • 3
    best answer between many on how to fix an apt-get upgrade aborted by putty session timeout... successfully tested, thank you !
    – Kojo
    Jan 13, 2015 at 16:22
  • The and restart the upgrade step not working in my case (I lost ssh session during do-release-upgrade 14.04 -> 16.04). What I do instead as last step to finish the release upgrade is sudo apt autoremove and then sudo shutdown -r now. May 22, 2017 at 3:02
  • Found a more complete answer here which I followed upgrade automatically continued where it left off. askubuntu.com/questions/219545/… Sep 23, 2017 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.

  • 1
    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, 2013 at 9:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .