13

When trying to update, the error weighs:

FATAL ERROR:
Both /lib/x86_64-linux-gnu/libselinux.so.1 and /usr/lib/x86_64-linux-gnu/libselinux.so.1 exist.

You can try correcting the errors reported and running again /usr/lib/usrmerge/convert-usrmerge until it will complete without errors. Do not install or update other Debian packages until the program has been run successfully.

dpkg: error processing usrmerge package (--configure): installed usrmerge package post-installation script subprocess returned error exit status 1

I tried to fix it with the commands: sudo apt -f install, sudo dpkg --configure -a, nothing helps, the error does not disappear! Tell me how you can fix it?

N0rbert
  • 103,263
rixxar
  • 291

4 Answers4

16

Thank you! I found a solution to my problem! Maybe someone will come in handy!

cd /var/lib/dpkg/info
sudo rm usrmerge.*
sudo apt-get -f install
rixxar
  • 291
2

I had a system where many files in different subdirectories of /usr would have to have corrected manually in order to get /usr/lib/usrmerge/convert-usrmerge running w/o errors.

Inspired by the answer from @cactuschibre I created a little shell script which does an automated correction of a given directory with some more sanity checks:

#!/bin/sh

dir=$1

if [ ! -d $dir -o ! -d /usr/$dir ]; then exit 1 fi

verbose () { echo "$@" >&2 "$@" }

for f in $(find $dir -mindepth 1 ! -type l ! -type d); do

# check if the same file exists in /usr
#
if [ -e /usr$f ]; then

    echo "---" >&2

    # check if either the file in /usr is older or if both files are the same
    #
    if [ /usr$f -ot $f ] || cmp -s /usr$f $f; then

        ls -l $f /usr$f
        dpkg -S $f
        dpkg -S /usr$f

        # if the `dpkg -S /usr$f command above failed it means that no
        # package installed the file to /usr. Therefore it should be safe
        # to overwrite the file in /usr w/o interfering with an installed
        # package.
        #
        if [ $? = 1 ]; then
            verbose rm /usr$f
            verbose mv $f /usr$f
            verbose ln -s /usr$f $f
        fi
    else
        echo /usr$f is newer than $f or files are not the same. >&2
        echo PLEASE RESOLVE THIS CONFLICT MANUALLY. >&2
    fi
fi

done

Use the script like this:

  1. start with /usr/lib/usrmerge/convert-usrmerge
  2. if convert-usrmerge returns with an error with a file in a certain directory (e.g. /lib) then call the above script with this directory
  3. the script will correct all files in the given directory
  4. start over with 1. convert-usrmerge will possibly complain about a conflict in another directory...
1

I also encountered the problem. It is kinda linked to https://www.freedesktop.org/wiki/Software/systemd/TheCaseForTheUsrMerge/ (I did not followed all the history of this).

I identified also files were duplicated between /bin and /usr/bin for example, but more recent in /bin. And usrmerge was unable to managed this situation. So I helped him and I did this:

for f in `find /bin -mindepth 1 ! -type l`; do sudo mv $f /usr/bin/$(basename ${f}); sudo ln -s /usr/bin/$(basename ${f}) $f;done
for f in `find /sbin -mindepth 1 ! -type l`; do sudo mv $f /usr/sbin/$(basename ${f}); sudo ln -s /usr/sbin/$(basename ${f}) $f;done
for f in `find /lib/systemd/system -mindepth 1 ! -type l`; do sudo mv $f /usr/lib/systemd/system/$(basename ${f}); sudo ln -s /usr/lib/systemd/system/$(basename ${f}) $f;done
for f in `find /lib/udev/rules.d -mindepth 1 ! -type l`; do sudo mv $f /usr/lib/udev/rules.d/$(basename ${f}); sudo ln -s /usr/lib/udev/rules.d/$(basename ${f}) $f;done

It can be adapted to any folder in conflict. For your case, I think:

for f in `find /lib/x86_64-linux-gnu -mindepth 1 ! -type l`; do sudo mv $f /usr/lib/x86_64-linux-gnu/$(basename ${f}); sudo ln -s /usr/lib/x86_64-linux-gnu/$(basename ${f}) $f;done

It only creates symlinks pointing to /usr/.*

0

It worked for me.

sudo apt-get update && sudo apt-get upgrade

complains that: dpkg: warning: files list file for package 'usrmerge' missing; assuming package has no files currently installed

but it runs fine otherwise, so I can live with this.