dpkg: error processing archive ... trying to overwrite '/usr/bin/fix10-tool', which is also in package fix10-one 1.0 means two packages ship the same file. dpkg refuses to let the second one take a file the first one owns. Remove the package named at the end of the message, then install the new one; that worked in the test.

--force-overwrite also gets past the error, but read what it did below before you reach for it: it handed the file to the new package, and the old package vanished from the system.

The error

$ cd /tmp && apt-get install -y ./fix10-two_1.0_all.deb
...
Unpacking fix10-two (1.0) ...
dpkg: error processing archive /tmp/fix10-two_1.0_all.deb (--unpack):
 trying to overwrite '/usr/bin/fix10-tool', which is also in package fix10-one 1.0
Errors were encountered while processing:
 /tmp/fix10-two_1.0_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
exit code: 100

With dpkg -i the same file gave the same message and exit code 1:

$ cd /tmp && dpkg -i fix10-two_1.0_all.deb
...
Preparing to unpack fix10-two_1.0_all.deb ...
Unpacking fix10-two (1.0) ...
dpkg: error processing archive fix10-two_1.0_all.deb (--install):
 trying to overwrite '/usr/bin/fix10-tool', which is also in package fix10-one 1.0
Errors were encountered while processing:
 fix10-two_1.0_all.deb
exit code: 1

Why it happens

dpkg -c showed that both archives contain ./usr/bin/fix10-tool, and fix10-one was already installed. When fix10-two tried to unpack the same path, dpkg stopped and left the installed package alone: afterwards dpkg -l showed fix10-one as ii and fix10-two as in with the version <none>. The message names both sides: the file, and the package that already owns it with its version.

The fix

$ apt-get remove -y fix10-one > /dev/null 2>&1; echo "remove exit: $?"
remove exit: 0
exit code: 0
$ cd /tmp && apt-get install -y ./fix10-two_1.0_all.deb > /tmp/q2.log 2>&1; echo "install exit: $?"; grep -E "^(Unpacking|Setting up)" /tmp/q2.log
install exit: 0
Unpacking fix10-two (1.0) ...
Setting up fix10-two (1.0) ...
exit code: 0
$ fix10-tool
tool from fix10-two
exit code: 0
$ dpkg -S /usr/bin/fix10-tool
fix10-two: /usr/bin/fix10-tool
exit code: 0

With the owner gone, the second package installed and dpkg -S named it as the new owner. Decide first which of the two packages you want; if both come from feeds, the conflict is between those packages and removing one of them is the choice you are making.

What --force-overwrite did

$ cd /tmp && dpkg -i --force-overwrite fix10-one_1.0_all.deb
...
Preparing to unpack fix10-one_1.0_all.deb ...
Unpacking fix10-one (1.0) ...
dpkg: warning: overriding problem because --force enabled:
dpkg: warning: trying to overwrite '/usr/bin/fix10-tool', which is also in package fix10-two 1.0
(Noting disappearance of fix10-two, which has been completely replaced.)
Setting up fix10-one (1.0) ...
exit code: 0
...
$ dpkg -l fix10-one fix10-two | tail -2
dpkg-query: no packages found matching fix10-two
...
exit code: 0

The file now belonged to fix10-one and printed its text, dpkg said fix10-two had been completely replaced, and dpkg -l no longer found fix10-two at all. Removing fix10-one afterwards deleted the file, so nothing of either package was left. A package that ships more files than the one in conflict was not tested.

How it was reproduced

The capture was made in an ubuntu:24.04 container (Ubuntu 24.04.5 LTS, apt 2.8.3, dpkg 1.22.6) on Docker Engine 29.9.3, standing in for Ubuntu in WSL. As root, two tiny packages, fix10-one and fix10-two, were built with dpkg-deb --build, each shipping a script at /usr/bin/fix10-tool that prints its package name.

Frequently asked

How do I fix 'trying to overwrite, which is also in package'?
Remove the package named at the end of the message, then install the new one. In the test apt-get remove fix10-one let fix10-two install, and dpkg -S named fix10-two as the owner.
What does dpkg --force-overwrite do?
In the test it printed a warning, gave the file to the package being installed, noted that the other package had been completely replaced, and dpkg -l no longer found the other package.
How do I find which package owns a file?
Run dpkg -S with the full path. In the test dpkg -S /usr/bin/fix10-tool printed fix10-two after the fix and fix10-one after the --force-overwrite run.

More decoded errors in the Fixes category. The Sub-process /usr/bin/dpkg returned an error code (1) line is explained in its own post.