TravelinMax
Posts: 25
Joined: Mon Nov 26, 2012 3:46 am
Location: Michigan, USA

SSH Connection Disconnected after apt-get upgrade

Sun Mar 17, 2013 3:14 am

What can I do now? I can't kill the process and I don't know if any prompts are going to come up (therefore causing the upgrade to pause indefinitely). What can I do about it? I don't want to break something (happened before) and have to reflash my card.

sdjf
Posts: 1395
Joined: Fri Mar 16, 2012 5:20 am
Location: California
Contact: Website

Re: SSH Connection Disconnected after apt-get upgrade

Sun Mar 17, 2013 7:38 am

Do you have a keyboard? What lights are on? Any flashing?

http://elinux.org/R-Pi_Troubleshooting
FORUM TIP: To view someone's posting history, sign in, click on their user name, then on "Search User's Posts." || Running ArchLinuxArm on Model 2B and 512MB Model B

DBryant
Posts: 281
Joined: Sat Feb 02, 2013 12:41 pm
Location: Berkshire, UK

Re: SSH Connection Disconnected after apt-get upgrade

Sun Mar 17, 2013 7:51 am

Try opening a new ssh session it may be that upgrade has given your network a kick and that has take you connection down.

With luck it will the same IP address.

aurelien
Posts: 7
Joined: Sat Oct 13, 2012 10:42 am

Re: SSH Connection Disconnected after apt-get upgrade

Sun Mar 17, 2013 7:21 pm

I have done the exact same thing :)

I can't connect back with a new ssh session. Though I configured the Pi to have a static IP.

All the light are on and none are flashing.
It has been 3 hours since I lost the ssh connexion.
Is there anything I can do ?

Thanks !

aurelien
Posts: 7
Joined: Sat Oct 13, 2012 10:42 am

Re: SSH Connection Disconnected after apt-get upgrade

Sun Mar 17, 2013 9:36 pm

After almost 5 hours, I decided to restart the Pi by shutting down the power.

Fortunately it is still working !
But in fact, the dpkg was running while I restarted the Pi.

If like me it has been 4 or 5 months you haven't updated your Pi, maybe you should try to wait a full night so the Pi can update everything !

sdjf
Posts: 1395
Joined: Fri Mar 16, 2012 5:20 am
Location: California
Contact: Website

Re: SSH Connection Disconnected after apt-get upgrade

Sun Mar 17, 2013 9:59 pm

In cases like this, I wonder if you started the upgrade from the command line with an ampersand (&) at the end of the line, if the ssh session might stay viable and you could check the status of what is going on? At some point it might die out, but it might be something to try the next time.
FORUM TIP: To view someone's posting history, sign in, click on their user name, then on "Search User's Posts." || Running ArchLinuxArm on Model 2B and 512MB Model B

TravelinMax
Posts: 25
Joined: Mon Nov 26, 2012 3:46 am
Location: Michigan, USA

Re: SSH Connection Disconnected after apt-get upgrade

Tue Mar 19, 2013 4:45 pm

Hey guys, I kept retrying "sudo apt-get upgrade" until I no longer got an error message (like 5 min) and it works fine. Except for a package called libc or something that won't update. No idea if its related.

MacValley
Posts: 6
Joined: Wed Feb 27, 2013 7:16 pm

Re: SSH Connection Disconnected after apt-get upgrade

Mon Mar 25, 2013 1:58 pm

Hi all,
Seems as if you have the same problem as I, see thread http://www.raspberrypi.org/phpBB3/viewt ... 97#p309997
I have two terminal windows open. In the first I use ssh to manage the pi, in the second I have a ping to my pi's ip-number running (the ip is reserved in my DHCP server).
At the end of SOME of my installations or upgrades the ssh contact is lost, and the ping no longer responds. So, obviously something happens to the network interface. As in others case the less are still on but the network interface is dead.
To solve the problem I just reboot! Having done that, I can see that the packages I installed via ssh actually are in place and working. The ip-number is still the same so the ping now responds again.
Of course one could use reboot as medicine but I now manage my pi remotely, and by remotely I mean 100 km. My way of "reboot" is that I control the mains power by a Telldus remote system. Meaning I can switch the power off and then on again by issuing a few commands on the internet. I know it is not the perfect way to abruptly stop the pi instead of using shutdown, but what are the options?
/MacValley

User avatar
malakai
Posts: 1382
Joined: Sat Sep 15, 2012 10:35 am
Contact: Website

Re: SSH Connection Disconnected after apt-get upgrade

Mon Mar 25, 2013 2:21 pm

sudo apt-get install screen

Great little tool if you run a long command through ssh it opens a screen that is persistent through ssh disconnect.

screen -S giveitaname
Opens new screen gives it a name and type what ever commands as usual

CTRL+A
disconnects the screen but keeps it running

screen -ls
lists the screens running

screen -r 2417.xxx
depending on -ls connects to a specific screen

CTRL+K
shuts the screen down.
http://www.raspians.com - always looking for content feel free to ask to have it posted. Or sign up and message me to become a contributor to the site. Raspians is not affiliated with the Raspberry Pi Foundation. (RPi's + You = Raspians)

Psychaotix
Posts: 7
Joined: Fri Jan 11, 2013 2:08 pm
Location: Barossa Valley, South Australia

Re: SSH Connection Disconnected after apt-get upgrade

Sat Mar 30, 2013 11:46 am

I agree with installing Screen as one of the first things to do on an install. Makes everything else so much easier afterwards. :)

The other alternative is, if at all possible, attach a KVM set to the Pi and do the upgrade from there.

Jeffrey74
Posts: 1
Joined: Sun Nov 13, 2016 9:46 am

Re: SSH Connection Disconnected after apt-get upgrade

Sun Nov 13, 2016 9:59 am

I had the same problem.
Found a solution:
1. Connect to the Pi again with ssh.
2. Find the process which is running the upgrade with: "ps aux | grep apt"
Mine resulted in:
root 1970 0.0 0.3 6780 3192 ? S 00:52 0:00 sudo apt-get upgrade
root 1974 7.3 3.2 33624 30492 ? S 00:52 43:20 apt-get upgrade
pi 10476 0.0 0.2 4280 2012 pts/2 S+ 10:41 0:00 grep --color=auto apt
3. Kill the first proces with: "sudo kill 1970"
4. Check if the proces was killed with: "ps aux | grep apt"
The proces was stopped, only the grep was running:
pi 10493 0.0 0.1 4276 1848 pts/2 S+ 10:43 0:00 grep --color=auto apt
5. Now if you want to run another upgrade or install the system suggests to run dpkg: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.
So run the command to continue the upgrade proces: "sudo dpkg --configure -a"

Return to “Advanced users”