Showing posts with label ubuntu. Show all posts
Showing posts with label ubuntu. Show all posts

Thursday, July 29, 2010

A first look at Ubuntu Netbook Edition 10.04

I had Ubuntu 8.04 LTS (Hardy Heron) installed on my Eee PC soon after I purchased it in 2008. Netbooks had just started appearing in the marketplace and Asus was a pioneer with the Eee 701 and then with the Eee 901. At that point Hardy Heron was not designed to be used on netbooks and I had a constant struggle between feature limitations of Linux vs the lack of responsiveness in Windows XP. There was talk of a netbook version of Linux and several vendors (Canonical, Intel) were various stages of development.

Cut to April 2010, Ubuntu is finally out with its 10.04 netbook edition. My frustration with my XP on my Eee PC is mounting on a daily basis and I use it primarily to remote to my Windows 7 HTPC box so that I can use it in my study. Watching Flash videos on Windows is a nightmare and multitasking is next to impossible. I am afraid to update Ubuntu 8.04 as the WiFi drivers break every time a major update is made. Having some spare time, I finally decided to make the switch to the new version of Ubuntu.

Try it before you buy use it!
One of my favorite things about Linux is the ability to try it without having to install it on your system. Ubuntu 10.04 (Lucid Lynx) has made it much easier to download the image to a Live CD / flash drive with complete instructions on their website. My first impressions with the Live CD were really good. The OS booted up in less than a minute. WiFi worked right out of the box and I was able to play around with some of the pre-installed applications.

Usability
One of the first things you will notice in the Netbook Edition is the menu bar which makes it very easy to navigate around to different sections of the OS. The mouse is a little difficult to use on the menu screen with a single click on a icon automatically opening up the application instead of highlighting it. All open applications are shown as icons in the top pane and the abundance of keyboard shortcuts makes it very easy to switch around between applications and the main menu.

Wifi Drivers
One big pain with the prior versions of Ubuntu was the lack of default WiFi drivers. Once Linux was installed you would have to manually download and install the drivers over an Ethernet connection. Though the MadWifi drivers worked quite well they would get uninstalled with every major update. The 10.04 drivers now work right out of the box as I mentioned before and I was easily able to connect to my WPA enabled router. Updates did not break the wireless drivers either.

Move over Firefox, Chrome is here
The default Firefox browser was one of my biggest gripes with Hardy Heron (and with 10.04). It was a great replacement for IE when it first came out in 2002/03 but over the years has turned slow and clunky consuming a lot of memory. I tried installing Google Chrome on 8.04 but the lack of latest updates which I refused to install because of the WiFi issue (see above) would result in Chrome crashing as soon as it started. Although Firefox is the default browser in Ubuntu, users can easily download Google Chrome and it works wonderfully in 10.04.

Chat, Mail & Social Networking
An integrated communication icon now allows users to setup new mail, chat and social networking accounts. Evolution is still carried over from previous versions of Linux but has a much easier setup procedure and I was able to quickly connect to my Gmail account via IMAP and synchronize my email. Empathy IM, the default messenger application, has a much slicker interface compared to Pidgin which I was using in 8.04 and supports Google Talk, Yahoo!, MSN and Facebook Messenger.

Skype – choppy sound?
Although I did not get a full chance to test Skype on 10.04, the sound quality was choppy while making a test call and I could not see the video of the other person although they could see me. Something to investigate and I believe should be fixable.

Flash
Steve Jobs is right about this one. Although it revolutionized Web content delivery for desktops, Flash is not meant for meant for small Internet devices. Flash is optional to install on Ubuntu but the responsiveness while watching Youtube videos on my netbook was much better than Windows, where I would have to wait until the whole video loaded before I could watch it.

Productivity Software
Since Oracle took over Sun, Openoffice has undergone quite a revolution. Openoffice 3.2 starts much faster, has a consistent look and feel and I believe will be a smoother transition for existing Windows users. Note: Much of this review was written on OpenOffice Writer.

Bridging the Geek / Novice Gap
One of the great things about Ubuntu is what it has done to bridge the geek / novice gap for Linux. Their design philosophy has made it much simpler for beginners to start using Linux and provided a much needed alternative to Windows. Personally, I believe the three major items that are needed to get Linux to mainstream are:
  • OS / Applications working right out of the box
  • OS does not need technical expertise to use
  • Large software ecosystem that is easy to get and use.
Ubuntu addresses the first point quite well. I have not had a chance to use it in different hardware but the advent of open source drivers has made it compatible across multiple platforms. The adoption of version numbers as opposed to code names (Gutsy Gibbon, Lucid Lynx) has given Ubuntu a more mainstream feel with users. On point two, Linux as a whole is still generally behind the curve. Ubuntu has made great strides on making Linux simpler to use but simple things like different terminology and the lack of “familiar” use and feel keeps new users away from it. Also the lack of pre-packaged applications due to the various flavors of Linux results in having to download the source and install it - which doesn’t sit well with novice users.

