Thursday, October 20, 2011

Installing Lubuntu 11.10 (Oneiric Ocelot) natively on a CR48

I started this because well, for one, ChromeOS is still not ready for prime time. Tabs would sad tab, machine would run slow, etc. Its not a dinky machine. Its a 1.66Ghz Atom processor with 2GB of RAM. Definitely nothing to scoff at. Ubuntu was a lot more stable however its fairly heavy weight so I got the idea to try something user friendly but lighter. Unfortunately, Lubuntu just came out this month and there are no CR48 specific guides for it. In the past 24hrs, this is what I have figured out.

Process
1.Generate a USB stick using UNetbootin and Lunbuntu and make sure to set at least 128MB free for "Space used to preserve files across reboots" else you will end up in a never ending loop of IO errors. http://unetbootin.sourceforge.net/
2. Install InsydeH20 using these instructions
3. Once loaded enter the BIOS by pressing the F2 key (-->) and then load Optimal Defaults, save, and exit.
4. Insert your USB drive in the CR48 and turn on the CR48. It should boot into Lubuntu. If not, hold down the power button to turn it off and then hit F10 (Vol+) to enter the boot menu.
5. I suggest trying before installing because then you can download updates and third party libraries as part of the install process since you can connect to a wireless network. I will assume you do the same
6. Once you connect to your wireless network, click the Install Lubuntu icon on the desktop. Choose your language, then select the options to download updates and and install third party software. Choose to erase all partitions (sometimes labeled as "Something else" so you can define your own partition layout)
7. Once you have the gparted running, click each partition and delete it. There are a lot of them. Don't stop till the drive is completely empty.
8. Once they are all deleted, click your free space, then click Add. Type: Primary, Size: 200MB, Beginning, Ext2, Mount Point: /Boot
9. Click add again: Accept the defaults except choose / as the mount point.
10. Click Install Now. If you get a warning about swap space, just click Continue. By not creating swap space, we are saving the SSD from excess writes. Follow the rest of the prompts while Lubuntu installs.
11. Once you finish with the prompts, open up the terminal, then run sudo gparted Click the your boot partition, and the click Partition -> Manage Flags. Click Boot. Then close gparted. Wait for the install to finish. [For some reason, the installer doesn't set this flag and grub then fails to install, therefore, you have to do this within the first few minutes after finishing step 11 else the grub portion of the installation will fail] Also, keep the mouse moving. When the screen blanks, the backlight doesn't turn back on. If this happens to you, use a flashlight to see the screen.

Hurray Lubuntu is now installed! Now to customize it for the CR48.

Add Sync option to /boot
Since we used ext2, there is no journaling on this partition so we want to make sure that any writes are flushed to disk before the IO call returns. This will keep things fast and reasonably safe from corruption.
1. Edit /etc/fstab as root in an editor.
2. Change defaults for the /boot partition to rw,suid,dev,exec,auto,nouser,sync without the quotes of course.

Add support for the Brightness and Volume keys
1. Open a root prompt (sudo -s in the terminal)
2. Install xbacklight apt-get install xbacklight)
3. Edit your keyboard short cut file (~/.config/openbox/lubuntu-rc.xml) Search for xbacklight. Notice that the entire section for Multimedia Keys and LCD backlight is commented out. Remove the --> and place it at the end of the <!-- comment line. Remove the first keybind section for C-F7. Change C-F10 to F6. Change C-F11 to F7 and change the -inc 10 in the execute section to -set 100
4. Search for amixer. Change XF86AudioRaiseVolume to F10. Change the XF86AudioLowerVolume to F9. Change the XF86AudioMute to F8.
5. Save and close the file.
6. On the root prompt, type openbox --reconfigure Your brightness and volume keys should work now.

Disable Track Pad while Typing
1. Open /etc/xdg/lxsession/Lubuntu/autostart in your favorite text editor and append the following

@/usr/bin/syndaemon -i1 -d
@/usr/bin/synclient PalmDetect=1
@/usr/bin/synclient PalmMinWidth=5
@/usr/bin/synclient PalmMinZ=200

2. Restart the computer.

This is the basics. Feel free to customize in other ways as well. The boot up time is amazing. About 10 seconds after the POST process. 88MB of RAM used after bootup!

--------------------------------------------------------------------
UPDATE NOV-19-2011
_______________________________________
I found that the syndaemon client would sometimes stop re-enabling the mouse after typing. This is likely a bug in syndaemon but rather than hope for a fix, when your mouse doesn't work, you want nothing more than for it to work again. I decided to write a little script and then bind it to the CTRL+ALT+SHIFT+M keyboard shortcut. Here is how I did this.

1. Make a directory in your home directory named scripts (hint, use lxterminal for the below)

mkdir ~/scripts

2. Create a file named fixmouse.sh

leafpad fixmouse.sh

3. Paste the following in, save it, and then close the text editor


#!/bin/bash
xinput set-int-prop "SynPS/2 Synaptics TouchPad" "Synaptics Off" 8 0
killall syndaemon 2>/dev/null
syndaemon -i1 -d


4. Now edit your keyboard shortcut file (~/.config/openbox/lubuntu-rc.xml) and search for </keyboard> Add the following line right above it but replace <USERNAME> with your actual username.


<keybind key="C-A-S-M"><action name="Execute"><execute>/home/<USERNAME>/scripts/fixmouse.sh</execute></action></keybind>


5. Now reconfigure openbox to pick up your changes

openbox --reconfigure

You should now be able to hit CTRL+ALT+SHIFT+M to restart your mouse!

Thursday, June 09, 2011

How to run diskutil in single user mode on OSX Leopard and Snowleopard

After spending some wonderful time troubleshooting a Macbook Pro with a failing drive, I wanted to know if the filesystem was corrupted or if it was indeed a disk failure. In order to know this, I had to read the SMART data off the drive. Here is my attempt

First you need to boot into single user mode by turning on the computer and immediately pressing CMD + S where the CMD key is the Apple key. Continue to hold down command + s until you see the verbose logging appear.

Then mount your drive in r/w mode with:

mount -uw /

Then we need to load a couple of required system modules. DirectoryServices is only required if you want networking support.


launchctl load /System/Library/LaunchDaemons/com.apple.notifyd.plist
launchctl load /System/Library/LaunchDaemons/com.apple.kextd.plist
launchctl load /System/Library/LaunchDaemons/com.apple.diskarbitrationd.plist
launchctl start com.apple.diskarbitrationd
launchctl load /System/Library/LaunchDaemon/com.apple.DirectoryServices.plist
launchctl load /System/Library/LaunchDaemons/com.apple.configd.plist

Now you should be able to at least run diskutil. You can run the following to check your specific drive
diskutil /dev/disk0sd2

You can enumerate your drives with

ls /dev/disk *


Right now its hanging for me but at least its running in single user mode which is better than before.