Error while upgrading Ubuntu 18.04 LTS packages from Local Repository - upgrade

I am maintaining a local repository for Ubuntu 18.04 LTS and recently updated the repository using apt-mirror. The I tried to upgrade the packages using the following commands
sudo apt-get clean
sudo apt-get update
sudo apt-get upgrade
The first two commands worked without any error. However, sudo apt-get upgrade resulted in the following error
Get:645 http://192.168.1.1/ubuntuRepo bionic-updates/multiverse amd64 virtualbox-guest-additions-iso all 5.2.18-1~ubuntu18.04.1 [39.0 MB]
Err:645 http://192.168.1.1/ubuntuRepo bionic-updates/multiverse amd64 virtualbox-guest-additions-iso all 5.2.18-1~ubuntu18.04.1
File has unexpected size (38955904 != 39016736). Mirror sync in progress? [IP: 192.168.1.1 80]
Hashes of expected file:
- SHA256:f7c5ab5ea5b1feadc2cf5d8527d7c14c8b34439d5345fd04822f12381681b2a6
- SHA1:5e0d43ebddd08d6256ac809c746de9c483ea83f1 [weak]
- MD5Sum:b2e992fd6462e216bc651ddb020216b8 [weak]
- Filesize:39016736 [weak]
Get:646 http://192.168.1.1/ubuntuRepo bionic-updates/main amd64 xbrlapi amd64 5.5-4ubuntu2.0.1 [61.9 kB]
Fetched 763 MB in 1min 7s (11.4 MB/s)
E: Failed to fetch http://192.168.1.1/ubuntuRepo/pool/multiverse/v/virtualbox-guest-additions-iso/virtualbox-guest-additions-iso_5.2.18-1~ubuntu18.04.1_all.deb File has unexpected size (38955904 != 39016736). Mirror sync in progress? [IP: 192.168.1.1 80]
Hashes of expected file:
- SHA256:f7c5ab5ea5b1feadc2cf5d8527d7c14c8b34439d5345fd04822f12381681b2a6
- SHA1:5e0d43ebddd08d6256ac809c746de9c483ea83f1 [weak]
- MD5Sum:b2e992fd6462e216bc651ddb020216b8 [weak]
- Filesize:39016736 [weak]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
How to fix it?
The contents of my /etc/apt/sources.list is given below.
deb [arch=amd64] http://192.168.1.1/ubuntuRepo bionic main restricted universe multiverse
deb [arch=amd64] http://192.168.1.1/ubuntuRepo bionic-security main restricted universe multiverse
deb [arch=amd64] http://192.168.1.1/ubuntuRepo bionic-updates main restricted universe multiverse
deb [arch=amd64] http://192.168.1.1/ubuntuRepo bionic-proposed main restricted universe multiverse
deb [arch=amd64] http://192.168.1.1/ubuntuRepo bionic-backports main restricted universe multiverse

The problem was solved by clearing the files in /var/lib/apt/ and running sudo apt-mirror in my machine which holds the local repository.

Related

An upgrade from 'hirsute' to 'jammy' is not supported with this tool

