Announcement

Collapse
No announcement yet.

Purge of package fails

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [SOLVED] Purge of package fails

    I have recently tried purging a package from my system (Kubuntu 14.04). I used this command:

    dpkg purge nokiainternetmodem

    This gave the following error message.

    dpkg: error processing package nokiainternetmodem (--remove):
    subprocess installed post-removal script returned error exit status 1


    Now all my attempts at updating packages fails with the same error message. How can I remove this package? Is there any way to find out what causes the error in the post-removal script?

    Thanks in advance
    Jens

    #2
    where did this package come from and how was it installed ?



    VINNY
    i7 4core HT 8MB L3 2.9GHz
    16GB RAM
    Nvidia GTX 860M 4GB RAM 1152 cuda cores

    Comment


      #3
      Change into the directory where you downloaded the package. Type: sudo dpkg --remove nokiainternetmodem
      Windows no longer obstructs my view.
      Using Kubuntu Linux since March 23, 2007.
      "It is a capital mistake to theorize before one has data." - Sherlock Holmes

      Comment


        #4
        Originally posted by vinnywright View Post
        where did this package come from and how was it installed ?
        It was a .deb-file that came with a wireless modem. I installed it using dpkg.

        -- Jens

        Comment


          #5
          Originally posted by Snowhog View Post
          Change into the directory where you downloaded the package. Type: sudo dpkg --remove nokiainternetmodem
          I'm not sure I have the .deb-file anymore. Is there any way to remove the package without the file?

          -- Jens

          Comment


            #6
            Originally posted by jbang View Post
            I'm not sure I have the .deb-file anymore. Is there any way to remove the package without the file?
            You don't need the deb package to remove (and you don't need to change to the directory it was installed), once a deb package is installed, dpkg can remove it like any other package.

            The error you reported suggests there is a problem with the post-removal script of the package (exit error 1), but it's impossible to say what exactly it is, can you post the contents of /var/lib/dpkg/info/nokiainternetmodem.postrm

            Comment


              #7
              Originally posted by kubicle View Post
              You don't need the deb package to remove (and you don't need to change to the directory it was installed), once a deb package is installed, dpkg can remove it like any other package.
              That's what I thought, but I wasn't sure. Thank you for clearing that up.

              Originally posted by kubicle View Post
              The error you reported suggests there is a problem with the post-removal script of the package (exit error 1), but it's impossible to say what exactly it is, can you post the contents of /var/lib/dpkg/info/nokiainternetmodem.postrm
              No problem. This is the contents of /var/lib/dpkg/info/nokiainternetmodem.postrm:

              Code:
              #!/bin/sh
              
              set -e
              # Automatically added by dh_installmenu
              if [ -x "`which update-menus 2>/dev/null`" ]; then update-menus ; fi
              # End automatically added section
              # Automatically added by dh_desktop
              if [ "$1" = "remove" ] && which update-desktop-database >/dev/null 2>&1 ; then
                      update-desktop-database -q
              fi
              # End automatically added section
              # Automatically added by dh_iconcache
              [ -d /usr/share/icons/hicolor ] && touch -m /usr/share/icons/hicolor || true
              if [ "$1" = "remove" ] && \
                 [ -x "`which gtk-update-icon-cache 2>/dev/null`" ] && \
                 [ -f /etc/gtk-2.0/gdk-pixbuf.loaders ]; then
                      if [ "`find /usr/share/icons/hicolor -mindepth 1 -maxdepth 1 -type d | wc -l`" -gt 0 ] && \
                         [ "`find /usr/share/icons/hicolor -mindepth 1 -maxdepth 1 -type f -name index.theme | wc -l`" -eq 1 ]; then
                              # we shouldn't bomb out, if gtk-update-icon-cache failes, 
                              # it's not important enough
                              gtk-update-icon-cache -q /usr/share/icons/hicolor || true;
                      else
                              # if the icon theme directory has no subdirs, we can remove the cache
                              rm -f /usr/share/icons/hicolor/icon-theme.cache || true;
                      fi
              fi
              # End automatically added section
              
              # wvdial Admin SUDO
              filesudoers='/etc/sudoers'
              filesudoerstmp='/tmp/sudo.tmp'
              
              chmod 0640 $filesudoers
              sed -e "s/.*wvdial.*//" $filesudoers > $filesudoerstmp
              cp $filesudoerstmp $filesudoers
              sed -e "s/.*\/bin\/kill.*//" $filesudoers > $filesudoerstmp
              cp $filesudoerstmp $filesudoers
              chmod 0440 $filesudoers
              rm $filesudoerstmp
              
              if [ -e /sbin/udevcontrol ]; then 
              udevcontrol reload_rules
              else
              /etc/init.d/udev restart
              fi
              if [ -e /etc/PolicyKit/PolicyKit.conf ]; then 
              sed -i "s/<match action=\"org.freedesktop.network-manager-settings.system.modify\"><return result=\"yes\"\/><\/match><\/config>/<\/config>/" /etc/PolicyKit/PolicyKit.conf
              fi
              My bash knowledge isn't exactly expert-level, but here's a couple of results of quick checks I did, based on my understanding of the code:
              1. /bin/sh is a symlink to /bin/dash.
              2. Both update-menus and update-desktop-database exist in /usr/bin/.
              3. /usr/share/icons/hicolor is a directory.
              4. gtk-update-icon-cache exist in /usr/bin/.
              5. There's 25 directories in /usr/share/icons/hicolor as checked by find /usr/share/icons/hicolor -mindepth 1 -maxdepth 1 -type d | wc -l.
              6. /usr/share/icons/hicolor exist as checked by [ "`find /usr/share/icons/hicolor -mindepth 1 -maxdepth 1 -type f -name index.theme | wc -l`" -eq 1 ].
              7. The output from sed -e "s/.*wvdial.*//" $filesudoers and sed -e "s/.*\/bin\/kill.*//" $filesudoers is (not surprisingly) exactly the same as the contents of the $filesudoers file.
              8. /etc/init.d/udev restart runs fine.
              9. /etc/PolicyKit/PolicyKit.conf doesn't exist


              Did I miss anything I need to check?

              -- Jens

              Comment


                #8
                I have tried running the commands in the postrm file manually, but I got no error message.

                Here is what I did:
                1. Started /bin/sh, using sudo: sudo /bin/sh
                2. Ignored set -e, since it would only mean exiting /bin/sh if an error occurred.
                3. Ran the first if, by copy/pasting the line into the console
                4. Ran the second if, by copy/pasting the full if-command into the console
                5. Ran the third if, by copy/pasting the full if-command into the console
                6. Ran the wvdial group by substituting the value of the variables into each line and then running that line.
                7. Ran the last 2 if-commands one at a time by copy/pasting each full if into the console.


                Why doesn't that give me an error message, when it fails when run by the purging of the package?

                -- Jens

                Comment


                  #9
                  try running the whole script to see if you get any error output:
                  1. Open a root shell sudo -i
                  2. run the script /var/lib/dpkg/info/nokiainternetmodem.postrm
                  3. check possible errors
                  4. exit root shell exit

                  Comment


                    #10
                    Originally posted by kubicle View Post
                    try running the whole script to see if you get any error output:
                    1. Open a root shell sudo -i
                    2. run the script /var/lib/dpkg/info/nokiainternetmodem.postrm
                    3. check possible errors
                    4. exit root shell exit
                    I tried that, and this is what I got:

                    Code:
                    jbang@amanda:~$ sudo -i
                    [sudo] password for jbang: 
                    root@amanda:~# /var/lib/dpkg/info/nokiainternetmodem.postrm
                    root@amanda:~# exit
                    logout
                    jbang@amanda:~$
                    But when I run sudo apt-get purge nokiainternetmodem I still get this:

                    Code:
                    Removing nokiainternetmodem (1.3.264.3) ...
                    dpkg: error processing package nokiainternetmodem (--remove):
                     subprocess installed post-removal script returned error exit status 1
                    Processing triggers for menu (2.1.46ubuntu1) ...
                    Errors were encountered while processing:
                     nokiainternetmodem
                    E: Sub-process /usr/bin/dpkg returned an error code (1)
                    -- Jens

                    Comment


                      #11
                      have you tried simply moving/deleting the postrm file, then trying to uninstall the package again?

                      Comment


                        #12
                        Originally posted by claydoh View Post
                        have you tried simply moving/deleting the postrm file, then trying to uninstall the package again?
                        This would be the next step to try.

                        You normally don't want to do this as the postrm script may perform some important actions during package removal, but since you have already run it manually it shouldn't be a problem any more.

                        EDIT: had another look at the script, and you may want to test to run it (as root) with:
                        /var/lib/dpkg/info/nokiainternetmodem.postrm remove

                        (Since there are couple of "$1" argument tests in the script)
                        Last edited by kubicle; Aug 31, 2014, 01:09 AM.

                        Comment


                          #13
                          Originally posted by kubicle View Post
                          EDIT: had another look at the script, and you may want to test to run it (as root) with:
                          /var/lib/dpkg/info/nokiainternetmodem.postrm remove

                          (Since there are couple of "$1" argument tests in the script)
                          Good point. I should have thought of that myself. :-)

                          I tried it, but I didn't get an error message:

                          Code:
                          jbang@amanda:~$ sudo -i
                          [sudo] password for jbang: 
                          root@amanda:~# /var/lib/dpkg/info/nokiainternetmodem.postrm remove
                          root@amanda:~# exit
                          logout
                          jbang@amanda:~$
                          Originally posted by kubicle View Post

                          Originally posted by claydoh View Post
                          have you tried simply moving/deleting the postrm file, then trying to uninstall the package again?
                          This would be the next step to try.

                          You normally don't want to do this as the postrm script may perform some important actions during package removal, but since you have already run it manually it shouldn't be a problem any more.
                          I didn't delete the file, I only emptied it,and then I tried removing the package. It seemed to go fine:

                          Code:
                          jbang@amanda:~$ cat /var/lib/dpkg/info/nokiainternetmodem.postrm 
                          #!/bin/sh
                          
                          jbang@amanda:~$ sudo apt-get purge nokiainternetmodem
                          Reading package lists... Done
                          Building dependency tree       
                          Reading state information... Done
                          The following packages were automatically installed and are no longer required:
                            [[SNIP]]
                          Use 'apt-get autoremove' to remove them.
                          The following packages will be REMOVED
                            nokiainternetmodem
                          0 to upgrade, 0 to newly install, 1 to remove and 27 not to upgrade.
                          1 not fully installed or removed.                                                                                                                                                                                  
                          After this operation, 34.5 MB disk space will be freed.                                                                                                                                                            
                          Do you want to continue? [Y/n] y                                                                                                                                                                                   
                          (Reading database ... 538386 files and directories currently installed.)                                                                                                                                           
                          Removing nokiainternetmodem (1.3.264.3) ...                                                                                                                                                                        
                          jbang@amanda:~$
                          Thank you all so much for your help. :-)

                          Now I will try to install the security updates that have been waiting...

                          -- Jens
                          Last edited by jbang; Sep 01, 2014, 10:19 AM.

                          Comment

                          Working...
                          X