Skip to content
← Back to Community
QEMU on replit!
Profile icon
CSharpIsGud

Ever wanted to make an OS on repl.it but couldn't get an emulator running? Now you can!

Developing, Compiling, Linking an OS is up to you!
Simply fork the repl and do whatever you want with qemu.

Voters
Profile icon
Doowew
Profile icon
Imparator878
Profile icon
Spaceboy1010
Profile icon
IncardoBTW
Profile icon
mfwowocringe
Profile icon
demcrepl
Profile icon
MiraculousC247
Profile icon
Hyderite
Profile icon
JosephYim3
Profile icon
Hitor1
Comments
hotnewtop
Profile icon
Highwayman

Now we can make a ReplOS XD

Profile icon
Wefd

@Highwayman unfunny joke smh :/

Profile icon
Highwayman

oof I feel ashamed of myself lol
@Wefd

Profile icon
AaryanAnsh

@Highwayman
Bad Joke, Nice Idea!

Profile icon
Highwayman

i mean, it had some context, so it's not necessarily gonna be a generally funny joke.. @AaryanAnsh

Profile icon
AaryanAnsh

@Highwayman
Lol. I am actually gonna try to make it

Profile icon
Highwayman

Sick, is it gonna be your first OS or have you done it before?
@AaryanAnsh

Profile icon
MrEconomical

what a legend

Profile icon
MrSnippy

Would their be a way to run something like Linux or maybe a lighter os like this one that I found called Kolibrios

Profile icon
CSharpIsGud

@MrSnippy If you can fit the iso on the repl yes

Profile icon
deliciouscupcak

I just forked it and its broken. :(
https://replit.com/@deliciouscupcak/QEMU-Replit

Profile icon
CSharpIsGud

@deliciouscupcak its not broken, the repl just doesn't run any OS with it since its just a blank repl that installs qemu in a way to make it work.
now that nix exists you can simply tell nix to install qemu and it will do it correctly without having to upload a bunch of files or anything

Profile icon
PikadaveStudios

@CSharpIsGud replit runs a linux vm, and locks the guest user (us) into it's terminal, which is why SUDO works

Profile icon
CSharpIsGud

@PikadaveStudios it will run, but you won't actually get root permissions.

Profile icon
PikadaveStudios

@CSharpIsGud I know, im just saying it runs linux

Profile icon
CSharpIsGud

@PikadaveStudios 99% of replit knows that

Profile icon
Hyderite

@CSharpIsGud i didnt lol

Profile icon
buddy92203

Thanks! i was looking for something to help me try and install a os in nix

Profile icon
Seven7Four4

How could I use a disk image with it? I want to use an operating system like Linux, or maybe Ubuntu

Profile icon
MrSnippy

@Seven7Four4 i got the same question
@CSharpIsGud
could you help

Profile icon
mrman314

I forked and ran the repl, but it shows:

qemu-system-x86_64: error while loading shared libraries: libbrlapi.so.0.6: cannot open shared object file: No such file or directory

I tried it on this repl, and another repl of mine. Any clues?

Profile icon
CSharpIsGud

@mrman314 I had put the fix on the other ones with it I just forgot to do it with this one. it should work now

Profile icon
mrman314

@CSharpIsGud Thanks for the quick reply, It works now, Thanks!

Profile icon
[deleted]

Nice! Do you know how to get qemu-system-i386 working on repl? Because the code I made works only on i386.

Here are the fantastic error messages that I get when I try to run it:

qemu-system-i386: error while loading shared libraries: libbrlapi.so.0.6: cannot open shared object file: No such file or directory exit status 127

Here is the link by the way: https://repl.it/@LucasAllori/theOS

Thanks!

Profile icon
CSharpIsGud

@LucasAllori Fork the repl this post attached, I uploaded all the things it requires from my own computer.

Profile icon
[deleted]

@CSharpIsGud Thanks! Now I don't have to download the OS and run it on my computer

Profile icon
Coder100

Nice work!
Don't know how to use this but I'll learn :)

Profile icon
Highwayman

O.o

Profile icon
[deleted]
mov eax, nice int 69 cli hlt nice: db 'Nice'
Profile icon
[deleted]

Nice! I have tried a few times to get this to work, but I never could. I can write an OS, now I just have to get one working!

Profile icon
CSharpIsGud

@sugarfi I have an OS with segmentation, keyboard input and vga output, Once I finish up "userland"(I didn't use paging) im going to put it on repl talk.

Profile icon
[deleted]

@CSharpIsGud nice! I started once and got as far as GRUB and paging, then I tried again later and I set up my own 4-stage bootloader that entered protected mode. Then I accidentally deleted all my code.

Profile icon
CSharpIsGud

@sugarfi How did you get paging, by the time I got to that part of the book I was reading I had already done a lot and I couldn't actually identity map anything.

Profile icon
[deleted]

@CSharpIsGud I basically followed a tutorial, with a couple of modifications: https://wiki.osdev.org/Setting_Up_Paging. Once you enable it and set up a table and directory, you just have to use table[vaddr >> 12] = phyaddr to map addresses.

Profile icon
CSharpIsGud

@sugarfi Oh yeah thats essentially what I had, at one point I managed to make it work without faults but the addresses weren't accurately mapped and I couldn't use the framebuffer anymore.

Profile icon
[deleted]

@CSharpIsGud yeah, the mapping goes by pages, not addresses, so it can be inaccurate. I don't know why you couldn't see the framebuffer, though. Did you map the whole lower 1mb?

Profile icon
CSharpIsGud

@sugarfi Pretty sure that part got mapped otherwise it probably would of just exploded

Profile icon
[deleted]

@CSharpIsGud if you try to access unmapped memory, at least in qemu, there is a segfault or triple fault or something and the machine reboots.

Profile icon
CSharpIsGud

@sugarfi My most working solution didn't crash, its just the framebuffer wasn't at the spot I wanted it to be in, just writing a huge chunk of data somewhere would eventually write into the framebuffer at some point

Profile icon
[deleted]
Profile icon
staticvoidliam7

how do you load a os into it?

Profile icon
CSharpIsGud

@LiamDonohue Assuming you have one just run qemu like you normally would like qemu-system-x86_64 IMAGE.iso or qemu-system-x86_64 -kernel KERNELIMAGE

Profile icon
staticvoidliam7
Profile icon
RobertFurr

why did you turn the first 2 lines into comments

Profile icon
CSharpIsGud

@RobertFurr The first line wasn't supposed to be a comment, I fixed that. I need to find some way to keep it from reinstalling qemu every time if its already installed and I was testing it.
the second line is actually a comment, you can put whatever there like commands to compile a kernel

Profile icon
RobertFurr

@CSharpIsGud okay. Can you put a comment with an example as to what someone should do so they don't have to figure it out yourself?

Profile icon
CSharpIsGud

@RobertFurr I thought of adding an example OS, but the point of the post is to show qemu working on repl.it not developing an OS.

Profile icon
CodeSalvageON

Didn’t work but still it’s very cool

Profile icon
CSharpIsGud

@CodeSalvageON Why didn't it work what did it say

Profile icon
CodeSalvageON

@CSharpIsGud it said command not found

Profile icon
CSharpIsGud

@CodeSalvageON oh, uncomment install-pkg qemu

Profile icon
CodeSalvageON
Profile icon
CSharpIsGud

@CodeSalvageON
image

Profile icon
CodeSalvageON

@CSharpIsGud thanks! Works great now!
Repl.it logo