Sunday, December 26, 2010

Easy way to install Ubuntu on your Cr-48

Update: You should probably use the new ChrUbuntu 12.04 Install Guide instead of this one. This guide will not work on Chromebooks updated to Chrome OS version 19 or higher which will be virtually all Chromebooks by June of 2012.

Google has made it clear from day one that the Cr-48 is an open laptop. In fact, a Google Engineer has posted instructions on getting Ubuntu 10.10 running on the Cr-48. But while the process is described in great detail, it's not exactly easy. Thus I've made a much simpler install process that carries out the same steps via an automated script:

Update: This process WILL DESTROY all data on your Cr-48 and set it back to Factory defaults. Additionally, if something goes wrong, your Cr-48 may be left in an unusable state until you recover. I strongly suggest that you create a recovery drive before trying this so that you're prepared in case of failure or if you just want to go back to regular Chrome OS. You and you alone are responsible for any issues, damage or nuclear warfare that results from following this process.
  1. Get root. (also known as Developer mode)
  2. Reboot your Cr-48 but don't login. Make sure you have a WiFi or USB Ethernet connection at this point. 3G is not recommended. Press CTRL+ALT+=> (=> is the forward arrow where the F2 key used to be). We can't use the normal CTRL+ALT+T method to get a shell because can't have any users logged in while we repartition and make room for Ubuntu.
  3. Login as user chronos, no password is needed.
  4. Run "sudo su -" to get a root shell prompt.
  5. Run "wget -O - http://goo.gl/DlmZS | sh -". Most people having issues aren't typing this command *EXACTLY* as it needs to be. The command needs to be exactly "wget<space>dashO(uppercase letter o, not number zero)<space><dash><space>http://goo.gl/DlmZS(case sensitive)<space>|(shift and the key above the Enter key)<space>sh<space>dash". If you get a "not found" error, make sure you have Internet connectivity.
  6. The first time through, the script will resize your partitions to make room for Ubuntu. It may look like the Cr-48 is doing nothing for 10-15 minutes but let it be, after awhile it will reboot and re-initialize the stateful partiiton (told you it was going to wipe your data). This process takes about 5 minutes and then the Cr-48 reboots again and shows you the Welcome screen you got when you first turned on your Cr-48 out of the box.
  7. Go through the setup process until you get to the Google login page. You'll need to have a WiFi or Ethernet Connection again at this point. 3G is not recommended. Now follow steps 2 through 5 again (minus the reboot). This time the script will see that you've already made room for Ubuntu and will start downloading the Ubuntu image and copying it to the SSD.
  8. There are 52 100mb files to be downloaded. Each is compressed so the actual download size ranges from less than 1mb in size to 90mb in size. The total size of all the files is about 1.2gb compressed and 5gb uncompressed so the download and install will take awhile. The files are named ubuntu.binXX.bz2 (where XX is aa, ab, ac, ad, ae, af... ba, bb, bc... all the way to bz). If you want to see how big each piece is, take a look here.
  9. The script keeps track of which of the 52 files have been successfully installed so if you lose Internet connectivity, or the battery dies (you should be plugged in BTW), etc, just re-run Step 5 and it should resume where it left off.
  10. After all 52 files have been downloaded and copied to the SSD, the script will make a few more updates to your Cr-48 and then reboot.
  11. You'll see Ubuntu 10.10 start up! The 1st run it'll complain about an unclean shutdown, check the filesystem and reboot. This is normal. On the 2nd boot, you should see the Ubuntu 10.10 desktop autologin! The username is "user" and the password is "user" if you need to make changes.
  12. Right now, you're in Ubuntu but if you reboot, you'll be back in Chrome OS. To make Ubuntu the default, run "sudo cgpt add -i 6 -P 5 -S 1 /dev/sda" (password is "user"). It should be possible to run this from Ubuntu or Chrome OS.
  13. To make Chrome OS the default again, either pull the battery and turn off Developer Mode, or run "sudo cgpt add -i 6 -P 0 -S 1 /dev/sda".
