WSL Install: Powershell vs MS Store?

1,047 views
Skip to first unread message

Johny Why

unread,
Apr 8, 2023, 9:41:21 PM4/8/23
to ns-3-users
For those on Window Home, is it better to use powershell to install hyper-v? Or use the WSL in Microsoft Store?

------

I used the .bat script here:
https://www.makeuseof.com/install-hyper-v-windows-11-home/

But then i saw this on the store. It says:
"Installing WSL through the store will allow you to get the latest WSL updates and features faster."

-----

Would the store version be better? Can i install it after the .bat install i already did?

Gabriel Ferreira

unread,
Apr 8, 2023, 11:34:09 PM4/8/23
to ns-3-users
Hyper-V is a supervisor (like VirtualBox and VMware). 
If you want to run a VM, you can use it. 

You don't need it for WSL. 
Just the WSL and Virtual Machine Platform (which is basically the core of Hyper-V, 
but Microsoft wanted to differentiate windows pro from home...)
Both can be enabled with a single command line:

wsl --install 

After that, you can go to the store and pick whatever 
distribution you prefer (Ubuntu, fedora, suse). 

Official instructions for wsl are available here: 

Johny Why

unread,
Apr 9, 2023, 12:39:57 AM4/9/23
to ns-3-users
Ok, i followed the Docker instructions. So what's best for ns3? 
WSL + Docker + Linux distro
or
WSL + Linux distro?

The latter obvious looks way lighter. Why would i use Docker?

----

I followed instructions from:

first five minutes of:


------

What can i eliminate here, if i'm not using Docker?

---------

