Friday, 28 October 2011

Installing Ubuntu on Samsung Series 5 Chromebook

Chromebook is a nice concept coupled with a sleek, fast, compact but yet capable OS, the ChromeOS. Both Samsung and Acer had released Chromebook models which are relatively cheap but still has good design, quite portable with great battery life. Google also gave away Samsung Series 5 Chromebooks to all attendees of Google I/O 2011 which I also qualified to receive one.

For those who had tried ChromeOS before would already know that it is just a browser built on top of a slimmed linux. It does not let you install apps other than chrome apps and not even has a desktop. However you can still save files and access the file system through the browser. Although in the era of the tablets it might seem a little weird, very soon I realized Chromebook is not a device to replace your laptop or your tablet. It is much lighter and portable than a laptop with great battery life but does not allow you wide variety of apps. Meanwhile it is heavier and chunkier than a tablet and lacks of a touch display but it does have a real browser, an accesible file system and a real keyboard.

So Chromebook is unique concept which can be placed between your laptop and your tablet.

However using ChromeOS for a while, I started feeling the need of using an IDE and since I would be having a trip to Antwerp for Devoxx, I thought it is time to install Ubuntu on my Series 5.

If you google to find out how to install ubuntu on chromebook you will end up with great articles describing how to do it for CR-48. Although most of the procedures will be the same, there are still some differences which may cause some troubles. Instead of using a CR48 tutorial and google for the problems follow this post and the links for a smoother experience.

I will mainly follow this tutorial which is a great but for CR48.

1. First you need to get root! Unless most CR48 tutorials will guide you to remove battery actually it is much simpler on Samsung Series 5 Chromebooks. On the right side of the device while the display is facing you, you will find a cover just next to the usb port. You will find a tiny switch just next to the sim slot. Find a needle and gently push the switch towards the sim slot. Be careful since the switch is very gentle and tiny, you may easily break it which I did :). 
2. Reboot the device. Press Ctrl+D but do not login. Press CTRL+ALT+F2 (the right arrow on top where F2 should be).
3. Login as user chronos, without any password.
4. Run "sudo bash" and "chromeos-firmwareupdate --mode=todev"
5. Run "wget; sudo sh hnkxo". This script will ask you how you want to shrink the partition of ChromeOS for installing Ubuntu. The default and recommended option is 9gbs. I am not sure if CR48 has same ssd size with the series 5 but I still used the default value. You may choose any size in increments of 1 at your own risk. After you choose the size the script will repartion the drive. It might take up to 15 minutes so do not turn off your device even there is no activity.
6.  Go through the setup process until you get to the login page. Be sure you are connected to wifi and follow the steps 2 and 3 again. Once again run "wget; sudo sh hnkxo". This time the script will start downloading Ubuntu 11.04 image which was prepared by Jay Lee.
7. The script will download 52 files at total of 1.1gb. If you lose connectivity or run out of battery, just re run the script and it will find out where its left.
8. The script will make few more updates and your device will restart.
9. If you do not see Ubuntu running follow steps 2,3,4 again.
10. Login to ubuntu using user "user" and password "user".
11. Open a terminal window and run "sudo resize2fs -p /dev/sda7" to finalize resizing your partitions.
12. Although you are in Ubuntu, it is not the default OS for the boot. To enable an easy switch between Ubuntu and Chrome OS, we will follow this steps.
13. In ubuntu, navigate to home folder and press ctrl+h.
14. Double click .bashrc and add "alias chromeos='sudo cgpt add -i 6 -P 0 -S 0 /dev/sda;sudo reboot' " to the bottom of the file.
15. Save the file. Open a terminal and type "chromeos".
16. When device boots into ChromeOS, press CTRL+ALT+F2 and login as chronos.
17. Run "sudo vim .profile" and press letter 'i'.
18. Type "alias ubuntu='sudo cgpt add -i 6 -P 5 -S 1 /dev/sda;sudo reboot' ". Then press esc and press shift+z twice. You should be in the console and saved the file.
19. Type "exit" and type "chronos" to login again.
20. Type "ubuntu" to boot in ubuntu again!

If you have any problems you can contact me and check the original links:

Monday, 24 October 2011

Android vs JDK7; First Act..

As some of the early adopters may have already faced, JDK7 has changed some behaviors of the 'keytool' utility. Actually this is not specific to Android but sooner or later any Android developer might need to use key tool utility.

