canonical / multipass

Multipass orchestrates virtual Ubuntu instances
https://multipass.run
GNU General Public License v3.0
7.7k stars 638 forks source link

Downloaded image hash does not match (stale network cache) #1714

Open oSoMoN opened 4 years ago

oSoMoN commented 4 years ago

I can reliably observe this:

$ multipass launch snapcraft:core18
launch failed: Downloaded image hash does not match

The only logs (from journalctl) are this:

sept. 01 15:18:03 bribon multipassd[7063]: Read pid "7189" from file "/var/snap/multipass/common/data/multipassd/network/dnsmasq.pid"
sept. 01 15:18:03 bribon multipassd[7063]: existing dnsmasq found with pid 7189

Additional info

Saviq commented 4 years ago

Hey @oSoMoN, does snap restart multipass, or rebooting, help? Do you have a proxy set up?

Saviq commented 4 years ago

This should get you going, btw:

snap stop multipass
sudo rm -rf /var/snap/multipass/common/cache/multipassd/network-cache/
snap start multipass
oSoMoN commented 4 years ago

Hey @oSoMoN, does snap restart multipass, or rebooting, help? Do you have a proxy set up?

snap restart multipass didn't help. I couldn't test rebooting as I have long-running local processes that I'd rather not interrupt. No proxy.

Deleting the network-cache folder and restarting multipass did the trick, though. Thanks!

How could it possibly get in such a state?

Saviq commented 4 years ago

How could it possibly get in such a state?

Looks like QNetworkDiskCache, that we have in front of our HTTP requests, decided it won't grab the new SHA256SUMS file. We'll need to dig if we can ask it to check if the file got updated, first.

townsend2010 commented 2 years ago

Upon some debugging and digging, I've found that this is caused by a Qt bug: https://bugreports.qt.io/browse/QTBUG-81318

There is a proposed fix since August 2020, but it remains unmerged: https://codereview.qt-project.org/c/qt/qtbase/+/296092

Seeing as this goes against the default and described behavior, this is pretty bad on Qt's part. See the QNetworkRequest::PreferNetwork part in https://doc.qt.io/qt-5/qnetworkrequest.html#CacheLoadControl-enum

UchihaYuki commented 2 years ago

I got the same issue on windows 10 pro.

C:\Data\projects\makabaka>multipass version
multipass   1.9.1+win
multipassd  1.9.1+win

C:\Data\projects\makabaka>multipass.exe launch -c=4 -m=8G -d=20G -n=makabaka-1-1 20.04
launch failed: Downloaded image hash does not match

I just uninstalled version 1.8 and installed version 1.9 and restarted my PC, and still got this error. Is there a way to get around it?

I download ubuntu-20.04-server-cloudimg-amd64.img manually and the md5sum is corrected. Is there a way to tell multipass to use the manually downloaded file?

I moved my manually downloaded file to C:\ProgramData\Multipass\cache\vault\images\focal-20220706, but it get removed, and downloaded again when I run multipass launch.

townsend2010 commented 2 years ago

Hi @UchihaYuki,

Yeah, it's a Qt bug. You need to remove, C:\ProgramData\Multipass\cache\network-cache and restart the Multipass service and that should clear it up.

ahdeanlau commented 1 year ago

I able to solve it by reinstall multipass on my mac

kokizzu commented 5 months ago

this still happened until now '__') but that workaround above seems to work

sudo snap stop multipass
sudo rm -rf /var/snap/multipass/common/cache/multipassd/network-cache/
sudo snap start multipass
sleep 1m; multipass launch jammy --cpus 2 --disk 20G --memory 8G --name ubu22

but after a while it's error again

Apr 13 13:34:20 pop2204 multipassd[25405]: Error getting https://cloud-images.ubuntu.com/releases/server/releases/jammy/release-20240319/ubuntu-22.04-server-cloudimg-amd64.img: Network timeout - trying cache.
Apr 13 13:34:20 pop2204 multipassd[25405]: Verifying hash "304983616fcba6ee1452e9f38993d7d3b8a90e1eb65fb0054d672ce23294d812"

or is there any way to download the image manually with more reliable software like aria2c?

or add an auto-retry for people that live in country with slow and unreliable internet?

zhhuabj commented 4 weeks ago

I also hit this issue today on ubuntu 24.04,

$ multipass --version multipass 1.14.0 multipassd 1.14.0 $ cat /etc/os-release |grep 24.04 PRETTY_NAME="Ubuntu 24.04 LTS" VERSION_ID="24.04" VERSION="24.04 LTS (Noble Numbat)"

I also fixed it by using above workaround.

georgeliao commented 4 weeks ago

One thing you guys can also try is multipass find --force-update, that forces downloading the image info from the network. As a result, network-cache should be overwritten if the download is successful.