Ubuntu update interrupted by power failure

Asked by Charlie on 2008-06-07

After downloading update packages (I'm using 8.04 version), and just beginning the updating process, power was cut, and the update process was interrupted. When power was restored, the update manager doesn't work, saying that I type 'dpkg --configure -a' to solve the problem. I followed the instruction but there's a parse error...

$ sudo dpkg --configure -a
[sudo] password for ...:
dpkg: parse error, in file `/var/lib/dpkg/updates/0034' near line 1:
field name `

How can I resolve that error?

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu update-manager Edit question
Assignee:
No assignee Edit question
Solved by:
Murali Krishna Marimekala
Solved:
2008-06-08
Last query:
2008-06-08
Last reply:
2008-06-08
Charlie (ccanicete) said : #1

/var/lib/dpkg/updates/0034 is a binary data file.

I posted this at the Forums but I'm getting no answers.

Hi Charlie,

Seems like you cache is corrupted.
Please execute these commands
sudo dpkg --clear-avail && sudo apt-get update

--Murali

Charlie (ccanicete) said : #3

Thanks Murali. I 'sudo dpkg --clear-avail'--no problem. When I 'sudo apt-get update':

E: dpkg was interrupted, you must manually run 'dpkg --configure -a' to correct the problem.
$ sudo dpkg --configure -a
dpkg: parse error, in file `/var/lib/dpkg/updates/0034' near line 1:
 field name ` :(

Tony Mugan (tmugan) said : #4

From this link
http://ubuntuforums.org/showthread.php?t=389997

sudo cp /var/lib/dpkg/available-old /var/lib/dpkg/available
sudo apt-get update

Or alternatively, if the available-old file does not exist...
sudo rm /var/lib/dpkg/available
sudo apt-get update

Charlie (ccanicete) said : #5

Thanks Tony. I did all that, including going to the link. Same error keeps on popping out. Is there a way of undoing the latest update process and beginning again?

Hi Charlie,

Take a backup of 0034 binary which is under /var/lib/dpkg/updates/0034 using

sudo rm -rf /var/lib/dpkg/updates/0034

Now do sudo dpkg --clear-avail && sudo apt-get update

--Murali

Charlie (ccanicete) said : #7

Thanks again, Murali. I did that, now I have a new error message:

E: dpkg was interrupted, you must manually run 'dpkg --configure -a' to correct the problem.
$ sudo dpkg --configure -a
dpkg: parse error, in file `/var/lib/dpkg/updates/0035' near line 1:
 field name `#!' must be followed by colon

Then I checked some other things... I think the line '#! /bin/sh -e' should not have a space between #! and /bin/sh, right? I tried to edit it in gedit but it refuses because it has a different encoding (if this is required I think I can overwrite the file)...

$ file /var/lib/dpkg/updates/0035
/var/lib/dpkg/updates/0035: POSIX shell script text executable
$ cat /var/lib/dpkg/updates/0035
#! /bin/sh -e

case "$1" in
    configure)
 docdir=/usr/share/doc/openoffice.org-calc
 if [ -d $docdir ] && [ ! -h $docdir ]; then
     rm -rf $docdir
     ln -s openoffice.org-core $docdir
 fi
esac

# Automatically added by dh_installmime
if [ "$1" = "configure" ] && [ -x "`which update-mime 2>/dev/null`" ]; then
 update-mime
fi
# End automatically added section
# Automatically added by dh_installmenu
if [ "$1" = "configure" ] && [ -x "`which update-menus 2>/dev/null`" ]; then
 update-menus
fi
# End automatically added section
# Automatically added by dh_desktop
if [ "$1" = "configure" ] && which update-desktop-database >/dev/null 2>&1 ; then
 update-desktop-database -q
fi
# End automatically added section

On a similar question: Is there a System Restore option in Ubuntu 8.04 as in Windows?

Tony Mugan (tmugan) said : #8

I did a
ls /var/lib/dpkg/updates/

and the folder is empty.
Perhpas you should clear it all out or move them elsewhere and then try

sudo apt-get update

Charlie (ccanicete) said : #9

Thanks again Tony. 'sudo apt-get update' worked. After 'sudo apt-get upgrade', the following error was noted:

Extracting templates from packages: 100%
Preconfiguring packages ...
(Reading database ... dpkg: error processing /var/cache/apt/archives/openjdk-6-jre-lib_6b10-0ubuntu1_all.deb (--unpack):
 files list file for package `openoffice.org-impress' is missing final newline
Errors were encountered while processing:
 /var/cache/apt/archives/openjdk-6-jre-lib_6b10-0ubuntu1_all.deb
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)

Is there a way of clearing everything (before the update process) and starting over? Maybe it's better to download the packages again...

Charlie (ccanicete) said : #10

I changed the repository settings, removing the proposed and back-ports updates. I then 'sudo apt-get update' (no problem), and 'sudo apt-get upgrade'...

$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be upgraded:
  evolution evolution-common evolution-plugins
3 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0B/18.5MB of archives.
After this operation, 12.3kB of additional disk space will be used.
Do you want to continue [Y/n]? Y
(Reading database ... dpkg: error processing /var/cache/apt/archives/evolution_2.22.2-0ubuntu1.2_i386.deb (--unpack):
 files list file for package `openoffice.org-impress' is missing final newline
Errors were encountered while processing:
 /var/cache/apt/archives/evolution_2.22.2-0ubuntu1.2_i386.deb
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)

Charlie,

Yes I got the problem,

Now give

$sudo apt-get -f install --- to force an install of the files that didn't get loaded because of the error.

Then try $sudo apt-get upgrade again, $sudo apt-get -f install back and forth until only the package that has the error is left.

--Murali

Charlie (ccanicete) said : #12

It doesn't work still. Why does it look at the missing final newline of 'openoffice.org-impress'? How is that related?

apt-get -f install works just fine; the apt-get upgrade outputs the same text as above.

I guess the Update Manager is working otherwise.

Hi Charlie,

Please look into this, similar problem http://www.linuxquestions.org/questions/debian-26/apt-get-dpkg-error-files-list-file-...-missing-final-newline-271118/
The problem discussed in this thread is resolved. This might help you.

--Murali

Charlie (ccanicete) said : #14

It worked... Hallelujah! I have to thank first Murali for that answer, and also to Tony. To summarize...

The power cut caused the corruption of some files, causing problems with dpkg, particularly `/var/lib/dpkg/info/openoffice.org-impress.list'. For some reason, dpkg (or apt-get) can't work if some `.list' files are corrupted; I hope such behavior will get corrected. Why not just ignore a bad file and continue on?

To clear the cache, and other things, `sudo apt-get clean' is good to do. `apt-get update' and `apt-get upgrade' will ferret out the offending file (for me it was `/var/lib/dpkg/info/openoffice.org-impress.list'). So, delete that file and then `apt-get upgrade' again. Then it should work.

Purge openoffice.org-impress (it may be another package for others) and Install it again, perhaps the `.list' file will be restored.

Bye for now.

Charlie (ccanicete) said : #15

Thanks Murali Krishna Marimekala, that solved my question.

You are welcome Charlie :).

Josiah-JrTech (scum2save) said : #17

I had the exact same problem as Charlie.
Instead of following the instructions for the error given when clicking on the following in the Graphical User Interface

System->Administration->Synaptic Package Manager

"E: dpkg was interrupted, you must manually run 'dpkg --configure -a' to correct the problem."

$ sudo dpkg --configure -a

I went to Applications-> add/remove and followed those Instructions for the error received. Which said to execute the command:

$sudo apt-get install -f

This command got me to the point where I could run the update process again and fixed the errors I was getting.

Thanks for pointing me in the right direction.

Josiah-JrTech (scum2save) said : #18

I had the power go out again in the middle of the update and tried to run 'sudo apt-get install -f and it failed.
I did run 'dpkg --configure -a' and this did work the second time around.
I suggest run both and see which one works for you!