Converting a ChromeBook to a Dev Environment


Chromebooks are inexpensive, generally single purpose devices that are 90% of what most people need for day to day use.  Developers however need just that little bit more.  My preferred development environment includes using the atom.io text editor among other tools.

When my normal OSX development environment was not available, I re-purposed an Intel based ChromeBook to being a dev environment.  This article describes the process and some of the final thoughts.

The steps needed are

  1. Backup local storage
  2. Enable Developer Mode
  3. Install Crouton
  4. Install the Crouton Extension
  5. Install Atom

Note this gets a developers editor, but does not set up other development tools (compilers, etc).  I’ll leave this as an exercise for the reader.

Backup any local storage

Part of the process for enabling dev mode involves completing a powerwash.  This will remove any local storage.  You have been warned.

Developer Mode

First step is to get the Chromebook into Dev Mode.  This is achieved with the following steps.

  1. Hold down esc, ⟳ (refresh) and power key at the same time.  The system will immediately reboot and start in recovery mode.
  2.  Even though the dev mode option won’t be described, you will need to hit <ctrl-d> to enable developer mode.
  3. Step through the process and the system will powerwash and then enable developer mode and then reboot.
  4. Post reboot, you will go through your standard account login process again.

Note that you will need to hit <ctrl-d> every time you boot to stay in developer mode.

Verifying Developer Mode

On the surface, developer mode will look exactly the same as the normal operating mode.  To confirm that you are in developer hit <ctrl-alt-t> and you will get a new tab  with the following text.  This shell is available in the normal operating mode, but is restricted to primarily information gathering commands like top, etc.

Welcome to crosh, the Chrome OS developer shell.

If you got here by mistake, don't panic!  Just close this tab and carry on.

Type 'help' for a list of commands.

crosh>

Once you have a crosh window open, you can confirm developer mode by typing shell at the crosh commandline.  You’ll see something similar to the text below.

crosh> shell
chronos@localhost / $

Congratulations, you now have a ChromeOS Developer Shell.

Install Crouton

Crouton is the Chromium OS Universal Chroot Environment , and provides for an independent Linux environments as a paired operating system for your Chromebook.  Installing is fairly simple.  On the github page referenced above, there will be a goo.gl shortened link.  Click to download that to your Downloads folder.  To install open up the crosh window <ctrl-alt-t> and run the command.

crosh> shell
chronos@localhost / $ sh ~/Downloads/crouton
Downloading latest crouton installer...

If all goes well, you will be presented with a list of options that crouton can take, for the purposes of getting atom up and running, you’ll need part of the x-windows environment – but paired with xiwi, X-in-a-window, we’ll start there.

chronos@localhost / $ sudo sh ~/Downloads/crouton -t xiwi
Installing precise-amd64 chroot to /usr/local/chroots/precise
Downloading latest debootstrap...
2016-05-01 09:41:42 URL:https://anonscm.debian.org/gitweb/?p=d-i/debootstrap.git;a=snapshot;h=HEAD;sf=tgz [64460] -> "-" [1]

That will take a while.

Verifying Crouton Installation

At the commandline you should be able to enter the chroot environment by running

chronos@localhost / $ sudo enter-chroot
Entering /mnt/stateful_partition/crouton/chroots/precise...
(precise)mtippett@localhost:~$
Which will give you a shell within an ubuntu linux environment.  Crouton will allows you to chose many different Linux environments (some supported, some not).  You can also run full X stacks on virtual terminals if that is what is needed.  I'm focusing on having a clean development environment, so I'll leave research into other details on crouton up to the reader.

Install Crouton Extension

The Crouton Extension allows you to run applications within a window.  Works quite well. Follow the instructions on the link.   You will see a stylized C in the extension section of your chrome browsers.

Verifying Crouton Extension

Assuming that Crouton is working and the extension is present. You should be able to do the follow and get an xterm in a window (again at a crosh tab).

crosh> shell
chronos@localhost / $ sudo startxiwi -b xterm
Entering /mnt/stateful_partition/crouton/chroots/precise...
chronos@localhost / $

After a few seconds, the xterm should pop up. These windows can be used in the same way as other chrome windows.  You can also start full screen with startxiwi -F xterm and then use the fullscreen key to toggle.

Installing Atom

Atom isn’t in a lot of distributions, so you can download it from atom.io.  They prepackage deb files, so you can take the following steps to install Atom.  If you download the atom package from the website (it may just download the x86_64 version, I’ve haven’t checked on an ARM ChromeBook).

chronos@localhost / $ sudo enter-chroot
Entering /mnt/stateful_partition/crouton/chroots/precise...
(precise)mtippett@localhost:~$ sudo dpkg -i ~/Downloads/atom-amd64.deb 
[sudo] password for mtippett: 
Selecting previously unselected package atom.
(Reading database ... 17429 files and directories currently installed.)
Unpacking atom (from .../Downloads/atom-amd64.deb) ...
dpkg: dependency problems prevent configuration of atom:
 atom depends on git; however:
  Package git is not installed.
 atom depends on gconf2; however:
  Package gconf2 is not installed.
 atom depends on gconf-service; however:
  Package gconf-service is not installed.
 atom depends on libgtk2.0-0; however:
  Package libgtk2.0-0 is not installed.
 atom depends on libnotify4; however:
  Package libnotify4 is not installed.
 atom depends on libnss3; however:
  Package libnss3 is not installed.
 atom depends on gvfs-bin; however:
  Package gvfs-bin is not installed.
 atom depends on libcap2; however:
  Package libcap2 is not installed.
dpkg: error processing atom (--install):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 atom
(precise)mtippett@localhost:~$

Now at this stage you have a broken atom installation.  Now thanks to the wonders of dpkg and apt you can fix this up (hopefully) by running

(precise)mtippett@localhost:~$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
  consolekit cryptsetup-bin dbus-x11 dconf-gsettings-backend dconf-service dosfstools fontconfig fuse gconf-service
  gconf-service-backend gconf2 gconf2-common git git-man gvfs gvfs-bin gvfs-common gvfs-daemons gvfs-libs hdparm
...

Which will install the dependencies as needed.

Verifying the Atom install

If all goes well, you can simply start up atom whenever you want with

crosh> shell
chronos@localhost / $ sudo startxiwi -b atom
Entering /mnt/stateful_partition/crouton/chroots/precise...
chronos@localhost / $

Have fun!

Note that I haven’t really created a dev environment here, but really a developer editor on a chrome system.  I typically do experiments in Javascript so that’s enough for me.  There might be other posts covering how to set up other parts of the dev environment.  Note that you can do most of your Linux development within the chroot environment as well.  So I’ll leave that as exercise for the reader.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: