Wednesday, November 6, 2013

Installing Bodhi Linux on My Samsung Chromebook

Introduction

In previous posts I described my experience with my Samsung Chromebook and why I decided to install Bodhi linux instead of using ChromeOS in conjunction with crouton.  Installing Bodhi, like most Linux distributions, on most Intel or AMD based computers is pretty straightforward (at least on most models).  Part of the reason the ARM-based Chromebooks, like the Samsung Chromebooks, are different is because they have secure boot.  From what I have read, the Chromebooks use UEFI or a subset thereof. The upshot of this on the Samsung Chromebook is:
  1. Installing a different OS is different, and more complicated, than on an Intel or AMD x86 or x86_64 architecture machine.
  2. You have to do things to bypass/disable the secure boot feature that comes with the Chromebook for ChromeOS.
Although I discussed this in previous posts, it is important to note here that what we are talking about is installing a separate OS (in addition to ChromeOS) that will be booted into at machine start. Essentially it is a dual boot, even if you have no intention of using ChromeOS. ChromeOS is still available, although booting to it, although not complicated, is not trivial and not as simple as making a selection from a list of OS's like one might be used to seeing with linx on many Intel/AMD based machines. This dual-boot environment is also different from the crouton situation, in which you use a chroot to run a subset of another OS to which you can switch with a key sequence.

Bodhi Linux is of course not the only option for Linux on the Samsung Chromebook.  One of the earliest options available was Ubuntu, via ChrUbuntu. Other options include installing Arch Linux or Debian. One thing all of these installations require is that you first put your Chromebook into developer mode. Additionally, every time you reboot (or power on) your Chromebook, you will be faced with a warning screen, at which time you need to hit Ctrl+d or wait 30 seconds for it to boot into Linux.

There is one other thing I should point out.  Too often, in my opinion, people or organizations, take credit for some invention which is built on the work of others.  This is the especially the case (again in my opinion) with things like software patents, but that is a discussion for another day.  The information I am providing here is based (very) largely on the work of others.  As I will describe later, I started out with a description and script for installing bodhi on Samsung ARM Chromebook, and used information from other OS installation descriptions to solve issues as I encountered them.  I believe the installation descriptions I worked with were probably originally based on reference documentation, much of which comes from Google. Although what I am providing is partially a product of my own perseverance and frustration, there is very little invention here. I will try to link to information sources I used in coming up with an installation solution for my Chromebook.

Please also note that there have been changes in the Samsung ARM Chromebook that may mean what I did may not work for you, or work without some changes.  As will be pointed out later, the original installation instructions I followed did not work for me.  The existing ChromeOS installation was not set up as the script I initially used expected.  I suspect that this was due solely to a newer version of ChromeOS, but perhaps there have been hardware changes as well.
Finally, please note following these steps permanently deletes all local data and configurations of your Chrome OS, restoring it to a pristine factory state.

As with any case where you install a new OS on a machine, bypassing what the manufacturer provided, I take no responsibility for the results.  If you are not willing to take the chance of something going horribly wrong, don't take the chance. I am not aware of people bricking their device using similar steps, but there are no guarantees. Unless the unbelievable happens, even if things do go horribly wrong, you should be able to recover your machine to the factory defaults following the recovery instructions here. As always, caveat emptor.

The Original Installation Instructions

The main installation source I used for my work to get Bodhi installed on my Samsung Chromebook was this post by Jeff Hoogland, who is Bodhi's lead developer.  Needless to say, without his earlier work I would not have even had a place to start with installing Bodhi on my Chromebook.

I followed the instructions in Jeff's post and got most of the way through the steps.  In fact, if you have a Samsung Chromebook, it is possible his steps and script will work for you.  What I encountered was that after executing the script according to instructions, upon reboot, it booted back into ChromeOS.  As you can see in this forum topic, I was not the only (or first) person to encounter this. I later discovered that the cause was that where previously the ChromeOS had a copy of the kernel installed under /boot, that is no longer the case.  If you wish to see if Jeff's script will work for you, you could go to the end of step #2 in his instructions and then execute the command:

ls /boot

If it does not find the boot directory this means his script will not work for you (unless he has updated since the time I tried it).  If you do find /boot then you hopefully can successfully use his script. My version of the script (based on his) checks for this and hopefully handles either case, but I have not been able to test the case where there was an existing kernel to use, since that was not the case on my Chromebook. The modifications I made to Jeff's script were based on the information I got from debian installation instructions I found here. I am grateful to the author, as I was stuck until I found the description of repackaging the running kernel.

Please note that I not only modified Jeff's script, but I borrowed the description of many of the manual steps as well.

Instructions Using My Script

Just to be clear, the instructions here are pretty much the same as in Jeff's post, except that my script is a modified version of his.  And at the end of the script I have commented out the reboot command in case you want to look around first. So you will need to issue the reboot command manually at the end yourself. Many of my descriptions will parrot Jeff's.

Step 1: Return to Secure ChromeOS Environment

If your machine does not boot into developer mode (i.e. does not give you a message about Chrome OS verification being turned off), you can probably skip this step. Otherwise, I would suggest you do this step. If you have some other OS installed, either via dual boot or via chroot, you should back up any data you need first. Any data you had previously will be lost. Although ChromeOS is backed up automatically, you probably should back up anything on the disk in your Chrome OS environment as well.

You will be reinstalling the Chrome OS image.  While in ChromeOS, you can create the image by entering:

chrome://imageburner

