2

After applying the latest updates today (August 16, 2014), Libreoffice-base will not complete the upgrade due "no diversion" error which then seems to break the postrm script and now I can neither update, install or remove packages.

I have turned off all ppa repositories, performed "sudo dpkg --configure -a", "sudo apt-get autoremove" as well as "sudo rm -fR /var/cache/apt" to create a clean slate - but to no avail. I have also tried renaming the offending files to .bak.

Any ideas?

Output of latest attempt:

$ sudo apt-get install -f
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  iw crda wireless-crda wireless-regdb
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
  libreoffice-base
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 6,748 kB disk space will be freed.
Do you want to continue [Y/n]? y
(Reading database ... 221883 files and directories currently installed.)
Removing libreoffice-base ...
No diversion 'diversion of /usr/lib/libreoffice/share/basic/dialog.xlc to /usr/lib/libreoffice/share/basic/dialog.xlc.noaccess by libreoffice-base', none removed.
No diversion 'diversion of /usr/lib/libreoffice/share/basic/script.xlc to /usr/lib/libreoffice/share/basic/script.xlc.noaccess by libreoffice-base', none removed.
/var/lib/dpkg/info/libreoffice-base.postrm: 31: /var/lib/dpkg/info/libreoffice-base.postrm: Syntax error: end of file unexpected (expecting "fi")
dpkg: error processing libreoffice-base (--remove):
 subprocess installed post-removal script returned error exit status 2
Errors were encountered while processing:
 libreoffice-base
E: Sub-process /usr/bin/dpkg returned an error code (1)
3

This bug has been reported here. In short there is syntax error in /var/lib/dpkg/info/libreoffice-base.postrm script that breaks it.

This what I did to fix the issue on my machine - was also suggested by nadrach here. Open that broken script for editing:

sudo gedit /var/lib/dpkg/info/libreoffice-base.postrm

Edit the file:

#!/bin/sh

set -e


if [ "$1" = remove -o "$1" = abort-install -o "$1" = disappear ]; then
dpkg-divert --package $DPKG_MAINTSCRIPT_PACKAGE --remove --rename \
--divert /usr/lib/libreoffice/share/basic/dialog.xlc.noaccess \
/usr/lib/libreoffice/share/basic/dialog.xlc
dpkg-divert --package $DPKG_MAINTSCRIPT_PACKAGE --remove --rename \
--divert /usr/lib/libreoffice/share/basic/script.xlc.noaccess \
/usr/lib/libreoffice/share/basic/script.xlc
fi
if [ "$1" = abort-upgrade ] && dpkg --compare-versions "$2" lt dpkg --compare-versions "$2" lt 1:4.3.0~beta1-1; then
dpkg-divert --package $DPKG_MAINTSCRIPT_PACKAGE --remove --rename \
--divert /usr/lib/libreoffice/share/basic/dialog.xlc.noaccess \
/usr/lib/libreoffice/share/basic/dialog.xlc
dpkg-divert --package $DPKG_MAINTSCRIPT_PACKAGE --remove --rename \
--divert /usr/lib/libreoffice/share/basic/script.xlc.noaccess \

PLACE THIS LINE HERE: /usr/lib/libreoffice/share/basic/script.xlc

fi

    # Automatically added by dh_installmenu

if [ -x "`which update-menus 2>/dev/null`" ]; then update-menus ; fi
# End automatically added section


exit 0

Save the file and run your updates. The fix hasn't caused any problems for me yet.


As David pointed out might need to fix broken packages after applying this before everything gets back to normal:

sudo apt-get -f install
  • Didn't work for me (on 14.04) - but I got an error message saying to run apt-get install -f in terminal so I did (with sudo, of course), and it all cleaned up nicely. Bit of a pain. :) – Dɑvïd Aug 18 '14 at 9:17
0

I used aptitude to solve it. I'm not sure whether is makes a difference to use aptitude, but as it's solved now for me I can not test. So if you have it installed, or can install it by apt-get install aptitude, you can try what worked for me:

