Description

This article describes a scenario where the apt-get tool update fails and points to local repositories instead of the Linux Internet repositories, and details what must be done to resolve the issue.

 

Symptoms

apt-get is a command-line tool, which helps in handling packages in Linux. Its main task is to retrieve information and packages from authenticated sources for installation, for upgrade, and for removal of packages along with their dependencies.

However, in some cases, users may see the following:

root@cftsbms7:~# apt-get update
Ign:1 http://127.0.0.1:90/repositories cspcommon InRelease
Hit:2 http://127.0.0.1:90/repositories cspcommon Release
Ign:3 http://127.0.0.1:90/repositories cspcommon Release.gpg
Reading package lists... Done
W: The repository 'http://127.0.0.1:90/repositories cspcommon Release' is not signed.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.

The above shows that apt-get is pointing to a local directory (this probably happens during a software/product installation wherein the installation may want to point to a local repository.)

Note: This was observed during a CSO installation. However, when the installation failed and a rollback and retry was attempted, the repository was seen to be pointing towards the local repository. Also when trying to install a package or just wanting to perform an apt-get update , which requires using the public repository, the changes in place did not allow reach of the public repository.

 

Solution

The apt-get tool usually points to the Linux Internet repositories, but the above output shows that the source is pointing to the Linux host itself.

 

To fix this issue, perform the following:

  1. Check the contents of the /etc/apt folder:

root@cftsbms7:/etc/apt#   ls -la
total 48
drwxr-xr-x   6 root root  4096 Sep  1 20:23 .
drwxr-xr-x 100 root root  4096 Sep 14 20:03 ..
drwxr-xr-x   2 root root  4096 Sep  1 18:14 apt.conf.d
-rw-r--r--   1 root root  3021 Sep  1 20:23 orig-sources.list
drwxr-xr-x   2 root root  4096 Apr 14  2016 preferences.d
-rw-r--r--   1 root root   111 Sep  7 17:47 sources.list
-rw-r--r--   1 root root     0 Sep  1 17:47 sources.list~
drwxr-xr-x   2 root root  4096 Apr 14  2016 sources.list.d
-rw-r--r--   1 root root     1 Sep  7 17:47 sources.list.save
-rw-r--r--   1 root root 12255 Jul 31  2018 trusted.gpg
drwxr-xr-x   2 root root  4096 Apr 14  2016 trusted.gpg.d

apt-get uses the URL defined in the sources.list file to update the modules.

root@cftsbms7:/etc/apt# more sources.list
deb http://127.0.0.1:90/repositories cspcommon main
# deb-src http://127.0.0.1:90/repositories cspcommon main
  1. Copy the content from the orig-sources.list file to the sources.list file by using any text-editor of your choice.

A sample output in the orig-sources.list file is shown below:

root@cftsbms7:/etc/apt# more orig-sources.list
#

# deb cdrom:[Ubuntu-Server 16.04.5 LTS _Xenial Xerus_ - Release amd64 (20180731)]/ xenial main restricted

#deb cdrom:[Ubuntu-Server 16.04.5 LTS _Xenial Xerus_ - Release amd64 (20180731)]/ xenial main restricted

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://in.archive.ubuntu.com/ubuntu/ xenial main restricted
# deb-src http://in.archive.ubuntu.com/ubuntu/ xenial main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://in.archive.ubuntu.com/ubuntu/ xenial-updates main restricted
# deb-src http://in.archive.ubuntu.com/ubuntu/ xenial-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://in.archive.ubuntu.com/ubuntu/ xenial universe
# deb-src http://in.archive.ubuntu.com/ubuntu/ xenial universe
deb http://in.archive.ubuntu.com/ubuntu/ xenial-updates universe
# deb-src http://in.archive.ubuntu.com/ubuntu/ xenial-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://in.archive.ubuntu.com/ubuntu/ xenial multiverse
# deb-src http://in.archive.ubuntu.com/ubuntu/ xenial multiverse
deb http://in.archive.ubuntu.com/ubuntu/ xenial-updates multiverse
# deb-src http://in.archive.ubuntu.com/ubuntu/ xenial-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://in.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
# deb-src http://in.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu xenial partner
# deb-src http://archive.canonical.com/ubuntu xenial partner

deb http://security.ubuntu.com/ubuntu xenial-security main restricted
# deb-src http://security.ubuntu.com/ubuntu xenial-security main restricted
deb http://security.ubuntu.com/ubuntu xenial-security universe
# deb-src http://security.ubuntu.com/ubuntu xenial-security universe
deb http://security.ubuntu.com/ubuntu xenial-security multiverse
# deb-src http://security.ubuntu.com/ubuntu xenial-security multiverse

Now when you attempt an apt-get update or download a new package, you will be able to connect to the public repository and complete the task on hand.