Other thoughts
If you need to connect to a Windows machine, rdesktop works quite well although I have not been able to get a working GUI version of it. Ubuntu 10.04 does not support Netflix either - or should it be the other way around? Overall, the new version is really usable and I would definitely recommend it for netbook users who want to make a switch.

Sunday, September 28, 2008

Using Blackberry 8830 as a tethered modem over Bluetooth on Ubuntu

I was recently toying around trying to get my Blackberry 8830 to work as a tethered modem with my eee pc running Ubuntu 8.04 LTS. This was one of the last hurdles keeping me from switching over to Ubuntu on my eee pc completely. I had to switch over to Windows XP everytime I needed to connect to the Internet on the road. After searching high and low I found what I needed on the Ubuntu documentation website. The following is just a reproduction of the same with specific details for Sprint Blackberry 8830.

These are the details of what I have:

Device: Blackberry 8830 (World Edition)
Carrier: Sprint
Laptop: eee pc 900
OS: Ubuntu 8.04 LTS (Hardy Heron)

My laptop does not have built-in Bluetooth so I picked up one of those USB dongles.

The following is a one time setup before you can use your device as a tethered modem.

Before you get started, first make sure you have bluez-utils and ppp installed on your machine.

$sudo apt-get install bluez-utils ppp

Next, make sure your phone is discoverable and run the following:

$hcitool scan

This will give you something like:

Scanning ...
xx:xx:xx:xx:xx:xx your_device_name

where xx:xx:xx:xx:xx:xx is your device's mac address.

If you haven't paired your device with your laptop yet, do so using the following command,

$sudo hcitool cc xx:xx:xx:xx:xx:xx

On my machine this opened up the Bluetooth Preferences window where I was able to enter the shared passkey and pair the two devices.

Next, check your device to see on what channel Dial-Up Networking runs.

$sdptool search DUN xx:xx:xx:xx:xx:xx

This will return something like:

Inquiring ...
Searching for DUN on xx:xx:xx:xx:xx:xx ...
Service Name: Dialup Networking
Service RecHandle: 0x10002
Service Class ID List:
"Dialup Networking" (0x1103)
"Generic Networking" (0x1201)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 3
Profile Descriptor List:
"Dialup Networking" (0x1103)
Version: 0x0100

As we can see from above the RFCOMM channel for this device is 3. This is what we use to modify our rfcomm.conf file as follows:

$sudo pico /etc/bluetooth/rfcomm.conf

and paste the following into the file.

rfcomm0 {
bind yes;
device xx:xx:xx:xx:xx:xx;
channel your-phone-rfcomm-channel;
comment "Bluetooth PPP Connection";
}

Save and close this file.

Running the following will create the rfcomm0 device:
$sudo /etc/init.d/bluetooth restart

Running rfcomm on your machine should show that it is connected to your Blackberry.

$rfcomm
rfcomm0:
xx:xx:xx:xx:xx:xx channel 3 closed

Next, we will configure PPP.

$sudo pico /etc/ppp/peers/BluetoothDialup

and paste in the following:

debug
noauth
connect "/usr/sbin/chat -v -f /etc/chatscripts/BluetoothDialup"
usepeerdns
/dev/rfcomm0 115200
defaultroute
crtscts
lcp-echo-failure 0

Save and close this file.

Next, edit the chatscript file. I found that the Verizon file in the Ubuntu documentation worked just fine for Sprint too.

$ sudo pico /etc/chatscripts/BluetoothDialup

and paste in the following

# abortstring
ABORT 'NO CARRIER' ABORT 'ERROR' ABORT 'NO DIALTONE' ABORT 'BUSY' ABORT 'NO ANSWER'
# modeminit
'' ATZ
# ispnumber
OK-AT-OKL3 ATDT#777
# ispconnect
CONNECT \d\c

Save and close the above file.

pon and poff are two commands to start and stop ppp connections. You'll use these to enable and disable Dial-Up Networking on your Blackberry everytime.

$pon BluetoothDialup

You should see "Modem Mode Enabled" now on your Blackberry. Try pinging any public website and see if it responds.

To turn off Dial-Up Networking simply type

$poff

That's it. Enjoy your tethered Blackberry modem!

btw, if you need to use your Blackberry 8830 as a modem over Windows XP, the software can be downloaded from here.

Wednesday, July 23, 2008

glibc on Ubuntu

About 6 months back I worked on an interesting project for school where we were developing a checkpointing application. My goal was to port the software onto Ubuntu where it some reason would not work. I initially put a query on ubuntuforums.org to which I never replied and people have queried me on and off about whether I did get an answer to this issue. So before the project information gets deleted from my school wiki, I'm going to put the full problem statement and solution here.

