How can I repair apt / dpkg?

119

Solution 1

Try this,

when you gt stuck in that situation background current process with CTRL+Z

that should give you shell again.

then do pgrep dpkg | xargs kill -9 # kill all processes matching string dpkg

pgrep apt-get | xargs kill -9 # kill all processes matching string apt-get

dpkg --purge cvs # remove currently installed cvs package

apt-get update # update package lists from your apt repositories

apt-get install cvs # install cvs package from the updated repositories

Solution 2

Just ran into this bug myself - it's apparently known and actively worked on here:

https://bugs.launchpad.net/ubuntu/+source/linux/+bug/624877

Solution 3

I'd first try to find out what the process is trying to do and why it might have gotten stuck there. This is most likely a problem that is somewhat independent from the missing list of files (which you've already solved by installing the exact same version of the package on top; dpkg will just generate a new file list from the new package then).

I think there may be something wrong with your file system, such as a loop of directory hardlinks or other inconsistency that confuses the kernel here; thus the first step for me in this situation would be to confirm this (e.g. by checking which kernel function the process is blocked in), and, if that is truly the case, to reboot and force a file system check.

Share:
119

Related videos on Youtube

Luiz Vaughan
Author by

Luiz Vaughan

Updated on September 17, 2022

Comments

  • Luiz Vaughan
    Luiz Vaughan over 1 year

    I have a sheet called "GRAPH" and two special cells (F4 and F5):

    F4 = 2013
    F5 = 2014

    In my workbook there are sheets named: DATA jan 2013, DATA feb 2013, DATA mar 2013 etc

    I want to replace "2013" by "2014" in all of them but I get the "Subscript out of range" error when I try to do the following:

    Sub test()

    Dim X1, X2 As Variant

            'X1 is to old as X2 is to new value
    
            X1 = Sheets("GRAPH").Range("F$4").Value
            X2 = Sheets("GRAPH").Range("F$5").Value 
    
           Sheets("DATA jan & X1").Select 
            ActiveSheet.Name = "DATA jan & X2"
                 Sheets("DATA feb & X1").Select 
                 ActiveSheet.Name = "DATA feb & X2"
                      Sheets("DATA mar & X1").Select 
                      ActiveSheet.Name = "DATA mar & X2"
    
            End Sub
    

    How to solve that?

    • pablo
      pablo over 13 years
      dpkg-reconfigure debconf and setting the priority to medium try that
    • coredump
      coredump over 13 years
      use kill -9 <pids> to kill everyone and try again.
    • Tony Dallimore
      Tony Dallimore almost 10 years
      Replace "DATA jan & X1" by "DATA jan " & X1. You have made & X1 part of the literal rather than concatenation of a variable. Repeat for all the other literal.
  • glisignoli
    glisignoli over 13 years
    xxx@xxx:~# dpkg --purge cvs dpkg: error processing cvs (--purge): Package is in a very bad inconsistent state - you should reinstall it before attempting a removal. Errors were encountered while processing: cvs
  • Hrvoje Špoljar
    Hrvoje Špoljar over 13 years
    try "aptitude reinstall cvs"
  • glisignoli
    glisignoli over 13 years
    hmm I don't think cvs is the problem now. I managed to remove cvs with: "sudo apt-get --purge remove --force cvs" but after trying a apt-get upgrade. It stalled on "Unpacking replacement login ..."
  • glisignoli
    glisignoli over 13 years
    Ah and those commands arn't killing my dpkg processes. Weird...
  • glisignoli
    glisignoli over 13 years
    and finally: "xxx@xxx:~# ps -aef |grep dpkg" tells me: root 11983 1 0 Feb16 ? 00:00:00 /usr/bin/dpkg --status-fd 25 --unpack --auto-deconfigure /var/cache/apt/archives/cvs_1%3a1.12.13-12ubuntu1_amd64.deb /var/cache/apt/archives/libparams-validate-perl_0.93-1_amd64‌​.deb <snip lota crap>. Tried to kill it but I cant
  • Hrvoje Špoljar
    Hrvoje Špoljar over 13 years
    if kill -9 11983 cant kill it I dont think anything but reboot will :/
  • glisignoli
    glisignoli over 13 years
    Yep a reboot solved it. Found this: arstechnica.com/phpbb/viewtopic.php?f=16&t=316926
  • SmallClanger
    SmallClanger over 13 years
    Agreed. It doesn't look like a dpkg/apt error to me. Have a look at the output of dmesg and see if there's any underlying problem. Also, try strace -fp <dpkg pid> to see what it's trying to do.
  • Cor_Blimey
    Cor_Blimey about 10 years
    @Jean-FrançoisCorbett I think it is just font. On my screen the O after Dim is virtually circular whereas the O used on the line O = ... is more oval shaped. Probably just my machine.
  • Cor_Blimey
    Cor_Blimey about 10 years
    @LuizVaughan I don't see the changes in the question w.r.t Jean-Francois' point. Have you noticed the specific point about the speech marks?
  • Luiz Vaughan
    Luiz Vaughan about 10 years
    @Cor_Blimey I replaced O and N. Now X1 and X2 yields the same error. It should be a simple task but it is not working.
  • Cor_Blimey
    Cor_Blimey about 10 years
    @LuizVaughan no, it is not that: look carefully at the difference between Sheets("DATA jan & X1") and Sheets("DATA jan " & X1)