Coder Social home page Coder Social logo

chromeos-qemu-docker's Introduction

Termux + QEMU + Alpine Linux = Docker on Stock ChromeOS

No Developer Mode Needed.

Tutorial for running Docker with an Alpine Linux Host inside of QEMU VM on a ChromeOS/Termux host.

Screenshot

Why would you choose this method over crouton? Crouton requires enabling developer mode on your ChromeOS device which breaks the security model of ChromeOS. This is fine for most developers but you trade security for performance. My goal was instead to trade performance for security.

Warning: Tested on Samsung Chromebook Pro (Intel m3 x86_64 w/ ChromeOS 63, 64) other hardware results may vary. I would be interested to know about other ChromeOS devices, so please let me know your results via PR or email

ARM Processor based ChromeOS Devices will have to use the qemu-system-x86_64 command which requires modifiying the two scripts in the script directory of this repo.

Installation Steps

  1. Install Termux.
  2. Setup Termux packages:
    pkg update
    pkg upgrade
    pkg install coreutils
    pkg install termux-tools proot util-linux net-tools openssh git
    pkg install wget
    
    NOTE: It is important to install wget or https will fail due to an older verison that comes with Termux.
  3. Setup storage:
    termux-setup-storage
    
    For more information about directories in Termux see this stack overflow post.
  4. Add the X/GUI Repos:
    wget https://raw.githubusercontent.com/xeffyr/termux-x-repository/master/enablerepo.sh
    bash enablerepo.sh
    
  5. Install QEMU
    pkg install qemu-system
    
  6. Clone this repo:
    git clone https://github.com/pwdonald/chromeos-qemu-docker.git
    
  7. Create Virtual Storage Device: (NOTE: make sure you're aware of what directory you're in i.e. /storage/emulated/0/Download can be wiped by ChromeOS periodically as space is needed so backup often!)
    • This command will create a 4GB dynamically allocated (qcow2) virtual drive.
    qemu-img create -f qcow2 virtual_drive 4G
    
  8. Download the latest version of the virtual ISO from the Alpine Linux website.
    1. Rename the iso to alpine_x86_64.iso
    2. Run the command
      bash ./chromeos-qemu-docker/scripts/setup_alpine.sh
      
      • This script should be run in whichever directory your virtual drive exists to start the VM.
      • This may take a few minutes to start, resulting in a black screen with a cursor.
      • If you've been using the Termux session for a while you may see some of your history creep into view instead of a black screen.
  9. Once inside the VM:
    1. Login with username root.
    2. Run the following command:
      setup-alpine
      
      Answer the questions as you see fit. You may encounter errors when trying to setup the alpine package repos. If this happens you will need to exit the script (Ctrl + C) and run the following:
      echo "nameserver 8.8.8.8" > /etc/resolv.conf
      
      Then attempt to run the alpine-setup command again.
  10. Once the alpine-setup script is complete--it will instruct you to restart the machine.
    • To exit the VM Press Ctrl + A, X.
    • Congrats! You've installed Alpine Linux!
  11. Run the command:
    bash ./chromeos-qemu-docker/scripts/start_persist.sh
    
    1. Login with root & the password you setup in step 8.
      • You may have to add your nameservers again.
    2. Run:
      apk --no-cache update
      apk --no-cache install vim
      
      Or install your favorite editor of choice
    3. Use vim (or whiehver editor) to modify /etc/apk/repositories by uncommenting the line ending with community. To uncomment simply delete the leading # symbol on the line.
    4. Run
      apk --no-cache add docker
      
      Docker is now installed!
  12. Start the docker service with
    service docker start
    
    • You can now use docker as you would in a traditional environment.
    • The start_persist.sh script maps ports 22 and 80 from the virtual environment to 10020 and 10080 respectively on the Termux environment. You can utilize these ports from your ChromeOS env by finding the IP address of your Termux session.

Supported Devices

This is a list of devices with report(s) of successful installation.

  • Samsung Chromebook Pro
  • Asus C302

chromeos-qemu-docker's People

Contributors

abiosoft avatar paralax avatar pwdonald avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

chromeos-qemu-docker's Issues

USB passthrough?

I have been trying to add the ability for USB passthrough without any luck. I am new to qemu which doesn't help.

Is there any other way to find the usb devices other than lsusb?

Add examples for shared folders.

This could be tricky as it seems that mounting a directory using VVFAT in qemu results in a segmentation fault if the ChromeOS host makes any changes to the shared directory.

Create convenience script.

Combine functionality into a single script that can be utilized to:

  1. Install dependencies form the official Termux repos.
  2. Add the X/GUI repositories and install dependencies for qemu.
  3. Download the appropriate Alpine ISO.
  4. Create a virtual disk.
  5. Launch the setup script.
  6. After installation--provide functionality for starting the VM.

X/GUI repo issues

It seems the qemu-system package is broken in the latest version of the x repos that this hack depends on. I am trying to fork an older version of the repos or build a new repo from source but until then you may get an error about libFLAC when trying to run qemu.

Asus Flip c302

I just got this running on a Asus Flip c302 m3,4gb ram
Version 63.0.3239.140 (Official Build) (64-bit)

start_persist.sh not working

I followed your instructions on a pixelbook but got stuck when running start_persist.sh

SeaBIOS (version rel-1.11.0-0-g63451fca13-prebuilt.qemu-project.org)


iPXE (http://ipxe.org) 00:03.0 C980 PCI2.10 PnP PMM+1FF915A0+1FEF15A0 C980



Booting from Hard Disk...

SYSLINUX 6.04 EDD 6.04-pre1 Copyright (C) 1994-2015 H. Peter Anvin et al
WARNING: No configuration file found
boot:

Booting from alpine virtual ISO again to inspect disk (which I formatted as "sys")

Disk /dev/sda: 4096 MB, 4294967296 bytes, 8388608 sectors
522 cylinders, 255 heads, 63 sectors/track
Units: cylinders of 16065 * 512 = 8225280 bytes

Device  Boot StartCHS    EndCHS        StartLBA     EndLBA    Sectors  Size Id Type
/dev/sda1 *  0,32,33     12,223,19         2048     206847     204800  100M 83 Linux
Partition 1 does not end on cylinder boundary
/dev/sda2    12,223,20   138,146,8       206848    2226175    2019328  986M 82 Linux swap
Partition 2 does not end on cylinder boundary
/dev/sda3    138,146,9   522,42,32      2226176    8388607    6162432 3009M 83 Linux
Partition 3 does not end on cylinder boundary

I ran setup script again (and had to fiddle with /etc/resolv.conf a few times...)

I ran it again with lvmsys instead of sys and I was able to boot this time.

Did you get it to work with normal sys partitioning scheme?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.