Debian – Repairing a failed Debian upgrade

debiansystemdsysvinitupgrade

I was attempting to upgrade from debian 9 to 10 but the installation failed when attempting to install systemd-sysv_241-7~deb10u6_amd64.deb. I get the following error:

My attempts to run apt --fix-broken install have not been successful and lead to the same error below.

(Reading database ... 59371 files and directories currently installed.)
Preparing to unpack .../systemd-sysv_241-7~deb10u6_amd64.deb ...
Unpacking systemd-sysv (241-7~deb10u6) ...
dpkg: error processing archive /var/cache/apt/archives/systemd-sysv_241-7~deb10u6_amd64.deb (--install):
 trying to overwrite '/usr/share/man/man8/halt.8.gz', which is also in package sysvinit 2.88dsf-41+deb7u1
Processing triggers for man-db (2.7.6.1-2) ...
Errors were encountered while processing:
 /var/cache/apt/archives/systemd-sysv_241-7~deb10u6_amd64.deb

In my attempts to isolate, I get the following when I run the failed command in verbose mode:

# dpkg --debug=77777 -i /var/cache/apt/archives/systemd-sysv_241-7~deb10u6_amd64.deb
...
D000040: ok 2 msgs >><<
D010000: check_triggers_cycle pnow=man-db:amd64
D020000: check_triggers_cycle pnow=man-db:amd64 first
Processing triggers for man-db (2.7.6.1-2) ...
D000002: fork/exec /var/lib/dpkg/info/man-db.postinst ( triggered /usr/share/man )
D000001: ensure_diversions: same, skipping
D020000: post_postinst_tasks - trig_incorporate
Errors were encountered while processing:
 /var/cache/apt/archives/systemd-sysv_241-7~deb10u6_amd64.deb

Unfortunately, this 'verbose' debugging is too terse for me and I am stuck mid-upgrade.

I tried running the man-db post install as follows:

sh -x /var/lib/dpkg/info/man-db.postinst configure 2.6.7.1-2

and it completed successfully without error so I am unsure what the error is to be able to try and fix.

I know that the installation scripts are located in ls /var/lib/dpkg/info, but I do not know which are related to this package.

Can anyone tell me where to get more detail to debug this more thoroughly and fix it?

Best Answer

I don't see how you could get more relevant information than you already have. The error message says:

trying to overwrite '/usr/share/man/man8/halt.8.gz', which is also in package sysvinit 2.88dsf-41+deb7u1

this is basically it: two packages want to install the same file, and debian forbids this (as a single file cannot have two different contents).

Since the file in question is only a manpage, there shouldn't be any real problem (as in: catastrophic problem that leads to an unbootable system), regardless which of the two packages "wins".

So I would personally just do a forced installation of the broken package:

# dpkg --force-overwrite -i /var/cache/apt/archives/systemd-sysv_241-7~deb10u6_amd64.deb

and after that restart the upgrade.

Please do note however, that the --force-*** options of dpkg are usually considered dangerous and you shouldn't just blindly force things by copying shell snippets from the internet without understanding the implications.

Debian upgrades

OTOH, Debian spends a lot of blood , sweat and tears into making systems smoothly upgradable between Debian releases (e.g. 9 to 10). So why does it not work for you?

You should use apt-get dist-upgrade to upgrade between major releases (as this relaxes the resolver and allows to upgrade more complicated situtations than a simple apt-get upgrade).

You should also make sure to remove cruft from older installations. E.g. your conflicting sysvinit package has a version number 2.88dsf-41+deb7u1 which indicates that it is from Debian 7. And indeed, there hasn't been a sysvinit package since Debian 8.

So you should first make sure that you actually run a Debian 9 system before you try to upgrade it to Debian 10.

Related Question