Lost connection to session during apt-get upgrade

Discussion in 'Installation/Configuration' started by Thomas Jensen, Nov 26, 2009.

  1. Thomas Jensen

    Thomas Jensen New Member

    I know this has nothing to do with ISPConfig, but the people in here are always so helpful!

    I used apt-get upgrade, but in the middle of some configuration options (a new PHP version), the power went of and i lost connection to the server. Therefor i can't do a new upgrade, because it's locked by a lock file, and the old connection still hangs.
    It's a debian lenny settup.

    Thanks :)
     
  2. Mark_NL

    Mark_NL New Member

    "i can't do a new upgrade, because it's locked by a lock file, and the old connection still hangs"

    can you elaborate on that?

    - The power went off, so the server rebooted, did it booted the kernel and initrd completely?

    - What's the name of the lock file

    - What do you mean by "old connection"


    If you can't login remote to the server, i'd say, start your car and have a drive to your datacenter ;-)
     
  3. Thomas Jensen

    Thomas Jensen New Member

    The server is remote, so it didn't loose power. Only my local machine turned off.

    The problem is that the apt-get install opens a lock file (i can delete this file with no problem), but what about those update which didn't finish? I was in the middle of a configuring process in a PHP update

    I'am wondering if it's possible to resume the connection which i lost?
     
    Last edited: Nov 27, 2009
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Delete the lockfile and run the update again.

    No. You can resume sessions only when you use the screen command to execute all commands in a virtual shell.
     
  5. Thomas Jensen

    Thomas Jensen New Member

    Okay, thanks a lot, i just assumed that it would cause problems, if the configuring was only "half-done".
     
  6. Mark_NL

    Mark_NL New Member

    What till said, delete the lock file ..

    the lock file is: /var/lib/dpkg/lock

    furthermore, the apt process got killed, just issue the apt-get command again and it will continue.

    try to get used to typing "screen -R" as soon as you log in, so you'll aslways work in a virtual shell .. if for some reason your computer crashes the apt-get would've kept on running in this case and you can (re)connect to it again ..
     
  7. Thomas Jensen

    Thomas Jensen New Member

    Okay, thanks.

    Code:
    server1:~# apt-get upgrade
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
    3 not fully installed or removed.
    After this operation, 0B of additional disk space will be used.
    Do you want to continue [Y/n]? y
    debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
    Setting up libapache2-mod-php5 (5.2.6.dfsg.1-1+lenny4) ...
    debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
    dpkg: error processing libapache2-mod-php5 (--configure):
     subprocess post-installation script returned error exit status 1
    Setting up php5-cgi (5.2.6.dfsg.1-1+lenny4) ...
    debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
    dpkg: error processing php5-cgi (--configure):
     subprocess post-installation script returned error exit status 1
    dpkg: dependency problems prevent configuration of php5:
     php5 depends on libapache2-mod-php5 (>= 5.2.6.dfsg.1-1+lenny4) | libapache2-mod-php5filter (>= 5.2.6.dfsg.1-1+lenny4) | php5-cgi (>= 5.2.6.dfsg.1-1+lenny4); however:
      Package libapache2-mod-php5 is not configured yet.
      Package libapache2-mod-php5filter is not installed.
      Package php5-cgi is not configured yet.
    dpkg: error processing php5 (--configure):
     dependency problems - leaving unconfigured
    Errors were encountered while processing:
     libapache2-mod-php5
     php5-cgi
     php5
    E: Sub-process /usr/bin/dpkg returned an error code (1)
    server1:~#
    
    Code:
    server1:~# screen -R
    -bash: screen: command not found
    
     
    Last edited: Nov 28, 2009
  8. till

    till Super Moderator Staff Member ISPConfig Developer

    Please post the output of:

    ps aux | grep apt
     
  9. Thomas Jensen

    Thomas Jensen New Member

    Code:
    server1:~# ps aux | grep apt
    root       451  0.0  0.0  17172  2440 ?        S    Oct03   2:15 apt-get update
    root       454  0.0  0.0  22824  1932 ?        S    Oct03   0:00 /usr/lib/apt/methods/http
    root       455  0.0  0.0  22824  1872 ?        S    Oct03   0:00 /usr/lib/apt/methods/http
    root       456  0.0  0.0  22828  1884 ?        S    Oct03   0:00 /usr/lib/apt/methods/ftp
    root       460  0.0  0.0  16520  1592 ?        S    Oct03   0:00 /usr/lib/apt/methods/gpgv
    root       675  0.0  0.0  16504  1612 ?        S    Oct03   0:00 /usr/lib/apt/methods/gzip
    root      5538  0.0  0.0   6316   788 pts/2    S+   11:56   0:00 grep apt
    root     29254  0.0  0.1  33256 15700 ?        S    Nov26   0:03 apt-get upgrade
    root     30750  0.0  0.0  17040  2352 ?        S    Sep06   3:09 apt-get update
    root     30753  0.0  0.0  22824  1876 ?        S    Sep06   0:00 /usr/lib/apt/methods/http
    root     30754  0.0  0.0  22824  1872 ?        S    Sep06   0:00 /usr/lib/apt/methods/http
    root     30755  0.0  0.0  22828  1876 ?        S    Sep06   0:01 /usr/lib/apt/methods/ftp
    root     30757  0.0  0.0  16520  1612 ?        S    Sep06   0:00 /usr/lib/apt/methods/gpgv
    root     30763  0.0  0.0  16504  1608 ?        S    Sep06   0:00 /usr/lib/apt/methods/gzip
    
    
     
  10. till

    till Super Moderator Staff Member ISPConfig Developer

    There are still apt processes hanging that need to be killed. Either you run:

    killall apt-get

    or you reboot the server and then try again.
     
  11. Thomas Jensen

    Thomas Jensen New Member

    I did "killall apt-get":

    Code:
    server1:~# apt-get upgrade
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
    3 not fully installed or removed.
    After this operation, 0B of additional disk space will be used.
    Do you want to continue [Y/n]? y
    debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
    Setting up libapache2-mod-php5 (5.2.6.dfsg.1-1+lenny4) ...
    debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
    dpkg: error processing libapache2-mod-php5 (--configure):
     subprocess post-installation script returned error exit status 1
    Setting up php5-cgi (5.2.6.dfsg.1-1+lenny4) ...
    debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
    dpkg: error processing php5-cgi (--configure):
     subprocess post-installation script returned error exit status 1
    dpkg: dependency problems prevent configuration of php5:
     php5 depends on libapache2-mod-php5 (>= 5.2.6.dfsg.1-1+lenny4) | libapache2-mod-php5filter (>= 5.2.6.dfsg.1-1+lenny4) | php5-cgi (>= 5.2.6.dfsg.1-1+lenny4); however:
      Package libapache2-mod-php5 is not configured yet.
      Package libapache2-mod-php5filter is not installed.
      Package php5-cgi is not configured yet.
    dpkg: error processing php5 (--configure):
     dependency problems - leaving unconfigured
    Errors were encountered while processing:
     libapache2-mod-php5
     php5-cgi
     php5
    E: Sub-process /usr/bin/dpkg returned an error code (1)
    
     
  12. till

    till Super Moderator Staff Member ISPConfig Developer

    Then try the other option and restart the server.
     
  13. Thomas Jensen

    Thomas Jensen New Member

    Hmm... okay, bad luck, I got lots of sites running on the server :(
    Isn't there a way to "unlock" files?
     
  14. Thomas Jensen

    Thomas Jensen New Member

    I've fixed it by backing up the locked files, deleting them and then restoring them from the backups.
    Thanks.
     
  15. Mark_NL

    Mark_NL New Member

    One of these is locking the apt-get proces

    root 29254 0.0 0.1 33256 15700 ? S Nov26 0:03 apt-get upgrade
    root 30750 0.0 0.0 17040 2352 ? S Sep06 3:09 apt-get update

    kill em both: killall apt-get
    delete the lock file, try again.

    screen -R doesn't work because it's not installed, do that with:
    apt-get install screen
     

Share This Page