Start aptitude, update with u, and install any packages left to install by pressing + on "Upgradable Packages", and then g to show what will be done, and if that seems reasonable, g again to make the changes. There was one of the libreoffice packages left uninstalled, and with the actions as described, it got installed, and the error was fixed on the way.

The terminal output where the problem was fixed is this:

Preparing to unpack .../libreoffice-base_1%3a4.3.0-3ubuntu1~trusty1_amd64.deb ...
Unpacking libreoffice-base (1:4.3.0-3ubuntu1~trusty1) over (1:4.3.0-0ubuntu1~trusty1) ...
/var/lib/dpkg/info/libreoffice-base.postrm: 28: /var/lib/dpkg/info/libreoffice-base.postrm: Syntax error: end of file unexpected (expecting "fi")
dpkg: warning: subprocess old post-removal script returned error exit status 2
dpkg: trying script from the new package instead ...
dpkg: ... it looks like that went OK
Preparing to unpack .../libreoffice-ogltrans_1%3a4.3.0-3ubuntu1~trusty1_amd64.deb ...
Unpacking libreoffice-ogltrans (1:4.3.0-3ubuntu1~trusty1) over (1:4.3.0-0ubuntu1~trusty1) ...
  • I can't install anything and Aptitude was not previously installed. I can't install even with the --no-upgrade option on apt-get. Synaptic fails as well. – mtb-cliff Aug 16 '14 at 20:42
  • @mtb-cliff I am not really sure I could have installed aptitude in that situation, I expected it based on the errors. Looking at my log, I kept aptitude running between the error ocurred and fixing it. The operations aptitude does should be just separate actions like two calls of apt-get, but maybe they are not really. – Volker Siegel Aug 16 '14 at 21:06
  • I tried dpkg --merge-avail to hopefully do the same as what you were indicating by aptitude 'g' however, the error persisted. I tried dpkg --remove and that just runs the postrm script that has the issue. – mtb-cliff Aug 16 '14 at 21:19
  • Just a guess, maybe this helps, because that's what triggered the actual fix I think: apt-get install libreoffice-base – Volker Siegel Aug 16 '14 at 21:26
0

I was able to get rid of the offending errors, but have no access to libreoffice-base. I can live without it for now as I usually use MySql instead. The way I did it was to open a nautilus window as root 'gksu nautilus' and then traverse to the directory where the postrm file resided '/var/lib/dpkg/info' then opened 'libreoffice-base.postrm' in a text editor and commented out the second block completely (until its 'fi') - starts with 'if [ "$1" = abort-upgrade ] && dpkg --compare-versions "$2" lt dpkg --compare-versions "$2" lt 1:4.3.0~beta1-1; then'. Saved the file and then performed a 'sudo apt-get install libreoffice-base' which produced the following:

Reading package lists... Done Building dependency tree
Reading state information... Done libreoffice-base is already the newest version. The following packages were automatically installed and are no longer required: iw crda wireless-crda wireless-regdb Use 'apt-get autoremove' to remove them. The following packages will be REMOVED: libreoffice-base 0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded. 1 not fully installed or removed. After this operation, 6,748 kB disk space will be freed. Do you want to continue [Y/n]? y (Reading database ... 221883 files and directories currently installed.) Removing libreoffice-base ... No diversion 'diversion of /usr/lib/libreoffice/share/basic/dialog.xlc to /usr/lib/libreoffice/share/basic/dialog.xlc.noaccess by libreoffice-base', none removed. No diversion 'diversion of /usr/lib/libreoffice/share/basic/script.xlc to /usr/lib/libreoffice/share/basic/script.xlc.noaccess by libreoffice-base', none removed. Processing triggers for menu ...

When I try to reinstall base it complains about dependencies, yet all of the files identified are at the latest version required. weird. But at least I can update and install packages again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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