mirror of
https://github.com/sickcodes/Docker-OSX.git
synced 2026-01-11 21:10:25 +01:00
Windows Subsystem Linux #32
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @selfagency on GitHub (Jun 12, 2020).
Any way to make this work under Windows Subsystem Linux? When I get to the final installation step before downloading the container, I get the error:
@SuperSandro2000 commented on GitHub (Jun 12, 2020):
WSL has no full kernel. You can try WSL2 but don't get your hopes up to heigh.
@selfagency commented on GitHub (Jun 12, 2020):
I'm using WSL 2 😔
@sickcodes commented on GitHub (Jun 15, 2020):
Looks possible https://twitter.com/unixterminal/status/1272236470074564610?s=21
@selfagency commented on GitHub (Jun 15, 2020):
sweet, he wrote it up https://boxofcables.dev/accelerated-kvm-guests-on-wsl-2/
@taylor-shift commented on GitHub (Jun 17, 2020):
(I am updating this post as I find out more about what steps the article was missing)
The article is good but it's missing a lot of key pieces on how to get X11 working in Windows, which leaves the user to have to figure it out themselves and wonder why it won't work...
I had to wrestle very hard to get this project not working but close to working on WSL2. There's a lot of subtleties in the way you have to configure the env vars for X11 for it to work with an Xserver running on Windows as well as dealing with firewall rules. The article fails to mention these with the exception of how to set the DISPLAY variable. It is part of the setup for a guide specifically on WSL2, so I wouldn't say it's out of scope.
For more information, check this SO post:
https://stackoverflow.com/questions/61110603/how-to-set-up-working-x11-forwarding-on-wsl2/61110604#61110604
X11 works, the kvm-ok output looks good, so does catting to see if nested virt is enabled, docker service is running + libvirtd, kvm_intel is loaded and configured with the options in the article. I'm at the last step where you run the docker command to launch the container. My only issue now is I'm getting a Could not access the KVM module whenever I do, even though my user is added to the KVM group and permissions are set correctly or should be. It's not x11 because I can run xterm a couple of other x11 utils.
It also fails to mention that most distros on the Windows store are going to setup for WSL1 Not 2, and that you’ll have to “convert” them to WSL2 before you’re even allowed to los a custom kernel or enable nested kvm.
If anyone has any suggestions or something I should post to get a better answer, I would love some. If I figure this out, I'll def write a script for it. Well...you'd have to have two. One bash, one batch that will each do the necessary steps in Win and nix. What would be the legalities of including a precompiled kernel image with the KVM driver? It would reduce a lot of friction for people who have no idea what a kernel even and increase adoption
@taylor-shift commented on GitHub (Jun 17, 2020):
Also, if you follow his guide, any of the commands in the README to run the container fail because we're attaching extra chars to the DISPLAY env var
@sickcodes commented on GitHub (Jun 18, 2020):
Regarding legal: the user has to accept or reject apples terms during install.
@sickcodes commented on GitHub (Jun 18, 2020):
@luisroel91 awesome stuff btw, feel free to create a pull request if you want to get it rolling.
Or if you have the bash output you can just summarize it here ill add it to the dockerfile
I think having all scripts and text inside the dockerfile is awesome, it makes them truly portable. E.g paste into stdin and done
@selfagency commented on GitHub (Jun 18, 2020):
can barely contain my excitement tbh
@taylor-shift commented on GitHub (Jun 18, 2020):
Apologies for my lack of clarity. Part of the process of getting this working is grabbing the Linux kernel sources specifically altered to run on WSL2, altering config by adding the kvm_intel module + virtio + linux guest support and then recompiling the kernel. What I meant to ask was, what would be the legality of including a precompiled MS Linux kernel and distributing that instead of having the user recompile when they might not even have an idea what a kernel is.
Will do. I have to get passed the kvm access denied (despite adding user to proper groups) I am fully committed to getting this working. I go to a school that's mac based but due to the quarantine, a lot of us don't have access to macs....guess what OS the school's grading system runs its unit tests on :|
@sickcodes commented on GitHub (Jun 18, 2020):
Awesome :)
Precomplied sounds fine, Linux is open source, you already posted a link to this instructions right? I’m gonna boot into Windows 10 hopefully today and have a go with it
@taylor-shift commented on GitHub (Jun 19, 2020):
I am in the process of writing up instructions from 0 up to the point I got (which is trying to run the docker command and getting KVM access denied). The Hayden Bowles article details how to recompile the kernel, yeah
@sickcodes commented on GitHub (Jul 4, 2020):
Keep us posted @luisroel91 :) Or create a new branch if you want or are halfway thru
@jamestalbot3 commented on GitHub (Aug 7, 2020):
@luisroel91 did you ever get it working? i'm at the same point, using the Hayden Bowles kernel. Still getting this error:
Edit: Apparently I'm an idiot and I missed a command under the troubleshooting section. I'm up and running with no issue (besides slow performance due to old hardware).
@ghasemikasra39 commented on GitHub (Dec 9, 2020):
Any update regarding running this container on windows 10?
@sickcodes commented on GitHub (Mar 19, 2021):
Hey @jamestalbot3 how slow was it running? WSL2 may have had some performance updates in the last few months with respect to kvm
@jamestalbot3 commented on GitHub (Mar 19, 2021):
It varied a lot, just wasn't too consistent. I didn't keep using it because I couldn't get imessage and facetime working otherwise I'd upload a recording for you.
@sickcodes commented on GitHub (Mar 19, 2021):
This will fix iMessage: https://github.com/sickcodes/Docker-OSX#serial-numbers
@sickcodes commented on GitHub (Mar 20, 2021):
Looks like @steeve got it working on Hyper-V
https://twitter.com/steeve/status/1297618048946442243?s=20
@sickcodes commented on GitHub (Mar 21, 2021):
Another successful WSL2 implementation by @iyadahmed
https://twitter.com/cgonfire/status/1373479561195892736?s=21
@Neurrone commented on GitHub (Mar 21, 2021):
Any chance that the steps mentioned in that article on making this work with WSL2 could be integrated into this project?
@ghost commented on GitHub (Mar 22, 2021):
Unfortunately as of now, WSL/2 nested virtualization is not very straightforward, while Microsoft actually enabled KVM on recent WSL2 kernels, and they also provided a config for enabling nested virtualization, it doesn't actually work without a workaround
https://github.com/microsoft/WSL/issues/4193
Here's the workaround:
There should be no need to build a custom kernel if you are running a recent WSL2 kernel
https://gist.github.com/steffengy/62a0b5baa124830a4b0fe4334ccc2606
So a way to go was to disable Hyper-V, Windows Hypervisor Platform, etc.. and rely on virtualization provided by VMWare, VirtualBox, QEMU, etc..., you can also install Intel HAXM if you like, the downside is you lose WSL
But anyways the rest is straight forward you need to make sure you enabled virtualization in BIOS, you also need to setup a Linux VM on your favorite software, you also need to turn on nested virtualization in the software
An equally valid way is to use Hyper-V nested virtualization
https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/user-guide/nested-virtualization
I did the first way, performance is indistinguishable from running a Mac VM directly on Windows or Linux
@sickcodes commented on GitHub (Mar 22, 2021):
Alternatively, you can use an Arch Linux VM and use the commands inside of the Dockerfile to run the same as Docker-OSX but on an Arch host rather than Ubuntu
@ghasemikasra39 commented on GitHub (Apr 3, 2021):
I installed VirtualBox on my windows and then installed
Ubuntu 20.04.2.0 LTSon that.Then I ran the following command inside the terminal:
This is the output I got:
Am I missing something?
Update:
I used this and solved the issue above.
Now when I run the same command:
I get this error:
I also tried this command suggested on the home page:
I get this output, and this time the vm crashes:

