Sunday, May 03, 2009

Fun with diverted files

I recently wanted to install a new program on grumpy, my MythTV box. apt-get install spat out a bunch of changes and dependencies, but I let it go ahead. What I didn't notice was a coreutils upgrade that was tucked away in the list, and led to the following error

Preparing to replace coreutils 5.2.1-2 (using .../coreutils_6.10-6_i386.deb) ...
Unpacking replacement coreutils ...
dpkg: error processing /var/cache/apt/archives/coreutils_6.10-6_i386.deb (--unpack):
trying to overwrite `/usr/share/man/man1/md5sum.1.gz', which is the diverted version of `/usr/share/man/man1/md5sum.textutils.1.gz'
dpkg-deb: subprocess paste killed by signal (Broken pipe)
Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)

Woah. Now what? After some fumbling around, I gave up for the evening. It was late, I was tired.

This morning I took another look at this. apt-get install -f led to the same error. After some googling and browsing around, I tried

grumpy# dpkg-divert --list | grep md5sumlocal diversion of /usr/bin/md5sum.textutils to /usr/bin/md5sum
local diversion of /usr/share/man/man1/md5sum.textutils.1.gz to /usr/share/man/man1/md5sum.1.gz
grumpy# dpkg-divert --remove /usr/bin/md5sum.textutils
Removing `local diversion of /usr/bin/md5sum.textutils to /usr/bin/md5sum'
grumpy# dpkg-divert --remove /usr/share/man/man1/md5sum.textutils.1.gz
Removing `local diversion of /usr/share/man/man1/md5sum.textutils.1.gz to /usr/share/man/man1/md5sum.1.gz'

Running apt-get install -f again fixed up everything and the queued packages installed.

I didn't really know about how diversions worked before this (though, now that I got to play with them, it's kinda cool), so I'm baffled where this local diversion came from, as all the other diversions in the list are maintained by packages.


christa said...

Dein Blog muß die nächste Woche etwas privater werden, Wolfram fällt nämlich aus, sonst habe ich Entzugserscheinungen

Unknown said...

Thank you, I had the exact same problem and this probably safed me a lot of trouble.

Anonymous said...

Thanks, this post just saved my day.