Thursday, October 11, 2012

How to run Chrome OS (not Chromium OS) on a Virtual Machine

As part of my job, I often want to be able to demo Chrome OS to clients so that they can see how simple it is or to show them a concept such as enterprise enrollment. However, since Chromebooks aren't compatible with common screen-sharing applications like GoToMeeting.com or WebEx, it's not possible. Google+ Hangouts do work on Chrome OS but you have to have a user logged into the Chromebook, no demoing the login screen or enrollment process.

So I set out to find a way to run Chrome OS (the official code) on a virtual machine. Even before Chromebook hardware was available, Chromium OS, the open source base for Chrome OS has been able to run on virtual machines (see Hexxeh's nice nightly builds) but I didn't want to deal with the rabbit trail of Chromium OS vs. Chrome OS when presenting to clients, I wanted them to see exactly what they'd see on a Chromebook. So with a little scripting, I've managed to get Chrome OS running on VMWare workstation (should work on VMWare Player and Fusion also though I haven't tested). Here are the instructions:

Disclaimer: None of this is official or supported. I'm not responsible if Chrome or Chromium OS breaks your physical or virtual machine, destroys your data or re-elects Obama. The risk is entirely your own.

  1. Download this VMWare image. It's an unofficial, 200mb Chromium OS image. We'll use it as the base image, overwriting the Chromium OS filesystem and kernel with Chrome OS. The image is .tar.bz2 compressed. Windows users may need to download 7-Zip to decompress.
  2. Once decompressed, open the .vmx file in VMWare and boot the machine. You'll see Chromium OS boot up. Your VM should have Ethernet setup so the image automatically has Internet connectivity, no need to run through setup since we'll be blowing things away shortly.
  3. Press CTRL+ALT+spacebar. Release the spacebar but hold CTRL+ALT down and press F2. This switches us to the virtual console on Chromium OS (the spacebar is needed to make sure the VMWare guest and not the host OS pick up the CTRL+ALT key combo).
  4. Login as user chronos password chronos. We'll want Chrome OS to start with a fresh stateful partition as soon as we first boot it so run:

    sudo touch /mnt/stateful_partition/.developer_mode                   (password is chronos again)


    this tells Chrome OS that the system has been in developer mode and should be wiped when it next boots up. Since we're running on a VM, there's really no such thing as a developer switch like there is on a real Chrome OS device but Chrome OS assumes it's not in developer mode so it does the wipe for us.
  5. Now we're ready to download Chrome OS and overwrite Chromium OS. This step is pretty easy. Just run:

    wget http://goo.gl/4suhf; sudo bash 4suhf

    this will download a script and run it. The script takes care of downloading Chrome OS and overwriting your VM with it. You'll be able to choose which specific Chrome OS image you wish to use. All of the models I've tested have worked but if you're low on VM resources (RAM, CPU) then I suggest using Mario. If you want a 64-bit VM, use the Samsung 550 or Series 3 image.

    When the script finishes, you'll be back at the command prompt but attempting to run any commands will crash. This is because you're still booted into Chromium OS but you've overwritten your VM disk with Chrome OS. Just manually reboot the VM with the reset button. Your stateful will quickly be wiped and you'll see Chrome OS boot with that official logo!
Gotchas
  • Auto-updates don't work. You'll need to rerun the script in Step 5 to update. Sometimes the recovery image version lags behind the current stable version of Chrome OS.
  • Enterprise enrollment won't work out of box but it can be made to work. Hit CTRL+space then F2 (let go of space, hit F2 while holding CTRL the entire time). Run:

    sudo su -
    echo 'serial_number="1234567890"' > /tmp/machine-info
    restart ui

    replace 1234567890 with whatever serial you prefer. Then follow the normal CTRL+ALT+E method to enroll. If you have devices already listed in your CPanel you can choose one that's not been enrolled yet, use it's serial and be able to demo auto-enrollment.
  • For some reason I can't figure out, Chrome OS always want's to display at 1280x800 but VMWare only shows 1280x720 cutting off the bottom 80 pixels. It's something to do with the VESA BIOS on VMWare I believe (and the fact that Chrome OS expects an Intel graphics card that's not there on the VM). It's annoying that the bottom part of the screen where the clock, menu, etc are is missing. You can however use CTRL+Windows Key to pull up the menu of apps. If anyone finds a workaround to fix this, I'd love to know it. Update: turning the VM off and setting the monitor to 1024x768 forced in VM settings lets you see the menu bar. I couldn't bump the resolution higher than 1024x768 without cutting off the bottom.
Good luck and post in the comments how Chrome OS works in a VM for you!

104 comments:

  1. In step 4 it asks to enter locahost login....

    ReplyDelete
  2. I imagine that Netflix won't run either as another gotcha...

    ReplyDelete
  3. I can't get past step 5 - the script downloads the ChromeOS and then begins unzipping but this never ends. First time, screensaver kicked in and vm was blank until kernel panic appeared. Second time, screensaver kicked in Chromium OS screen appeared as if nothing had happened.

    ReplyDelete
  4. I'm having trouble appliying this to Vmware ESXi. I needed to make sure the nic was e1000, but get Kernel panic - No init found. after the reboot. Any ideás?

    ReplyDelete
    Replies
    1. sounds like writing the rootfs failed for some reason. Have you tried multiple times and found it's reproducible... I don't have access to an ESXi box anymore but see no reason it shouldn't work...

      Delete
    2. I have tried multiple times, but since I can access the OS after the script have run, it's hard to diagnose.

      Delete
    3. Works for me on ESXi 4.1 - did you use the converter tool to convert the VM?

      Delete
    4. 5.0, converted Jay's source file to the server using the vmware converter tools.

      Did you download directly to the datastore?

      Delete
    5. Same problem here on esxi 5.0. Had to change nic to e1000 and when I pick which Chrome version I want to use, it gives a disk space error message. Reset it and it goes into kernel panic.

      Delete
  5. In Step 4 I have not enough privilegs ("Permission denied").
    What I am doing wrong????
    I cant create developer_mode in /mnt too :-(
    Please help!

    ReplyDelete
  6. Doesnt seem to work on vmware player 5 on ubuntu 12.10 :(

    ReplyDelete
  7. what i mean to say it fails before even booting the vmx

    ReplyDelete
  8. How do you force the resolution in VMWare?

    ReplyDelete
  9. This comment has been removed by the author.

    ReplyDelete
  10. I figured it out vmware doesn’t like 3.5 kernel so i rebooted held down shift key and chose the 3.2 kernel and it worked.Now i have a new problem. i run the script i choose to download #7 which is cr48 it downloads script runs and my vm seems to auto restart and mentions stateful partition and seems to do the wipe. Once it boots back up im in chromium again not chrome os. chromium 21 developer build jay to be precise. Anyone have any ideas?

    ReplyDelete
  11. Which boot did you choose? holding down shift, I get

    chromeos-usb.A
    chromeos-vusb.A
    chromeos-hd.A
    chromeos-vhd.A
    chromeos-hd.B
    chromeos-vhd.D

    ReplyDelete
  12. Works well for me. Thank you so much for the guide. Its a fun little play around.

    Windows 7 - VM Workstation 9.0

    ReplyDelete
  13. Worked perfectly as described on Workstation 9 under Windows 7 x64. Thanks for the article.

    ReplyDelete
  14. I'm stuck on step 3. I hold ctrl, alt, and space at the same time. release space. then hit f2. and release ctrl, alt, and f2 at the same time. nothing happens. It still just displays the login screen. :(

    ReplyDelete
    Replies
    1. I'm having this issue also. ctrl+alt+t brings up the crosh terminal, but ctrl+atl+f2 does nothing.

      Entering the shell from crosh is read-only.

      Delete
  15. it works , thank you for give this method (win7+wm8) but how to migrate to physical machine(x86)

    ReplyDelete
  16. how do i manually reboot? just close the vm?

    ReplyDelete
  17. How long does the last step, the "dd if=$image_file of=/dev/sda3 bs=512 skip=$rootfs_start count=$rootfs_size" command take? I have attempted to run the script twice and both times that last command "seemed" to never end - meaning after about 20-30 minutes I turned off the VM.

    Should that dd command take over 20-30 minutes? (I am using recent hardware with a SSD drive.) Or, any thoughts of why it could be not completing that step?

    ReplyDelete
  18. I'm sorry I'm a noob at this but how do I force the VMware resolution?

    ReplyDelete
  19. Ran through the instructions on vmware fusion 5.0.2, and now end up at a very large resolution black screen. I'll try restoring from the other 10 images, but so far no luck.

    ReplyDelete
  20. Worked perfectly in Win7 x64 / VMWare Workstation 8 with the Samsung 550 selection. Thanks!!!

    ReplyDelete
  21. Anyone seen a Kernal Panic on the reboot? I've tried both Samsung Series 3 and 5 images with the same result.

    Using VM 9.x

    ReplyDelete
  22. The process worked for me, but I don't get sound from ChromeOs running as guest on both VMWaare Player and VirtualBox.

    ReplyDelete
  23. Thanks for good informative post!

    I've managed to install this image (Samsung 550) on my real aging C2D Dell notebook using USB-drive. At first glance it looks identical to Hexxeh build, including undetected wifi (always shown as disabled, but at least ethernet works), non-responsive touchpad (USB mouse works normal) and strict intolerance to >1 drives in system.

    In case there's an extra HDD/SDD drive present in system, boot would regularly abort at initial stage on kernel panic (block read error). Pfffuu, very very annoying.

    Anyway, good insight into OS that I believe must be a real nightmare and torture for any single ambitious non-BFU user. ;-)

    ReplyDelete
  24. xrandr -s 1280x720 its better than trying to add a new mode or trying to change the xorg.conf only to finds its of no use after reboot.

    the vmplayer cuts off because its unable to display the pixels past 1280x720 while 1280x768 is the default. i would love to get this runnning at full screen 1920x1200 like the chromium build its ok,, this is for testing to see if i will be getting a chromebook. also would like to add that the first steps arent exactly nessesary, I logged in with my google account and did the rest through crosh. made sure my vrtual drive had enough space and picked the acer image.

    ReplyDelete
  25. I am doing this on a mac and when I enter the script downloading command it says no such file or directory. What should I do. Please help.

    ReplyDelete
    Replies
    1. Try this: curl http://cr-48-ubuntu.googlecode.com/files/overwrite-chromiumos-with-chromeos.sh > overwrite-chromiumos-with-chromeos.sh

      Delete
  26. Very good, I did this but not in VM, I did on my laptop with a blank HD, so I installed the Chromium OS on the HD and did this steps for upgrade for Chrome OS and it works with an erros about login so I made a factory reset in setup and it works very very fine! Thank you so much.

    ReplyDelete
    Replies
    1. Could you be so kind to post how you did that exactly? A step by step tutorial perhaps?
      Greetings!

      Delete
    2. Yes it would be really kind if you would say how you did this?

      Delete
  27. It took a few times but I got it to work. Typed bash at prompt to got into a bash shell for tab completion. Switched from /dev/dsp to auto-detect to get sound to work.

    ReplyDelete
  28. Worked great on my acer. Many thanks.
    One thing: since a 'normal' PC does not feature a dev switch, I'm locked in chrome os jail. Impossible to upgrade from within chrome os.
    Will have to use a live cd/usb to rerun the script each time you want to update. I'll try to work out a tiny usb-intaller/updater that basically runs your script.
    Cheers

    ReplyDelete
  29. Thanks for the HowTo. And for the funny disclaimer. :)

    ReplyDelete
  30. Have you been able to install vmware tools? I have been trying but with no success.

    ReplyDelete
  31. Am I legally allowed to capture an image of this OS and redistribute?

    ReplyDelete
  32. running the wget http://goo.gl/4suhf, I have a failure in the address resolution... so I can't get the script. How can i handle this issue?

    ReplyDelete
  33. I just ran the script on a netbook with Chromium OS Vanilla(build from 6 feb 2013). I choose the Samsung Chromebox image, en now I will try it out. The Chrome-logo looks okay, and now it says it's restoring to normal mode, because it was in dev mode.. Let's wait...

    ReplyDelete
  34. It booted, and looks like it's working great!!

    ReplyDelete
    Replies
    1. which script did you use exactly? step 5? did you run the sudo command in step 4?

      Delete
  35. It booted, and looks like it's working great!!

    ReplyDelete
  36. cp: cannot stat '/home/chronos/user/tmp.crosrec/chrome_efi_mount/syslinux/vmlinuz.B': No such file or directory

    ReplyDelete
  37. Hi, I've got Chromium OS on my SD Card, but I've also got Windows 8 and Windows XP on my HDD.

    So if I install this script, it only will overwrite Chromium OS and won't do anything with my HDD?

    Thanks for your reply

    ReplyDelete
    Replies
    1. And could the same drivers be kept because I'm using April 15 Dell Lime Build?

      Delete
  38. Now I've tried it on an 4GB, 8GB and 32GB medium and every time it says that I haven't got enough memory.

    I also tried to convert the VirtualBox image to an .img File and wrote it with the Windows Image Writer on my stick, then I booted it up and got a Kernel Panic?

    What could I do to get it on an SD Card?

    ReplyDelete
  39. i'm also getting an out of space/memory error when it tries to extract the recovery image.....i tried to expand the vdh in vmware workstation and that is successful but it says i'd need to repartition in the OS for it to see the new free space. any way to do this?

    ReplyDelete
  40. Yeah the STATE partition is only 1GB big as I now.. Dunno why it runs in VBox then...

    ReplyDelete
  41. i get the same error in virtual box when i attempt the restore even though it says my drive is a 5.6gb

    ReplyDelete
  42. But on VBox it worked... I think it would work when I do it with my Netbook HDD...

    ReplyDelete
  43. which recovery did you use on vbox? i tired #1 samsung chromebook first and it failed and trying acer c7 now . the last time it still looked like it was out of space when it tried to extract the recovery file. did you do anything special after setting up the vm? (i had to change the network adapter to virutal before i could run through the first setup

    ReplyDelete
    Replies
    1. Yes you have to set Intel Adapter...

      I used the CR-48 Build every time but also tried one time with Samsung Chromebook.

      Delete
  44. Hey I've found something, if it works I will post it.

    ReplyDelete
  45. Nope didn't work... Has someone other an idea how we could make the STATEFUL partition bigger or how to make the WORKDIR right?

    ReplyDelete
  46. Damn thanks for trying anyways. I was looking forward to trying this. Hopefully someone is able to help

    ReplyDelete
  47. OK, got this to work under Virtualbox. Really, easy-peasy stuff. First issue - the login password on the virtualbox edition of chromium was facepunch. When running the script, what I did was to first download it (duh), then su to root (sudo su) then ran bash (optional, but I like the filename completion. Then just do a
    WORKDIR=/home bash ./4suhf
    and wait for a bit. There will be an error message at the end - /sbin/blkid gets a bus error or the like - but the copy is already done so just reset the VM and let it boot. You should get the message that it's recovering from developer mode, and it will reboot again, and there you are.

    ReplyDelete
    Replies
    1. But I still got the message that the hard disk doesn't have enough space (16GB SD Card)

      Delete
    2. But I know why it doesn't work: The Stateful Partition is not big enough... Does anybody know how I could make the Stateful Partition bigger?

      Delete
    3. You need to run parted magic live from another flash drive and resize the ex2 partition. You'll have to move the ex4 part over first. DO NOT mess with any other partitions on it. It looks like the 16gb flash drive is all broken up, but that's just the way it is.

      Delete
    4. I have fix for the disk size issue and can confirm it works!

      I'll detail the steps below:-

      1) Edit the virtual machine settings and Expand the Hard Drive (IDE) to atleast 5GB. This will add 2GB of unallocated space to the end of the virtual hard drive

      1) download Gparted Live on CD from here (http://gparted.sourceforge.net/livecd.php)

      2) Add a virtual CD drive to the Chromium virtual machine (VM) and attach the GParted ISO to CD Drive

      3) Boot the (VM) into the bios and change the boot order to move the CD drive above the HDD (Menu Options in VMware Workstation 7: VM - Power - Power On to BIOS)

      4) Boot into Gparted and configure keyboard as necessary. All other options can be default. (We’ll only be using GIU mouse clicks so you can leave the keyboard as default too, if you wish)

      5) Accept the fix for the unallocated space

      6) Delete all unknown partitions

      7) Copy Partition /dev/sda3 and paste into the unallocated space to the right of the fat 16 partition (do not resize at this time)

      8) Apply changes! This will create partition /dev/sda2 in the unallocated space

      9) Delete partition /dev/sda3

      10) Apply changes!

      11) Copy partition /dev/sda2 to the unallocated to the right of the /dev/sda2 partition

      12) Apply changes! This will create partition a copy of the original partition but assign it the correct partition number of /dev/sda3

      13) Delete partition /dev/sda2

      14) Apply changes!

      15) Resize /dev/sda1 and /dev/sda3 to fill all available adjacent unallocated space

      16) Apply Changes!

      17) Power off VM

      18) Edit the virtual machine settings and remove the virtual CD drive

      19) Power on VM and go to Step 3 of Jay Lee's instructions...

      Delete
    5. I'm still unable to successfully get this to work.

      I'm unable to follow step 5. I don't get a prompt to accept the fix for unallocated space.

      Any thoughts?

      Delete
    6. Have you definitely expanded the virtual disk in step 1 of my instructions?

      Delete
  48. Anyone get the sound to work? It seems to recognize the Intel HD Audio in virtualbox, and I can see it in alsamixer, but no sound comes out. Is there a way to tell it what audio device to use, or is it just stuffed?
    (used the Acer C7 restore package, BTW.)

    ReplyDelete
  49. I cant download the script i tried both links in this forum and it says problem in name resolution, cant contact dns server. I am on a macbook pro running parallels desktop and i converted the download to work on it. i can do the first four steps but i get stuck on the wget of the script please help me asap i really want this instead of chromium. thanks!

    ReplyDelete
  50. This comment has been removed by a blog administrator.

    ReplyDelete
  51. And with some additional work, the Chrome OS can also runs in your USB stick!

    Just download "StarWind V2V Converter" and using it to convert the .vmdk file (with Chrome OS inside) to the .img file, the using "Win32 Disk Imager" to write the .img file into the USB stick, finally boot from the USB stick and you're done.

    It worked on my desktop with the Acer C7 Chromebook Image : )

    ReplyDelete
  52. I'm pretty new at this, can I install in on a flash drive ?

    ReplyDelete
  53. script links are broken. 403 forbidden! It worked this morning now it's not.

    ReplyDelete
  54. I'm also getting the black screen from Fusion 5. I get through all the steps and there and I even see activity in the VM but you just get a black screen. Anyone have ideas?

    ReplyDelete
  55. I got this to run on an old Acer Aspire One - with the exception that Netflix will not run. It thinks I am in Developer mode. Is there any way to edit this to work around it?

    ReplyDelete
  56. mmm... Can you update the VMWare Image with larger virtual disk space ? Because now I want to try out the newest Chromebook Pixel's Chrome OS Image, but the virtual disk space is not big enough to save the Image file...

    ReplyDelete
  57. nice. now my eeepc is running chrome os instead of chromium os ;-)

    ReplyDelete
  58. Does anybody know whether one of the builds has support for the Broadcom BCM4312 driver?

    ReplyDelete
  59. FYI -
    To change screen resolution: Press Control+Option+T (Control+Alt+T) for terminal then in terminal type:
    "/usr/bin/xrandr --size 1280x960" (without the quotes)

    ReplyDelete
  60. Correction!

    To change screen resolution: Press Control+Option+T (Control+Alt+T) for terminal then in terminal type:
    "/usr/bin/xrandr --size 1280x720" (without the quotes)

    ReplyDelete
  61. This comment has been removed by the author.

    ReplyDelete
  62. Is there any way to change the resolution to 1280x1024?

    ReplyDelete
  63. Assuming you are running the Samsung ChromeBook 550 system image, is there a way to enable developer mode?

    ReplyDelete
  64. Greetings! I tried to do this on VirtualBox on Windows 7 with hexxeh's March 1 build. I get stuck at step 5. Although I could download this script (via curl http://cr-48-ubuntu.googlecode.com/files/overwrite-chromiumos-with-chromeos.sh), I could not run it script. It says "overwrite-chromiumos-with-chromeos.sh: line 849: initctl: command not found"
    What should I do?

    ReplyDelete
  65. Hey I would have an other question that not exactly fits this topic:

    Everytime when I begin writing anything with my keyboard I have to reactivate the Synaptics Touchpad Driver by clicking with the Left/Right Button. Does someone know why I have to do that and how I could make it not to need that?

    And my other problem is also:

    It doesn’t use the Synaptics Touchpad like a normal mouse:

    I can’t move Windows,
    it doesn’t scroll down the favorite bar,
    it isn’t able to copy+paste a text.

    What can I also do against that?

    ReplyDelete
  66. Had a bit of trouble getting the link for the script to work. You can alternatively use

    wget http://cr-48-ubuntu.googlecode.com/files/overwrite-chromiumos-with-chromeos.sh; sudo bash overwrite-chromiumos-with-chromeos.sh

    if you having issues.

    ReplyDelete
  67. "To change screen resolution: Press Control+Option+T (Control+Alt+T) for terminal then in terminal type:
    "/usr/bin/xrandr --size 1280x720" (without the quotes)"

    Everytime i try to run this command i get "Unknown command: '/usr/bin/xrandr' "

    Any other way?

    ReplyDelete
    Replies
    1. ive also tried doing the lenovo x13 image but keep getting "not enough space" and then reboots and never starts anything

      Delete
  68. Works like a charm in kvm-qemu. thx.

    ReplyDelete
  69. Quick question.... after you reboot it manually after the image restore, is the OS still considered to be in "developer mode" or not? Netflix complains about it being in dev mode. I suspect however there may be hardware DRM that just isn't present that prevents the stream from playing back.

    ReplyDelete
  70. I'm not an expert at this, by any means. But, the guide is broken for me.
    I believe the stateful_partition in the VMware build linked above is too small to fit the current Chrome OS recovery builds (unless I'm using the wrong ones - series 5, series 3 and cr-48 don't work).
    As a result, when I'm installing the recovery builds I'm getting "No space left on device" or the script quits halfway... either way, it obviously doesn't finish and I get kernel panics on reboot.
    Either way, I don't have the skill to figure out a work around. Anyone have any solutions? Anyone know how to create a larger stateful_partition?
    I'm using VMware Fusion on MacOSX

    ReplyDelete
  71. The IDE included in the download link in Original Post is about 3GB, but that is not enough space for step #5. How can we remedy this? Or, can you post a bzip with a 16G ide? Many of the Chromebooks come with a 16GB SSD.

    ReplyDelete
  72. This comment has been removed by the author.

    ReplyDelete
  73. Is there a possible way to boot chrome OS on Virtualbox. i don't have money to buy any fancy software

    ReplyDelete
    Replies
    1. Yes you can.
      In fact virtual box doesn’t suffer from the resolution issue present in VM Wks as it runs the VM at 1024x786.

      In Virtualbox

      1) Create a standard Linux Kernel 2.2 VM
      2) Add 2GB of memory
      3) In the hard drive options select “use and existing virtual hard drive” and browse the downloaded and expanded VMDK
      4) Select “Settings” – “Network” – Change “Attached to:” Bridged Adapter” – Select “Advanced” – Change “Adapter Type:” – “Intel PRO 1000 MT Desktop”
      5) In the advanced networking option change the VM nic to an Intel E1000 MT desktop card
      6) Select “Display” – increase video memory to the maximum of 128MB.
      7) Start

      Delete
  74. worked like a champ! thanks for posting this!

    ReplyDelete
  75. Once in ChromeOS, is it possible to enter shell (ctrl + alt + F2)? I like the way the samsung 550 ran on my vaio better than any of the chromium builds (they give me a strange horizontal ripple about 3/4 up the screen)

    ReplyDelete
  76. just like to say i took Hexxeh build from today, installed to /sda on Acer Netbook i386 and then ran your script and selected Cr48 image..i now have a fully working ChomeBook

    Thanks :D

    ReplyDelete
  77. After downloading and unzipping the file, I got an error:
    mount: special device /dev/sda12 does not exist

    anyone know how to fix this???

    ReplyDelete
  78. For those just stumbling on this article, allow me to point to you the modern version of this Chrome-OS-writing-over-Chromeium-OS: Project Croissant. The general premise is the same, but the steps are going to be different. Good luck!

    ReplyDelete