In my case this has happened with the MapViewActivity. Those who had used MapView before will definitely remember that you need to provide an Api Key to retrieve maps. Google Maps offers a simple signup mechanism and a detailed tutorial.

Actually all you need is to extract the fingerprint of the certificate which is used for signing your application.

The following command will give you the certificate fingerprint.

keytool -list -alias alias_name -keystore my-release-key.keystore

Certificate fingerprint (MD5): 94:1E:43:49:87:73:BB:E6:A6:88:D7:20:F1:8E:B5:98

However those who had already downloaded and started using JDK7 will end up with SHA1 fingerprint instead of MD5.

Certificate fingerprint (SHA1): 33:59:42:3D:74:CB:8F:AA:A9:C4:56:3D:16:4D:0E:13:68:FC:3C:2F

Since both fingerprints are in the same format and the only difference is the extra digits on SHA1, it might not be easy to understand you are not getting what you had asked for but the solution is quite simple.

Either set your JDK version to 6 or add -v keytool command which would give you the MD5 instead SHA1.

keytool -v -list -alias alias_name -keystore my-release-key.keystore

Sunday, 16 October 2011;

Last year I wrote a very pessimistic blog post on Oracle's JavaOne which I never published and just wanted to give Oracle another chance. Since then Oracle did not really perform well in terms of community. Android lawsuit, the clash with Apache which caused them to leave JCP, replacement JCP nominations, dead of JavaFX script, a crippled JavaOne and the list goes on...

This year even when i step out of the plane I still did not have any good feelings or hopes on JavaOne. Honestly I wouldnt be attending if i did not have a session accepted.

However, despite I was ready ready to criticize each move, soon I realized there is a good progress. Oracle might have taken some bold an not really approved steps by the community but it seems like they had already done with that part and they really seem to move java forward. Still everything is not perfect but JavaOne is alive again and once again it is a conference worth to attend. 

First of all Oracle really realized they are not communicating with the community. This year there was a good effort to do that. Arun Gupta and the Glassfish team were great on handling the JavaEE part. I must confess JavaEE6 should be the most underrated JavaEE version ever. It is quite mature, completed and has everything you may need to develop an enterprise project. Glassfish team did great with providing an east to setup reference implementation on Netbeans+Glassfish but did not stop there, very soon after the conference started we heard of JavaEE certified version of Tomcat, the TomEE. Even the TomEE team was quite surprised they had been certified that soon. This is a huge step! Tomcat is the most commonly used and accepted development server on non-vendor locked development world. A Tomcat with JavaEE capabilities would most probably drive more people to give JavaEE a chance against Spring and other frameworks. This might be the most clever move Oracle has ever made.

Donald Smith which you may know as @DonaldOJDK performed a good success on replying most of the tweets and on the stage shows. Clearly bringing people with community and open source experience in is helping Oracle. Adam Bien also performed just like a good natural evangelist although he failed with a menly joke offending some women which an experienced rock star would never do. I think it was a bit exaggerated but still he had chance to correct it but he failed to.

It is quite clear JavaOne is missing something on the stage - specially in the keynotes - some rockstars. Ever remember James Gosling on stage talking on Java? the passion, the tech shows, t-shirt catapult... There needs to be fun and innovation on the stage which Oracle miserably failed this year by letting sponsors to perform keynotes. It was quite boring and awful. Oracle should really make a cease fire with formed rock stars and bring them on the stage no matter what! A JavaOne can never be a JavaOne without Gosling, Bloch... and others. However still they could do much better with what they already had. For example why not letting Simon Ritter hosting the keynotes? He is still an Oracle employee and had been there at the era of Sun. He was always behind the scenes on most of the SPOT, JavaFx or other geek demos just like this years kinect show. Why not just bringing him or people like him more on the stage.

JavaEE6 is great, Java7 with coin, fork&join is very thrilling, Java8 with lambda is exciting but Oracle, you really need to bring the old guns back in the stage to make JavaOne more fun, more innovative and more alive. Also running between sessions distributed to 3 hotels is not really a good conference experience. This year Oracle had a tremendous effort to organize this such as putting each track to a dedicated hotel and hiring stuff to show people their way but still 3 hotel conference area is no where near moscone. I do not really understand to schedule Oracle Open World and JavaOne on the same dates. Please Oracle just bring JavaOne back to Moscone.

You don't need to license Java to Android or say sorry to Gosling. Just give them a hand to unite the community. I am very hopeful on JavaOne'12 and very happy that I didn't publish what I wrote on JavaOne'10 but I wish i would not be disappointed the next year.