Running Snaps on WSL2 (Insiders only for now)

You’re correct that it seems there is an unescaped pair of parentheses which is causing BASH to complain. I’ve not given the docker tech preview a try yet, but I’ll download and see what I can discover :slight_smile: Thanks for your continuing help debugging and suggestions.

I’ve got docker for wsl2 tech preview running!

You need to edit /usr/sbin/enter-systemd-namespace and change line 20 to:

/bin/bash -c 'set -a; source "$HOME/.systemd-env"; set +a; exec bash -c '"$(printf "%q" "$@")"

Edit: this has broken VSCode again :frowning: still working on it
Edit2: fixed - both docker for wsl2 tech preview and vscode remote extension are working for me with the line above (I’ve amended the original post to show the full file that I’m using)

That fixed it I’m up and running with WSL2, with VSCode, and Snap. Docker and docker-compose are working. Now I am trying to get Snap working with a docker build. Thank you @daniel.

1 Like

With systemd enabled using this guide (complete with the custom kernel, it might works too without it). I able to use docker in WSL2 natively in Ubuntu without Docker Desktop Tech Preview. Using Docker Desktop Tech Preview with this setup, gives me an error that the daemon cannot start. Just don’t forget to “docker login” first in Ubuntu WSL2 befor using “docker run” or “docker pull” command. Thanks so much Daniel!.

1 Like

Working great, was able run snaps now.
Is there some way to disable the system information echo, when starting a new bash session?

This does enable Snaps for me, however I hit a few snags along the way:

I was unable to compile my own Kernel from the repo listed - I got a bunch of compile errors.
I followed along with the precompiled kernel instead which did get me to the end result of working Snaps, however my WSL2 terminal now starts as Root, rather than my user.