Software centre not working due to "cant find an archive"

Asked by Marinus Bos on 2018-11-06

After an atempt to install an application probably called "unifi" directly from Ubiquiti/unifi website I can no longer install new software or do anything like that. Whether I use synaptic, software centre, update manager or apt-get in the terminal I get the following error:
E: The package unifi needs to be reinstalled, but I can't find an archive for it.
I have tried a few possible fixes with apt-get, like upgrade, update, install -f. Nothing works because every command related to installing software is not working due to the "installer" hanging at its unfinished business. I don"t mind not having "unifi" but cant find a way to let synaptic and the likes to move past it.

rin@rin-EX58-UD5 ~ $ ubuntu-support-status
The program 'ubuntu-support-status' is currently not installed. You can install it by typing:
sudo apt install update-manager-core
rin@rin-EX58-UD5 ~ $ cat /etc/dpkg/dpkg.cfg.d/multiarch
cat: /etc/dpkg/dpkg.cfg.d/multiarch: No such file or directory
rin@rin-EX58-UD5 ~ $ dpkg --print-foreign-architectures
i386
rin@rin-EX58-UD5 ~ $ sudo grep -R roxy /etc/apt/*
[sudo] password for rin:
rin@rin-EX58-UD5 ~ $ sudo grep -R roxy /etc/apt/*
rin@rin-EX58-UD5 ~ $ grep roxy /etc/environment
rin@rin-EX58-UD5 ~ $ echo $http_proxy

rin@rin-EX58-UD5 ~ $ echo $ftp_proxy

rin@rin-EX58-UD5 ~ $ grep roxy /etc/bash.bashrc
rin@rin-EX58-UD5 ~ $ grep roxy ~/.bashrc
rin@rin-EX58-UD5 ~ $
rin@rin-EX58-UD5 ~ $
rin@rin-EX58-UD5 ~ $ cat /etc/apt/apt.conf
cat: /etc/apt/apt.conf: No such file or directory
rin@rin-EX58-UD5 ~ $ sudo fuser -vvv /var/lib/dpkg/lock
rin@rin-EX58-UD5 ~ $ sudo fuser -vvv /var/cache/apt/archives/lock
rin@rin-EX58-UD5 ~ $ cat /etc/lsb-release
DISTRIB_ID=LinuxMint
DISTRIB_RELEASE=18
DISTRIB_CODENAME=sarah
DISTRIB_DESCRIPTION="Linux Mint 18 Sarah"
rin@rin-EX58-UD5 ~ $ uname -a
Linux rin-EX58-UD5 4.4.0-21-generic #37-Ubuntu SMP Mon Apr 18 18:33:37 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
rin@rin-EX58-UD5 ~ $ sudo rm /var/lib/apt/lists/lock
rin@rin-EX58-UD5 ~ $ sudo rm /var/cache/apt/archives/lock
rin@rin-EX58-UD5 ~ $ sudo rm /var/lib/dpkg/lock
rin@rin-EX58-UD5 ~ $ sudo cp -arf /var/lib/dpkg /var/lib/dpkg.backup
rin@rin-EX58-UD5 ~ $ sudo mv /var/lib/dpkg/status /var/lib/dpkg/status-bad
rin@rin-EX58-UD5 ~ $ sudo cp /var/lib/dpkg/status-old /var/lib/dpkg/status || sudo cp /var/backups/dpkg.status.0 /var/lib/dpkg/status
rin@rin-EX58-UD5 ~ $ sudo mv /var/lib/dpkg/available /var/lib/dpkg/available-bad
rin@rin-EX58-UD5 ~ $ sudo cp /var/lib/dpkg/available-old /var/lib/dpkg/available
cp: cannot stat '/var/lib/dpkg/available-old': No such file or directory
rin@rin-EX58-UD5 ~ $ sudo rm -rf /var/lib/dpkg/updates/*
rin@rin-EX58-UD5 ~ $ sudo rm -rf /var/lib/apt/lists
rin@rin-EX58-UD5 ~ $ sudo rm /var/cache/apt/*.bin
rin@rin-EX58-UD5 ~ $ sudo mkdir /var/lib/apt/lists
rin@rin-EX58-UD5 ~ $ sudo mkdir /var/lib/apt/lists/partial
rin@rin-EX58-UD5 ~ $ LANG=C;sudo apt-get clean
rin@rin-EX58-UD5 ~ $ LANG=C;sudo apt-get autoclean
Reading package lists... Done
Building dependency tree
Reading state information... Done
rin@rin-EX58-UD5 ~ $ sudo dpkg --configure -a
rin@rin-EX58-UD5 ~ $ sudo dpkg --clear-avail
rin@rin-EX58-UD5 ~ $ LANG=C;sudo apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: The package unifi needs to be reinstalled, but I can't find an archive for it.
rin@rin-EX58-UD5 ~ $ LANG=C;sudo apt-get --fix-missing install
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: The package unifi needs to be reinstalled, but I can't find an archive for it.
rin@rin-EX58-UD5 ~ $ LANG=C;sudo apt-get --purge autoremove
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: The package unifi needs to be reinstalled, but I can't find an archive for it.
rin@rin-EX58-UD5 ~ $ LANG=C;sudo apt-get --fix-missing update -o APT::Cache-Limit=100000000
Get:1 http://security.ubuntu.com/ubuntu xenial-security InRelease [107 kB]
Get:2 http://archive.canonical.com/ubuntu xenial InRelease [11.5 kB]
Get:3 http://archive.ubuntu.com/ubuntu xenial InRelease [247 kB]
Get:4 http://archive.canonical.com/ubuntu xenial/partner amd64 Packages [3132 B]
Ign:5 http://packages.linuxmint.com sarah InRelease
Get:6 http://packages.linuxmint.com sarah Release [24.1 kB]
Get:7 http://archive.canonical.com/ubuntu xenial/partner i386 Packages [3128 B]
Get:8 http://archive.canonical.com/ubuntu xenial/partner Translation-en [1616 B]
Get:9 http://packages.linuxmint.com sarah Release.gpg [819 B]
Get:10 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages [573 kB]
Get:11 http://packages.linuxmint.com sarah/main amd64 Packages [16.2 kB]
Get:12 http://packages.linuxmint.com sarah/main i386 Packages [15.5 kB]
Get:13 http://packages.linuxmint.com sarah/upstream amd64 Packages [34.0 kB]
Get:14 http://archive.ubuntu.com/ubuntu xenial-updates InRelease [109 kB]
Get:15 http://security.ubuntu.com/ubuntu xenial-security/main i386 Packages [493 kB]
Get:16 http://archive.ubuntu.com/ubuntu xenial-backports InRelease [107 kB]
Get:17 http://packages.linuxmint.com sarah/upstream i386 Packages [34.0 kB]
Get:18 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages [1201 kB]
Get:19 http://security.ubuntu.com/ubuntu xenial-security/main Translation-en [240 kB]
Get:20 http://security.ubuntu.com/ubuntu xenial-security/restricted amd64 Packages [7204 B]
Get:21 http://security.ubuntu.com/ubuntu xenial-security/restricted i386 Packages [7224 B]
Get:22 http://security.ubuntu.com/ubuntu xenial-security/restricted Translation-en [2152 B]
Get:23 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 Packages [397 kB]
Get:24 http://packages.linuxmint.com sarah/import amd64 Packages [6723 B]
Get:25 http://packages.linuxmint.com sarah/import i386 Packages [6725 B]
Get:26 http://packages.linuxmint.com sarah/backport amd64 Packages [73.4 kB]
Get:27 http://packages.linuxmint.com sarah/backport i386 Packages [73.4 kB]
Get:28 http://security.ubuntu.com/ubuntu xenial-security/universe i386 Packages [344 kB]
Get:29 http://archive.ubuntu.com/ubuntu xenial/main i386 Packages [1196 kB]
Get:30 http://security.ubuntu.com/ubuntu xenial-security/universe Translation-en [153 kB]
Get:31 http://security.ubuntu.com/ubuntu xenial-security/multiverse amd64 Packages [3460 B]
Get:32 http://security.ubuntu.com/ubuntu xenial-security/multiverse i386 Packages [3632 B]
Get:33 http://security.ubuntu.com/ubuntu xenial-security/multiverse Translation-en [1744 B]
Get:34 http://archive.ubuntu.com/ubuntu xenial/main Translation-en [568 kB]
Get:35 http://archive.ubuntu.com/ubuntu xenial/restricted amd64 Packages [8344 B]
Get:36 http://archive.ubuntu.com/ubuntu xenial/restricted i386 Packages [8684 B]
Get:37 http://archive.ubuntu.com/ubuntu xenial/restricted Translation-en [2908 B]
Get:38 http://archive.ubuntu.com/ubuntu xenial/universe amd64 Packages [7532 kB]
Get:39 http://archive.ubuntu.com/ubuntu xenial/universe i386 Packages [7512 kB]
Get:40 http://archive.ubuntu.com/ubuntu xenial/universe Translation-en [4354 kB]
Get:41 http://archive.ubuntu.com/ubuntu xenial/multiverse amd64 Packages [144 kB]
Get:42 http://archive.ubuntu.com/ubuntu xenial/multiverse i386 Packages [140 kB]
Get:43 http://archive.ubuntu.com/ubuntu xenial/multiverse Translation-en [106 kB]
Get:44 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [871 kB]
Get:45 http://archive.ubuntu.com/ubuntu xenial-updates/main i386 Packages [777 kB]
Get:46 http://archive.ubuntu.com/ubuntu xenial-updates/main Translation-en [354 kB]
Get:47 http://archive.ubuntu.com/ubuntu xenial-updates/restricted amd64 Packages [7556 B]
Get:48 http://archive.ubuntu.com/ubuntu xenial-updates/restricted i386 Packages [7524 B]
Get:49 http://archive.ubuntu.com/ubuntu xenial-updates/restricted Translation-en [2272 B]
Get:50 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages [701 kB]
Get:51 http://archive.ubuntu.com/ubuntu xenial-updates/universe i386 Packages [643 kB]
Get:52 http://archive.ubuntu.com/ubuntu xenial-updates/universe Translation-en [285 kB]
Get:53 http://archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64 Packages [16.4 kB]
Get:54 http://archive.ubuntu.com/ubuntu xenial-updates/multiverse i386 Packages [15.5 kB]
Get:55 http://archive.ubuntu.com/ubuntu xenial-updates/multiverse Translation-en [8344 B]
Get:56 http://archive.ubuntu.com/ubuntu xenial-backports/main amd64 Packages [7304 B]
Get:57 http://archive.ubuntu.com/ubuntu xenial-backports/main i386 Packages [7300 B]
Get:58 http://archive.ubuntu.com/ubuntu xenial-backports/main Translation-en [4456 B]
Get:59 http://archive.ubuntu.com/ubuntu xenial-backports/universe amd64 Packages [7804 B]
Get:60 http://archive.ubuntu.com/ubuntu xenial-backports/universe i386 Packages [7488 B]
Get:61 http://archive.ubuntu.com/ubuntu xenial-backports/universe Translation-en [4184 B]
Fetched 29.6 MB in 24s (1226 kB/s)
Reading package lists... Done
rin@rin-EX58-UD5 ~ $ LANG=C;sudo apt-get update -o APT::Cache-Limit=100000000 && sudo apt-get dist-upgrade
Ign:1 http://packages.linuxmint.com sarah InRelease
Hit:2 http://archive.canonical.com/ubuntu xenial InRelease
Hit:3 http://packages.linuxmint.com sarah Release
Hit:5 http://security.ubuntu.com/ubuntu xenial-security InRelease
Hit:6 http://archive.ubuntu.com/ubuntu xenial InRelease
Hit:7 http://archive.ubuntu.com/ubuntu xenial-updates InRelease
Hit:8 http://archive.ubuntu.com/ubuntu xenial-backports InRelease
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: The package unifi needs to be reinstalled, but I can't find an archive for it.
rin@rin-EX58-UD5 ~ $ find /etc/apt -name '*.list' -exec bash -c 'echo -e "\n$1\n"; cat -n "$1"' _ '{}' \;

/etc/apt/sources.list.d/ubuntu-defaults.list

     1 # deb http://ppa.launchpad.net/kubuntu-ppa/backports/ubuntu xenial main

/etc/apt/sources.list.d/official-package-repositories.list

     1 deb http://packages.linuxmint.com sarah main upstream import backport
     2
     3 deb http://archive.ubuntu.com/ubuntu xenial main restricted universe multiverse
     4 deb http://archive.ubuntu.com/ubuntu xenial-updates main restricted universe multiverse
     5 deb http://archive.ubuntu.com/ubuntu xenial-backports main restricted universe multiverse
     6
     7 deb http://security.ubuntu.com/ubuntu/ xenial-security main restricted universe multiverse
     8 deb http://archive.canonical.com/ubuntu/ xenial partner

/etc/apt/sources.list

     1 #deb cdrom:[Linux Mint 18 _Sarah_ - Release amd64 20160904]/ xenial contrib main non-free
rin@rin-EX58-UD5 ~ $ sudo dpkg --audit
The following packages are in a mess due to serious problems during
installation. They must be reinstalled for them (and any packages
that depend on them) to function properly:
 unifi Ubiquiti UniFi server

rin@rin-EX58-UD5 ~ $ E: The package unifi needs to be reinstalled, but I can't find an archive for it.E: The package unifi needs to be reinstalled, but I can't find an archive for it.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu apt Edit question
Assignee:
No assignee Edit question
Solved by:
Manfred Hampl
Solved:
2018-11-07
Last query:
2018-11-07
Last reply:
2018-11-07

DISTRIB_ID=LinuxMint
DISTRIB_RELEASE=18
DISTRIB_CODENAME=sarah
DISTRIB_DESCRIPTION="Linux Mint 18 Sarah"

You are using Linux Mint which isn't supported here or by the Ubuntu community in any way. None of the "Ubuntu based" distributions are supported by the Ubuntu community or Canonical. I suggest you post on the Mint forum which is here
https://forums.linuxmint.com

Thanks

Manfred Hampl (m-hampl) said : #2

1. Mint is not supported here (as already written by actionparsnip).
2. Hint for repairing your problem: Try re-installing unifi from the same source. This may help.

Marinus Bos (rinus2) said : #3

Thanks I will pass the question on to the Mint forum. In the mean time
you might like to know that I had already tryed your hint but to no
avail. It is very well possible that the Ubiquiti-unifi website is the
culprit. Then it is both a Mint and Ubuntu problem that the installer
does not have the option to ignore a messed up source and can move on to
installing other stuf.

Regards,
Rinus Bos

On 07/11/18 01:32, Manfred Hampl wrote:
> Your question #675952 on apt in Ubuntu changed:
> https://answers.launchpad.net/ubuntu/+source/apt/+question/675952
>
> Manfred Hampl proposed the following answer:
> 1. Mint is not supported here (as already written by actionparsnip).
> 2. Hint for repairing your problem: Try re-installing unifi from the same source. This may help.
>

Best Manfred Hampl (m-hampl) said : #4

You are a bit misinterpreting the messages.
I do not know the cause, but the package management system is in an in unhealthy status. It is comprehensible that the package management system refuses further installations or updates until that problem is solved.
It is not about a messed up source, but a messed up package. You have to reinstall that package or forcefully remove its remnants. Best program for doing that on an Ubuntu system is dpkg; I do not know about the possibilities in Mint.

Marinus Bos (rinus2) said : #5

I found on the mint forum that someone had a similar problem and it was resolved using your suggestion to forcefully remove the remnants of the offending package using the following commant
sudo dpkg --remove --force-remove-reinstreq --force-depends nameofoffendingpakkage
This also worked for me.
So thanks, problem solved.