jasonacox / Powerwall-Dashboard

Grafana Monitoring Dashboard for Tesla Solar and Powerwall Systems
MIT License
270 stars 57 forks source link

Updated Windows 11 Install Instructions #378

Closed BJReplay closed 8 months ago

BJReplay commented 8 months ago

Updated Windows 11 Install Instructions New Windows 11 Docker without Docker Desktop Install Instructions May address some concerns as discussed in #63 Have changed absolute to relative references in README.md to enable testing links on forked repo.

mcbirse commented 8 months ago

Thanks Bernard for the great instructions!

I'm going to test following the Running without Docker Desktop instructions on my Windows test machine and see how I go.

BJReplay commented 8 months ago

I'm going to test following the Running without Docker Desktop instructions on my Windows test machine and see how I go.

Thanks.

I just remembered there's one more step to add in. I'm going to add it to the commit chain in a moment - it's to change iptables to legacy:

sudo update-alternatives --config iptables

  Selection    Path                       Priority   Status
------------------------------------------------------------
  0            /usr/sbin/iptables-nft      20        auto mode
* 1            /usr/sbin/iptables-legacy   10        manual mode
  2            /usr/sbin/iptables-nft      20        manual mode

choose iptables-legacy (should be option1)

I also realised that my start WSL scheduled task included a bash script that calls backfill.sh which in turn calls your backfill script - so I need to change that :)

BJReplay commented 8 months ago

Changes made - WINDOWS.md updated for your testing @mcbirse

BJReplay commented 8 months ago

One more thing @mcbirse, if you're doing this on your windows test machine where you were previously running Docker Desktop, you'll need to clean up docker desktop config. I've got to run out the door now, but if you get an error about docker auth, you'll need to blow away the docker config, and do a docker login, having set up a docker auth.

mcbirse commented 8 months ago

One more thing @mcbirse, if you're doing this on your windows test machine where you were previously running Docker Desktop, you'll need to clean up docker desktop config. I've got to run out the door now, but if you get an error about docker auth, you'll need to blow away the docker config, and do a docker login, having set up a docker auth.

Thanks! No need to worry though - I went all out to keep a "clean" test machine and backed up the Windows OS to an image with Macrium Reflect, before even installing anything (including WSL). I have restored this backup about 5 times now, lol.

