Ubuntu 20.04 Wont Connect to my Local REPO

sk flag

Iv setup a local REPO where I have downloaded all the packages from Ubuntu.

root@vm-repo-server:~# ifconfig | grep inet
        inet  netmask  broadcast

root@vm-repo-server:/var/www/html/ubuntu/mirror/ ll
total 40472
drwxr-xr-x 6 root root      146 Jan 24 12:31 ./
drwxr-xr-x 8 root root      123 Jan 24 12:31 ../
-rw-r--r-- 1 root root 40902952 Apr 23  2020 Contents-amd64.gz
-rw-r--r-- 1 root root   264892 Apr 23  2020 InRelease
-rw-r--r-- 1 root root   263289 Apr 23  2020 Release
-rw-r--r-- 1 root root     1554 Apr 23  2020 Release.gpg
drwxr-xr-x 5 root root       51 Jan 24 12:31 main/
drwxr-xr-x 5 root root       51 Jan 24 12:31 multiverse/
drwxr-xr-x 4 root root       38 Jan 24 12:31 restricted/
drwxr-xr-x 5 root root       51 Jan 24 12:31 universe/

602.5 GiB will be downloaded into archive.
Downloading 187125 archive files using 20 threads...
Begin time: Mon Jan 24 10:24:22 2022
[20]... [19]... [18]... [17]... [16]... [15]... [14]... [13]... [12]... [11]... [10]... [9]... [8]... [7]... [6]... [5]... [4].                                                                                                           .. [3]... [2]... [1]... [0]...
End time: Mon Jan 24 12:31:12 2022

I have setup two clients one 18.04 and one 20.04. These clients will now download updates from the REPO server

The 18.04 source list /etc/apt/sources.list contains entries:

root@vm-ubuntu18:~# cat /etc/apt/sources.list | grep allow
deb [allow-insecure=yes] bionic main restricted universe multiverse
deb [allow-insecure=yes] bionic-updates main restricted universe multiverse
deb [allow-insecure=yes] bionic-backports main restricted universe multiverse
deb [allow-insecure=yes] bionic-security main restricted universe multiverse

When running the apt update from the 18.04 server it works fine and connects to my REPO.

root@vm-ubuntu18:~# date && apt update
Mon Jan 24 16:13:40 UTC 2022
Hit:1 bionic InRelease
Hit:2 bionic-updates InRelease
Hit:3 bionic-backports InRelease
Hit:4 bionic-security InRelease
Reading package lists... Done
Building dependency tree
Reading state information... Done
5 packages can be upgraded. Run 'apt list --upgradable' to see them.

When i try to update the 20.04 LTS from the same REPO i get the below error:

Err:4 focal/main amd64 c-n-f Metadata
  404  Not Found [IP: 80]
Ign:11 focal/universe amd64 c-n-f Metadata
Ign:12 focal/multiverse amd64 c-n-f Metadata
Ign:13 focal/restricted amd64 c-n-f Metadata
Fetched 265 kB in 0s (867 kB/s)
Reading package lists... Done
E: Failed to fetch  404  Not Found [IP: 80]
E: Some index files failed to download. They have been ignored, or old ones used instead.

What should be in the 20.04 source list file to connect to my local REPO with IP and download the packages without errors ?


us flag

I ran into this problem when I recently upgraded all my systems from 18.04 to 20.04, including my local mirror.

The problem is with "command not found" files which apparently didn't exist in 18.04 or at least worked differently. I had to add these lines to the script that runs after the mirror downloads to unzip the files.

unxz -fk /[mirror location]/
unxz -fk /[mirror location]/
unxz -fk /[mirror location]/
unxz -fk /[mirror location]/
unxz -fk /[mirror location]/
unxz -fk /[mirror location]/
unxz -fk /[mirror location]/
unxz -fk /[mirror location]/

I may have manually unzipped the files for the base distribution, I can't remember. Probably I did but didn't put commands for that in the script, since those files don't change. So that was a one time thing.

I use apt-mirror which sadly is unmaintained and required some other tweaking to get it to work with 20.04 as well - but it seems you don't use that. So what I did may not work for you exactly, but bottom line, you need to extract those c-n-f files so that the sudo apt update check works properly for the clients.

LinuxRsa avatar
sk flag
Could you help me put the Ubuntu 20.04 file **/etc/apt/sources.list** together ? below are my paths on the main repo server with IP Path :/var/www/html/ubuntu/mirror/$ ls Contents-amd64.gz InRelease Release Release.gpg main multiverse restricted universe azureuser@vm-repo-server:` Path:/var/www/html/ubuntu/mirror/$ ls Contents-amd64.gz InRelease Release Release.gpg main multiverse restricted universe azureuser@vm-repo-server:` What would the entry look like ?
Organic Marble avatar
us flag
The sources.list doesn't look any different between 18.04 and 20.04. I just have 3 lines like this `deb [mirror path]/ focal main restricted universe multiverse` One for focal, one for focal-updates, and one for focal-security.

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.