E: Sub-process /usr/bin/dpkg returned an error code (1)

Asked by exquest

I'm using: Ubuntu 8.04 - the Hardy Heron

When I try to update or install anything I get this response from apt-get:

 files list file for package `thunar' is missing final newline
Errors were encountered while processing:
 /var/cache/apt/archives/ufw_0.16.2.2_all.deb
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)

When I tried to apt-get remove the thunar package I got the response:

 files list file for package `thunar' is missing final newline
Errors were encountered while processing:
 /var/cache/apt/archives/ufw_0.16.2.2_all.deb
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)

I don't know what to do but I can't upgrade my system and I can't install anything at this point.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu dpkg Edit question
Assignee:
No assignee Edit question
Solved by:
marcobra (Marco Braida)
Solved:
Last query:
Last reply:
Revision history for this message
Thomas Kluyver (takluyver) said :
#1

Estimated bug filing

Revision history for this message
Cesare Tirabassi (norsetto) said :
#2

Can you attach a copy of /var/log/apt/term.log ?

Revision history for this message
exquest (exquest) said :
#3

Here is the requested term.log

Revision history for this message
Cesare Tirabassi (norsetto) said :
#4

Thanks,

there is no bug which jump to my eye, looks more as if you system (possibly the dpkg cache) got corrupted.

Revision history for this message
exquest (exquest) said :
#5

How do I fix this? I put a post up in the ubuntu forums but got no response. Do I have to do a complete reinstall of the OS or is there an easier way? Thanks for looking at my problem for me.

Revision history for this message
Thomas Kluyver (takluyver) said :
#6

Converting to a question.

If the dpkg cache is indeed corrupted, you may be able to fix it by running "sudo dpkg --configure -a"

Revision history for this message
exquest (exquest) said :
#7

I ran that and still got the same error when I tried to apt-get

I also tried apt-get clean

Revision history for this message
Cesare Tirabassi (norsetto) said :
#8

Neither sudo dpkg --configure -a nor apt-get clean alone are going to help for a corrupted cache. Your only chance is first to delete the cache (/var/cache/apt/pkgcache.bin) and then try to finish whatever dpkg operation needs to be completed.

Revision history for this message
Sam_ (and-sam) said :
#9

Hi,
>>Errors were encountered while processing:
/var/cache/apt/archives/ufw_0.16.2.2_all.deb<<

did you make any changes in ufw?
https://help.ubuntu.com/community/Uncomplicated_Firewall_ufw

>>package `thunar' is missing final newline<<

go to the thunar package file list, insert an empty last line and save.
Then try again
sudo dpkg --configure -a

Or check in Synaptic -> status -> broken packages

Revision history for this message
exquest (exquest) said :
#10

where is the thunar package file list?

Revision history for this message
exquest (exquest) said :
#11

I think I found it. How do I edit it?

Revision history for this message
marcobra (Marco Braida) (marcobra) said :
#12

Please open a Terminal from the menu Applications->Accessories->Terminal and type:

sudo gedit /path/and/your_file_name

give your user password when requested, you don't see nothing when you type it, then press enter.

Hope this helps

Revision history for this message
exquest (exquest) said :
#13

so. I think I need to edit the thunar-data.list file. Is this the file I need to edit? Also when I do the sudo gedit thing on that file I get a message that tells me that the gedit can't detect the encoding on the file and thus won't let me open it.

Revision history for this message
Best marcobra (Marco Braida) (marcobra) said :
#14

Try the same as here: https://answers.launchpad.net/ubuntu/+question/2591

Please open a Terminal from the menu Applications->Accessories->Terminal and type:

sudo -i

give your user password when requested, you don't see nothing when you type it, then press enter.

Then type a command similar to this echo -en '\n' | sudo tee -a /var/lib/dpkg/info/gxine.list
substitute the path and the .list file

For example:
echo -en '\n' | sudo tee -a /var/lib/dpkg/info/thunar.list

Hope this helps

Revision history for this message
exquest (exquest) said :
#15

That seems to have done the trick. Thanks marcobra. Do you have any idea what could have caused this?

Revision history for this message
exquest (exquest) said :
#16

Thanks marcobra, that solved my question.

Revision history for this message
marcobra (Marco Braida) (marcobra) said :
#17

I guess some bug or repository corruption...

Thank you

Revision history for this message
triplesqaurednine (triplesquarednine) said :
#18

another easy way to fix this particular error is to remove the particular list + it's friends:
i.e. in my case it was scons. so i went into /var/lib/dpkg/info/......found scons deleted it's files,
re-installed scons and it was fixed...

Revision history for this message
reju (reju-kmr) said :
#19

I hav broken packages
when trying to reinstall it, the error comes..
it also comes when i uses -f

Errors were encountered while processing:
 /var/cache/apt/archives/linux-image-2.6.28-14-generic_2.6.28-14.47_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Pls, help me......

Revision history for this message
marcobra (Marco Braida) (marcobra) said :
#20

@reju

Please don't append a new question on a already answered or marked as solved question.
Please make new question from here: https://answers.launchpad.net/ubuntu/+addquestion
you will get better chance to get right answer on a fresh tagged "open" question.
Solved or answered questions are usually not read from answering people.

Thank you

Revision history for this message
Luisb859 (luisfbarros) said :
#21

for me itś an error about freevo:

A instalar freevo (1.9.0-10.1ubuntu1) ...
Traceback (most recent call last):
  File "/usr/bin/freevo.real", line 521, in <module>
    execfile(freevo_version, {}, versions)
IOError: [Errno 2] No such file or directory: '/usr/lib/pymodules/python2.5/freevo/version.py'

dpkg: erro ao processar freevo (--configure):
 subprocesso script post-installation instalado retornou erro do status de saída 1
Foram encontrados erros enquanto processava:
 freevo
E: Sub-process /usr/bin/dpkg returned an error code (1)