Friday, November 13, 2015

Installing crouton, MATLAB, and Office 2010 on a USB drive

I recently bought a Toshiba CB35-B3340 Chromebook with the intent of installing crouton and using it as my primary work machine. Below are the detailed steps I took to get everything working. To get around the issues related to having a tiny hard drive, I opted to install crouton on a USB stick, which was the platform I use to run MATLAB and a few windows programs ported through wine.

Below are the detailed steps I took to:

  1. Install Crouton on a USB stick
  2. Install Microsoft office 2010 through wine
  3. Install Matlab from an ISO image
  4. Get a windows virtual machine running through Virtualbox

Set your chromebook to developer mode

Before installing crouton, you’ll have to switch your Chromebook to developer mode. Be aware that this will wipe your internal storage, so backup any important files you have on the local disk beforehand. This is really easy to do and since its pretty well documented already, you can follow the instructions on this link.

Download compiled version of Crouton

After you’ve got your Chromebook booting in developer mode, you can download crouton from here. You can then run crouton by opening crosh (ctrl + alt + t), then entering the shell by typing the command shell. Assuming you have saved the crouton file in your Downloads folder, you can use the following commands to interface with the compiled crouton package:

  • Check target and release lists
    • sh ~/Downloads/crouton -t help
    • sh ~/Downloads/crouton -r list

You can use these lists to pick out the release you want to install.

Prep the USB stick

The first step is to prepare a USB stick for the installation. The only real requirement here is that the USB is formatted in ext4 which is the standard Ubuntu format. For picking out a USB stick, it’s probably a good idea to go for a USB 3.0 compatible one, and I’d recommend having a minimum of 32GB, as programs like MATLAB and wine eat up a lot of space.

  • Format USB stick to ext4.
  • Name the USB partition “Crouton”.

Install to USB

Now you can go back to your crosh shell and enter the commands for installing crouton from the pakcaged binary you downloaded.

  • The -p flag is the important part here, as it specifies the location of the install.
  • Use the -r flag to specify the release you want.
  • The -e flag will make your chroot encrypted with an additional password.
  • sudo sh ~/Downloads/crouton -e -r trusty -t unity -p /media/removable/Crouton

Run from USB

The installation is pretty straight forward and I’ve never ran into issues. However, launching crouton from a USB stick is a little different that if its on the hard disk. You’ll have to first enter the chroot, before you can use the startunity command.

  • sudo sh /media/removable/Crouton/bin/enter-chroot (to enter the chroot)
  • startunity (to start Ubuntu)

Useful Crouton actions

Clone your crouton installation to another USB drive

If you later upgrade to a larger USB drive for your crouton installation, you don’t have to worry about reinstalling everything. You can use the Ubuntu disk manager gparted to copy and paste your crouton partition to another USB drive.

  • Install gparted with this command: sudo apt-get install gparted
  • Open gparted and copy and paste your crouton partition to another ext4 formatted USB drive

Update your chroot

If your chroot no longer works after a chrome OS update, you can try using crouton to update it with the command below.

  • sudo sh ~/Downloads/crouton -u -n trusty -p /media/removable/Crouton
  • The -u flag specifies the update option.
  • The -n flag is the name of the chroot you want to update.

Installing software

The following instructions assume a basic knowledge of linux operating systems. This section will show you how to install a selection of programs within crouton.


Install Matlab

Mount MATLAB ISO

  • Download Furius ISO mount
  • sudo apt-get install furiusisomount
  • Open Furius ISO and mount the MATLAB ISO file

Create an install directory

I ran into permissions problems when I let the MATLAB try to create its own installation directory. To work around this, I just made a new directory in my home folder and chose that as the install directory. In the past, I’ve had problems with file permissions when I installed MATLAB under sudo, so I’m going to refrain from using sudo here.

  • Make an installation directory for MATLAB: mkdir ~/MATLAB

Install MATLAB from ISO

  • cd to the MATLAB ISO mount: cd /home/username/Maltab801_MacUnix.iso
  • Run the install command: sh ./install_linux

If you get the error, Failed to create folder error during the installation, choose the new installation directory you created in the step Create an install directory: /home/username/MATLAB.


Install Virtualbox

These steps are essentially just a summary of this youtube video. The scripts used in these steps can be found here, or you can download them from the command line in the steps below.

Modifying the kernel headers

To get virtualbox running, you’ll have to use the scripts to do some modifications of the kernel headers. I’m not really sure what happens during this process… but I just know it works, and installing Virtualbox without these scripts is a nightmare.

