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

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/*

Related

Problem during installation PostgreSQL 12 and PgAdmin4 on Linux Mint 20.1 Ulyssa 64-bit

I want to install PostgreSQL and PgAdmin4 on my Linux Mint 20.1 Ulyssa 64-bit
My inxi info
System: Kernel: 5.4.0-58-generic x86_64 bits: 64 compiler: gcc v: 9.3.0 Desktop: MATE 1.24.0 info: mate-panel
wm: marco 1.24.0 dm: LightDM 1.30.0 Distro: Linux Mint 20.1 Ulyssa base: Ubuntu 20.04 focal
Machine: Type: Portable System: Dell product: Inspiron 3542 v: N/A serial: <filter> Chassis: type: 8 serial: <filter>
Mobo: Dell model: 0KHNVP v: A04 serial: <filter> UEFI: Dell v: A04 date: 08/05/2014
Battery: ID-1: BAT0 charge: 15.6 Wh condition: 27.7/41.4 Wh (67%) volts: 16.7/14.8 model: SMP-SDI2.8 DELL FW1MN31
type: Li-ion serial: <filter> status: Charging
CPU: Topology: Dual Core model: Intel Core i3-4005U bits: 64 type: MT MCP arch: Haswell rev: 1 L2 cache: 3072 KiB
flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 13568
Speed: 798 MHz min/max: 800/1700 MHz Core speeds (MHz): 1: 798 2: 798 3: 798 4: 798
Graphics: Device-1: Intel Haswell-ULT Integrated Graphics vendor: Dell driver: i915 v: kernel bus ID: 00:02.0
chip ID: 8086:0a16
Display: x11 server: X.Org 1.20.8 driver: modesetting unloaded: fbdev,vesa compositor: marco v: 1.24.0
resolution: 1366x768~60Hz
OpenGL: renderer: Mesa DRI Intel HD Graphics 4400 (HSW GT2) v: 4.5 Mesa 20.0.8 compat-v: 3.0 direct render: Yes
Audio: Device-1: Intel Haswell-ULT HD Audio vendor: Dell driver: snd_hda_intel v: kernel bus ID: 00:03.0
chip ID: 8086:0a0c
Device-2: Intel 8 Series HD Audio vendor: Dell driver: snd_hda_intel v: kernel bus ID: 00:1b.0 chip ID: 8086:9c20
Sound Server: ALSA v: k5.4.0-58-generic
Network: Device-1: Broadcom and subsidiaries BCM43142 802.11b/g/n vendor: Dell Wireless 1704 802.11n + BT 4.0
driver: bcma-pci-bridge v: N/A port: f040 bus ID: 06:00.0 chip ID: 14e4:4365
Device-2: Realtek RTL810xE PCI Express Fast Ethernet vendor: Dell driver: r8169 v: kernel port: e000
bus ID: 07:00.0 chip ID: 10ec:8136
IF: enp7s0 state: down mac: <filter>
Drives: Local Storage: total: 494.66 GiB used: 9.07 GiB (1.8%)
ID-1: /dev/sda vendor: Toshiba model: MQ01ABF050 size: 465.76 GiB speed: 6.0 Gb/s rotation: 5400 rpm
serial: <filter> rev: 1D scheme: GPT
ID-2: /dev/sdb type: USB model: USB DISK 3.0 size: 28.90 GiB serial: <filter> rev: PMAP scheme: MBR
Partition: ID-1: / size: 95.62 GiB used: 8.97 GiB (9.4%) fs: ext4 dev: /dev/sda8
Sensors: System Temperatures: cpu: 47.0 C mobo: 46.0 C
Fan Speeds (RPM): cpu: 0
Repos: Active apt repos in: /etc/apt/sources.list
1: deb cdrom:[Linux Mint 20.1 _Ulyssa_ - Release amd64 20210103]/ focal contrib main
Active apt repos in: /etc/apt/sources.list.d/official-package-repositories.list
1: deb http://packages.linuxmint.com ulyssa main upstream import backport #id:linuxmint_main
2: deb http://archive.ubuntu.com/ubuntu focal main restricted universe multiverse
3: deb http://archive.ubuntu.com/ubuntu focal-updates main restricted universe multiverse
4: deb http://archive.ubuntu.com/ubuntu focal-backports main restricted universe multiverse
5: deb http://security.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse
6: deb http://archive.canonical.com/ubuntu/ focal partner
Info: Processes: 184 Uptime: 1h 14m Memory: 3.75 GiB used: 671.3 MiB (17.5%) Init: systemd v: 245 runlevel: 5 Compilers:
gcc: 9.3.0 alt: 9 Shell: bash v: 5.0.17 running in: mate-terminal inxi: 3.0.38
I followed the instruction from https://www.postgresql.org/download/linux/ubuntu/
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get -y install postgresql
I performed the instruction step by step and noticed Error messages in the log after step 3
Hit:1 http://archive.ubuntu.com/ubuntu focal InRelease
Hit:2 http://archive.canonical.com/ubuntu focal InRelease
Get:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Ign:4 http://mirror.yandex.ru/linuxmint-packages ulyssa InRelease
Get:5 http://archive.ubuntu.com/ubuntu focal-backports InRelease [101 kB]
Hit:6 http://mirror.yandex.ru/linuxmint-packages ulyssa Release
Get:7 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [844 kB]
Get:9 http://archive.ubuntu.com/ubuntu focal-updates/main i386 Packages [436 kB]
Get:10 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 DEP-11 Metadata [264 kB]
Get:11 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [750 kB]
Get:12 http://archive.ubuntu.com/ubuntu focal-updates/universe i386 Packages [558 kB]
Get:13 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 DEP-11 Metadata [303 kB]
Get:14 http://archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 DEP-11 Metadata [2 468 B]
Get:15 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 DEP-11 Metadata [1 768 B]
Hit:16 http://dl.google.com/linux/chrome/deb stable InRelease
Get:17 http://security.ubuntu.com/ubuntu focal-security InRelease [109 kB]
Ign:18 http://apt.postgresql.org/pub/repos/apt ulyssa-pgdg InRelease
Err:19 http://apt.postgresql.org/pub/repos/apt ulyssa-pgdg Release
404 Not Found [IP: 147.75.85.69 80]
Hit:20 https://repo.skype.com/deb stable InRelease
Get:21 http://security.ubuntu.com/ubuntu focal-security/main amd64 DEP-11 Metadata [24,3 kB]
Get:22 http://security.ubuntu.com/ubuntu focal-security/universe amd64 DEP-11 Metadata [58,2 kB]
Error: Timeout was reached
Reading package lists... Done
E: The repository 'http://apt.postgresql.org/pub/repos/apt ulyssa-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.
Then I checked repos using inxi -r
Repos: No active apt repos in: /etc/apt/sources.list
Active apt repos in: /etc/apt/sources.list.d/google-chrome.list
1: deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main
Active apt repos in: /etc/apt/sources.list.d/official-package-repositories.list
1: deb http://mirror.yandex.ru/linuxmint-packages ulyssa main upstream import backport
2: deb http://archive.ubuntu.com/ubuntu focal main restricted universe multiverse
3: deb http://archive.ubuntu.com/ubuntu focal-updates main restricted universe multiverse
4: deb http://archive.ubuntu.com/ubuntu focal-backports main restricted universe multiverse
5: deb http://security.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse
6: deb http://archive.canonical.com/ubuntu/ focal partner
Active apt repos in: /etc/apt/sources.list.d/pgdg.list
1: deb http://apt.postgresql.org/pub/repos/apt ulyssa-pgdg main
Active apt repos in: /etc/apt/sources.list.d/skype-stable.list
1: deb [arch=amd64] https://repo.skype.com/deb stable main
When I made step 4 [c]sudo apt-get -y install postgresql[/c] I got next results:
E: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 61709 (apt)
N: Be aware that removing the lock file is not a solution and may break your system.
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?
I checked 61709 process. It was
root 61709 0.0 0.0 80208 1600 ? S мар13 0:23 /usr/bin/apt install bcmwl-kernel-source
Queries:
Should I remove preinstalled PostgreSQL and PgAdmin3 before installing v 12 and PgAdmin4?
What's wrong in the PosgreSQL installation process and how is it possible to get success?
Restart your Linux Mint Laptop/Server.
Backup your Database and remove old PostgreSQL and PgAdmin3.
Follow instructions from here to install PostgreSQL.

Error while upgrading Ubuntu 18.04 LTS packages from Local Repository

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.

Kubernetes' Kubeadm stops at apiclient

I have created a new Ubuntu 16.04 droplet on DigitalOcean and followed those guides respectively to install kubeadm (and its dependencies):
https://docs.docker.com/engine/installation/
https://kubernetes.io/docs/tasks/tools/install-kubectl/
https://kubernetes.io/docs/setup/independent/install-kubeadm/
However, when I run kubeadm init, I get:
root#ubuntu-512mb-nyc3-01:~# kubeadm init
[kubeadm] WARNING: kubeadm is in beta, please do not use it for production clusters.
[init] Using Kubernetes version: v1.7.3
[init] Using Authorization modes: [Node RBAC]
[preflight] Running pre-flight checks
[preflight] WARNING: docker version is greater than the most recently validated version. Docker version: 17.06.0-ce. Max validated version: 1.12
[kubeadm] WARNING: starting in 1.8, tokens expire after 24 hours by default (if you require a non-expiring token use --token-ttl 0)
[certificates] Generated CA certificate and key.
[certificates] Generated API server certificate and key.
[certificates] API Server serving cert is signed for DNS names [ubuntu-512mb-nyc3-01 kubernetes kubernetes.default kubernetes.default.svc kubernetes.default.svc.cluster.local] and IPs [10.96.0.1 165.227.70.168]
[certificates] Generated API server kubelet client certificate and key.
[certificates] Generated service account token signing key and public key.
[certificates] Generated front-proxy CA certificate and key.
[certificates] Generated front-proxy client certificate and key.
[certificates] Valid certificates and keys now exist in "/etc/kubernetes/pki"
[kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/admin.conf"
[kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/kubelet.conf"
[kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/controller-manager.conf"
[kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/scheduler.conf"
[apiclient] Created API client, waiting for the control plane to become ready
I even tried to create a new CentOS 7 droplet to apply the different instructions for CentOS, and I got the same problem.
Here's the full history for what I applied since I created the VPS:
Welcome to Ubuntu 16.04.3 LTS (GNU/Linux 4.4.0-87-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
Get cloud support with Ubuntu Advantage Cloud Guest:
http://www.ubuntu.com/business/services/cloud
0 packages can be updated.
0 updates are security updates.
The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.
Changing password for root.
(current) UNIX password:
Enter new UNIX password:
Retype new UNIX password:
root#ubuntu-512mb-nyc3-01:~# apt update
Get:1 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB]
Hit:2 http://nyc2.mirrors.digitalocean.com/ubuntu xenial InRelease
Get:3 http://nyc2.mirrors.digitalocean.com/ubuntu xenial-updates InRelease [102 kB]
Get:4 http://nyc2.mirrors.digitalocean.com/ubuntu xenial-backports InRelease [102 kB]
Get:5 http://nyc2.mirrors.digitalocean.com/ubuntu xenial/main Sources [868 kB]
Get:6 http://nyc2.mirrors.digitalocean.com/ubuntu xenial/restricted Sources [4,808 B]
Get:7 http://nyc2.mirrors.digitalocean.com/ubuntu xenial/universe Sources [7,728 kB]
Get:8 http://nyc2.mirrors.digitalocean.com/ubuntu xenial/multiverse Sources [179 kB]
Get:9 http://nyc2.mirrors.digitalocean.com/ubuntu xenial-updates/main Sources [265 kB]
Get:10 http://nyc2.mirrors.digitalocean.com/ubuntu xenial-updates/restricted Sources [3,012 B]
Get:11 http://nyc2.mirrors.digitalocean.com/ubuntu xenial-updates/universe Sources [166 kB]
Get:12 http://nyc2.mirrors.digitalocean.com/ubuntu xenial-updates/multiverse Sources [7,232 B]
Get:13 http://nyc2.mirrors.digitalocean.com/ubuntu xenial-updates/main amd64 Packages [593 kB]
Get:14 http://nyc2.mirrors.digitalocean.com/ubuntu xenial-updates/main Translation-en [240 kB]
Get:15 http://nyc2.mirrors.digitalocean.com/ubuntu xenial-updates/universe amd64 Packages [511 kB]
Get:16 http://nyc2.mirrors.digitalocean.com/ubuntu xenial-updates/universe Translation-en [199 kB]
Get:17 http://security.ubuntu.com/ubuntu xenial-security/main Sources [86.5 kB]
Get:18 http://nyc2.mirrors.digitalocean.com/ubuntu xenial-backports/main Sources [3,312 B]
Get:19 http://security.ubuntu.com/ubuntu xenial-security/restricted Sources [2,604 B]
Get:21 http://security.ubuntu.com/ubuntu xenial-security/universe Sources [38.2 kB]
Get:20 http://nyc2.mirrors.digitalocean.com/ubuntu xenial-backports/universe Sources [4,400 B]
Get:22 http://nyc2.mirrors.digitalocean.com/ubuntu xenial-backports/universe amd64 Packages [5,804 B]
Get:23 http://security.ubuntu.com/ubuntu xenial-security/multiverse Sources [1,144 B]
Get:24 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages [341 kB]
Get:25 http://security.ubuntu.com/ubuntu xenial-security/main Translation-en [144 kB]
Get:26 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 Packages [155 kB]
Get:27 http://security.ubuntu.com/ubuntu xenial-security/universe Translation-en [79.4 kB]
Get:28 http://security.ubuntu.com/ubuntu xenial-security/multiverse amd64 Packages [2,752 B]
Fetched 11.9 MB in 3s (3,327 kB/s)
ade
Reading package lists... Done
Building dependency tree
Reading state information... Done
6 packages can be upgraded. Run 'apt list --upgradable' to see them.
root#ubuntu-512mb-nyc3-01:~# apt pgrade
E: Invalid operation pgrade
root#ubuntu-512mb-nyc3-01:~# apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following package was automatically installed and is no longer required:
grub-pc-bin
Use 'apt autoremove' to remove it.
The following NEW packages will be installed:
linux-headers-4.4.0-91 linux-headers-4.4.0-91-generic
linux-image-4.4.0-91-generic
The following packages will be upgraded:
git git-man linux-headers-generic linux-headers-virtual
linux-image-virtual linux-virtual
6 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 36.5 MB of archives.
After this operation, 145 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://security.ubuntu.com/ubuntu xenial-security/main amd64 git-man all 1:2.7.4-0ubuntu1.2 [736 kB]
Get:2 http://security.ubuntu.com/ubuntu xenial-security/main amd64 git amd64 1:2.7.4-0ubuntu1.2 [3,163 kB]
Get:3 http://security.ubuntu.com/ubuntu xenial-security/main amd64 linux-headers-4.4.0-91 all 4.4.0-91.114 [9,876 kB]
Get:4 http://security.ubuntu.com/ubuntu xenial-security/main amd64 linux-headers-4.4.0-91-generic amd64 4.4.0-91.114 [791 kB]
Get:5 http://security.ubuntu.com/ubuntu xenial-security/main amd64 linux-image-4.4.0-91-generic amd64 4.4.0-91.114 [21.9 MB]
Get:6 http://security.ubuntu.com/ubuntu xenial-security/main amd64 linux-virtual amd64 4.4.0.91.96 [1,780 B]
Get:7 http://security.ubuntu.com/ubuntu xenial-security/main amd64 linux-image-virtual amd64 4.4.0.91.96 [2,270 B]
Get:8 http://security.ubuntu.com/ubuntu xenial-security/main amd64 linux-headers-virtual amd64 4.4.0.91.96 [1,760 B]
Get:9 http://security.ubuntu.com/ubuntu xenial-security/main amd64 linux-headers-generic amd64 4.4.0.91.96 [2,262 B]
Fetched 36.5 MB in 0s (40.0 MB/s)
(Reading database ... 54209 files and directories currently installed.)
Preparing to unpack .../git-man_1%3a2.7.4-0ubuntu1.2_all.deb ...
Unpacking git-man (1:2.7.4-0ubuntu1.2) over (1:2.7.4-0ubuntu1.1) ...
Preparing to unpack .../git_1%3a2.7.4-0ubuntu1.2_amd64.deb ...
Unpacking git (1:2.7.4-0ubuntu1.2) over (1:2.7.4-0ubuntu1.1) ...
Selecting previously unselected package linux-headers-4.4.0-91.
Preparing to unpack .../linux-headers-4.4.0-91_4.4.0-91.114_all.deb ...
Unpacking linux-headers-4.4.0-91 (4.4.0-91.114) ...
Selecting previously unselected package linux-headers-4.4.0-91-generic.
Preparing to unpack .../linux-headers-4.4.0-91-generic_4.4.0-91.114_amd64.deb ...
Unpacking linux-headers-4.4.0-91-generic (4.4.0-91.114) ...
Selecting previously unselected package linux-image-4.4.0-91-generic.
Preparing to unpack .../linux-image-4.4.0-91-generic_4.4.0-91.114_amd64.deb ...
Done.
Unpacking linux-image-4.4.0-91-generic (4.4.0-91.114) ...
Preparing to unpack .../linux-virtual_4.4.0.91.96_amd64.deb ...
Unpacking linux-virtual (4.4.0.91.96) over (4.4.0.87.93) ...
Preparing to unpack .../linux-image-virtual_4.4.0.91.96_amd64.deb ...
Unpacking linux-image-virtual (4.4.0.91.96) over (4.4.0.87.93) ...
Preparing to unpack .../linux-headers-virtual_4.4.0.91.96_amd64.deb ...
Unpacking linux-headers-virtual (4.4.0.91.96) over (4.4.0.87.93) ...
Preparing to unpack .../linux-headers-generic_4.4.0.91.96_amd64.deb ...
Unpacking linux-headers-generic (4.4.0.91.96) over (4.4.0.87.93) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up git-man (1:2.7.4-0ubuntu1.2) ...
Setting up git (1:2.7.4-0ubuntu1.2) ...
Setting up linux-headers-4.4.0-91 (4.4.0-91.114) ...
Setting up linux-headers-4.4.0-91-generic (4.4.0-91.114) ...
Setting up linux-image-4.4.0-91-generic (4.4.0-91.114) ...
Running depmod.
update-initramfs: deferring update (hook will be called later)
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-91-generic /boot/vmlinuz-4.4.0-91-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-91-generic /boot/vmlinuz-4.4.0-91-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-91-generic
W: mdadm: /etc/mdadm/mdadm.conf defines no arrays.
run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.4.0-91-generic /boot/vmlinuz-4.4.0-91-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 4.4.0-91-generic /boot/vmlinuz-4.4.0-91-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.4.0-91-generic /boot/vmlinuz-4.4.0-91-generic
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.4.0-91-generic
Found initrd image: /boot/initrd.img-4.4.0-91-generic
Found linux image: /boot/vmlinuz-4.4.0-87-generic
Found initrd image: /boot/initrd.img-4.4.0-87-generic
done
Setting up linux-image-virtual (4.4.0.91.96) ...
Setting up linux-headers-generic (4.4.0.91.96) ...
Setting up linux-headers-virtual (4.4.0.91.96) ...
Setting up linux-virtual (4.4.0.91.96) ...
root#ubuntu-512mb-nyc3-01:~# sudo apt-get install \
> apt-transport-https \
> ca-certificates \
> curl \
> software-properties-common
Reading package lists... Done
Building dependency tree
Reading state information... Done
ca-certificates is already the newest version (20160104ubuntu1).
apt-transport-https is already the newest version (1.2.24).
curl is already the newest version (7.47.0-1ubuntu2.2).
software-properties-common is already the newest version (0.96.20.7).
The following package was automatically installed and is no longer required:
grub-pc-bin
Use 'sudo apt autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
root#ubuntu-512mb-nyc3-01:~# curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
OK
root#ubuntu-512mb-nyc3-01:~# sudo add-apt-repository \
> "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
> $(lsb_release -cs) \
> stable"
root#ubuntu-512mb-nyc3-01:~# apt update
Hit:1 http://mirrors.digitalocean.com/ubuntu xenial InRelease
Hit:2 http://mirrors.digitalocean.com/ubuntu xenial-updates InRelease
Hit:3 http://mirrors.digitalocean.com/ubuntu xenial-backports InRelease
Hit:4 http://security.ubuntu.com/ubuntu xenial-security InRelease
Get:5 https://download.docker.com/linux/ubuntu xenial InRelease [38.9 kB]
Get:6 https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages [1,966 B]
Fetched 40.9 kB in 0s (56.7 kB/s)
sudo apt-get install docker-ce
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.
root#ubuntu-512mb-nyc3-01:~# sudo apt-get install docker-ce
Reading package lists... Done
Building dependency tree... 50%
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
grub-pc-bin
Use 'sudo apt autoremove' to remove it.
The following additional packages will be installed:
aufs-tools cgroupfs-mount libltdl7
Suggested packages:
mountall
The following NEW packages will be installed:
aufs-tools cgroupfs-mount docker-ce libltdl7
0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 20.6 MB of archives.
After this operation, 96.6 MB of additional disk space will be used.
Get:2 https://download.docker.com/linux/ubuntu xenial/stable amd64 docker-ce amd64 17.06.0~ce-0~ubuntu [20.5 MB]
Get:1 http://nyc2.mirrors.digitalocean.com/ubuntu xenial/universe amd64 aufs-tools amd64 1:3.2+20130722-1.1ubuntu1 [92.9 kB]
Get:3 http://nyc2.mirrors.digitalocean.com/ubuntu xenial/universe amd64 cgroupfs-mount all 1.2 [4,970 B]
Get:4 http://nyc2.mirrors.digitalocean.com/ubuntu xenial/main amd64 libltdl7 amd64 2.4.6-0.1 [38.3 kB]
Fetched 20.6 MB in 0s (23.2 MB/s)
Selecting previously unselected package aufs-tools.
(Reading database ... 82102 files and directories currently installed.)
Preparing to unpack .../aufs-tools_1%3a3.2+20130722-1.1ubuntu1_amd64.deb ...
Unpacking aufs-tools (1:3.2+20130722-1.1ubuntu1) ...
Selecting previously unselected package cgroupfs-mount.
Preparing to unpack .../cgroupfs-mount_1.2_all.deb ...
Unpacking cgroupfs-mount (1.2) ...
Selecting previously unselected package libltdl7:amd64.
Preparing to unpack .../libltdl7_2.4.6-0.1_amd64.deb ...
Unpacking libltdl7:amd64 (2.4.6-0.1) ...
Selecting previously unselected package docker-ce.
Preparing to unpack .../docker-ce_17.06.0~ce-0~ubuntu_amd64.deb ...
Unpacking docker-ce (17.06.0~ce-0~ubuntu) ...
Processing triggers for libc-bin (2.23-0ubuntu9) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for systemd (229-4ubuntu19) ...
Setting up aufs-tools (1:3.2+20130722-1.1ubuntu1) ...
Setting up cgroupfs-mount (1.2) ...
Setting up libltdl7:amd64 (2.4.6-0.1) ...
Setting up docker-ce (17.06.0~ce-0~ubuntu) ...
Processing triggers for libc-bin (2.23-0ubuntu9) ...
Processing triggers for systemd (229-4ubuntu19) ...
Processing triggers for ureadahead (0.100.0-19) ...
root#ubuntu-512mb-nyc3-01:~# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
b04784fba78d: Pull complete
Digest: sha256:f3b3b28a45160805bb16542c9531888519430e9e6d6ffc09d72261b0d26ff74f
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://cloud.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/engine/userguide/
root#ubuntu-512mb-nyc3-01:~# curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 1 68.9M 1 995k 0 0 2613k 0 0:00:27 --:--:-- 0:00:27 100 68.9M 100 68.9M 0 0 72.8M 0 --:--:-- --:--:-- --:--:-- 72.8M
root#ubuntu-512mb-nyc3-01:~# chmod +x ./kubectl
root#ubuntu-512mb-nyc3-01:~# sudo mv ./kubectl /usr/local/bin/kubectl
root#ubuntu-512mb-nyc3-01:~# kubectl cluster-info
Kubernetes master is running at http://localhost:8080
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
root#ubuntu-512mb-nyc3-01:~#
root#ubuntu-512mb-nyc3-01:~# apt-get update && apt-get install -y apt-transport-https
Hit:1 http://security.ubuntu.com/ubuntu xenial-security InRelease
Hit:2 http://nyc2.mirrors.digitalocean.com/ubuntu xenial InRelease
Hit:3 http://nyc2.mirrors.digitalocean.com/ubuntu xenial-updates InRelease
Hit:4 https://download.docker.com/linux/ubuntu xenial InRelease
Hit:5 http://nyc2.mirrors.digitalocean.com/ubuntu xenial-backports InRelease
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
apt-transport-https is already the newest version (1.2.24).
The following package was automatically installed and is no longer required:
grub-pc-bin
Use 'apt autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
root#ubuntu-512mb-nyc3-01:~# curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
OK
root#ubuntu-512mb-nyc3-01:~# cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
> deb http://apt.kubernetes.io/ kubernetes-xenial main
> EOF
root#ubuntu-512mb-nyc3-01:~# apt-get update
Hit:1 http://mirrors.digitalocean.com/ubuntu xenial InRelease
Hit:2 http://mirrors.digitalocean.com/ubuntu xenial-updates InRelease
Hit:3 http://mirrors.digitalocean.com/ubuntu xenial-backports InRelease
Hit:4 http://security.ubuntu.com/ubuntu xenial-security InRelease
Hit:6 https://download.docker.com/linux/ubuntu xenial InRelease
Get:5 https://packages.cloud.google.com/apt kubernetes-xenial InRelease [8,942 B]
Get:7 https://packages.cloud.google.com/apt kubernetes-xenial/main amd64 Packages [4,977 B]
Fetched 13.9 kB in 0s (16.0 kB/s)
Reading package lists... Done
root#ubuntu-512mb-nyc3-01:~# apt-get install -y kubelet kubeadm
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
grub-pc-bin
Use 'apt autoremove' to remove it.
The following additional packages will be installed:
ebtables kubectl kubernetes-cni socat
The following NEW packages will be installed:
ebtables kubeadm kubectl kubelet kubernetes-cni socat
0 upgraded, 6 newly installed, 0 to remove and 0 not upgraded.
Need to get 45.4 MB of archives.
After this operation, 334 MB of additional disk space will be used.
Get:1 http://mirrors.digitalocean.com/ubuntu xenial-updates/main amd64 ebtables amd64 2.0.10.4-3.4ubuntu2 [79.4 kB]
Get:2 http://mirrors.digitalocean.com/ubuntu xenial/universe amd64 socat amd64 1.7.3.1-1 [321 kB]
Get:3 https://packages.cloud.google.com/apt kubernetes-xenial/main amd64 kubernetes-cni amd64 0.5.1-00 [5,560 kB]
Get:4 https://packages.cloud.google.com/apt kubernetes-xenial/main amd64 kubelet amd64 1.7.3-01 [19.6 MB]
Get:5 https://packages.cloud.google.com/apt kubernetes-xenial/main amd64 kubectl amd64 1.7.3-01 [10.1 MB]
Get:6 https://packages.cloud.google.com/apt kubernetes-xenial/main amd64 kubeadm amd64 1.7.3-01 [9,796 kB]
Fetched 45.4 MB in 4s (10.2 MB/s)
Selecting previously unselected package ebtables.
(Reading database ... 82383 files and directories currently installed.)
Preparing to unpack .../ebtables_2.0.10.4-3.4ubuntu2_amd64.deb ...
Unpacking ebtables (2.0.10.4-3.4ubuntu2) ...
Selecting previously unselected package kubernetes-cni.
Preparing to unpack .../kubernetes-cni_0.5.1-00_amd64.deb ...
Unpacking kubernetes-cni (0.5.1-00) ...
Selecting previously unselected package socat.
Preparing to unpack .../socat_1.7.3.1-1_amd64.deb ...
Unpacking socat (1.7.3.1-1) ...
Selecting previously unselected package kubelet.
Preparing to unpack .../kubelet_1.7.3-01_amd64.deb ...
Unpacking kubelet (1.7.3-01) ...
Selecting previously unselected package kubectl.
Preparing to unpack .../kubectl_1.7.3-01_amd64.deb ...
Unpacking kubectl (1.7.3-01) ...
Selecting previously unselected package kubeadm.
Preparing to unpack .../kubeadm_1.7.3-01_amd64.deb ...
Unpacking kubeadm (1.7.3-01) ...
Processing triggers for systemd (229-4ubuntu19) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up ebtables (2.0.10.4-3.4ubuntu2) ...
update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults
Setting up kubernetes-cni (0.5.1-00) ...
Setting up socat (1.7.3.1-1) ...
Setting up kubelet (1.7.3-01) ...
Setting up kubectl (1.7.3-01) ...
Setting up kubeadm (1.7.3-01) ...
Processing triggers for systemd (229-4ubuntu19) ...
Processing triggers for ureadahead (0.100.0-19) ...
root#ubuntu-512mb-nyc3-01:~# kubeadm init
[kubeadm] WARNING: kubeadm is in beta, please do not use it for production clusters.
[init] Using Kubernetes version: v1.7.3
[init] Using Authorization modes: [Node RBAC]
[preflight] Running pre-flight checks
[preflight] WARNING: docker version is greater than the most recently validated version. Docker version: 17.06.0-ce. Max validated version: 1.12
[kubeadm] WARNING: starting in 1.8, tokens expire after 24 hours by default (if you require a non-expiring token use --token-ttl 0)
[certificates] Generated CA certificate and key.
[certificates] Generated API server certificate and key.
[certificates] API Server serving cert is signed for DNS names [ubuntu-512mb-nyc3-01 kubernetes kubernetes.default kubernetes.default.svc kubernetes.default.svc.cluster.local] and IPs [10.96.0.1 165.227.70.168]
[certificates] Generated API server kubelet client certificate and key.
[certificates] Generated service account token signing key and public key.
[certificates] Generated front-proxy CA certificate and key.
[certificates] Generated front-proxy client certificate and key.
[certificates] Valid certificates and keys now exist in "/etc/kubernetes/pki"
[kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/admin.conf"
[kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/kubelet.conf"
[kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/controller-manager.conf"
[kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/scheduler.conf"
[apiclient] Created API client, waiting for the control plane to become ready
^C
Here's the log from journalctl: https://pastebin.com/S6Tkak3P
How long did you wait for it to be ready? Note that it takes a bit in that step. Moreover, in the journalctl logs there are errors regarding the cni network not being ready, which is something expected. Could you try again and waiting a bit longer?

installing mongodb in a docker container

I am trying to create a docker image for mongodb. I am followed the installation instructions from the official mongodb installation to the letter without success. I have tried every single blog and installation instruction out there but without any success. Any help will be greatly appreciated.
My dockerfile contents :
FROM ubuntu:16.04
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
RUN echo "deb [ arch=amd64 ] http://repo.mongodb.org/apt/ubuntu/ xenial/mongodb-org/3.4 multiverse" | tee /etc/apt/sources.list.d/mongodb-3.4.list
RUN apt-get update && apt-get install -y mongodb-org
RUN mkdir -p /data/db
RUN chown -R mongodb:mongodb /data/db
ADD mongodb.conf /etc/mongodb.conf
ADD mongodb.pem /etc/ssl/certs/mongodb.pem
VOLUME ["/data/db"]
EXPOSE 27017
ENTRYPOINT ["/usr/bin/mongod", "--config", "/etc/mongodb.conf"]
I am using the follwing command :
sudo docker image build -t mongodb .
Everytime I am trying to build the image, I get the following:
Sending build context to Docker daemon 7.68kB
Step 1/11 : FROM ubuntu:16.04
---> 14f60031763d
Step 2/11 : RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
---> Using cache
---> 97a851663e60
Step 3/11 : RUN echo "deb [ arch=amd64 ] http://repo.mongodb.org/apt/ubuntu/ xenial/mongodb-org/3.4 multiverse" | tee /etc/apt/sources.list.d/mongodb-3.4.list
---> Using cache
---> 122a2fad0021
Step 4/11 : RUN apt-get update && apt-get install -y mongodb-org
---> Running in 014e7918e156
Get:1 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB]
Ign:2 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 InRelease
Get:3 http://archive.ubuntu.com/ubuntu xenial InRelease [247 kB]
Get:4 http://archive.ubuntu.com/ubuntu xenial-updates InRelease [102 kB]
Get:5 http://archive.ubuntu.com/ubuntu xenial-backports InRelease [102 kB]
Get:6 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 Release [3457 B]
Get:7 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 Release.gpg [801 B]
Get:8 http://security.ubuntu.com/ubuntu xenial-security/universe Sources [42.0 kB]
Get:9 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages [394 kB]
Get:10 http://security.ubuntu.com/ubuntu xenial-security/restricted amd64 Packages [12.8 kB]
Get:11 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 Packages [184 kB]
Get:12 http://security.ubuntu.com/ubuntu xenial-security/multiverse amd64 Packages [2931 B]
Get:13 http://archive.ubuntu.com/ubuntu xenial/universe Sources [9802 kB]
Get:14 http://alert.scansafe.net/alert/process?a=-3-BW4R_eLtf_R7PUTnlOeb6kHjw5kMPDH4n_j9vuji99G7a0CHJtXpeYpzGHZPC0wRr52uECxiceRo23F5y5nJqQ&b=iDw6Hli7TPC7hodjxRcdBj9i1UevoPI4aXCTkM2htEe16EENN3K7sUkicBLWMmbvQJHy5RccSqbLlHU4Q23W8w7vzekV399jAw6NbyJsJBJPm_U3VdYSosJyHFldLABeOaw16L56ass0uQ-KDLgyWadENbyoiMwzO-1nwE6QYwf1NcLI1073TBf9mObvKXGE7lL2-OpA1MA6dI2cdh6AETyP3g0OipJUm4fag2-7TI5j_BImQOsvvEVlzZ7ilSFaUVOlMbWBWuuU822y_f0ph82C3dG_kBenckmPWso5ln9ShKoiCmjbcSZjT76_j3Hwh3nSYYv1AqX8Kj8gFD4k1MI2Li7WNMs9rnq4vUa9eeaN_ivffMClQHK6I88vPaR4FQr61U5ecOwl0KmVyhP3FLDF-4KpOGg3Kf7kVRCnLpQZwXnsrrTt3enSpjn66IzlCgG3PmNrVhdqOTBQFh5PfWtgdGG68Ir6hZIBt170nqGSMhgFmlTMTMbO5EGkA-uyPz8worv7RSc&blockedUrl=http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4/multiverse amd64 Packages [5870 B]
Err:14 http://alert.scansafe.net/alert/process?a=-3-BW4R_eLtf_R7PUTnlOeb6kHjw5kMPDH4n_j9vuji99G7a0CHJtXpeYpzGHZPC0wRr52uECxiceRo23F5y5nJqQ&b=iDw6Hli7TPC7hodjxRcdBj9i1UevoPI4aXCTkM2htEe16EENN3K7sUkicBLWMmbvQJHy5RccSqbLlHU4Q23W8w7vzekV399jAw6NbyJsJBJPm_U3VdYSosJyHFldLABeOaw16L56ass0uQ-KDLgyWadENbyoiMwzO-1nwE6QYwf1NcLI1073TBf9mObvKXGE7lL2-OpA1MA6dI2cdh6AETyP3g0OipJUm4fag2-7TI5j_BImQOsvvEVlzZ7ilSFaUVOlMbWBWuuU822y_f0ph82C3dG_kBenckmPWso5ln9ShKoiCmjbcSZjT76_j3Hwh3nSYYv1AqX8Kj8gFD4k1MI2Li7WNMs9rnq4vUa9eeaN_ivffMClQHK6I88vPaR4FQr61U5ecOwl0KmVyhP3FLDF-4KpOGg3Kf7kVRCnLpQZwXnsrrTt3enSpjn66IzlCgG3PmNrVhdqOTBQFh5PfWtgdGG68Ir6hZIBt170nqGSMhgFmlTMTMbO5EGkA-uyPz8worv7RSc&blockedUrl=http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4/multiverse amd64 Packages
Hash Sum mismatch
Get:15 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages [1558 kB]
Get:16 http://archive.ubuntu.com/ubuntu xenial/restricted amd64 Packages [14.1 kB]
Get:17 http://archive.ubuntu.com/ubuntu xenial/universe amd64 Packages [9827 kB]
Get:18 http://archive.ubuntu.com/ubuntu xenial/multiverse amd64 Packages [176 kB]
Get:19 http://archive.ubuntu.com/ubuntu xenial-updates/universe Sources [208 kB]
Get:20 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [756 kB]
Get:21 http://archive.ubuntu.com/ubuntu xenial-updates/restricted amd64 Packages [13.3 kB]
Get:22 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages [645 kB]
Get:23 http://archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64 Packages [17.5 kB]
Get:24 http://archive.ubuntu.com/ubuntu xenial-backports/main amd64 Packages [4930 B]
Get:25 http://archive.ubuntu.com/ubuntu xenial-backports/universe amd64 Packages [6237 B]
Fetched 24.2 MB in 7s (3158 kB/s)
Reading package lists...
E: Failed to fetch http://alert.scansafe.net/alert/process?a=-3-BW4R_eLtf_R7PUTnlOeb6kHjw5kMPDH4n_j9vuji99G7a0CHJtXpeYpzGHZPC0wRr52uECxiceRo23F5y5nJqQ&b=iDw6Hli7TPC7hodjxRcdBj9i1UevoPI4aXCTkM2htEe16EENN3K7sUkicBLWMmbvQJHy5RccSqbLlHU4Q23W8w7vzekV399jAw6NbyJsJBJPm_U3VdYSosJyHFldLABeOaw16L56ass0uQ-KDLgyWadENbyoiMwzO-1nwE6QYwf1NcLI1073TBf9mObvKXGE7lL2-OpA1MA6dI2cdh6AETyP3g0OipJUm4fag2-7TI5j_BImQOsvvEVlzZ7ilSFaUVOlMbWBWuuU822y_f0ph82C3dG_kBenckmPWso5ln9ShKoiCmjbcSZjT76_j3Hwh3nSYYv1AqX8Kj8gFD4k1MI2Li7WNMs9rnq4vUa9eeaN_ivffMClQHK6I88vPaR4FQr61U5ecOwl0KmVyhP3FLDF-4KpOGg3Kf7kVRCnLpQZwXnsrrTt3enSpjn66IzlCgG3PmNrVhdqOTBQFh5PfWtgdGG68Ir6hZIBt170nqGSMhgFmlTMTMbO5EGkA-uyPz8worv7RSc&blockedUrl=http://repo.mongodb.org/apt/ubuntu/dists/xenial/mongodb-org/3.4/multiverse/binary-amd64/Packages.gz Hash Sum mismatch
E: Some index files failed to download. They have been ignored, or old ones used instead.
The command '/bin/sh -c apt-get update && apt-get install -y mongodb-org' returned a non-zero code: 100
The line RUN apt-get update && apt-get install -y mongodb-org should be
RUN apt-get update && apt-get install -y mongodb You can also just use the official mongo image and then provide a docker link
I'm hoping you know that you don't have to go to the effort because there is already an official image on Docker Hub.
However, your error message gives a hint to what went wrong:
mongodb-org/3.4/multiverse/binary-amd64/Packages.gz Hash Sum mismatch
You can correct this if you are determined to make your own image.
One place I would start is looking at the Docker best practices for run. You have split some related to the same dependency over multiple lines in your code, which can cause caching to mismatch versions and hashes. This is likely the problem.
If you aren't satisfied with using the official image directly you can at least look at how it was built here:
https://github.com/docker-library/mongo/blob/c02ca4cce8c69e5069b75cb574d1b99d7b4edaeb/3.4/Dockerfile
I found a solution. Since I changed the network adapter of the VM from NAT to Bridge, the image is building successfully.
I do not understand why the network type would cause this issue, but it it working now.

How can I solve the errors in apt update in raspberry pi?

Recently I edit my /etc/apt/sources.list and change jessie to stretch to get the new version of gcc-6. However I when I change stretch back to jessie, and run sudo apt-get update I got a lot of errors. How can I solve it.
pi#raspberrypi ~ $ sudo apt update
Hit:1 http://raspberrypi.collabora.com wheezy InRelease
Get:2 http://mirrordirector.raspbian.org/raspbian jessie InRelease [14.9 kB]
Err:1 http://raspberrypi.collabora.com wheezy InRelease
The following signatures were invalid: FF9FD9E73808E2376CB76F0AED4BF9140C50B1C5
Hit:4 http://archive.raspberrypi.org/debian jessie InRelease
Get:5 http://mirrordirector.raspbian.org/raspbian jessie/main armhf Packages [9534 kB]
Hit:3 https://packagecloud.io/Hypriot/Schatzkiste/raspbian jessie InRelease
Get:6 http://124.202.164.8/files/311600000A34E137/http.debian.net/debian jessie/main armhf Packages [169 kB]
Err:6 http://124.202.164.8/files/311600000A34E137/http.debian.net/debian jessie/main armhf Packages
Writing more data than expected (196868 > 169365)
Hashes of expected file:
- Filesize:169365 [weak]
- SHA256:779179f25b91efa4fdbf69aeb7c37d444e104e3b8d359daf27bc4db4d330003f
- SHA1:aa605ce914ddacfd4b8c71c72bab3a95b76c0ed5 [weak]
- MD5Sum:f0867f34045767904d0caa686f288615 [weak]
Release file created at: Fri, 14 Jul 2017 15:58:01 +0000
Get:7 http://archive.raspbian.org/raspbian jessie InRelease [14.9 kB]
Get:8 http://archive.raspbian.org/raspbian jessie/rpi Sources [1132 B]
Get:9 http://archive.raspbian.org/raspbian jessie/non-free Sources [113 kB]
Get:10 http://archive.raspbian.org/raspbian jessie/main Sources [7754 kB]
Ign:11 https://apt.dockerproject.org/repo raspbian-jessie InRelease
Get:12 http://mirrordirector.raspbian.org/raspbian jessie/contrib armhf Packages [43.3 kB]
Get:13 http://mirrordirector.raspbian.org/raspbian jessie/non-free armhf Packages [84.2 kB]
Get:14 http://mirrordirector.raspbian.org/raspbian jessie/rpi armhf Packages [1356 B]
Err:15 https://apt.dockerproject.org/repo raspbian-jessie Release
gnutls_handshake() failed: The TLS connection was non-properly terminated.
Get:16 http://archive.raspbian.org/raspbian jessie/contrib Sources [64.5 kB]
Reading package lists... Done
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://raspberrypi.collabora.com wheezy InRelease: The following signatures were invalid: FF9FD9E73808E2376CB76F0AED4BF9140C50B1C5
E: The repository 'https://apt.dockerproject.org/repo raspbian-jessie Release' does no longer 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.
My sources.list file
deb http://mirrordirector.raspbian.org/raspbian/ jessie main contrib non-free rpi
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
deb-src http://archive.raspbian.org/raspbian/ jessie main contrib non-free rpi
I had the same issue and below solution worked for me.
Create a file called badproxy with below lines:
Acquire::http::Pipeline-Depth 0;
Acquire::http::No-Cache true;
Acquire::BrokenProxy true;
then copy the file into the apt config folder:
cp ./badproxy /etc/apt/apt.conf.d/99fixbadproxy
I tried above suggestion from docker form
sudo apt remove gnupg
sudo apt install --reinstall gnupg2 (possibly not necessary, but doesn't hurt)
sudo apt install dirmngr
Then run
gpg --keyserver keys.gnupg.net --recv-key FF9FD9E73808E2376CB76F0AED4BF9140C50B1C5
gpg -a --export FF9FD9E73808E2376CB76F0AED4BF9140C50B1C5 | sudo apt-key add -