{"id":312,"date":"2021-01-02T15:52:25","date_gmt":"2021-01-02T23:52:25","guid":{"rendered":"http:\/\/bornski.com\/maria\/blog\/?p=312"},"modified":"2022-11-21T13:54:04","modified_gmt":"2022-11-21T21:54:04","slug":"adventures-in-programming-wsl-and-time-drift","status":"publish","type":"post","link":"https:\/\/bornski.com\/maria\/blog\/2021\/01\/02\/adventures-in-programming-wsl-and-time-drift\/","title":{"rendered":"Adventures in programming: WSL and time drift"},"content":{"rendered":"\n<p>I went to try to install <code>golang<\/code> on my WSL install today, but my packages lists for <code>apt-get<\/code> were apparently out of date, so I got an error:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>E: Failed to fetch http:\/\/security.ubuntu.com\/ubuntu\/pool\/main\/l\/linux\/linux-libc-dev_5.4.0-52.57_amd64.deb  404  Not Found &#91;IP: 91.189.88.152 80]\r\nE: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?<\/code><\/pre>\n\n\n\n<p>Theoretically, this should be easy to solve with <code>apt-get update<\/code>, as recommended right there in the error message, but I got an error there too:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo apt-get update\nHit:1 http:\/\/archive.ubuntu.com\/ubuntu focal InRelease\nGet:2 http:\/\/security.ubuntu.com\/ubuntu focal-security InRelease &#91;109 kB]\nGet:3 http:\/\/archive.ubuntu.com\/ubuntu focal-updates InRelease &#91;114 kB]\nGet:4 http:\/\/archive.ubuntu.com\/ubuntu focal-backports InRelease &#91;101 kB]\nReading package lists... Done\nE: Release file for http:\/\/security.ubuntu.com\/ubuntu\/dists\/focal-security\/InRelease is not valid yet (invalid for another 22h 43min 18s). Updates for this repository will not be applied.\nE: Release file for http:\/\/archive.ubuntu.com\/ubuntu\/dists\/focal-updates\/InRelease is not valid yet (invalid for another 22h 43min 31s). Updates for this repository will not be applied.\nE: Release file for http:\/\/archive.ubuntu.com\/ubuntu\/dists\/focal-backports\/InRelease is not valid yet (invalid for another 22h 43min 55s). Updates for this repository will not be applied.<\/code><\/pre>\n\n\n\n<p>According to <a href=\"https:\/\/askubuntu.com\/questions\/1096930\/sudo-apt-update-error-release-file-is-not-yet-valid\">https:\/\/askubuntu.com\/questions\/1096930\/sudo-apt-update-error-release-file-is-not-yet-valid<\/a>, this happens if your clock is incorrect.  My laptop clock looked OK, but the clock inside WSL was ~11 minutes behind.  It turns out this is a known issue that the clock in WSL can get out of sync with the actual time clock: <a href=\"https:\/\/github.com\/microsoft\/WSL2-Linux-Kernel\/issues\/16\">https:\/\/github.com\/microsoft\/WSL2-Linux-Kernel\/issues\/16<\/a>  Luckily, the fix was quite simple:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ date\nFri Jan  1 15:15:58 PST 2021\n$ sudo hwclock --hctosys\n$ date\nSat Jan  2 15:26:40 PST 2021<\/code><\/pre>\n\n\n\n<p>Running <code>sudo hwclock --hctosys<\/code> told WSL to sync its clock with the underlying hardware clock.  Since that clock was already correct in my case, my problem was fixed and I was able to run <code>apt-get update<\/code> successfully, then install <code>golang<\/code>.  And now that I&#8217;m documenting the solution for myself, it should be faster to figure out what&#8217;s going on next time!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I went to try to install golang on my WSL install today, but my packages lists for apt-get were apparently out of date, so I got an error: Theoretically, this should be easy to solve with apt-get update, as recommended right there in the error message, but I got an error there too: According to &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/bornski.com\/maria\/blog\/2021\/01\/02\/adventures-in-programming-wsl-and-time-drift\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Adventures in programming: WSL and time drift&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[28],"tags":[37,35,38],"_links":{"self":[{"href":"https:\/\/bornski.com\/maria\/blog\/wp-json\/wp\/v2\/posts\/312"}],"collection":[{"href":"https:\/\/bornski.com\/maria\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bornski.com\/maria\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bornski.com\/maria\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bornski.com\/maria\/blog\/wp-json\/wp\/v2\/comments?post=312"}],"version-history":[{"count":2,"href":"https:\/\/bornski.com\/maria\/blog\/wp-json\/wp\/v2\/posts\/312\/revisions"}],"predecessor-version":[{"id":316,"href":"https:\/\/bornski.com\/maria\/blog\/wp-json\/wp\/v2\/posts\/312\/revisions\/316"}],"wp:attachment":[{"href":"https:\/\/bornski.com\/maria\/blog\/wp-json\/wp\/v2\/media?parent=312"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bornski.com\/maria\/blog\/wp-json\/wp\/v2\/categories?post=312"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bornski.com\/maria\/blog\/wp-json\/wp\/v2\/tags?post=312"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}