Checkpointing is a technique for storing the state of a process in order to recover it at a later point. Checkpointing is used where there are long running processes, saving the state of scientific applications to execute different conditions from that state or cases where debugging of processes is required. The different approaches to checkpointing include:

a. Kernel Level Checkpointing
b. User Level Checkpointing
c. Application Level Checkpointing

In Kernel Level Checkpointing, the operating system is modified to support checkpointing for
applications. This is the most transparent but the least efficient of the approaches. Here, the operating system does not know anything about the application and simply dumps the memory into a file for later restart. An issue with this approach is that the changes required in the kernel to support checkpointing will be different for each OS. User level checkpointing allows the user to link the application to the checkpointing framework in order to make the application checkpointable. With application level checkpointing, the developer of the application implements checkpointing within the application itself as the person has detailed knowledge about the application. At the same time this approach has the least amount of transparency and it is very difficult to migrate the checkpointing approach from one application to another.

In DMTCP (Distributed MultiThreaded CheckPointing) we study a user-level checkpointing technique used to restart or migrate a process. DMTCP works at the socket level so it can checkpoint applications without requiring modification to either the operating system or the application. DMTCP operates using a checkpoint control process which sends messages to a checkpoint manager thread about each process. The manager then uses signals to gain control of other threads before checkpointing. Our term project will be to study DMTCP and to test it for different application and to extend DMTCP to applications using LAM/MPI.

The first problem that we tackled was to port mtcp to Ubuntu. We noticed a problem when we first tried to run dmtcp on Ubuntu 7.10. When trying to run just mtcp mtcp_restore used to give a segmentation fault.

After debugging through the code, we traced the problem to the mtcp_sys_munmap() call in mtcp_restatic.c. Looking at the memory maps gave us something like this:

08048000-080be000 r-xp 00000000 08:07 594167 /home/vsriram/dmtcp/mtcp/mtcp_restore
080be000-080c0000 rw-p 00075000 08:07 594167 /home/vsriram/dmtcp/mtcp/mtcp_restore
080c0000-080e3000 rw-p 080c0000 00:00 0 [heap]
4001e000-4002c000 rwxp 4001e000 00:00 0
bfa6d000-bfa83000 rw-p bfa6d000 00:00 0 [stack]
ffffe000-fffff000 r-xp 00000000 00:00 0 [vdso]

The problem occurred when unmapping the heap area of the memory. We figured that the error would be either with the Ubuntu Linux Kernel or with glibc. This is because mtcp works fine in other Linux distros like Suse or Red Hat and even Linux versions prior to 6.10. The only other calls were to the Linux Kernel and glibc libraries. The next steps were to put printk statements in the kernel and see where it gives an error or to compile a vanilla glibc and see if the error was still reproducing using the glibc libraries.

We first approached the problem by trying to re-compile glibc. glibc would not compile easily on Ubuntu and it gave an undefined reference errorwhich we could not resolve even by setting the CFLAGS environment variable to -fno-stack-protector. So, this approach was abandoned in favor of recompiling the kernel and putting printk statements in the kernel code. After doing this and recompiling the kernel, we noticed that the sys_munmap() system call returns without any issues. This meant that the problem lay outside the system call.

As no system calls (even printf) can be called after the return from the sys_munmap() sytem call we decided to put while(1); statements to see till what points the application would continue (or in this case hang) without breaking. While doing this we could go upto the highest_userspace_address() call in code. The first thought was that the function does not exist in the address any more and this was leading to a segmentation fault.

We then recompiled mtcp_restatic.c to an assembly file (by using gcc -S) and put the assembly code for the while(1); loop in the mtcp_restatic.s file and recompiled the assembly code to an object file. This was to see if the program counter could enter the highest_userspace_address() method.

Assembly code for while(1); loop is shown below:

.L170
jmp .L170

At this point we found that the error occurs during the reference to %gs:20 which is a segment register referencing a memory location which is in the heap. Googling this lead to an interesting webpage where they talked about stack protection in Ubuntu which might be cause of this issue.

We read about Stack smashing protection where canary values are placed between a buffer and control data on the stack to monitor buffer overflows. When the buffer overflows, the first data to be corrupted will be the canary, and a failed verification of the canary data is therefore an alert of an overflow, which can then be handled. The canary values are inserted in by gcc while compiling the code.

The assembly code below sets the canary value at the beginning of the function.

movl %gs:20, %eax
movl %eax, -8(%ebp)

The assembly code below checks if the value of the canary remained the same. This code is placed at the end of the function.

movl -8(%ebp), %edx
xorl %gs:20, %edx
je .L179
call __stack_chk_fail

After the canary checking assembly code was removed from the assembly code and compiled to object code, the highest_userspace_address function worked fine but it failed further on. This validated the hypothesis that the segmentation fault was because of the reference to the memory location in the heap which by then was already unmapped.

Adding -fno-stack-protector to gcc (in the Makefile) before compiling the entire mtcp code removes the default stack protection and mtcp works fine after that.