First download the relevant scripts. Use (ctrl + alt + t) to enter the crosh, then type shell to enter the shell, and use these commands to download the scripts (or you can use the link above to grab them with your browser)

  • cd ~/Downloads
  • wget https://raw.githubusercontent.com/divx118/crouton-packages/master/change-kernel-flags
  • wget https://raw.githubusercontent.com/divx118/crouton-packages/master/setup-headers.sh

Now you can execute the change-kernel-flags script form the shell.

  • sudo sh ~/Downloads/change-kernel-flags
  • Restart your computer to activate the changes after the script has finished
  • Whenever you update your chrome OS, you’ll have to rerun the change-kernel-flages script , so it’s worth keeping around your downloads folder after you’ve finished the installation

Now you can log in to your chroot to run the setup-headers.sh script.

  • Enter crosh (ctrl + alt + t)
  • Enter the shell: shell
  • Enter your chroot: sudo sh /media/removable/Crouton/bin/enter-chroot

You don’t have to use the startunity command here. You can just install the script from the command line from within the crosh terminal after you’ve logged into the chroot. Use the following line to run the script:

  • sudo sh ~/Downloads/setup-headers.sh
  • Use logout and then sudo sh /media/removable/Crouton/bin/enter-chroot to log out and log back in again to your chroot to activate the changes the script has made.

Now the kernel headers are modified, you can go ahead and install Virtualbox as you normally would on any Ubuntu installation.

Install Virtualbox

Enter the chroot in the crosh terminal.

  • Enter crosh (ctrl + alt + t)
  • Enter the shell: shell
  • Enter your chroot: sudo sh /media/removable/Crouton/bin/enter-chroot
  • From the chroot, use sudo apt-get install virtualbox to install Virtualbox
  • Now you can run Virtualbox from within Ubuntu!

After the Virtualbox installation, I managed to setup a 32-bit version of Windows 7 on a .vdi disk with no issues. Also, check the github page for the kernel scripts and take a read through, as you may need to rerun some of the scripts when your Chrome OS updates to keep Virtualbox working.

Enable USB devices in Virtualbox

