Yesterday I did apt-get upgrade on my Debian/testing and broke a php5 package. I even tried to remove & purge with apt and dpkg clean apt cache. When installed again clean, it fails with following error message:

Setting up libapache2-mod-php5 (5.3.6-12) ...
readlink: invalid option -- 'm'
BusyBox v1.17.1 (Debian 1:1.17.1-10) multi-call binary.

Usage: readlink [-fnv] FILE

Display the value of a symlink

        -f      Canonicalize by following all symlinks
        -n      Don't add newline
        -v      Verbose

ucf: Unable to determine The new file
dpkg: error processing libapache2-mod-php5 (--configure):
subprocess installed post-installation script returned error exit status 1

Any ideas how to solve this Debian way?

  • The postinst script is invoking the Busybox readlink instead of the GNU version. What I don't understand is how it can happen. If you run readlink --help in a terminal, does the first line show BusyBox or GNU coreutils? What is your PATH? Did you knowingly do anything BusyBox-related? What Debian architecture are you running? – Gilles Jun 21 '11 at 22:44
  • actually i did work with busybox some time ago , i was building initramfs & kernel with busybox for an embedded platform but do not recall changing anything on the system itself. this is a debian/testing running in a vbox – njekto Jun 22 '11 at 19:36

You have accidentally changed /bin/readlink to be busybox, rather than the GNU coreutils version.

This will cause a LOT of breakage. You need to restore GNU coreutils.


# aptitude reinstall coreutils
  • did not help, any other ideas? :) – njekto Jun 22 '11 at 20:00
  • 1
    solved! for some reason i've had busybox binary called /usr/bin/readlink and when executed readlink in shell busybox readlink was launched instead. little gdb session and i've figured that out .. after that i removed the mentioned binary from /usr/bin and reinstalled coreutils pkg .. boy, do i feel foolish now :) thanks for pointing me to the right direction! – njekto Jun 22 '11 at 20:19

Looks like the post install script is broken. Edit /var/lib/dpkg/info/libapache2-mod-php5.postinst and look for the line referencing readlink and see what you can do to fix it.

Afterward run apt-get upgrade again.

  • The postinst is not broken. It assumes readlink is the GNU readlink, which is provided by the coreutils package, which is Essential: yes and Priority: required, so this is a reasonable assumption. – jmtd Jun 22 '11 at 8:40
  • Well, if you've replaced it with something else then it's your own fault. EITHER WAY you need to edit the postinst script to resolve your problem. – bahamat Jun 27 '11 at 20:41
  • I'm sorry, but I don't agree, and I think you are offering bad advice. Changing the postinst doesn't fix the problem, it works around it for one package installation, once: the problem will rear its head in other places, and crop up again as soon as you upgrade the PHP package (which will happen frequently with security updates). – jmtd Jun 29 '11 at 11:45
  • The postinst isn't normally broken. Thousands of users can install and uninstall PHP just fine. He did something to break it, apparently install busybox, which I assume he did on purpose. He can either 1) revert 2) update postinst to account for his different system 3) cry. I assumed his preference was 2. – bahamat Jul 5 '11 at 6:21
  • There are other, more sane options, one of which is outlined in my answer, another of which is outlined in a comment on the question. – jmtd Jul 13 '11 at 14:44

I had the same issue with a recent Kali 1.1.0 VM install on Fusion 7.1.1.

Here's what sorted me out:

aptitude reinstall coreutils
mv /usr/bin/readline /usr/bin/readline.old (leaves GNU /bin/readline as available, trash once completed)
sed -i 's/BUSYBOX=y/BUSYBOX=n/' /etc/initramfs-tools/initramfs.conf
update-initramfs -u

I agree with jmtd, editing a postinst seems both overkill and kludgy.

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.