{"id":9532,"date":"2023-07-26T15:30:30","date_gmt":"2023-07-26T13:30:30","guid":{"rendered":"https:\/\/via-internet.de\/blog\/?p=9532"},"modified":"2023-07-26T15:30:35","modified_gmt":"2023-07-26T13:30:35","slug":"wsl-wrong-date","status":"publish","type":"post","link":"https:\/\/via-internet.de\/blog\/2023\/07\/26\/wsl-wrong-date\/","title":{"rendered":"WSL: Wrong Date"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">When checking the date in WSl, it display the wrong date<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\u276f date\nWed Jul 26 15:28:20 CEST 2023<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">So setup the correct date, you could run either<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\u276f sudo hwclock -s<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">or setup a timesync daemon (described <a href=\"https:\/\/github.com\/microsoft\/WSL\/issues\/8204#issuecomment-1338334154\" data-type=\"URL\" data-id=\"https:\/\/github.com\/microsoft\/WSL\/issues\/8204#issuecomment-1338334154\" target=\"_blank\" rel=\"noreferrer noopener\">here<\/a>)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Add these lines to the&nbsp;<code>\/etc\/wsl.conf<\/code>&nbsp;(note you will need to run your editor with sudo privileges, e.g:&nbsp;<code>sudo nano \/etc\/wsl.conf<\/code>):<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">[boot]\nsystemd=true\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">And close out of the nano editor using CTRL+O to save and CTRL+X to exit. Now close your WSL distro windows and run&nbsp;<code>wsl.exe --shutdown<\/code>&nbsp;from PowerShell, then restart your WSL instance. Upon launch you should have&nbsp;<code>systemd<\/code>&nbsp;running.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Now install&nbsp;<code>systemd-timesyncd<\/code>:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo apt install systemd-timesyncd\nsudo systemctl edit systemd-timesyncd\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">In the second step, when editing, add the two lines beginning with&nbsp;<code>[Unit]<\/code>, as shown below:<br><a target=\"_blank\" rel=\"noreferrer noopener\" href=\"https:\/\/user-images.githubusercontent.com\/6633152\/205764109-a6710872-292d-4567-ad65-3ef341244c61.png\"><\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Now start it:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo systemctl start systemd-timesyncd\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Check status with:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">timedatectl status\ntimedatectl timesync-status<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>When checking the date in WSl, it display the wrong date So setup the correct date, you could run either or setup a timesync daemon (described here) Add these lines to the&nbsp;\/etc\/wsl.conf&nbsp;(note you will need to run your editor with sudo privileges, e.g:&nbsp;sudo nano \/etc\/wsl.conf): And close out of the nano editor using CTRL+O to save and CTRL+X to exit. Now close your WSL distro windows and run&nbsp;wsl.exe &#8211;shutdown&nbsp;from PowerShell, then restart your WSL instance. Upon launch you should have&nbsp;systemd&nbsp;running. Now install&nbsp;systemd-timesyncd: In the second step, when editing, add the two lines beginning with&nbsp;[Unit], as shown below: Now start it: Check [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-9532","post","type-post","status-publish","format-standard","hentry","category-allgemein"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/via-internet.de\/blog\/wp-json\/wp\/v2\/posts\/9532","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/via-internet.de\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/via-internet.de\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/via-internet.de\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/via-internet.de\/blog\/wp-json\/wp\/v2\/comments?post=9532"}],"version-history":[{"count":1,"href":"https:\/\/via-internet.de\/blog\/wp-json\/wp\/v2\/posts\/9532\/revisions"}],"predecessor-version":[{"id":9533,"href":"https:\/\/via-internet.de\/blog\/wp-json\/wp\/v2\/posts\/9532\/revisions\/9533"}],"wp:attachment":[{"href":"https:\/\/via-internet.de\/blog\/wp-json\/wp\/v2\/media?parent=9532"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/via-internet.de\/blog\/wp-json\/wp\/v2\/categories?post=9532"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/via-internet.de\/blog\/wp-json\/wp\/v2\/tags?post=9532"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}