Update: If you're seeing very slow download speeds (10-15k/sec), check your WiFi settings, if you're using WPA or WPA2 encryption, make sure your router is set to use AES, not TKIP (should be the default for WPA2, might not be possible with WPA). There is currently a bug that causes very slow WiFi speeds with WPA TKIP.

    Thursday, December 23, 2010

    Make CTRL+ALT+T go straight to Bash instead of the limited Crosh shell

    This tip comes courtesy of ngharo on the Chromium OS discuss mailing list, If you know Linux and you've rooted your Cr-48, chances are that when you hit CTRL+ALT+T you're headed for a Bash shell and the limited Crosh shell just leaves you with the additional step of needing to type "shell" each time. Now you can make CTRL+ALT+T go straight to Bash:

    1. Become root.
    2. Run the following commands:
      1. /usr/share/vboot/bin/make_dev_ssd --remove_rootfs_verification
      2. reboot       (Cr-48 will reboot and you'll need to re-login and get back to root)
      3. mount -o remount,rw /
      4. mkdir /usr/local/bin
      5. cat /sbin/window_manager_session.sh | sed -e 's/\/usr\/bin\/cros-term/\/usr\/local\/bin\/bash-term/' > /tmp/window
      6. cat /usr/bin/cros-term | sed -e 's/\/usr\/bin\/crosh/\/bin\/bash/'  > /tmp/bash
      7. sudo cp /tmp/window /sbin/window_manager_session.sh 
      8. sudo cp /tmp/bash /usr/local/bin/bash-term 
      9. sudo chmod +x /usr/local/bin/bash-term /sbin/window_manager_session.sh
    Now when you press CTRL+ALT+T, you should drop right to a lovely little Bash shell saving you 6 precious keystrokes (S, H, E, L, L, and Enter). Be sure to enjoy your newfound free time.

    Sunday, December 19, 2010

    Cr-48 Tips and Tricks

    After 5 days with my Cr-48, I'm starting to learn some shortcuts and tricks. Here's what I've learned so far, be sure to share your own tips and tricks in the comments!

    • Having a hard time with right clicks and scrolling on that fancy new track pad? Try holding down the ALT key and doing a regular click to perform a right click. To scroll, try placing both fingers on the trackpad but move only one of them up and down.
    • CAPS LOCK isn't dead yet! If you're hitting that search key constantly meaning to turn on CAPS LOCK, you can change it to perform a CAPS LOCK function instead of opening a new tab. Click the wrench icon at the top right, then Settings, System, Modifier Keys, and change Search in the Search box to CapsLock. There you go!
    • Google says you can't change the photo it took of you when you first logged in without deleting the account enitrely. You also can't delete the owner account (the 1st account you used to login to the Cr-48) without completely resetting the Cr-48 to factory defaults. But you can using Picnik! Just install Picnik from the webstore, then upload a picture you like to Picnik or take a new one with their webcam app. Now click "Save and Share". Name the file your full email address and change the file extension to be .png if it's not already. Now browse to the /home/chronos folder and save your image over the old one. Once you log out you should see your new image! Thanks to bupahs for this tip!
    • If you're a Network Admin like me, 99% of the 1% of computer time you're not in a web browser, you're using SSH to admin a Linux box or network device. Fortunately Google gives you access to SSH even if you're uncomfortable with putting your Cr-48 into developer mode. Just press CTRL+ALT+T and you'll get a limited crosh shell. Use the command "ssh username host port" to ssh into your Linux box.
    That's all I've got for now, again, please share your tips and tricks in the comments!

    Saturday, December 18, 2010

    GPS Support for the Cr-48

    Not only does Google's new wonder known as the Cr-48 have Bluetooth, it has GPS also. The GPS hardware comes courtesy of the Gobi 2000 3G Modem. Like Bluetooth, Google just hasn't built the interface into Chrome OS for making use of the GPS just yet. With the emphasis that Google places on location these days though, I fully expect that one of those silent updates the Cr-48 receives every few weeks (days?) will bring the GPS to life. Unfortunately, at this point, it doesn't look like the low level GPS interfaces are finished in Chrome OS just yet. If we get to our root shell there's just a few things we can find out:

    • A gpsd command exists, but it seems to just be a wrapper script for the real GPS daemon which isn't yet included in Chrome OS builds
    • Running "dmesg | grep -i "gobi\|novatel\|qualcomm" will search through the kernel messages and display those that reference the Gobi/Qualcomm/Novatel device (no idea why there's 3 companies involved in 1 3G modem). Unfortunately, it looks like Google has yet to include the kernel patch that enables the Gobi 2000's GPS device.
    Looks like we'll just have to keep an eye on those Chrome OS updates as they roll out.

    Bluetooth on the Cr-48

    It's a little known fact that the Cr-48 has Bluetooth on board. In fact, it seems Chrome OS on the Cr-48 already supports Bluetooth, all that seems to be missing is the graphical interface to setup your Bluetooth devices. Assuming you've rooted your Cr-48 though, you can start playing with Bluetooth now:

    1. Get root.
    2. Open up a crosh shell with CTRL+ALT+T.
    3. Open up a bash shell by running "shell"
    4. Become root with by running: "sudo su -"
    5. Put your Bluetooth device into discovery mode (see device manual if you don't know how to do this)
    6. To have the Cr-48 scan for Bluetooth devices, run "hcitool scan". This should list any discoverable devices in your area. Make a note of the devices address, we'll use it in the next command.
    7. To connect to a device, run "hcitool cc nn:nn:nn:nn:nn:nn" replacing the n's with the device address from above.
    8. To specify a key, run "hcitool auth nn:nn:nn:nn:nn:nn" again replacing the n's with the device address.
    Unfortunately, at this point I've run into some trouble with the devices I've tried. They connect but fail to authorize. If anybody knows more about Bluetooth on Linux, feel free to chime in in the comments.

    Recovering your Cr-48 to Factory Settings

    Update: I'm now taking orders for pre-made Recovery SD Cards. If you're having trouble with these instructions or just don't want the added hassle, order a ready to go recovery drive for just $20 shipped!

    Update 2: You may find it even easier to create the recovery drive from your Cr-48.

    So you managed to get root on your Cr-48. Congratulations, you're now ready to shoot yourself in the foot and break your free laptop. Fortunately, those wonderful Google guys also made it very simple to reset your Cr-48's to it's Out of Box Experience (OOBE) factory default state. I suggest trying this recovery process before going any further with hack tips on this blog so that you're familiar with the process when you actually need to use it. Google has instructions describing the Cr-48 recovery process using a Mac or Linux computer. To bad you only have Windows huh? No problem, here's how to create the recovery USB drive or SD Card from Windows:
    1. Download Disk Imager for Windows.
    2. Extract the files somewhere. For the purpose of these instructions, we'll assume you extracted to C:\DiskImager
    3. Download the recovery image from Google. Extract it to c:\DiskImager also.
    4. Plug in a USB drive or SD Card that is at least 1gb in size (Google says 4gb but 1gb works just fine for me, thanks for pointing this out Doggydude. Update: some 1gb drives work but some don't, the image is really close to 1gb in size and drive sizes can vary by a few mb. Use a 2gb if you want to be sure it'll fit). Warning! All data on the drive will be wiped! Make sure it has nothing important on it!
    5. Run c:\DiskImager\Win32DiskImager.exe
    6. Under Device, select the drive letter of your USB drive or SD Card. Warning! Make sure you have the right drive. If you choose the wrong drive, you'll wipe out some other disk on your computer!
    7. Now click the folder icon under "Image File" and browse for the Google recovery file you downloaded and extracted. The file will be named .bin, not .img so type *.bin in the "File Name:" text entry area so that *.bin files are listed.
    8. Finally, hit the Write button. The write process will probably take 5-10 minutes depending on the speed of your drive.
    9. Now that you've got your recovery disk, you can continue to step 2 of Google's instructions to perform the actual recovery.

    Rooting (jailbreaking) your new Google Chrome OS based Cr-48

    Rooting (sometimes called jailbreaking) is the process by which you take complete control of the software running on a particular device. Depending on how much effort the device manufacturer put into locking down the device, rooting can be very easy or very hard. Lucky for us, Google made it extremely easy to root the Cr-48. The process is simple but be warned that it involves resetting your Cr-48 to Factory Defaults. Fortunately, the Cr-48 stores very little locally, the main thing you stand to loose is that horrible picture you took of yourself when you first setup the device. The rooting process is:

    1. Hold down the power button to turn off your Cr-48 (enjoy the cool logoff animation)
    2. Unplug the power cord, and any other devices you might have connected. Flip the Cr-48 upside down.
    3. Pop out the Cr-48's battery by sliding the battery lock over.
    4. Just to the right of the battery's gold contacts, you'll notice a piece of black tape. Take the tape off. This picture might help you locate the tape.
    5. You'll find a simple white switch under the tape. By default, the switch is away from the gold battery connectors. This is user mode. Use a pen, paperclip, or finger of an infant to push the switch towards the gold connectors. Congrats, you're now in developer mode.
    6. Replace the battery and boot your Cr-48 again. You'll get a scary message but don't panic, just press CTRL+D on the keyboard.
    7. As a security measure, the device will wipe your stateful partition, getting rid of that lousy picture you took on first setup. The process takes 5-10 minutes so while you wait, go clean yourself up in the bathroom for the new picture (sheesh!)
    8. Once wiped, the Cr-48 will reboot, Hit CTRL+D to boot again or wait the 30 seconds (just don't press spacebar)
    9. Redo the setup process. If you already activated Verizon it should remain activated.
    10. Once you're at the Chrome browser, press CTRL+ALT+T on your keyboard to get to the limited crosh shell. This shell was actually available to you before you switched to Developer mode but now if you type "help" you'll see one extra, very useful command. Type "shell" to drop to a full bash shell. You'll be the special user named chronos.
    11. Type "sudo su -". Feel the power of root!