Chrome OS Flex No-Nonsense QEMU Virtualization: A Complete Guide
Chrome OS Chrome OS Flex Guide Installation WalkthroughHi all, welcome to my blog, MusaBase! In this comprehensive walkthrough, I`ll guide you through virtualization of Chrome OS Flex on QEMU (Quick Emulator) in Linux. I am using Arch Linux btw, but you can achieve the same on almost every Linux Distribution.
It might be challenging, but i assure you that if you follow each step in this walkthrough, you`ll have a fully functional virtual machine with Chrome OS Flex installed and running by the end.
In this tutorial, I will cover every step, from installing and configuring QEMU to creating a virtual disk and installing Chrome OS Flex on that virtual hard drive, ensuring that the OS runs smoothly.
Jump To:
Limitations and Caveats
Chrome OS Flex is designed to be installed directly onto physical hardware specifically, PCs and Macs, to revitalize older devices. Although it can be run in virtual machines, this is not its intended use case, and Google does not officially provide full support for it in a virtual enviornmnet. Furthermore, there are additional limitations with this setup: for example, you cannot run a Linux development enviornmnet within it because doing so require nested virtualization, and successful operation is not guaranteed.
Prerequisites for Running Chrome OS Flex on a Virtual Machine
Running Chrome OS Flex on a virtual machine is straightforward, though the process differs from installing it on physical hardware. Instead of booting from a USB drive, you`ll need to create a virtual disk and configure your VM to boot from the Chrome OS Flex recovery image. This approach allows you to test and get familiar with Chrome OS Flex in a safe virtual enviornmnet before considering any physical deployment.
Before proceeding, ensure your PC meets the following hardware requirments:
-   Processor: Intel or AMD x86-64-bit compatible.
-   Ram: 8GB or 16GB.
-   Hard-Drive: Allocate at least 16GB for Chrome OS Flex, plus additional space based on your needs.
-   Operating System: Any Linux distribution to run your virtualization software.
Step 1: Installing QEMU and Core Virtualization Packages
QEMU, short for "Quick Emulator", is a free and open-source software that allows users to run operating systems and programs designed for one type of computer hardware on a different machine by emulating the hardware, essentially creating a virtual machine enviornment, it can be used to test software across different platforms.
-
Installation Step:
1. Update Your System:
Run your system update command to ensure that installed pacakges are up-to-date and to aviod conflicts with new installations.
2. Open Your Terminal:
Press Ctrl + Alt + T or open your teminal emulator.
3. Install QEMU and Essential Virtualization Packages:
To install QEMU along with necessary tools for running Chrome OS Flex in a virtual machine(for example, on Arch Linux), type:
sudo pacman -S qemu-full qemu-img libvirt virt-install virt-manager dnsmasq libosinfo edk2-ovmf
Replace pacman with your distribution`s package manager if you`re not using an Arch-based distro.
Alternative Installation Methods:
If you encounter package conflicts, install each package individually using your distro`s package manager:
- Debian-based distros :
- sudo apt install package-name
- sudo dpkg install package-name
- Red Hat-based distros :
- sudo dnf install package-name
- sudo rpm -i package-name.rpm
- Arch-based distros :
- yay -S package-name
- paru -S package-name
- Universal Pacakge Managers:
- flapak install package-name
- sudo snap install package-name
After entering the command, the system will prompt you for your password (due to the use of sudo ) and then proceed to install the specified packages.
Command PurposeNote: Avoid running VMs as root.
Installs core virtualization tools for creating/managing QEMU/KVM virtual machines on Linux.
- qemu-full: Full QEMU emulator with all feautres (KVM acceleration, multiple architectures, SPICE support).
- qemu-img: Tool for creating, converting, and managing QEMU disk images (e.g., .qcow2, .raw).
- libvirt: Toolkit to manage virtualization platforms (QEMU/KVM, LXC). Includes the libvirtd deamon and virsh CLI.
- virt-install: CLI utility to create and provision new virtual machines from the terminal.
- virt-manager: GUI application for managing VMs (create, start, stop, configure).
- dnsmasq: Lightweight DHCP/DNS server for libvirt`s default NAT-based virtual networks (assigns IPs to VMs).
- libosinfo: Database of OS metadata (e.g., recommended disk size, drivers) to simplify VM setup in virt-manager.
Step 2: Enabling and Configuring Services
Now, we need to enable essential services and adjust configuration files for the packages we installed. Follow these steps:
1. Enable Virtualization Services:
- Open your terminal and run:
sudo systemctl enable --now libvirtd
- libvirtd: is the Libvirt daemon, responsible for managing virtual machines (VMs). Enabling it ensures your system can control VMs properly.
2. Add User to the Libvirt Group
- Run the command:
sudo usermod -aG libvirt $USER
- By default, libvirt requires root privileges to manage VMs. Adding your user to the libvirt group allows you to manage virtual machines without sudo, which is both safer and more convenient.
Log out and back in to apply group changes.
3. Verify KVM Support
- Check if your CPU supports hardware virtualization by typing:
LC_ALL=C lscpu | grep Virtualization
- This checks whether your CPU supports hardware virtualization.
- For Intel CPUs, look for Virtualization: VT-x .
- For AMD CPUs, look for Virtualization: AMD-V
- This confirms that hardware-assisted virtualization is supported, which significantly improves performance compared to software emulation.
4. Load KVM Kernel Modules:
- For Intel CPUs, type:
sudo modprobe kvm_intel
- For AMD CPUs, type:
sudo modprobe kvm_amd
- These modules are required for KVM to work.
- kvm-intel or kvm_amd enables the CPU`s hardware virualization features.
- If these modules aren`t loaded, your system can`t use KVM, and virutalization won`t work properly.
5. Configure Libvirt (Optional)
- Open the libvirt configuration file with your preferred text editor (e.g., kate or nano):
kate /etc/libvirt/libvirtd/conf
- Use the editor`s search function ( Ctrl + F ) to locate and uncomment/modify these lines by removing the leading #:
unix_sock_group = "libvirt"
unix_sock_rw_perms = "0770"
- unix_sock_group = "libvirt": Ensures that the libvirt group has access to the daemon.
- unix_sock_rw_perms = "0770": Sets proper read/write permissions for the libvirt group.
- These changes allow non-root users to control virutal machines securely.
6. Restart the Libvirt Service:
- Apply the new configuration by restarting libvirtd:
sudo systemctl restart libvirtd
The above command will:
- Stops and then starts the libvirtd service: This ensures that any changes made to the configuration file (/etc/libvirt/libvirtd.conf) are applied.
- Reinitializes the libvirt daemon: It refreshes the virtualization service without requiring a full system reboot.
- Restarts any related background processes: This can help fix issues where virtual machines fail to start due to service misconfigurations or crashes.
- Ensures the latest settings are in effect: If you`ve made modifications to permissions, socket groups, or other configurations, restarting the service is necessary for them to take effect.
7. Launch Virt-Manager
- Finally, test your setup by launching virt-manager with:
virt-manager
We have now successfully configured a working virtual machine environment. By following the above steps, we ensure that KVM is properly enabled, users have the right permissions, and virtual machines can be created and managed efficiently.
Step 3: Acquire Chrome OS Flex Image
Now that you`ve set up your virtual emulator, it`s time to download the Chrome OS Flex image for QEMU. Note that Chrome OS Flex is not distributedas a conventional .ISO file. Instead, Google provides a recovery image in .bin format, compressed withing a .zip file.
-
To download ChromeOS Flex:
- Option 1:
- Option 2:
Visit Google`s Official Chrome OS Flex Page. Fill out the form and follow Google`s guide to obtain the Chrome OS Flex image.
Click the direct download link:
https://dl.google.com/chromeos-flex/images/latest.bin.zip
The above link will start downloading the Chrome OS Flex image.
This link is safe and comes directly from Google`s official website for Chrome OS Flex.
After the downlaod completes you`ll have a.zip file, typically named something:
"chromeos_16002.51.0_reven_recovery_stable-channel_mp-v6.bin.zip"
Extracting the Image:
Since the download file is a .zip archive containing a .bin file, you need to extract it. You can use a graphical file extraction tool like Ark, a utility that supports multiple formats(tar, gzip, bzip2, rar, and zip).
- Installation (Example for Arch-Base distros):
sudo pacman -S ark
Replace "pacman" with your package manager.
Once Ark is installed, extract the .bin file from the .zip archive. For clarity when selecting the image in QEMU, rename the extracted .bin file to a simple, memorable name (e.g., chromeosflex).
Step 4: Installing Chrome OS Flex On a Virtual Machine
Now that your QEMU virtual emulator is set up, configured, and you`ve downloaded and extracted the Chrome OS Flex image, it`s time to install Chrome OS Flex on your virtual machine. First, create a virtual storage device where the OS will be installed.
1. Creating a Virtual Storage Drive
- Open your terminal.
- (Optional) If you want the virtual drive created in a specific directory, navigate there using the cd command. By default, the drive will be created in your home directory.
- To create the virtual drive, type:
qemu-img create -f qcow2 chromeosflex.qcow2 16G
- 16G: Adjust the size as needed (Chrome OS Flex requires a minimum of 8-12GB).
- Replace the "chromeosflex" with your preferred drive name.
- qemu-img: A tool for creating and managing virtual disk images for QEMU.
- create: This tells qemu-img to create a new disk image.
- -f qcow2: Specifies the format of the image:qcow2 (QEMU Copy-On-Write 2) is a flexible disk image format that supports features like compression, snapshots, and thin provisioning.
Note: Make sure that your chromeosflex.bin file and chromeos.qcow2 (virtual drive) are in the same directory. Like this:
2. Booting into Chrome OS Flex Image
- The first drive is the chromeosflex.bin file (the installer, functioning like a bootable USB).
- The second drive is the virtual storage drive (chromeosflex.qcow2) where the OS will be installed.
To install Chrome OS Flex, you must attach two virtual drives to QMEU:
Note: Confirm you`re in the same directory as both files, use cd if necessary.
- To launch QEMU with chromeosflex.bin and chromeosflex.qcow2, type:
qemu-system-x86_64 -drive format=raw,file=chromeosflex.bin -drive format=qcow2,file=chromeosflex.qcow2 -m 8G -smp 2 -enable-kvm -display "gtk,gl=on,show-cursor=on" -device virtio-vga-gl -usb -device usb-tablet
- qemu-system-x86_64: This is the command to start the QMEU emulator for the x86_64 architecture, QEMU is a generic and open-source machine emulator and virtualizer.
- -drive format=raw,file=chromeosflex.bin: This option defines a virtual hard drive for the VM. format=raw specifies that the dirve image is in raw format, meaninig it`s a direct binary image of the disk. file=chromeosflex.bin indicates that the raw disk image file is named chromeosflex.bin, you can replace it with name you named your .bin file.
- -m 8G: This specifies the amount of RAM 8 gigabytes (GB) we allocated to the VM, replace 8G with your preffered size.
- -smp 2: This sets the number of virtual CPUs (symmetric multiprocessing) to 2. The VM will have two processor cores, also replace the 2 with your preffered size.
- -enable-kvm: This enables Kernel-based Virtual Machine (KVM) acceleration. KVM is a virtualization module in the Linux Kernel that allows QEMU to run VMs with near-native performance. This option significantly improves the speed of the VM. If you are not on a linux based system, or if your cpu does not support hardware virtualization, this will cause an errro, the workaround is simply remove this option from the above command.
- -display "gtk,gl=on,show-cursor=on": This configures the display settings for the VM. gtk specifies that the GTK (GIMP Toolkit) graphical user interface should be used for the VM`s display. gl=on Enables OpenGL acceleration for the virtual display. which is important for smooth graphics rendering, especially for Chrome OS FLex.
- -device virtio-vga-gl: This adds a virtual graphics adapter to the VM, using the virtio-vga-gl driver, VirtIO is a standardized interface for virtual devices, providing high performance. The gl suffix indicates that it supports OpenGL acceleration.
- -usb: This enables USB support for the virtual machine.
- -device usb-tablet: This adds a virtual USB tablet device, which is often used for better mouse input and responsiveness,espically in virtualized environments.
Once QEMU starts, the Chrome OS Flex installer will load after about 1-2 minutes. You can also use Chrome OS Flex in guest mode by clikcing the Browse as Guest button. However, note that guest mode won`t save changes between sessions.
3. Installing Chrome OS Flex
-
To install the OS:
- When the installer loads, click the Install Chrome OS Flex button (or follow the on-screen prompts to choose between trying and installing the OS). The installer will warn you that the installation will erase data on the hard-drive. Since this is a virtual drive, click Install to proceed.
- After installation, the emulator will shut down.
Booting into Freshly Installed Chrome OS Flex
- Now that Chrome OS Flex is successfully installed in the virutal machine, it`s time to boot into the freshly installed operating system from the virtual drive.
- To do this, simply modify the preivous QEMU run command by removing the installer drive option -drive format=raw,file=chromeosflex.bin.
- Use the following command to boot directly from the virtual storage drive:
qemu-system-x86_64 -drive format=qcow2,file=chromeosflex.qcow2 -m 8G -smp 2 -enable-kvm -display "gtk,gl=on,show-cursor=on" -device virtio-vga-gl -usb -device usb-tablet
- Press Enter.
And here you go! now you have Chrome OS Flex running in your virtual machine. With save state support, every time you shut down QEMU and restart Chrome OS Flex, it picks up right where you left off. Enjoy exploring your new virtual machine envrionment.
Thank you for following along! Happy virutalizing, and enjoy your Chome OS Flex experience!
1o1 out, i will see you around!
FIN!!!