Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I've recently upgraded my Ubuntu 11.10 to 12.04 . Whenever I'm trying to install some new package using apt-get I'm getting the following error messages in terminal :

$ apt-get -y update && apt-get -y upgrade && apt-get -y dist-upgrade && reboot

and this is what I got:

Hit http://ppa.launchpad.net precise Release.gpg
Hit http://ppa.launchpad.net precise Release                                               
Hit http://security.ubuntu.com precise-security Release.gpg                                                       
Hit http://archive.canonical.com precise Release.gpg                                       
Hit http://ppa.launchpad.net precise/main Sources                                          
Hit http://security.ubuntu.com precise-security Release                                    
Hit http://archive.canonical.com precise Release                                                                  
Hit http://extras.ubuntu.com precise Release.gpg                                                                  
Hit http://ppa.launchpad.net precise/main i386 Packages                                                           
Hit http://in.archive.ubuntu.com precise Release.gpg                                                             
Ign http://ppa.launchpad.net precise/main TranslationIndex                                                       
Hit http://security.ubuntu.com precise-security/main Sources                               
Hit http://extras.ubuntu.com precise Release                                               
Hit http://archive.canonical.com precise/partner i386 Packages                                                    
Get:1 http://in.archive.ubuntu.com precise-updates Release.gpg [198 B]                     
Hit http://security.ubuntu.com precise-security/restricted Sources                         
Hit http://extras.ubuntu.com precise/main Sources                                                                
Get:2 http://in.archive.ubuntu.com precise-backports Release.gpg [198 B]                                         
Ign http://archive.canonical.com precise/partner TranslationIndex                                                
Hit http://security.ubuntu.com precise-security/universe Sources                                                 
Hit http://extras.ubuntu.com precise/main i386 Packages                                    
Hit http://in.archive.ubuntu.com precise Release                                           
Hit http://security.ubuntu.com precise-security/multiverse Sources                                                                     
Ign http://extras.ubuntu.com precise/main TranslationIndex                                                       
Get:3 http://in.archive.ubuntu.com precise-updates Release [49.6 kB]                       
Hit http://security.ubuntu.com precise-security/main i386 Packages                                                         
Hit http://security.ubuntu.com precise-security/restricted i386 Packages                                                   
Ign http://ppa.launchpad.net precise/main Translation-en_US                                                                            
Hit http://security.ubuntu.com precise-security/universe i386 Packages                                            
Ign http://ppa.launchpad.net precise/main Translation-en                                    
Get:4 http://in.archive.ubuntu.com precise-backports Release [49.6 kB]                      
Hit http://security.ubuntu.com precise-security/multiverse i386 Packages                             
Hit http://security.ubuntu.com precise-security/main TranslationIndex                                                
Hit http://in.archive.ubuntu.com precise/main Sources                                       
Hit http://security.ubuntu.com precise-security/multiverse TranslationIndex                 
Hit http://in.archive.ubuntu.com precise/restricted Sources                                 
Hit http://security.ubuntu.com precise-security/restricted TranslationIndex
Hit http://in.archive.ubuntu.com precise/universe Sources                                   
Hit http://security.ubuntu.com precise-security/universe TranslationIndex                   
Ign http://archive.canonical.com precise/partner Translation-en_US    
Hit http://in.archive.ubuntu.com precise/multiverse Sources           
Hit http://security.ubuntu.com precise-security/main Translation-en   
Ign http://archive.canonical.com precise/partner Translation-en       
Ign http://extras.ubuntu.com precise/main Translation-en_US           
Hit http://in.archive.ubuntu.com precise/main i386 Packages           
Hit http://security.ubuntu.com precise-security/multiverse Translation-en
Ign http://extras.ubuntu.com precise/main Translation-en              
Hit http://in.archive.ubuntu.com precise/restricted i386 Packages     
Hit http://security.ubuntu.com precise-security/restricted Translation-en
Hit http://in.archive.ubuntu.com precise/universe i386 Packages
Hit http://security.ubuntu.com precise-security/universe Translation-en
Hit http://in.archive.ubuntu.com precise/multiverse i386 Packages
Hit http://in.archive.ubuntu.com precise/main TranslationIndex
Hit http://in.archive.ubuntu.com precise/multiverse TranslationIndex                                                                   
Hit http://in.archive.ubuntu.com precise/restricted TranslationIndex                                                                   
Hit http://in.archive.ubuntu.com precise/universe TranslationIndex                                                                     
Get:5 http://in.archive.ubuntu.com precise-updates/main Sources [410 kB]                                                               
Get:6 http://in.archive.ubuntu.com precise-updates/restricted Sources [5,467 B]                                                        
Get:7 http://in.archive.ubuntu.com precise-updates/universe Sources [93.5 kB]                                                          
Get:8 http://in.archive.ubuntu.com precise-updates/multiverse Sources [6,582 B]                                                        
Get:9 http://in.archive.ubuntu.com precise-updates/main i386 Packages [683 kB]                                                         
Get:10 http://in.archive.ubuntu.com precise-updates/restricted i386 Packages [10.0 kB]                                                 
Get:11 http://in.archive.ubuntu.com precise-updates/universe i386 Packages [214 kB]                                                    
Get:12 http://in.archive.ubuntu.com precise-updates/multiverse i386 Packages [13.8 kB]                                                 
Hit http://in.archive.ubuntu.com precise-updates/main TranslationIndex                                                                 
Hit http://in.archive.ubuntu.com precise-updates/multiverse TranslationIndex                                                           
Hit http://in.archive.ubuntu.com precise-updates/restricted TranslationIndex                                                           
Hit http://in.archive.ubuntu.com precise-updates/universe TranslationIndex                                                             
Get:13 http://in.archive.ubuntu.com precise-backports/main Sources [2,935 B]                                                           
Get:14 http://in.archive.ubuntu.com precise-backports/restricted Sources [14 B]                                                        
Get:15 http://in.archive.ubuntu.com precise-backports/universe Sources [34.9 kB]                                                       
Get:16 http://in.archive.ubuntu.com precise-backports/multiverse Sources [5,311 B]                                                     
Get:17 http://in.archive.ubuntu.com precise-backports/main i386 Packages [2,390 B]                                                     
Get:18 http://in.archive.ubuntu.com precise-backports/restricted i386 Packages [14 B]                                                  
Get:19 http://in.archive.ubuntu.com precise-backports/universe i386 Packages [35.9 kB]                                                 
Get:20 http://in.archive.ubuntu.com precise-backports/multiverse i386 Packages [5,178 B]                                               
Hit http://in.archive.ubuntu.com precise-backports/main TranslationIndex                                                               
Hit http://in.archive.ubuntu.com precise-backports/multiverse TranslationIndex                                                         
Hit http://in.archive.ubuntu.com precise-backports/restricted TranslationIndex                                                         
Hit http://in.archive.ubuntu.com precise-backports/universe TranslationIndex                                                           
Hit http://in.archive.ubuntu.com precise/main Translation-en                                                                           
Hit http://in.archive.ubuntu.com precise/multiverse Translation-en                                                                     
Hit http://in.archive.ubuntu.com precise/restricted Translation-en                                                                     
Hit http://in.archive.ubuntu.com precise/universe Translation-en                                                                       
Hit http://in.archive.ubuntu.com precise-updates/main Translation-en                                                                   
Hit http://in.archive.ubuntu.com precise-updates/multiverse Translation-en                                                             
Hit http://in.archive.ubuntu.com precise-updates/restricted Translation-en                                                             
Hit http://in.archive.ubuntu.com precise-updates/universe Translation-en                                                               
Hit http://in.archive.ubuntu.com precise-backports/main Translation-en                                                                 
Hit http://in.archive.ubuntu.com precise-backports/multiverse Translation-en                                                           
Hit http://in.archive.ubuntu.com precise-backports/restricted Translation-en                                                           
Hit http://in.archive.ubuntu.com precise-backports/universe Translation-en                                                             
Fetched 1,623 kB in 21s (77.2 kB/s)                                                                                                    
Reading package lists... Done
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  linux-image-3.0.0-29-generic linux-image-3.0.0-30-generic linux-image-3.0.0-31-generic
0 upgraded, 0 newly installed, 3 to remove and 0 not upgraded.
13 not fully installed or removed.
After this operation, 350 MB disk space will be freed.
(Reading database ... 265234 files and directories currently installed.)
Removing linux-image-3.0.0-29-generic ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.0.0-29-generic /boot/vmlinuz-3.0.0-29-generic
update-initramfs: Deleting /boot/initrd.img-3.0.0-29-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.0.0-29-generic /boot/vmlinuz-3.0.0-29-generic
/usr/sbin/grub-mkconfig: 27: /etc/default/grub: want: not found
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 127
Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-3.0.0-29-generic.postrm line 328.
dpkg: error processing linux-image-3.0.0-29-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Removing linux-image-3.0.0-30-generic ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.0.0-30-generic /boot/vmlinuz-3.0.0-30-generic
update-initramfs: Deleting /boot/initrd.img-3.0.0-30-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.0.0-30-generic /boot/vmlinuz-3.0.0-30-generic
/usr/sbin/grub-mkconfig: 27: /etc/default/grub: want: not found
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 127
Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-3.0.0-30-generic.postrm line 328.
dpkg: error processing linux-image-3.0.0-30-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Removing linux-image-3.0.0-31-generic ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.0.0-31-generic /boot/vmlinuz-3.0.0-31-generic
update-initramfs: Deleting /boot/initrd.img-3.0.0-31-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.0.0-31-generic /boot/vmlinuz-3.0.0-31-generic
/usr/sbin/grub-mkconfig: 27: /etc/default/grub: want: not found
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 127
Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-3.0.0-31-generic.postrm line 328.
dpkg: error processing linux-image-3.0.0-31-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
No apport report written because MaxReports is reached already
                                                              Errors were encountered while processing:
 linux-image-3.0.0-29-generic
 linux-image-3.0.0-30-generic
 linux-image-3.0.0-31-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