i was upgrading ubuntu 21.04 hirsute to 22.04 by following this tutorial ,in step 6 it's failing it's throwing an following error please help me to fix this issue
Reading cache
Checking package manager
Can not upgrade
An upgrade from 'hirsute' to 'jammy' is not supported with this tool.
https://linuxconfig.org/how-to-upgrade-ubuntu-to-22-04-lts-jammy-jellyfish
UPDATE: thanks to smknstd, JoeCool, MDarrinT and PurplProto.
Script is working again.
You can chose 3 different methods:
# First method, upgrade to 22.04 with the official ubuntu method ( old-releases.ubuntu.com )
# Replace sources.list
text="deb http://old-releases.ubuntu.com/ubuntu/ hirsute main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu/ hirsute-updates main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu/ hirsute-security main restricted universe multiverse"
sudo echo "$text" | sudo tee /etc/apt/sources.list
# Prerequisites
sudo apt-get update
sudo apt-get install update-manager-core update-manager -y
sudo apt-get upgrade -y
sudo apt-get dist-upgrade -y
# Download and run the ubuntu upgrade tool
wget http://archive.ubuntu.com/ubuntu/dists/jammy-updates/main/dist-upgrader-all/current/jammy.tar.gz
tar -xaf jammy.tar.gz
sudo ./jammy --frontend=DistUpgradeViewText
-------------------------------++++++++++++++++++++++++--------------------------------
# Second method, upgrade to 22.04 replacing the entire sources.list with the jammy repos
# Replace sources.list
text="deb http://archive.ubuntu.com/ubuntu/ jammy main universe restricted multiverse
deb-src http://archive.ubuntu.com/ubuntu/ jammy main universe restricted multiverse
deb http://security.ubuntu.com/ubuntu jammy-security main universe restricted multiverse
deb-src http://security.ubuntu.com/ubuntu jammy-security main universe restricted multiverse
deb http://archive.ubuntu.com/ubuntu/ jammy-updates main universe restricted multiverse
deb-src http://archive.ubuntu.com/ubuntu/ jammy-updates main universe restricted multiverse"
sudo echo "$text" | sudo tee /etc/apt/sources.list
# Bypass "An upgrade from 'xxx' to 'xxx' is not supported with this tool" error
sudo sed -i 's/continue/pass/g' /usr/lib/python3/dist-packages/UpdateManager/Core/MetaRelease.py
# Start upgrade
sudo apt-get update
sudo do-release-upgrade
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get dist-upgrade -y
sudo apt-get install -f -y
sudo apt-get autoremove --purge -y
-------------------------------++++++++++++++++++++++++--------------------------------
# Third method, upgrade to 22.04 replacing the current distro codename with jammy into the sources.list with sed
# Replace sources.list
sudo sed -i 's/hirsute/jammy/g' /etc/apt/sources.list
# Bypass "An upgrade from 'xxx' to 'xxx' is not supported with this tool" error
sudo sed -i 's/continue/pass/g' /usr/lib/python3/dist-packages/UpdateManager/Core/MetaRelease.py
# Start upgrade
sudo apt-get update
sudo do-release-upgrade
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get dist-upgrade -y
sudo apt-get install -f -y
sudo apt-get autoremove --purge -y
LInk to the complete github script here.
Well, I tried the approach above. It failed.
Going through the script, I decided to check the Ubuntu server for the packages. Strange, there are all these NotFound errors. Guess what? The apt files referenced were missing from the Ubuntu server.
Then I went in and changed all the hirsute labels to jammy in the /etc/apt/sources.list file. Once I did that, apt ran. I could then run the script indicated above and have it find the packages.
Now, it works. A couple of messages about php-fpm not being enabled under Apache HTTP, but since I run nginx, I hope it works.
And it worked. I had to run through the apt upgrade && apt update && apt dist-upgrade && apt autoremove to clean out the detritus, but I have a working install on LTS.
Before running the script, I had to modify my sources.list (/etc/apt/sources.list) and comment-out all lines leaving only these:
## EOL upgrade sources.list
# Required
deb http://old-releases.ubuntu.com/ubuntu/ jammy main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu/ jammy-updates main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse
Then it went first to 'impish' and then to 'jammy' by running the script twice.
Or you can sudo do-release-upgrade after the first script; from 'impish' to 'jammy'.
Thank you and voted-up your answer.
official (unsupported) upgrade path from EOL is described here:
https://help.ubuntu.com/community/EOLUpgrades
and requires pointing apt to old-releases.ubuntu.com mirror

Can't install mongodb for ubuntu

