GithubHelp home page GithubHelp logo

layer8err / wsl2setup Goto Github PK

View Code? Open in Web Editor NEW
58.0 6.0 29.0 44 KB

Install WSL2 and handle dependencies

License: BSD 2-Clause "Simplified" License

PowerShell 100.00%
wsl2 wsl2setup wsl2install

wsl2setup's Introduction

Hi there ๐Ÿ‘‹, My name is Layer8Err

I am always learning

I've been deploying systems and improving processes for as long as I can remember.

Skills: Kubernetes / Helm / Kustomize / Flux CD / Terraform / Python / PowerShell / Bash

github stackoverflow

โ€ƒโ€ƒโ€ƒโ€ƒโ€ƒ

wsl2setup's People

Contributors

layer8err avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

wsl2setup's Issues

Need to check for WSL Update

Need to determine if WSL kernel component update is already installed, so we don't re-install with every run.

HTML parsing fails due to PS version

While selecting a package where URI is not available, the Get-StoreDownloadLink function fails because $newHtml.write($src) does not work. I couldn't dig deep into the "why it doesn't work" but found this StackOverflow answer to be helpful.
Proposed fix -
image

Additional debugging details -

PS C:\Windows\system32> $PSVersionTable

Name                           Value                                                                                                                                        
----                           -----                                                                                                                                        
PSVersion                      5.1.19041.610                                                                                                                                
PSEdition                      Desktop                                                                                                                                      
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                                                      
BuildVersion                   10.0.19041.610                                                                                                                               
CLRVersion                     4.0.30319.42000                                                                                                                              
WSManStackVersion              3.0                                                                                                                                          
PSRemotingProtocolVersion      2.3                                                                                                                                          
SerializationVersion           1.1.0.1       

Here's what the log looks like -

+------------------------------------------------+
| Choose your Distro                             |
| Ubuntu 18.04 is recommended for Docker on WSL2 |
+------------------------------------------------+
1 Ubuntu 20.04
2 Ubuntu 18.04
3 Ubuntu 16.04
4 Debian
5 Kali
6 OpenSUSE Leap 42
7 SUSE Linux Enterprise Server 12
8 Alpine
>: 1
 ...Downloading Ubuntu 20.04.
Exception calling "write" with "1" argument(s): "Type mismatch.
"
At line:95 char:5
+     $newHtml.write($src)
+     ~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : COMException

Invoke-WebRequest : Cannot validate argument on parameter 'Uri'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.
At line:225 char:32
+         Invoke-WebRequest -Uri $distro.URI -OutFile $Filename -UseBas ...
+                                ~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Invoke-WebRequest], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

 ...Beginning Ubuntu 20.04 install.
Add-AppxPackage : Cannot find path 'C:\Windows\system32\CanonicalGroupLimited.Ubuntu20.04onWindows.appx' because it does not exist.
At line:227 char:9
+         Add-AppxPackage -Path $Filename
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (C:\Windows\syst...4onWindows.appx:String) [Add-AppxPackage], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.Windows.Appx.PackageManager.Commands.AddAppxPackageCommand

Start-Process : This command cannot be run due to the error: The system cannot find the file specified.
At line:261 char:9
+         Start-Process $distro.winpe
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Start-Process], InvalidOperationException
    + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand

Other Distribution support

Have you thought about supporting other Distros than Ubuntu. E.g. Debian.

I kind of have trouble finding the "installer link" in microsofts docs.

Links to Distros no longer seem vaild

First part of the script seems to work OK, however after reboot and rerun it can't obtain the appx files from the store:

`
Exception calling "write" with "1" argument(s): "Type mismatch.
"
At line:95 char:5

  • $newHtml.write($src)
    
  • ~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    • FullyQualifiedErrorId : COMException

Invoke-WebRequest : Cannot validate argument on parameter 'Uri'. The argument is null or empty. Provide an argument
that is not null or empty, and then try the command again.
At line:225 char:32

  •     Invoke-WebRequest -Uri $distro.URI -OutFile $Filename -UseBas ...
    
  •                            ~~~~~~~~~~~
    
    • CategoryInfo : InvalidData: (:) [Invoke-WebRequest], ParameterBindingValidationException
    • FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
      `

Broken Links

URIs for Alpine and Ubuntu 20.04 expire, will need to post/parse and get fresh links when installing those distros.
Create new function to handle Windows Store links and return a fresh download URI.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.