joshiemoore / snakeware

A free Linux distro with a Python-based userspace
MIT License
1.72k stars 100 forks source link

Boot on virtualbox #2

Closed appcove closed 3 years ago

appcove commented 4 years ago

Hello, I was going to try your new OS on VirtualBox, but it wasn't clear how to do so with a .img file. Any suggestions?

joshiemoore commented 4 years ago

Hi, thanks for your interest! I don't use VirtualBox but I found a straightforward way to do this.

Use this command to convert the .img file to a .vdi file: C:\'Program Files'\Oracle\VirtualBox\VBoxManage.exe convertfromraw --format VDI .\snakeware0-0-1.img snakeware0-0-1.vdi

Then select this .vdi file as your virtual disk image when you're creating the VM in VirtualBox. Also select Linux/Other Linux (64-bit) as the OS type. I just tried this and it works.

Source: https://superuser.com/questions/554862/how-to-convert-img-to-usable-virtualbox-format/555170

appcove commented 4 years ago

Hey Josh, I'm running Ubuntu 18.04, but the steps I followed were the same.

jason@localhost:~$ vboxmanage convertfromraw --format VDI Desktop/snakeware0-0-1.img Desktop/snakeware0-0-1.vdi
Converting from raw image file="Desktop/snakeware0-0-1.img" to file="Desktop/snakeware0-0-1.vdi"...
Creating dynamic image with size 419430400 bytes (400MB)...

That produced snakeware 0-0-1.vdi

Then I started a new VirtualBox machine with Linux/Other Linux (64-bit) as the OS type, and selected this VDI as the virtual image.

Screenshot from 2020-05-29 14-00-41

Please let me know if there is something I should do differently. Thanks!

joshiemoore commented 4 years ago

I'm 99% sure this is because your VirtualBox's virtual hardware is configured in a way that snakeware's current kernel config doesn't support. This is the first time I've tried running this in VirtualBox, it worked for me but I will take a look at the different hardware configurations VirtualBox has and try to get it to work for all of them. Sorry this didn't work for you, thank you for trying, I will work on sorting the config issues out.

appcove commented 4 years ago

I'll keep testing for you if you give me guidance. I think this is a fun project. I started programming on Commodore 64 when I was 6 years old. Have been using Python primarily for about 15 years now.

win8linux commented 4 years ago

I do have a converted snakeware VDI image that does work. Should I send it here?

bekirbostanci commented 4 years ago

I tried also and print loading initial ramdisk. I waited but it is not continue. Is there any solution ?

Solved in the virtualbox should select linux > debian

bekirbostanci commented 4 years ago

@win8linux it is very basic to convert img to vdi. Firstly you install img file and open cmd. In the cmd you should write "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" convertfromraw --format VDI .\snakeware0-0-1.img snakeware0-0-1.vdi Note : if your img name is snakeware0-0-2.img you have to change snakeware0-0-2.img this

Also you can watch my video. It is turkish but all processes are obvious https://www.youtube.com/watch?v=2amogZS_JBI&t=1s

ghost commented 4 years ago

I ran the statement below on version 0.0.3 and it seems to import into virtualbox just fine. vboxmanage convertfromraw --format VDI snakeware0-0-3.img snakeware0-0-3.vdi

FYI.. running it in virtualbox is quite a bit faster than running it in qemu.

Admicos commented 4 years ago

On Fri Jun 5, 2020 at 5:11 PM +03, Billy Earney wrote:

FYI.. running it in virtualbox is quite a bit faster than running it in qemu.

Did you try running QEMU with -cpu host -enable-kvm -smp $(nproc)?

IIRC QEMU will use software to to emulate instructions by default, and enabling KVM makes it use the hardware extensions (VT-d, etc) to make it faster.

-smp is to allocate more threads to QEMU so it can take advantage of multiple cores.

-cpu host is to make sure QEMU doesn't try to emulate a specific CPU model, and uses your host's instead.

ghost commented 4 years ago

No I didn't try running with the cpu argument.. Using it like you demonstrate does increase the speed quite a bit.. Thank you for the tip. Maybe we can update the docs on the front page to use this (or at least mention it for those that do not know?

hippytaffer commented 4 years ago

Please let me know if there is something I should do differently. Thanks!

Are you mounting the vdi rather than trying to select it as you would an iso?

ghost commented 4 years ago

When virtualbox asks you to create an image, you should choose the last option which allows you to select an image, then choose the vdi that you just created..

joshiemoore commented 4 years ago

@earney That's interesting about VirtualBox vs. QEMU in terms of speed... I'm going to have to mess with VirtualBox, I've been hearing that it's leagues better than QEMU. QEMU has so many problems that I'm ready to switch our documentation and build process to VirtualBox if I find it works well. So many potential users use VirtualBox and so few use QEMU that it might make sense to make the switch.

alexandruavadanii commented 4 years ago

I successfully tested snakeware 0.0.3 using VirtualBox 6.0.22 on Windows 10 version 2004 (19041.264). Since I'm also using WSL2 which requires HyperV to be enabled, VirtualBox could not spawn the VM, raising a WHvSetupPartition failed error, similar to the one described in [1]. The solution in [1] (without disabling HyperV as WSL needs it) worked for me:

'C:\Program Files\Oracle\VirtualBox\VBoxManage.exe' setextradata global "VBoxInternal/NEM/UseRing0Runloop" 0

To convert the image from raw to VDI, the command mentioned earlier worked too:

'C:\Program Files\Oracle\VirtualBox\VBoxManage.exe' convertfromraw --format VDI .\snakeware.img .\snakeware3.vdi

Then I created a new VirtualBox machine with Type Linux, Version Other Linux (64-bit), 512MB RAM and Use an existing virtual hard disk file pointing to the just converted VDI image.

@appcove Are you by any chance allocation less RAM to the virtual machine? That could explain the behavior you reported.

[1] https://github.com/kubernetes/minikube/issues/4587

TechStudent10 commented 3 years ago

(btw I didn't mean to mention this issue)

hungl6844 commented 3 years ago

Uh, excuse me if I'm wrong, it's been a while since I've used VirtualBox, but couldn't you just use the img as a boot device? I know you can do that with ISOs, and if the img doesn't work, you can just convert it to an ISO.