Trying to install mongodb for ubuntu and can't solve the issue.
I got lost, need your help please!
Going according the docs:
https://www.mongodb.com/docs/master/tutorial/install-mongodb-on-ubuntu/
wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add -
Result (CLI output): on mine ubuntu:
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
OK
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
Result (CLI output):
deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse
sudo apt-get update
Result (CLI output):
et:1 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB]
Ign:2 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.0 InRelease
Hit:3 http://packages.microsoft.com/repos/code stable InRelease
Hit:4 https://ppa.launchpadcontent.net/graphics-drivers/ppa/ubuntu jammy InRelease
Hit:5 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.0 Release
Ign:6 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 InRelease
Hit:7 http://il.archive.ubuntu.com/ubuntu jammy InRelease
Ign:8 https://ppa.launchpadcontent.net/upubuntu-com/xampp/ubuntu jammy InRelease
Hit:9 http://il.archive.ubuntu.com/ubuntu jammy-updates InRelease
Hit:11 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 Release
Hit:12 http://il.archive.ubuntu.com/ubuntu jammy-backports InRelease
Err:13 https://ppa.launchpadcontent.net/upubuntu-com/xampp/ubuntu jammy Release
404 Not Found [IP: 185.125.190.52 443]
Reading package lists... Done
W: http://repo.mongodb.org/apt/ubuntu/dists/xenial/mongodb-org/4.0/Release.gpg: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
E: The repository 'https://ppa.launchpadcontent.net/upubuntu-com/xampp/ubuntu jammy Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: https://repo.mongodb.org/apt/ubuntu/dists/focal/mongodb-org/6.0/Release.gpg: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
sudo apt-get install -y mongodb-org
Result (CLI output):
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
mongodb-org-mongos : Depends: libssl1.0.0 (>= 1.0.1) but it is not installable
mongodb-org-server : Depends: libcurl3 (>= 7.16.2) but it is not installable
Depends: libssl1.0.0 (>= 1.0.1) but it is not installable
mongodb-org-shell : Depends: libssl1.0.0 (>= 1.0.1) but it is not installable
mongodb-org-tools : Depends: libssl1.0.0 (>= 1.0.2~beta3) but it is not installable
E: Unable to correct problems, you have held broken packages.
uname -m
Result (CLI output):
x86_64
lsb_release -a
Result (CLI output):
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04 LTS
Release: 22.04
Codename: jammy
Good evening, I was having the same problem which was basically the lack of libssl1.1
What I did to solve it was to add the repository that contains this lib to download, in this case I used the focal repository.
Use this command in your terminal to add it to your system:
echo "deb http://security.ubuntu.com/ubuntu focal-security main" | sudo tee /etc/apt/sources.list.d/focal-security.list
Then do an update:
sudo apt-get update
And finally install the library:
sudo apt install libssl1.1
After installed try to install mongodb again, if it worked I'm glad to have helped you, if the problem persists I don't know how I can help you :(

Error building custom Docker image with Postgres and security updates: "configuration file createcluster.conf is available"

I have a Dockerfile that builds an image based on postgres, but additionally installs security updates (this is to ensure that the image has the latest patches even if a release is slightly older).
This is the Dockerfile:
FROM postgres:14.2
# apply security updates
RUN \
apt-get update -qq && \
apt-get upgrade -y && \
rm -rf /var/lib/apt/lists/*
ENV PGDATA /var/lib/postgresql/data
# switch to lower-privileged user
USER 999
CMD ["postgres", "-c", "listen_addresses=*", "-c", "config_file=/etc/postgresql/postgresql.conf"]
Now, this build broke:
Reading package lists...
Building dependency tree...
Reading state information...
Calculating upgrade...
The following packages will be upgraded:
libpq5 postgresql-14 postgresql-client-14 postgresql-client-common
postgresql-common
5 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 17.9 MB of archives.
After this operation, 25.6 kB of additional disk space will be used.
Get:1 http://apt.postgresql.org/pub/repos/apt bullseye-pgdg/main amd64 libpq5 amd64 14.3-1.pgdg110+1 [172 kB]
Get:2 http://apt.postgresql.org/pub/repos/apt bullseye-pgdg/main amd64 postgresql-common all 241.pgdg110+1 [230 kB]
Get:3 http://apt.postgresql.org/pub/repos/apt bullseye-pgdg/main amd64 postgresql-client-common all 241.pgdg110+1 [92.1 kB]
Get:4 http://apt.postgresql.org/pub/repos/apt bullseye-pgdg/main amd64 postgresql-client-14 amd64 14.3-1.pgdg110+1 [1,629 kB]
Get:5 http://apt.postgresql.org/pub/repos/apt bullseye-pgdg/main amd64 postgresql-14 amd64 14.3-1.pgdg110+1 [15.8 MB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 17.9 MB in 1s (25.4 MB/s)
(Reading database ... 12100 files and directories currently installed.)
Preparing to unpack .../libpq5_14.3-1.pgdg110+1_amd64.deb ...
Unpacking libpq5:amd64 (14.3-1.pgdg110+1) over (14.2-1.pgdg110+1) ...
Preparing to unpack .../postgresql-common_241.pgdg110+1_all.deb ...
Leaving 'diversion of /usr/bin/pg_config to /usr/bin/pg_config.libpq-dev by postgresql-common'
Unpacking postgresql-common (241.pgdg110+1) over (238.pgdg110+1) ...
Preparing to unpack .../postgresql-client-common_241.pgdg110+1_all.deb ...
Unpacking postgresql-client-common (241.pgdg110+1) over (238.pgdg110+1) ...
Preparing to unpack .../postgresql-client-14_14.3-1.pgdg110+1_amd64.deb ...
Unpacking postgresql-client-14 (14.3-1.pgdg110+1) over (14.2-1.pgdg110+1) ...
Preparing to unpack .../postgresql-14_14.3-1.pgdg110+1_amd64.deb ...
invoke-rc.d: could not determine current runlevel
invoke-rc.d: policy-rc.d denied execution of stop.
Unpacking postgresql-14 (14.3-1.pgdg110+1) over (14.2-1.pgdg110+1) ...
Setting up postgresql-client-common (241.pgdg110+1) ...
Setting up libpq5:amd64 (14.3-1.pgdg110+1) ...
Setting up postgresql-client-14 (14.3-1.pgdg110+1) ...
Setting up postgresql-common (241.pgdg110+1) ...
debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
Configuring postgresql-common
-----------------------------
createcluster.conf: A new version (/tmp/postgresql-common.sK2jGD) of
configuration file /etc/postgresql-common/createcluster.conf is available, but
the version installed currently has been locally modified.
1. install the package maintainer's version
2. keep the local version currently installed
3. show the differences between the versions
4. show a side-by-side difference between the versions
5. start a new shell to examine the situation
What do you want to do about modified configuration file createcluster.conf?
How can I solve this problem?
The build breaks because it asks you what to do, and from a script (or automated build), this is not possible.
The solution is to allow apt to configure the installation noninteractively. Add to your Dockerfile:
ENV DEBIAN_FRONTEND=noninteractive
This way, automatic selections to the packages will apply. This is fine for most cases.

The repository 'https://apt.postgresql.org/pub/repos/apt trusty-pgdg Release' does not have a Release file

Linux Mint 20.2
I want to install PgAdmin4.
Here OFFICIAL TUTORIAL
https://www.pgadmin.org/download/pgadmin-4-apt/
Steps:
sudo curl https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo apt-key add
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 3935 100 3935 0 0 4517 0 --:--:-- --:--:-- --:--:-- 4512
sudo sh -c 'echo "deb https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/$(lsb_release -cs) pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list && apt update'
Result:
Hit:1 http://dl.google.com/linux/chrome/deb stable InRelease
Hit:2 http://apt.postgresql.org/pub/repos/apt focal-pgdg InRelease
Hit:3 http://archive.ubuntu.com/ubuntu focal InRelease
Hit:4 http://archive.canonical.com/ubuntu focal InRelease
Hit:5 http://ppa.launchpad.net/kelleyk/emacs/ubuntu focal InRelease
Hit:6 http://apt.postgresql.org/pub/repos/apt bionic-pgdg InRelease
Hit:7 https://repo.skype.com/deb stable InRelease
Hit:8 http://archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:9 http://archive.ubuntu.com/ubuntu focal-backports InRelease
Hit:10 http://security.ubuntu.com/ubuntu focal-security InRelease
Ign:11 https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/uma pgadmin4 InRelease
Ign:12 http://packages.linuxmint.com uma InRelease
Ign:13 https://apt.postgresql.org/pub/repos/apt trusty-pgdg InRelease
Err:14 https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/uma pgadmin4 Release
404 Not Found [IP: 147.75.85.69 443]
Err:15 https://apt.postgresql.org/pub/repos/apt trusty-pgdg Release
404 Not Found [IP: 147.75.85.69 443]
Hit:16 http://packages.linuxmint.com uma Release
Reading package lists... Done
N: Skipping acquire of configured file 'main/binary-i386/Packages' as repository 'http://apt.postgresql.org/pub/repos/apt focal-pgdg InRelease' doesn't support architecture 'i386'
E: The repository 'https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/uma pgadmin4 Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'https://apt.postgresql.org/pub/repos/apt trusty-pgdg Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
Error:
E: The repository 'https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/uma pgadmin4 Release' does not have a Release file.
Please try to change /etc/apt/sources.list.d/pgadmin4.list file lines to deb https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/bionic pgadmin4 main
Bad tutorial boys
Widuranga Dilruksha already solved op question. But i just want to expand it.
The following steps have to be performed on terminal
Execute: sudo nano /etc/apt/sources.list.d/pgadmin4.list
Delete everything you see there and paste the following text: deb https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/bionic pgadmin4 main
Save Changes by pressing Ctrl + x then Y and finally enter
Execute: sudo apt install pgadmin4
Done. I Hope it clarifies the answer.
In my case the repo file was /etc/apt/sources.list.d/pgdg.list (Elementary OS 6).
The other answers don't cover the case where, sudo apt update raises:
W: GPG error: https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/bionic pgadmin4 InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 8881B2A8210976F2
What solved this error was to get the PUBKEY 8881B2A8210976F2 and execute:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 8881B2A8210976F2
Afterwards I was able to sudo apt update and then install postgres.
Check if the version you want it is still supported
https://www.debian.org/releases/
https://wiki.postgresql.org/wiki/Apt#News
I do agree with all other answers but before running
sudo apt install pgadmin4
You have to update apt and this is made by
Executing the following command int terminal
sudo apt update

Hash sum mismatch when apt-get update Ubuntu 20.04 VM with Multipass

My issue is the following:
I start a new multipass VM which is Ubuntu 20.04 version (I do not specify it, just launch).
First command in my new VM is:
sudo apt-get update
Where I already have some error:
Err:6 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages
Hash Sum mismatch
Hashes of expected file:
- Filesize:1291458 [weak]
- SHA256:407e1e5f8188d9a38dec308c87203aadb16cb4ac173b729005525c4d824317c9
- SHA1:47f50537ae094c725a60e90bf5e72d563a73abb2 [weak]
- MD5Sum:05500c05300ff2f3be66040cd9d4c24b [weak]
Hashes of received file:
- SHA256:fc9c8ae3385f3b2cdb7c52c8e4ee5fa5074c843155b7ce4786b3ce3c97fe8c3f
- SHA1:59b7721865c7a9c1b313ce11f11aefa4c7951fd4 [weak]
- MD5Sum:05500c05300ff2f3be66040cd9d4c24b [weak]
- Filesize:1291458 [weak]
Last modification reported: Mon, 28 Sep 2020 16:55:59 +0000
Release file created at: Tue, 29 Sep 2020 10:33:40 +0000
Get:7 http://security.ubuntu.com/ubuntu focal-security/main Translation-en [69.3 kB]
Err:7 http://security.ubuntu.com/ubuntu focal-security/main Translation-en
Err:5 http://archive.ubuntu.com/ubuntu focal/universe amd64 Packages
Hash Sum mismatch
Hashes of expected file:
- Filesize:8627544 [weak]
- SHA256:46a746dac789bd9537aca54db1680b9dff51c248153111350382199d7d96b9d1
- SHA1:7bce310e1f03066e04653926de275118ec09b4d9 [weak]
- MD5Sum:bc50840f4e1bbb64fb3ee6e8a351d744 [weak]
Hashes of received file:
- SHA256:b2f7c8b1b81060721c7f414843b41eda6760b7814fddeefd5abbf9f2bd4a9fd0
- SHA1:b07e3465964e50b87630eea2c05faff5253efa0d [weak]
- MD5Sum:bc50840f4e1bbb64fb3ee6e8a351d744 [weak]
- Filesize:8627544 [weak]
Last modification reported: Thu, 23 Apr 2020 17:34:17 +0000
Release file created at: Thu, 23 Apr 2020 17:33:17 +0000
Get:17 http://archive.ubuntu.com/ubuntu focal/universe Translation-en [5124 kB]
Err:17 http://archive.ubuntu.com/ubuntu focal/universe Translation-en
Get:18 http://archive.ubuntu.com/ubuntu focal/universe amd64 c-n-f Metadata [265 kB]
Get:19 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 Packages [144 kB]
Get:20 http://archive.ubuntu.com/ubuntu focal/multiverse Translation-en [104 kB]
Err:20 http://archive.ubuntu.com/ubuntu focal/multiverse Translation-en
Get:21 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 c-n-f Metadata [9136 B]
Get:22 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [375 kB]
Err:22 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages
Hash Sum mismatch
Hashes of expected file:
- Filesize:374700 [weak]
- SHA256:35c0b5b9cdd324a81b1ee2c31610ca9c81779dd42df1393fcc1013a877a7f01c
- SHA1:380d462e7356a2ce3e1598f4588a5e5ff0afadff [weak]
- MD5Sum:73c1f287aab2928e8db81a62677faea6 [weak]
Hashes of received file:
- SHA256:6d8b94194f56ad754d1e2b04dbaa421c81a6b539bc045713b6ad0a0d40ffd340
- SHA1:be4ec3facb19f7272637f36337a050e5826335a3 [weak]
- MD5Sum:73c1f287aab2928e8db81a62677faea6 [weak]
- Filesize:374700 [weak]
Last modification reported: Tue, 29 Sep 2020 07:15:53 +0000
Release file created at: Tue, 29 Sep 2020 10:33:56 +0000
Get:23 http://archive.ubuntu.com/ubuntu focal-updates/main Translation-en [142 kB]
Get:24 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 c-n-f Metadata [9876 B]
Get:25 http://archive.ubuntu.com/ubuntu focal-updates/restricted amd64 Packages [43.6 kB]
Get:26 http://archive.ubuntu.com/ubuntu focal-updates/restricted Translation-en [10.8 kB]
Get:27 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [175 kB]
Get:28 http://archive.ubuntu.com/ubuntu focal-updates/universe Translation-en [92.7 kB]
Get:29 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 c-n-f Metadata [5952 B]
Get:30 http://archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 Packages [11.6 kB]
Get:31 http://archive.ubuntu.com/ubuntu focal-updates/multiverse Translation-en [3892 B]
Get:32 http://archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 c-n-f Metadata [480 B]
Get:33 http://archive.ubuntu.com/ubuntu focal-backports/main amd64 c-n-f Metadata [112 B]
Get:34 http://archive.ubuntu.com/ubuntu focal-backports/restricted amd64 c-n-f Metadata [116 B]
Get:35 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 Packages [3088 B]
Get:36 http://archive.ubuntu.com/ubuntu focal-backports/universe Translation-en [1448 B]
Get:37 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 c-n-f Metadata [224 B]
Get:38 http://archive.ubuntu.com/ubuntu focal-backports/multiverse amd64 c-n-f Metadata [116 B]
Fetched 15.9 MB in 11s (1399 kB/s)
Reading package lists... Done
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal/universe/binary-amd64/by-hash/SHA256/46a746dac789bd9537aca54db1680b9dff51c248153111350382199d7d96b9d1 Hash Sum mismatch
Hashes of expected file:
- Filesize:8627544 [weak]
- SHA256:46a746dac789bd9537aca54db1680b9dff51c248153111350382199d7d96b9d1
- SHA1:7bce310e1f03066e04653926de275118ec09b4d9 [weak]
- MD5Sum:bc50840f4e1bbb64fb3ee6e8a351d744 [weak]
Hashes of received file:
- SHA256:b2f7c8b1b81060721c7f414843b41eda6760b7814fddeefd5abbf9f2bd4a9fd0
- SHA1:b07e3465964e50b87630eea2c05faff5253efa0d [weak]
- MD5Sum:bc50840f4e1bbb64fb3ee6e8a351d744 [weak]
- Filesize:8627544 [weak]
Last modification reported: Thu, 23 Apr 2020 17:34:17 +0000
Release file created at: Thu, 23 Apr 2020 17:33:17 +0000
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal/universe/i18n/by-hash/SHA256/a9c6ca6ce2913776bf753ae5132c7814139880784e98672525b4059c61f209dd
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal/multiverse/i18n/by-hash/SHA256/224cafd684a26e8bce3dfca4daf33b853c9273d13e4ada6161ce9ef38f1a567c
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal-updates/main/binary-amd64/by-hash/SHA256/35c0b5b9cdd324a81b1ee2c31610ca9c81779dd42df1393fcc1013a877a7f01c Hash Sum mismatch
Hashes of expected file:
- Filesize:374700 [weak]
- SHA256:35c0b5b9cdd324a81b1ee2c31610ca9c81779dd42df1393fcc1013a877a7f01c
- SHA1:380d462e7356a2ce3e1598f4588a5e5ff0afadff [weak]
- MD5Sum:73c1f287aab2928e8db81a62677faea6 [weak]
Hashes of received file:
- SHA256:6d8b94194f56ad754d1e2b04dbaa421c81a6b539bc045713b6ad0a0d40ffd340
- SHA1:be4ec3facb19f7272637f36337a050e5826335a3 [weak]
- MD5Sum:73c1f287aab2928e8db81a62677faea6 [weak]
- Filesize:374700 [weak]
Last modification reported: Tue, 29 Sep 2020 07:15:53 +0000
Release file created at: Tue, 29 Sep 2020 10:33:56 +0000
E: Failed to fetch store:/var/lib/apt/lists/partial/security.ubuntu.com_ubuntu_dists_focal-security_main_binary-amd64_Packages.xz Hash Sum mismatch
Hashes of expected file:
- Filesize:1291458 [weak]
- SHA256:407e1e5f8188d9a38dec308c87203aadb16cb4ac173b729005525c4d824317c9
- SHA1:47f50537ae094c725a60e90bf5e72d563a73abb2 [weak]
- MD5Sum:05500c05300ff2f3be66040cd9d4c24b [weak]
Hashes of received file:
- SHA256:fc9c8ae3385f3b2cdb7c52c8e4ee5fa5074c843155b7ce4786b3ce3c97fe8c3f
- SHA1:59b7721865c7a9c1b313ce11f11aefa4c7951fd4 [weak]
- MD5Sum:05500c05300ff2f3be66040cd9d4c24b [weak]
- Filesize:1291458 [weak]
Last modification reported: Mon, 28 Sep 2020 16:55:59 +0000
Release file created at: Tue, 29 Sep 2020 10:33:40 +0000
E: Failed to fetch http://security.ubuntu.com/ubuntu/dists/focal-security/main/i18n/by-hash/SHA256/66c9979e0ab12165a3ab86f426e3e910d52933bce60ab14fa80a596e1733b0b3
E: Some index files failed to download. They have been ignored, or old ones used instead.
I have tried the some solution what I had found on the web but none of them worked.
Solution 1:
sudo rm -rf /var/lib/apt/lists/*
sudo apt-get update -o Acquire::CompressionTypes::Order::=gz
sudo apt-get update && sudo apt-get upgrade
Solution 2
sudo rm -rvf /var/lib/apt/lists/*
echo "APT::Cache-Limit "100000000";" >> /etc/apt/apt.conf.d/70debconf
Solution 3
sudo rm -rvf /var/lib/apt/lists/*
&& sudo mv /var/lib/dpkg/status /var/lib/dpkg/status-bad
&& sudo cp /var/lib/dpkg/status-old /var/lib/dpkg/status
&& sudo apt-get update
Solution 4
sudo apt-get autoclean && sudo apt-get autoremove -y && sudo apt-get update
Solution 5
sudo rm -rf /var/lib/apt/lists
sudo apt-get clean
sudo apt-get update
I also tried to add Ubuntu keyserver:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 16126D3A3E5C1192
Here is my source.list
deb http://archive.ubuntu.com/ubuntu focal-updates main restricted
deb http://archive.ubuntu.com/ubuntu focal universe
deb http://archive.ubuntu.com/ubuntu focal-updates universe
deb http://archive.ubuntu.com/ubuntu focal multiverse
deb http://archive.ubuntu.com/ubuntu focal-updates multiverse
deb http://archive.ubuntu.com/ubuntu focal-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu focal-security main restricted
deb http://security.ubuntu.com/ubuntu focal-security universe
deb http://security.ubuntu.com/ubuntu focal-security multiverse
I would appreciate any suggestion!
Thanks
ps: on my WSL2 everything works fine.
In my case with the same problem the following solution worked:
sudo su -
mkdir /etc/gcrypt
echo all >> /etc/gcrypt/hwf.deny
apt-get update
My environment
Windows 10.0.19041.508
Vagrant 2.2.10
VirtualBox 6.1.14r140239
ubuntu/focal64 Vagrant Box
I've found the answer and the explanation here:
askubuntu.com/questions/1235914/hash-sum-mismatch-error-due-to-identical-sha1-and-md5-but-different-sha256
I tried to install Docker (get-docker.sh) in the VM and got very similar error: "Failed to fetch https://download.docker.com ... Hash Sum mismatch". So I think this type of issues are not related to the VM, but to the Windows 10 host machine.
I changed Hyper-V launch type to off and rebooted the system:
bcdedit /set hypervisorlaunchtype off
I'm not really understand why but both of the problems are gone.
This worked for me:
i went to system updater and changed update from local server to update from main server, then i ran sudo apt update and it worked. i hope it works for you too
This worked for me:
sudo apt-get clean
sudo rm -r /var/lib/apt/lists/*