in the browser's address bar and following the instructions. Other options to create the image, on a different computer (Linux, Mac, Windows) are found at the link I will give in this paragraph. What you need to do here is reboot but when you encounter the "Chrome OS verification is turned off" message, do not hit Ctrl+d. Instead hit the space bar and follow the instructions here.  If you did not previously create an image, you can create one on another computer.  I created one on another Linux machine. Note that my Samsung Chromebook has a Snow... ChromeOS image.  You can check the type at the bottom of the recovery screen. Note that if you want to force the screen which says "Chrome OS is missing or damaged" you can boot in recovery mode by turning off your machine and then holding ESC (escape) and Refresh (F3) and hitting the power button. At this point you can plug in your recovery USB drive created earlier. On the Samsung Chromebook you cannot use the blue USB port, but the other one. After plugging in the USB drive (into the correct USB port), if it says the image is not valid, it probably means you selected the wrong one (I did this once) when creating the restore image.

Step 2: Boot in Recovery Mode

Assuming you did not do step #1, you should back up any data you need first. Any data you had previously will be lost. I assume at this point that you have a ChromeOS verified boot environment, either because you never changed to developer mode or you executed step #1 above. You now need to boot into recovery mode. You boot into recovery mode by turning off your machine and then holding ESC (escape) and Refresh (F3) and hitting the power button. You then should hit Ctrl+d and then on the next screen press enter. At this point the system should reboot into recovery mode. Once it reboots into recovery mode it takes a few minutes to configure everything, so please be patient.

Step 3: Get into a Virtual Terminal with Internet Access

After the system has started up, select a wireless access point to connect. to. It might take a few seconds after starting up for the list of access points to get populated into the pull-down list.  After selecting the wireless access point, go to the next screen (the google login screen) but do not log in. Hit Ctrl+alt+-> (where -> is where F2 would be on many keyboards).  This will open up a shell window.  For the username enter chronos and just press enter for the password (there is no password).

Step 4: Download and Run the Installation Script

From the command prompt run:

wget --no-check-certificate http://goo.gl/2OOuG0

followed by

sudo bash 2OOuG0

The commands are case sensitive. Note that "2OOuG0" has two capital letter O's (not zeros) following the digit 2, and the last character is a zero.

After entering the second command (which runs the script), you will be provided some information about your Chromebook. To continue, press enter.

Step 5: Choose How Much Space to Give to Bodhi Linux

The installer will prompt you for how much space you want to give to Bodhi. You should enter an integer amount for how many GB you would like to give Bodhi. On the 16 GB Chromebook the most Jeff (and others) recommended giving to Bodhi is 9 GB (with the maximum being 10).  For information, the initial base Bodhi install occupies around 1.6 GB. Once you select an amount of space to give Bodhi the drive will be re-partitioned automatically and then the system will restart. After restarting,  you will need to go through the ChromeOS setup process once more (see the beginning of step #3). Again, when you get to the google login screen do not log in.

Step 6: Getting the Linux Filesystem Set Up

Get into the virtual terminal again as described at the end of step #3. Then run the same two commands given in step #4, which will download and execute the script a second time.  This time the installation script will see that your drive has already been partitioned and it will begin downloading the Bodhi Chromebook image which it will then install onto the system. Note that this will take some time depending on your internet connection speed since a 300MB tarball needs to be downloaded and extracted. A couple of things to note here. First, my script will write the identification of the target kernel and target disk into a file called bodhiboot.info. This may be useful for debugging purposes.  Secondly, I commented out the line at the bottom of the script which reboots, in case you wish to look around before rebooting.

One other thing to point out is that near the end of the script, the following statement is executed:

cgpt add -i 6 -P 5 -T 1 -S 1 ${target_disk}

where you can find the value for ${target_disk} in the bodhiboot.info file mentioned above. This statement sets the Bodhi Linux partition as the top priority so after reboot it will boot Bodhi and not ChromeOS.  The "-S 1" arguments indicate there has already been a successful boot.  If this is not included (it was not needed in Jeff's script), the first reboot will take you into Bodhi, but subsequent boots will take you back to ChromeOS (you can still follow step #3 to get back to the same chronos virtual terminal if that happens).  The reason I believe the "-S 1" is needed is because if there is no indication that there was a successful boot of the alternative OS, it will boot ChromeOS instead.  Otherwise, if you have a bad boot image, it would continually just boot you into that image. If you wish to boot Bodhi just once and then have it boot back to ChromeOS subsequently (until you are confident you are ready to make Bodhi the permanent choice on every boot), you can remove the "-S 1" from the script (assuming you know how to use the vi editor), or after executing the script but before rebooting, enter the command:

sudo cgpt add -i 6 -P 5 -T 1 ${target_disk}

remembering to replace the "${target_disk}" with the value of the target disk given in bodhiboot.info. Note also that if you reboot into ChromeOS and then get back to the chronos virtual terminal (without logging in) and rexecute the script, it will still recognize that the partitioning has already been done and only execute the second pass of the script. Note also, that your previous files and the 2OOuG0 script should still be there.

If you left off the "-S 1" arguments to the cgpt command but are confident that Bodhi will boot up safely, you can manually execute

sudo cgpt add -i 6 -P 5 -T 1 -S 1 ${target_disk}

again replacing "${target_disk}" with the target disk value from bodhiboot.info.

When you are ready to reboot, enter the command

sudo reboot

and hopefully you will boot into the Enlightenment desktop. Note that the default installed user is armhf and the password is bodhilinux. That user has sudo rights. With the given installation image, there is no login screen and you will be logged in as the default user automatically.
Please also note that based on information I found in the debian install instructions, I found that to get the audio speakers working on the Samsung (ARM) Chromebook, I had to open a terminal and enter the following command (just once):
 alsaucm -c DAISY-I2S set _verb HiFi

To customize the installation to work with special keys like the increase/decrease brightness, increase/decrease audio, and mute audio, I made some additional changes after installing. I will discuss those changes in a future post.

No comments:

Post a Comment