So I have been able to ensure I can test with a pretty clean Windows each time (only thing installed on it was my car ECU tuning software and Motec dash display stuff - that's another story).

I originally tried to set up a Windows VM for testing, but had trouble with WSL due to nested virtualisation. Would have been easier to just restore a snapshot each time...

mcbirse commented 8 months ago

TL;DR - In summary, we should revise the instructions to remove any references to Windows 10 (heading does say already Windows 11 instructions 👍 ). And, revise the section "The host system will require" and add "Windows 11".


Okay so... I attempted to set up my Windows 10 test laptop following the "Running without Docker Desktop" instructions, and ended up in a world of pain and going down a rabbit hole trying to get WSL to work with the Hyper-V Virtual Network Bridge interface. 😠

The consensus seems to be that this is simply not supported with WSL on Windows 10.

@BJReplay - did you get this working in Windows 10, or was it Windows 11? I'm not a Windows guru so it could just be me.

Given the issues I had though, I think perhaps we should revise the section "The host system will require" and add "Windows 11". Or else some other poor soul will waste hours trying to get it to work, like I did. Especially since the first section about WSL mentions minimum requirement of version 1093 of Windows 10 which may make one think Windows 10 is fine.

WSL2 itself will work in Windows 10, and the main (easy) instructions from the README (using Docker Desktop) do work in Windows 10.

The issues I had under Windows 10 were related to the bridged networking setup, and I could not proceed past that point.

Some details:

I was testing on Windows 10 Pro version 22H2 build 19045.3570 (latest I think). Also updated to latest WSL2 available to me and the pre-release update as well.

First issue I had was with this command: Install-WindowsFeature -Name Hyper-V -IncludeManagementTools -Restart

I received an error: The term 'Install-WindowsFeature' is not recognized as the name of the cmdlet

Looking into that it appears I needed RSAT for Windows 10 (which I went and installed) but that didn't fix it. I know I could have probably just gone into Control Panel -> Programs and Features -> Turn Windows features on or off, and tick the Hyper-V box to install, but was looking for the equivalent PowerShell command...

I found this worked instead: Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-All

So, first issue solved.

Next, setting up the Virtual Network Bridge adapter all went fine, and I updated the .wslconfig to use the WSLBridge interface - this is where I got stuck.

When attempting to start Ubuntu, I got the error "The virtual machine or container JSON document is invalid".

This sent me down the rabbit hole of trying to work out why, with the result being if you are on Windows 10 and trying to set up WSL to use a different network interface - don't - give up now - you are better off upgrading to Windows 11 if you can (which I cannot on this laptop, as the hardware is too old).

I did find a workaround, which I did actually get working (but yet to test the rest of the instructions, I got tired and was driven to drink - a nice single malt at least). But it involves setting the default "WSL" interface to External, which is problematic since this interface is dynamically created/removed whenever WSL starts or shuts down. And setting it back to Internal just after shutdown seems critical unless you want a busted network environment in Windows.

So at least we can advise Windows 10 will not work? (happy to be proven wrong with some simple magical workaround)

Windows is a PITA. I probably need to get myself a Windows 11 test machine, but this experience has strengthened my opinion of Windows for these kinds of things (which I'm sure you can guess is not favourable).


Otherwise regarding the instructions and this PR, as mentioned perhaps a couple of revisions around requirements (Windows 11) and remove Windows 10 references, etc. I will review again once I have some more time as I noted a couple of other changes I would suggest.

BJReplay commented 8 months ago

Out and about today. I didn't try Windows 10, only 11. Sorry.

Agreed suggestion to revise for Win 11 only.

Apologies for the pain.

I hope that you enjoyed the restorative single malt.

Will review and revise when I get back home.

mcbirse commented 8 months ago

No worries all good - please revert my change.

The many threads I read about WSL on Windows 10 being configured to use a different network interface to the default "WSL" interface, seem to indicate it was not possible.

mcbirse commented 8 months ago

Hi @BJReplay - I eventually got this mostly working on Windows 10, with Docker starting/running in WSL after following the rest of the instructions, and of course Powerwall-Dashboard all set up and working. Thanks for documenting these instructions!

The only remaining problem I had on Windows 10 was to do with the bridged network setup. It seems it is not possible to configure WSL to use a different network interface (it will use the "WSL" interface only on Win10). At least that was the case for me.

I used a work around which would set the "WSL" interface to external when starting WSL. Not ideal and certainly not recommended, as it sometimes caused network issues on the host, but it mostly worked.

jasonacox commented 8 months ago

Thanks @BJReplay for putting this together! This is a great addition to the project. 🙏

Thanks @mcbirse for the testing, updates and... let's be honest... one of the best single malt reviews I've ever seen. 😂

Windows is a PITA. I probably need to get myself a Windows 11 test machine, but this experience has strengthened my opinion of Windows for these kinds of things (which I'm sure you can guess is not favourable).

And I thought it was just me... 🤣

BJReplay commented 8 months ago

And I thought it was just me...

It is a matter of what you're familiar with, for sure!

I used to enjoy learning new OSes and languages, but I find it harder, now.

Having started with Z80 and 6502 machine code (not assembler, mind you, machine code), then graduated to Apple DOS, CP/M and luxuries such as OSes, System 360 assembler, PL/AS, COBOL, when Windows 3.11 came out and you could have the luxury of a GUI and a command prompt at the same time, I didn't mind it.

I've used that many OSes and languages that I've lost track.

I still have the Wordstar manual from 1981 that provides the information on how to write your printer driver in machine code for an unsupported printer (it supported a total of 6 printers from two manufacturers).