Please someone help me solve this problem.

share|improve this question

2 Answers 2

Type in terminal: uname -r (that will show you the version of the kernel in use) Case your version is greater than 3.0.0-31 you can remove the versions listed up there. Try to remove them: sudo apt-get remove --purge linux-image-3.0.0-29-generic linux-image-3.0.0-30-generic linux-image-3.0.0-31-generic

share|improve this answer
    
My kernel is 3.0.0-32-generic . After running the above command , again I'm getting errors like "Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-3.0.0-31-generic.postrm line 328. dpkg: error processing linux-image-3.0.0-31-generic (--remove): subprocess installed post-removal script returned error exit status 1 Errors were encountered while processing: linux-image-3.0.0-29-generic linux-image-3.0.0-30-generic linux-image-3.0.0-31-generic E: Sub-process /usr/bin/dpkg returned an error code (1) " –  lalit Jul 28 '13 at 4:18

I had a similar problem. I resolved this issue with removing the postrm files. In your case:

sudo rm -f /var/lib/dpkg/info/linux-image-3.0.0-31-generic.postrm    
sudo rm -f /var/lib/dpkg/info/linux-image-3.0.0-30-generic.postrm    
sudo rm -f /var/lib/dpkg/info/linux-image-3.0.0-29-generic.postrm

Then run:

sudo apt-get -f purge linux-image-3.0.0-31-generic

and finally:

sudo apt-get update 
sudo apt-get upgrade
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.