By default, USB devices won’t work in Virtualbox on crouton, the reasons for this are detailed in this wiki. The mentioned wiki in combination with this one gives instructions on how to get your USB devices recognized. Before reading these wikis, I had no idea what udev was and I found the instructions really intimidating for a relative newcomer to Linux. Because of this, I’m going to rehash the steps you need to do from these wiki’s with particular emphasis on the procedure rather than the explanation. For explanations on why this works, please read the wikis.

  • Open the chromeOS shell and log into your chroot, but don’t run the startunity command to launch the unity GUI. From here, we can edit the crouton system files we need to with a terminal text editor called nano. We’ll start by installing nano with the following command:
    • sudo apt-get install nano

  • With nano installed, we can now open the system file /etc/rc.local. Use the following command to open it:
    • sudo nano /etc/rc.local

  • We’ll need to add the following 3 lines to the file to apply the fix (you can use ctrl + shift + v to paste text when working in the terminal).
    • mkdir -p /run/udev/rules.d
      cp /etc/udev/rules.d/*.rules /run/udev/rules.d
      udevadm control --reload
    • After adding the lines, your nano file should look like the image below:

  • Finally, press ctrl + o to save your updates, then ctrl + x to close nano

  • Now we’ll prepare the udev rules for virtualbox. While still logged into your chroot, run this command:

    • cp /usr/share/virtualbox/VBoxCreateUSBNode.sh ~/Downloads

  • Now log out of your chroot with the exit command, and while in the chromeOS shell, run the following lines:
    • sudo mv ~/Downloads/VBoxCreateUSBNode.sh /usr/local/
    • sudo chmod 755 /usr/local/VBoxCreateUSBNode.sh
    • sudo chown root:root /usr/local/VBoxCreateUSBNode.sh

  • Now log back into your chroot, and use the following command to get the group ID of vboxusers
    • cat /etc/group | grep vboxusers
    • In the output, you’ll need to make a note of the 3-digit group ID. Mine was 121, and we’ll need to use this number again in the final step.

  • Now we’ll need to download the udev rules for virtualbox using the following command (while still in your chroot):
    • wget -P ~/Downloads 'https://gist.githubusercontent.com/Timvrakas/d43fe840d9fc336cae7b/raw/virtualbox.rules'

  • Now we’ll copy the rules into the appropriate directory, then delete the previous rules which were already in the folder. Run the following commands:
    • sudo cp ~/Downloads/virtualbox.rules /etc/udev/rules.d/
    • sudo rm /etc/udev/rules.d/*-vboxdrv.rules

  • Finally, use nano to open the rules file you just copied into the rules.d directory, and change the 3-digit group IDs in the first 2 lines of the file to the group ID you found earlier.

    • sudo nano /etc/udev/rules.d/virtualbox.rules

  • Finally, use ctrl + o to save your changes and then ctrl + x to exit nano.

After these steps are done, Virtualbox should now have the capacity to recognize your USB devices. I used these exact steps to get a Wacom tablet working on my windows virtual machine within crouton.

Minor issues

  • If you have kernel errors following the Virtualbox installation, try repeating the process with a .deb package form the Virtualbox website instead of installing from the repositories. After one of my Virtualbox updates, I started getting Kernel errors, but uninstalling Virtualbox and reinstalling the most recent .deb package from the website resolved it. Not sure why this is, but it seems like the .deb packages are more stable than the repository versions. I then used the synaptic-package-manager to lock the version of my Virtualbox install to avoid running into this again in the future.

  • After using virtualbox for a few weeks, my internet connection seemingly randomly stopped working. The workaround was simple and I only had to change the network settings on my virtual machine to enable cable connected.
    enter image description here


Install wine

To get the MSXML6.dll working (which is necessary for Office 2010), you’ll have to use a 32-bit winearch. This is detailed in the following steps.

  • Install wine via the terminal
    • sudo apt-get install wine
  • Delete old default wine prefix (only necessary if you already created a default 64-bit one)
    • sudo rm -r ~/.wine
  • Create default 32-bit prefix for wine
    • WINEARCH=win32 winecfg
    • Running the winecfg script will automatically create a new default wine prefix if one doesn’t already exist

Install Office 2010

Installing office in wine is pretty straight forward, and the only preparation you have to do is to install the MSXML6 package with winetricks. Aside from that, I’ve run into no other issues with running microsoft Word or Excel.

  • Install MSXML6 with winetricks

    • winetricks should have been automatically installed along with wine. You can find it by searching your apps with the super button.
    • Alternatively, you can do it from the terminal within Ubuntu using the following command: winetricks MSXML6.
  • Copy the Office2010 installation files from the ISO to your downloads folder.

  • Alternatively, you could try mounting the ISO with furius iso mount, but I haven’t tried this with the Office installation.
  • Now just double click the Office installation exe (or right click and select open with wine). The installer should initialize.

I’ve gotten both Word and Excel working with this method. It seems that the only necessary dependency issue was with MSXML6, and no additional dll’s were required.


All the above steps worked for me on my Toshiba Chromebook 2. Feel free to leave comments if any of the steps are unclear or something isn’t working!

9 comments:

  1. Is it possible to partition a 64GB USB into two partitions, one ext4 and an one exFAT, and install crouton onto the ext4 partition? Want to have a partition for linux, then the other for storage.

    ReplyDelete
    Replies
    1. I'm trying this as I speak, partitioned my microsd card with MiniTool Partition Wizard from www.partitionwizard.com exFAT needs to be the first partition for Windows to recognize it and ext4 can be the second. It appears to be installing fine so far.

      Delete
    2. I was thinking about installing on a SD card when I started, but was worried about the transfer speed. How's your performance? With USB 3.0 I barely notice its running off external media.

      Delete
  2. with these directions I was able to install crouton via my 64gb micro. It took forever to install but once it boots its fast. I was able to install steam and other games and keep it separate from my normal work. I even got steam streaming working on this chromebook thanks to you! Very good stuff this blog is.

    ReplyDelete
  3. Thank you for writing this. It's the best crouton installation guide I've found anywhere. Installing to a USB3 stick using your method was very easy, even on my ancient ARM chromebook with debian.

    ReplyDelete
  4. I think the -e flag needs to come after ~/Downloads/crouton. That's the only way I can get it to encrypt the chroot. Otherwise great guide! Thanks!

    ReplyDelete
    Replies
    1. Thanks for the feedback! I just updated the page to reflect your comment.

      Delete
  5. This is a great post ! it was very informative. I look forward in reading more of your work. Also, I made sure to bookmark your website so I can come back later. I enjoyed every moment of reading it.kim kardashian sex tape
    porn sex video hd
    mia khalifa sex video
    sunny leone sexy movie

    ReplyDelete