[LINUX] Solved the problem that apt-get update could not be executed on Ubuntu (Virtual Box) on Windows.

Introduction

Taking off from the Linux development environment in VirtualBox (on Windows) Recently, I am developing on a laptop computer (Linux machine).

However, I suddenly missed the familiar Windows environment and returned to VirtualBox. And when I tried to install Java on Ubuntu in VirtualBox, I got an error. (The error statement will be described later)

Not to mention apt install openjdk-14-jdk-headless Even sudo apt-get update returns an error. The same is true for sudo apt update.

I don't usually enter commands for Java installation, so I suspect there may be some spelling mistakes or other causes.

However, because the command sudo apt update, which is entered on a daily basis, is also played, I thought that something fundamental was the problem.

This article is the one that struggled to solve this problem.

In addition, including those that did not lead to a solution in my case For those who experience the same phenomenon, ** URLs of all referenced materials are listed in #参考. ** **

What would you like to say in this article?

When you start VirtualBox on Windows, be careful because it will not work properly unless you turn off Hyper-V (hypervisor). I think it's more likely to happen, especially when you come back to VirtualBox after touching other virtualization technologies like WSL and Docker.

Execution environment

error contents

It's so long that I've omitted some of the likely duplication.

Get:1 http://security.ubuntu.com/ubuntu focal-security InRelease [109 kB] Get:2 http://jp.archive.ubuntu.com/ubuntu focal InRelease [265 kB]
Get:3 http://jp.archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB] Get:4 http://jp.archive.ubuntu.com/ubuntu focal-backports InRelease [101 kB] Get:5 http://jp.archive.ubuntu.com/ubuntu focal/main i386 Packages [718 kB] Get:6 http://jp.archive.ubuntu.com/ubuntu focal/main amd64 Packages [970 kB] Err:6 http://jp.archive.ubuntu.com/ubuntu focal/main amd64 Packages Hash Sum mismatch Hashes of expected file:

  • Filesize:970408 [weak]

~ Omitted ~

E: Failed to fetch http://jp.archive.ubuntu.com/ubuntu/dists/focal/main/binary-amd64/by-hash/SHA256/7757921ff8feed9c3934a0c9936d441ba4a238bee3ea6c8c1df5cbcd43fc9861 Hash Sum mismatch Hashes of expected file: - Filesize:970408 [weak]

~ Omitted ~

E: Some index files failed to download. They have been ignored, or old ones used instead.

Solutions

From "Turn Windows features on or off", uncheck "Windows hypervisor platform" and restart the entire Windows machine. image.png

Also, if Hyper-v, which is a virtualization function unique to Windows, is enabled, VT-x and AMD-v cannot be used, so it is necessary to disable it. This setting can be operated from the control panel. Oracle VM VirtualBox installation procedure

reference

-Oracle VM VirtualBox installation procedure -Relationship between WSL2 and Hyper-V -Enable Hyper-V on Windows 10 | Microsoft Docs -How can I fix the apt-get update "hash total mismatch" -"Apt-get update" always failed to fetch -Ubuntu Japanese Forum / Software update is not possible. -What to do if a Hash Sum mismatch error is output during apt-get update -Ubuntu apt-get update resolves "File has unexpected size" error -What to do if Ubuntu's apt-get update says "hash sum does not match" -When Failed to fetch occurs in Ubuntu apt-get install -Solution when Ubuntu 18.04 sudo apt-get update command fails to fetch error

Recommended Posts

Solved the problem that apt-get update could not be executed on Ubuntu (Virtual Box) on Windows.
Solved the problem that the test could not be executed from the command line with spring-boot-starter-test
The story that the forced update could not be implemented
The case that "apt-get update" defined in "Dockerfile" could not be done at the time of "docker-compose build"
The story that I could not build after installing multiple Java on Windows
Solved the problem that profile and logout were not displayed on the screen after signup.
Solved the problem that the scroll event did not fire in JQuery
File transfer to virtual environment that could not be solved even after trying for a day: Memorandum
About the problem that the server can not be started with rails s
How to solve the problem that notification cannot be requested on iOS14
Solved the problem of freezing due to sudden "EXT4-fs error" on Ubuntu 20.04
The story that the Servlet could not be loaded in the Java Web application
ValidationMessages.properties should not be multiple on the classpath
The story that did not disappear when I tried to delete mysql on ubuntu