Ubuntu 18.04.1 | cannot use sudo apt-get update (connection fail)

Asked by Nuthakul Nuthep

I can't use this command
Please Help me, I've tried my best to figure it out by myself but it still not worked.

>> sudo apt-get update

that show error message as Below :

Err:1 http://security.ubuntu.com/ubuntu bionic-security InRelease
  Connection failed [IP: 91.189.88.149 80]
Err:2 http://archive.ubuntu.com/ubuntu bionic InRelease
  Connection failed [IP: 91.189.88.162 80]
Err:3 http://ppa.launchpad.net/ondrej/php/ubuntu bionic InRelease
  Connection failed [IP: 91.189.95.83 80]
Err:4 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
  Connection failed [IP: 91.189.88.161 80]
Err:5 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
  Connection failed [IP: 91.189.88.162 80]
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic/InRelease Connection failed [IP: 91.189.88.162 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease Connection failed [IP: 91.189.88.161 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-backports/InRelease Connection failed [IP: 91.189.88.162 80]
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease Connection failed [IP: 91.189.88.149 80]
W: Failed to fetch http://ppa.launchpad.net/ondrej/php/ubuntu/dists/bionic/InRelease Connection failed [IP: 91.189.95.83 80]
W: Some index files failed to download. They have been ignored, or old ones used instead.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Mark Rijckenberg
Solved:
Last query:
Last reply:
Revision history for this message
Mark Rijckenberg (markrijckenberg) said :
#1

Please send us the full Terminal output from step 6 in following procedure:

https://help.ubuntu.com/community/PackageManagerTroubleshootingProcedure

Please post the Terminal output here:

https://answers.launchpad.net/ubuntu/+question/673653

Revision history for this message
Nuthakul Nuthep (devilznat) said :
#2

nuthakul@7FYNZL2:~$ sudo cp -arf /var/lib/dpkg /var/lib/dpkg.backup
[sudo] password for nuthakul:
nuthakul@7FYNZL2:~$ ^C
nuthakul@7FYNZL2:~$ ubuntu-support-status
Support status summary of '7FYNZL2':

You have 480 packages (100.0%) supported until April 2023 (Canonical - 5y)

You have 0 packages (0.0%) that can not/no-longer be downloaded
You have 0 packages (0.0%) that are unsupported

Run with --show-unsupported, --show-supported or --show-all to see more details
nuthakul@7FYNZL2:~$ cat /etc/dpkg/dpkg.cfg.d/multiarch
cat: /etc/dpkg/dpkg.cfg.d/multiarch: No such file or directory
nuthakul@7FYNZL2:~$ dpkg --print-foreign-architectures
nuthakul@7FYNZL2:~$ sudo grep -R roxy /etc/apt/*
nuthakul@7FYNZL2:~$ grep roxy /etc/environment
nuthakul@7FYNZL2:~$ echo $http_proxy

nuthakul@7FYNZL2:~$ echo $ftp_proxy

nuthakul@7FYNZL2:~$ grep roxy /etc/bash.bashrc
nuthakul@7FYNZL2:~$ grep roxy ~/.bashrc
nuthakul@7FYNZL2:~$ cat /etc/apt/apt.conf
cat: /etc/apt/apt.conf: No such file or directory
nuthakul@7FYNZL2:~$ sudo fuser -vvv /var/lib/dpkg/lock
Cannot open /proc/net/unix: No such file or directory
Specified filename /var/lib/dpkg/lock does not exist.
Cannot stat file /proc/1/fd/5: Operation not permitted
Cannot stat file /proc/3/fd/7: Operation not permitted
nuthakul@7FYNZL2:~$ sudo fuser -vvv /var/cache/apt/archives/lock
Cannot open /proc/net/unix: No such file or directory
Specified filename /var/cache/apt/archives/lock does not exist.
Cannot stat file /proc/1/fd/5: Operation not permitted
Cannot stat file /proc/3/fd/7: Operation not permitted
nuthakul@7FYNZL2:~$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.1 LTS"
nuthakul@7FYNZL2:~$ uname -a
Linux 7FYNZL2 4.4.0-17134-Microsoft #137-Microsoft Thu Jun 14 18:46:00 PST 2018 x86_64 x86_64 x86_64 GNU/Linux
nuthakul@7FYNZL2:~$ sudo rm /var/lib/apt/lists/lock
rm: cannot remove '/var/lib/apt/lists/lock': No such file or directory
nuthakul@7FYNZL2:~$ sudo rm /var/cache/apt/archives/lock
rm: cannot remove '/var/cache/apt/archives/lock': No such file or directory
nuthakul@7FYNZL2:~$ sudo rm /var/lib/dpkg/lock
rm: cannot remove '/var/lib/dpkg/lock': No such file or directory
nuthakul@7FYNZL2:~$ sudo cp -arf /var/lib/dpkg /var/lib/dpkg.backup
nuthakul@7FYNZL2:~$ sudo mv /var/lib/dpkg/status /var/lib/dpkg/status-bad
nuthakul@7FYNZL2:~$ sudo cp /var/lib/dpkg/status-old /var/lib/dpkg/status || sudo cp /var/backups/apt.extended_states.0 /var/lib/dpkg/status
nuthakul@7FYNZL2:~$ sudo mv /var/lib/dpkg/available /var/lib/dpkg/available-bad
nuthakul@7FYNZL2:~$ sudo cp /var/lib/dpkg/available-old /var/lib/dpkg/available
cp: cannot stat '/var/lib/dpkg/available-old': No such file or directory
nuthakul@7FYNZL2:~$ sudo rm -rf /var/lib/dpkg/updates/*
nuthakul@7FYNZL2:~$ sudo rm -rf /var/lib/apt/lists
nuthakul@7FYNZL2:~$ sudo rm /var/cache/apt/*.bin
nuthakul@7FYNZL2:~$ sudo mkdir /var/lib/apt/lists
nuthakul@7FYNZL2:~$ sudo mkdir /var/lib/apt/lists/partial
nuthakul@7FYNZL2:~$
nuthakul@7FYNZL2:~$ LANG=C;sudo apt-get clean
nuthakul@7FYNZL2:~$ LANG=C;sudo apt-get autoclean
Reading package lists... Done
Building dependency tree
Reading state information... Done
nuthakul@7FYNZL2:~$ sudo dpkg --configure -a
Processing triggers for ureadahead (0.100.0-20) ...
Processing triggers for systemd (237-3ubuntu10.3) ...
nuthakul@7FYNZL2:~$ sudo dpkg --clear-avail
nuthakul@7FYNZL2:~$ LANG=C;sudo apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
  libfreetype6
Use 'sudo apt autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
nuthakul@7FYNZL2:~$ LANG=C;sudo apt-get --fix-missing install
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
  libfreetype6
Use 'sudo apt autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
nuthakul@7FYNZL2:~$ LANG=C;sudo apt-get --purge autoremove
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
  libfreetype6*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 940 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 28490 files and directories currently installed.)
Removing libfreetype6:amd64 (2.8.1-2ubuntu2) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
nuthakul@7FYNZL2:~$ LANG=C;sudo apt-get --fix-missing update -o APT::Cache-Limit=100000000
Err:1 http://archive.ubuntu.com/ubuntu bionic InRelease
  Connection failed [IP: 91.189.88.152 80]
Err:2 http://security.ubuntu.com/ubuntu bionic-security InRelease
  Connection failed [IP: 91.189.91.23 80]
Err:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
  Connection failed [IP: 91.189.88.161 80]
Err:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
  Connection failed [IP: 91.189.88.152 80]
Reading package lists... Done
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic/InRelease Connection failed [IP: 91.189.88.152 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease Connection failed [IP: 91.189.88.161 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-backports/InRelease Connection failed [IP: 91.189.88.152 80]
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease Connection failed [IP: 91.189.91.23 80]
W: Some index files failed to download. They have been ignored, or old ones used instead.
nuthakul@7FYNZL2:~$
nuthakul@7FYNZL2:~$ LANG=C;sudo apt-get --fix-missing update -o APT::Cache-Limit=100000000
Err:1 http://security.ubuntu.com/ubuntu bionic-security InRelease
  Connection failed [IP: 91.189.88.162 80]
Err:2 http://archive.ubuntu.com/ubuntu bionic InRelease
  Connection failed [IP: 91.189.88.162 80]
Err:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
  Connection failed [IP: 91.189.88.149 80]
Err:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
  Connection failed [IP: 91.189.88.162 80]
Reading package lists... Done
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic/InRelease Connection failed [IP: 91.189.88.162 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease Connection failed [IP: 91.189.88.149 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-backports/InRelease Connection failed [IP: 91.189.88.162 80]
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease Connection failed [IP: 91.189.88.162 80]
W: Some index files failed to download. They have been ignored, or old ones used instead.
nuthakul@7FYNZL2:~$
nuthakul@7FYNZL2:~$ LANG=C;sudo apt-get update -o APT::Cache-Limit=100000000 && sudo apt-get dist-upgrade
Err:1 http://archive.ubuntu.com/ubuntu bionic InRelease
  Connection failed [IP: 91.189.88.161 80]
Err:2 http://security.ubuntu.com/ubuntu bionic-security InRelease
  Connection failed [IP: 91.189.91.26 80]
Err:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
  Connection failed [IP: 91.189.88.152 80]
Err:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
  Connection failed [IP: 91.189.88.161 80]
Reading package lists... Done
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic/InRelease Connection failed [IP: 91.189.88.161 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease Connection failed [IP: 91.189.88.152 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-backports/InRelease Connection failed [IP: 91.189.88.161 80]
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease Connection failed [IP: 91.189.91.26 80]
W: Some index files failed to download. They have been ignored, or old ones used instead.
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
nuthakul@7FYNZL2:~$ find /etc/apt -name '*.list' -exec bash -c 'echo -e "\n$1\n"; cat -n "$1"' _ '{}' \;

/etc/apt/sources.list

     1 # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
     2 # newer versions of the distribution.
     3 deb http://archive.ubuntu.com/ubuntu/ bionic main restricted
     4 # deb-src http://archive.ubuntu.com/ubuntu/ bionic main restricted
     5
     6 ## Major bug fix updates produced after the final release of the
     7 ## distribution.
     8 deb http://archive.ubuntu.com/ubuntu/ bionic-updates main restricted
     9 # deb-src http://archive.ubuntu.com/ubuntu/ bionic-updates main restricted
    10
    11 ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
    12 ## team. Also, please note that software in universe WILL NOT receive any
    13 ## review or updates from the Ubuntu security team.
    14 deb http://archive.ubuntu.com/ubuntu/ bionic universe
    15 # deb-src http://archive.ubuntu.com/ubuntu/ bionic universe
    16 deb http://archive.ubuntu.com/ubuntu/ bionic-updates universe
    17 # deb-src http://archive.ubuntu.com/ubuntu/ bionic-updates universe
    18
    19 ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
    20 ## team, and may not be under a free licence. Please satisfy yourself as to
    21 ## your rights to use the software. Also, please note that software in
    22 ## multiverse WILL NOT receive any review or updates from the Ubuntu
    23 ## security team.
    24 deb http://archive.ubuntu.com/ubuntu/ bionic multiverse
    25 # deb-src http://archive.ubuntu.com/ubuntu/ bionic multiverse
    26 deb http://archive.ubuntu.com/ubuntu/ bionic-updates multiverse
    27 # deb-src http://archive.ubuntu.com/ubuntu/ bionic-updates multiverse
    28
    29 ## N.B. software from this repository may not have been tested as
    30 ## extensively as that contained in the main release, although it includes
    31 ## newer versions of some applications which may provide useful features.
    32 ## Also, please note that software in backports WILL NOT receive any review
    33 ## or updates from the Ubuntu security team.
    34 deb http://archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
    35 # deb-src http://archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
    36
    37 ## Uncomment the following two lines to add software from Canonical's
    38 ## 'partner' repository.
    39 ## This software is not part of Ubuntu, but is offered by Canonical and the
    40 ## respective vendors as a service to Ubuntu users.
    41 # deb http://archive.canonical.com/ubuntu bionic partner
    42 # deb-src http://archive.canonical.com/ubuntu bionic partner
    43
    44 deb http://security.ubuntu.com/ubuntu/ bionic-security main restricted
    45 # deb-src http://security.ubuntu.com/ubuntu/ bionic-security main restricted
    46 deb http://security.ubuntu.com/ubuntu/ bionic-security universe
    47 # deb-src http://security.ubuntu.com/ubuntu/ bionic-security universe
    48 deb http://security.ubuntu.com/ubuntu/ bionic-security multiverse
    49 # deb-src http://security.ubuntu.com/ubuntu/ bionic-security multiverse
nuthakul@7FYNZL2:~$ sudo dpkg --audit
nuthakul@7FYNZL2:~$

Revision history for this message
Best Mark Rijckenberg (markrijckenberg) said :
#3

Weird. Please try changing the Ubuntu mirror sources using these instructions:

http://www.ubuntubuzz.com/2018/03/how-to-change-ubuntu-repository-mirror-sources.html

Then try upgrading again.

Revision history for this message
Mark Rijckenberg (markrijckenberg) said :
#4

Also test this command:

ping 8.8.8.8

Does it work?

Revision history for this message
Nuthakul Nuthep (devilznat) said :
#5

Thanks Mark Rijckenberg, that solved my question.

Revision history for this message
Nuthakul Nuthep (devilznat) said :
#6

It worked to ping 8.8.8.8
and on comment #3 that worked and solve the problem !! So many Thanks and I wonder why this happens?

Thank you again Mark.

Revision history for this message
Mark Rijckenberg (markrijckenberg) said :
#7

Repository (containing updates) must have been temporarily down....

Revision history for this message
Riyaz Rangrage (rangrage) said :
#8

Hi,

I'm having the same problem, I've changed my setting to a local mirror, but it still gives the same error.

I have disabled my anti-virus and all firewalls but still no luck.

I am able to ping 8.8.8.8 successfully.

Please help!

Revision history for this message
Jyotendra Sharma (jyotendra) said :
#9

Thanks Mark Rijckenberg, I changed the server pointing to "Main Server" using "Software Updater" and it worked.

Revision history for this message
Sajid Ali (sajidali1610) said :
#10

Ubuntu 20.04.1 LTS sudo apt-get update (Connection failed)

(base) sajid@sajid-Lenovo-Yoga-500-15ISK:~$ sudo apt-get update
[sudo] password for sajid:
Hit:1 http://dl.google.com/linux/chrome/deb stable InRelease
Err:2 http://archive.ubuntu.com/ubuntu focal InRelease
  Connection failed [IP: 91.189.88.152 80]
Err:3 http://ppa.launchpad.net/ubuntu-mozilla-daily/ppa/ubuntu focal InRelease
  Connection failed [IP: 91.189.95.83 80]
Err:4 http://archive.ubuntu.com/ubuntu focal-updates InRelease
  Connection failed [IP: 91.189.88.152 80]
Err:5 http://archive.ubuntu.com/ubuntu focal-backports InRelease
  Connection failed [IP: 91.189.88.152 80]
Err:6 http://archive.ubuntu.com/ubuntu focal-security InRelease
  Connection failed [IP: 91.189.88.152 80]
Hit:7 https://download.sublimetext.com apt/stable/ InRelease
Reading package lists... Done
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal/InRelease Connection failed [IP: 91.189.88.152 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal-updates/InRelease Connection failed [IP: 91.189.88.152 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal-backports/InRelease Connection failed [IP: 91.189.88.152 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal-security/InRelease Connection failed [IP: 91.189.88.152 80]
W: Failed to fetch http://ppa.launchpad.net/ubuntu-mozilla-daily/ppa/ubuntu/dists/focal/InRelease Connection failed [IP: 91.189.95.83 80]
W: Some index files failed to download. They have been ignored, or old ones used instead.