Setting up ChromeOS Virtual Machine

Share on:

ChromeOS can create multiple virtual machines to run various software.
Creating a new virtual machine allows for software to be tested without ruining your existing setup. It is also great for running programs in an isolated fashion.
In this blog post learn how to Create a new virtual machine in ChromeOS.

Asus Chromebox 2 CN62 codename: Guado:inline


  • Create a virtual machine
  • Create a Ubuntu container
  • Create a user account
  • Setup SSH

Create a virtual machine

  1. In a browser press CTRL+ALT+T to open the Chrome OS developer shell (i.e. chrome-untrusted://crosh)
  2. Create a new VM
1vmc start sandbox
  1. Create a new profile A profile enable the default settings to be altered.
1lxc profile copy default custom-profile
  1. Update the profile setting
1lxc profile set minikube-profile security.nesting true
2lxc profile set minikube-profile security.priviledged false

Create a Ubuntu container

LXC supports a number of images in the following section Ubuntu is used. To see a list of available images:

1lxc image list images:
  1. Create a new container based on Ubuntu 18.04
1lxc launch image:ubuntu/bionic sandboxvm --profile custom-profile
  1. Create a new container based on Ubuntu 18.04
1lxc launch image:ubuntu/bionic sandboxvm --profile custom-profile
  1. Check the status of the container
1lxc list

Note: This screen shows the state of the container. The IP used to access the machine can be seen here.

  1. Run the new Ubuntu container
1lxc exec sandboxvm /bin/bash

Create a user account

  1. Add an account (ie. substitute USERNAME with the account name to be used)
1useradd -m [USERNAME]
  1. Set a password for the account
1passwd [USERNAME]
  1. Add user to sudo group
1usermod -aG sudo [USERNAME]
  1. Note the USERID and GROUPID assigned to the USERNAME
1cat /etc/passwd

Setup SSH

If a remote SSH connection is required then this needs to be setup on the local and remote hosts.

  1. On the local host VM, generate an SSH key
  1. Display the ssh key generated
1cat ~/.ssh/
  1. On the remote host set up the SSH user
1mkdir -p /home/[USERNAME]/.ssh
2chmod 700 /home/[USERNAME]/.ssh
3touch /home/[USERNAME]/.ssh/authorized_keys
4chmod /home/[USERNAME]/.ssh/authorized_keys
  1. Paste the generated key into the authorized_keys file e.g.
1echo "[SSHKEY]" >> /home/[USERNAME]/.ssh/authorized_keys

Connect via SSH

  1. Get the IP of the container via the LXC screen
  2. Connect via SSH
1ssh [USERNAME]@[IP]

Connect via LXC

  1. Login as root
1lxc exec sandboxvm /bin/bash && cd
  1. Login as a specific user and use their home directory

To connect as a specific user:

1lxc exec sandboxvm --user [USERID] --group [GROUPID] --cwd [USERID] --env HOME=/home/[USERNAME] /bin/bash && cd