2

I tried multiple things to get this to work, but it's not working:

I'm running sudo apt-get upgrade and get the following error:

Preparing to unpack .../base-files_10.1ubuntu2.2_amd64.deb ...
Unpacking base-files (10.1ubuntu2.2) over (9.4ubuntu4.13) ...
dpkg: error processing archive /var/cache/apt/archives/base-files_10.1ubuntu2.2_amd64.deb (--unpack):
 trying to overwrite '/etc/default/motd-news', which is also in package motd-news-config 9.4ubuntu4.13
Errors were encountered while processing:
 /var/cache/apt/archives/base-files_10.1ubuntu2.2_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

How can I fix this?

ubfan1
  • 17,041
  • 4
  • 39
  • 47
mcadio
  • 123
  • 4
  • 4
    Does this answer your question? [dpkg error: "trying to overwrite file, which is also in..."](https://askubuntu.com/questions/176121/dpkg-error-trying-to-overwrite-file-which-is-also-in) – N0rbert Oct 12 '20 at 07:30
  • Not really. When I try to remove the conflicting package I get: root@lemp-512mb-nyc3-01:~# sudo dpkg -P motd-news-config dpkg: dependency problems prevent removal of motd-news-config: ubuntu-server depends on motd-news-config. dpkg: error processing package motd-news-config (--purge): dependency problems - not removing Errors were encountered while processing: motd-news-config – mcadio Oct 12 '20 at 12:48

1 Answers1

7

Then force installation of base-files by

sudo dpkg -i --force-all /var/cache/apt/archives/base-files_10.1ubuntu2.2_amd64.deb

and resume upgrade by

sudo apt-get install -f
sudo apt-get dist-upgrade
N0rbert
  • 97,162
  • 34
  • 239
  • 423
  • Thank you!!! That was driving me nuts. I wanted to stay up to date, but couldn't find the solution anywhere. – mcadio Oct 12 '20 at 13:36
  • the 2nd command should be `sudo apt-get upgrade`. OP is not looking for distribution upgrade – Raptor Aug 28 '23 at 06:17