@ghost commented on GitHub (Apr 3, 2021):
Edit: Hmm the problem is related to audio check your vm settings and your guest configuration
Not sure where exactly is the problem but make sure to enable Nested Virtualization

@ghasemikasra39 commented on GitHub (Apr 3, 2021):
@iyadahmed

This option was enabled for me. I saw an image a few posts above hat someone ran this successfully on VMware, mint. Does it matter which virtualization tool/distribution of Linux we should uses?
@ghost commented on GitHub (Apr 3, 2021):
Yeah it was on Mint under VMWare, Mint was straight forward, make sure to update Mint though, before trying to enable KVM and install docker
to get nested virtualisation working properly you should disable all features related to Hyper-V and WSL
then make sure to enable all Virtualisation features in BIOS settings
then setup a virtual machine with Linux and get KVM working
@ghasemikasra39 commented on GitHub (Apr 4, 2021):
@iyadahmed
I tried Linux Mint on VirtualBox, getting exactly the same error as Ubuntu. I can confirm that both WSL and Hyper-v is disabled in my windows. I will try Mint on VMware as my last try.
@ghost commented on GitHub (Apr 4, 2021):
Btw can you give system info?, the very first error says that cpu doesn't support eax
@ghasemikasra39 commented on GitHub (Apr 4, 2021):
@iyadahmed
same Error on VMWare.
Yes sure, which info do you need?
@ghost commented on GitHub (Apr 4, 2021):
Just usual, CPU, Host system what build number and so
@ghasemikasra39 commented on GitHub (Apr 4, 2021):
@iyadahmed
Update:
I used this and ran:
now when I run
sudo docker run --privileged -v /tmp/.X11-unix:/tmp/.X11-unix sickcodes/docker-osx, I get this window:But running the commands in my previous posts still gave me the same errors.
@ghasemikasra39 commented on GitHub (Apr 4, 2021):
@ghasemikasra39 commented on GitHub (Apr 6, 2021):
@iyadahmed
Update:
I could make all the commands working by adding
sudoat the beginning and using the option--privileged.I tried both Big Sur and Catalina but both show this page:
Then I continue with the second option. But in both cases I get the message
This dist is locked:Is it the expected behaviour? I mean, am I supposed to re-install to be able to use it?
@ghost commented on GitHub (Apr 6, 2021):
EDIT: AFAIK, the error this is not expected behaviouri f you use the auto build
Awesome,
to reuse the docker image see this https://github.com/sickcodes/Docker-OSX#start-the-same-container-later-persistent-disk
no need to reinstall it keeps your installation
@lokinmodar commented on GitHub (Apr 29, 2021):
I was able to run this just fine:
docker run -it \ --device /dev/kvm \ -p 50922:10022 \ -v /tmp/.X11-unix:/tmp/.X11-unix \ -e "DISPLAY=${DISPLAY:-:0.0}" \ sickcodes/docker-osx:latest(i was even able to update Catalina to its latest version)But this
docker run -it \ --device /dev/kvm \ -p 50922:10022 \ -v /tmp/.X11-unix:/tmp/.X11-unix \ -e "DISPLAY=${DISPLAY:-:0.0}" \ sickcodes/docker-osx:big-suris giving me a headache. Here are the steps i follow:
1 - Run the command and wait for QEMU output.
2 - Launch macOS installer
3 - Disk utility -> erase -> exit Disk utility
4 - macOS installer -> reinstall macOS big-sur
5 - choose the drive I just erased
6 - wait for installation to finish
7 - installation ends, system reboots as expected and then:
Where is the disk it installed the system? If i launch the installation again it just retuns to openCore screen... Is there something I am missing?
@sickcodes commented on GitHub (May 1, 2021):
Base System is the one :)Installer
@lokinmodar commented on GitHub (Jun 4, 2021):
I had some issues with my system and could not test this. After doing it all again and using the additional options
e GENERATE_UNIQUE=true -e MASTER_PLIST_URL=https://raw.githubusercontent.com/sickcodes/osx-serial-generator/master/config-custom.plistI still can't boot to big sur even when entering Base System. It shows me the menu to Reinstall MacOS and Disk Utillity as if it isn't installed...With Catalina this does not happen. It shows the 200GB disk and I can boot the system...
@sickcodes commented on GitHub (Jun 7, 2021):
Let me pull latest and check if anything's wrong
@1ycx commented on GitHub (Jun 16, 2021):
wow, that's a lot of information.
IfIs* there a compiled blog of sorts for WSLg ?@selfagency commented on GitHub (Apr 5, 2022):
closing this for staleness and i wanna clean up my issues tab