enable virtualization in bios (my BIOS doesn't even have that option, but the PC still supports WSL)

In Windows features, enable:
- hyper-v
- virtualization
- windows subsystem linux
- hyper-v manager

If hv manager not available, use PowerShell to enable Hyper-V in Windows 11 Pro, Edu, and Enterprise edition of the operating system:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-All

if error, save and run this
 hyperv.bat
 
----------------

pushd "%~dp0"



dir /b %SystemRoot%\servicing\Packages\*Hyper-V*.mum >hyper-v.txt



for /f %%i in ('findstr /i . hyper-v.txt 2^>nul') do dism /online /norestart /add-package:"%SystemRoot%\servicing\Packages\%%i"



del hyper-v.txt



Dism /online /enable-feature /featurename:Microsoft-Hyper-V -All /LimitAccess /ALL



pause

------------------

On Windows Server, open Server Manager > Manage > Add roles and features. Move to the Features page and expand Remote server administration tools > Role administration tools > Hyper-V management tools.

------------

cmd:
wsl --set-default-version 2

can now run hyper-v manager, if desired.

----------

stop hyper-v from auto launching on start
cmd
bcdedit /set hypervisorlaunchtype off

-----------

Download and install the Linux kernel update package.
https://docs.microsoft.com/windows/wsl/wsl2-kernel

--------

Download Docker Desktop for Windows.
https://desktop.docker.com/win/main/amd64/Docker%20Desktop%20Installer.exe

Johny Why

unread,
Apr 9, 2023, 12:51:43 AM4/9/23
to ns-3-users
You gave me very helpful info. 
But i just realized i misspoke. 

Correction:
Is it better to install WSL with powershell?
Or install WSL from Microsoft Store?

Gabriel Ferreira

unread,
Apr 9, 2023, 2:28:41 PM4/9/23
to ns-3-users
Whatever is easier for you. Shouldn't be any different. 

Johny Why

unread,
Apr 9, 2023, 4:03:55 PM4/9/23
to ns-3-users
The store version claims the updates are faster and more reliable with the store version, compared to manual installation. 
You disagree?

thx

Gabriel Ferreira

unread,
Apr 9, 2023, 4:19:23 PM4/9/23
to ns-3-users
Considering I got to use it when WSL was just released and was completely unstable... 

Whatever you get today is stable and up-to-date for you to use. 
Get whatever you prefer. 

Johny Why

unread,
Apr 9, 2023, 4:43:29 PM4/9/23
to ns-3-users
I think you have a misunderstanding. 

It's not about whether the current version is up-to-date. 

It's about receiving new updates as they become available. 

"Installing WSL through the store will allow you to get the latest WSL updates and features faster."

Gabriel Ferreira

unread,
Apr 9, 2023, 4:48:15 PM4/9/23
to ns-3-users
The user land distro won't be updated via the store, but the usual packet manager. 
The only component that gets updated by the store is the kernel, which is irrelevant to ns-3. 

Johny Why

unread,
Apr 9, 2023, 4:59:21 PM4/9/23
to ns-3-users
Ok, kernel may be "irrelevant" to ns3, but if i prefer my WSL to stay up-to-date, the store claims to do that. 
My question is: Even with a manual install, won't Windows Updater keep WSL updated?

Gabriel Ferreira

unread,
Apr 9, 2023, 5:28:25 PM4/9/23
to ns-3-users
As far as I know, it won't. There is a separate installer for that. 

johny why

unread,
Apr 9, 2023, 5:49:03 PM4/9/23
to ns-3-...@googlegroups.com
The store version claims updates will be more reliable than the manual install. 

You disagree?


--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
You received this message because you are subscribed to a topic in the Google Groups "ns-3-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ns-3-users/RC3IJn17RRs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ns-3-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ns-3-users/1901e657-8206-41db-9006-168b3f1df548n%40googlegroups.com.

Gabriel Ferreira

unread,
Apr 9, 2023, 5:57:05 PM4/9/23
to ns-3-users
I just don't care about updates. Install it from the store if you want it and it works for you. 

Ashley Tharp

unread,
Apr 10, 2023, 4:02:43 PM4/10/23
to ns-3-...@googlegroups.com
Using WSL is slightly more easy than using Docker in my experience in that a WSL distro image can save state, whereas a Docker container will lost all state as soon as I exit and stop the running container. I use WSL for most of my ns-3 development needs on Windows-hosted Linux environments. 

A moderator here mentioned adding such content to the documentation, and I will make a PR as soon as I have more time to go through the contributor guidelines, but feel free to use this link for now until I get to that point. 

This tutorial is just for how to quickly import and export tarballs from WSL, which I like to do if I want to toss my tarball at another dev and say like, "hey check this out" and my environment and what not is all already set up. However, these files are large. Like an Ubuntu image with ns-3 on it came to over 10GB. Loading time is small for me, it takes maybe 10 seconds to import the tarball, so not a big deal there. 


HOWEVER, (caps for emphasis)

Docker I find is much better for testing and keeping my environments perfect and encapsulated. I find this super handy when for example, some feature I want only works in ns-3.37, and the other feature I want only works in ns-3.34 (probably because of conversion from WAF to CMake or other backwards compatibility stuff)

I like having a Dockerfile for each version of ns-3, as a Dockerfile is just a single lightweight file. I have an example repo https://github.com/sitting-duck/simple-ns3-lte that shows how I set up a simple build for ns-3.34 using a Docker file. 
I am mainly interested in lte networks, but to use this example repo, you needn't be, you may be able to take what you like from my Dockerfile and use it as a template. 

I can export a tarball from WSL, but my last Ubuntu image tarball was 10GB, which is a bit large to just be attaching to emails, whereas a Dockerfile is much quicker and easier to share. 

tldr; 
Dockerfiles are easier to share, but take more work to create
Docker is better for controlling the environment perfectly because it forces me to think in a "stateless" way. 
I use WSL more for prototyping because it is more flexible and more deeply engrained with the Windows OS, hence more convenient. 
I use docker more for testing, since it forces me to build my own environment in a Dockerfile or else lose my environment state when I exit the container. 

Tommaso Pecorella

unread,
Apr 10, 2023, 6:35:04 PM4/10/23
to ns-3-users
How to keep a docker container "alive":
  • docker container create -i -t --name ns-3-dev ubuntu:22.04
  • docker container start --attach -I ns-3-dev
  • [do your stuff, then exit the container]
  • docker container stop ns-3-dev
  • [do other stuff... shut down the machine, do other stuff...]
  • docker container start --attach -I ns-3-dev
  • [keep on from where you left]
rinse and repeat.

Tommaso Pecorella

unread,
Apr 10, 2023, 6:37:39 PM4/10/23
to ns-3-users
Note on the above: the auto-corrector changed a "-i" to a "-I". Blame the stupid autocorrect, it's "attach -i"
Reply all
Reply to author
Forward
0 new messages