Saturday, November 19, 2011

Lenovo Laptops with Ubuntu 11.04

Me and my team encountered with this problem when we are testing our OS on laptops. We installed it to various laptops and this Lenovo laptops make us a big headache. Because Ubuntu has many hardware compatibility problems, most of the Lenovo laptops are not supporting to this compatibilities.
We find few issues when installing and running Ubuntu on Lenovo laptops.

1.System boots to garbled display

Refer this link and you can find the solution.

https://bugs.launchpad.net/ubuntu/natty/+source/grub-gfxpayload-lists/+bug/777212

2.Splash screen is not working properly when booting up.

This isn't solved yet. The problem is Lenovo is not picking up the correct resolution when the machine boots up and it directly calls to the text splash screen as my knowledge. when machine boots it will pick the resolution correctly and it outputs the correct splash screen. Suppose to give the solved answer when we fixed this issue.

3.Lenevo L412 slow to restart and shutdown .

This is another problem that occur when we testing the os on Lenovo L412. It took more and more time to restart and shutdown. We tried to find the reason few days and we couldn't at last we found it is a problem with the third party software called Likewise that we use join the machines to the domain. There were some processes that wouldn't kill when its shutting down. So the shutting down is waiting until this process kills. Our project manager Chamindra de Silva helped us to fix this issue.
1. Observe what is the process take more time to kill.

Press ALT + CTRL + F1 on the shutting-down splash screen then it will show what are the processes are killing. For me it was Likewise. There was a process that runs with likewise that took more time to kill. So what we do was go to the likewise source where /opt/likewise. Then went through the code and force to kill all all processes rather than hanging.




Wednesday, November 2, 2011

Basic customizations in ubuntu 11.04 using bash

How to change the wallpaper:
in terminal type
gconftool-2 --type string --set /desktop/gnome/background/picture_filename "path/to/wallpaper"

How to change the login window icon:
in terminal type
sudo cp path/to/icon /usr/share/icons/LoginIcons/apps/64/

create desktop shortcuts:
in terminal type the follwing 2 commands.
cp /usr/share/applications/any_file.desktop ~/Desktop
chmod +x ~/Desktop/any_file.desktop

If you have screenlets installed how to run sreenlets in terminal.
type the following command.
ex:run calculator screenlet:
python /usr/share/screenlets/screenlets-pack-basic/Calc/CalcScreenlet.py

change start menu icon:
in terminal type:
gconftool-2 --type string --set /apps/panel/objects/object_0/custom_icon "path/to/icon"
gconftool-2 --type bool --set /apps/panel/objects/object_0/use_custom_icon "true"

Menu editing in ubuntu 11.04

I assume you know that you can edit menus by right clicking main menu bar.You can edit your menu system as you want using that way very easily.But do you know that where these configurations are saved in your machine. Knowing these locations are really helpful when you want edit the menu system by script or if you want to make the exact menu system in another machine.

So here are the locations you should know.
applications.menu file location: ~/.config/menus/
.directory files location: ~/.local/share/desktop-directories/
.desktop files location: ~/.local/share/applications/

if you want to create the same menu system in another machine it is a matter of copying all those files into relevant locations of that machine.

Also remember to execute the following comamnd after file copying.

sudo killall gnome-panel

How to set visible your domain account in login window ubuntu 11.04

THIS IS APPLICABLE TO UBUNTU 11.04
Normally when you are in a network you can log into basically 2 types of accounts which are local accounts and domain accounts. If you want to log into your domain account you have to click the 'other' category in the login window and enter your username.But this may be a bit annoying and there is a way to set visible your domain account name in your login window and even hide any local accounts.

This is the way.
step 1:
log in to your domain account.Find the uid of you by typing id command in terminal.
example:
>id
uid=123456789(DOMAIN\username) gid=0(root) groups=0(root)

Here the UID is 123456789.

step 2:
add the following line to /etc/passwd file.repalce UID with the number you have found in the previous step.
DOMAIN\username:x:UID:0:Name_To_Be_Shown,,,:/home/local/DOMAIN/username:/bin/bash

step 3:(optional)
Hide local accounts from the login window.
edit /etc/gdm/custom.conf as follows.

[daemon]
TimedLoginEnable=false
AutomaticLoginEnable=false
TimedLogin=user
AutomaticLogin=user
TimedLoginDelay=30
DefaultSession=gnome-2d
[greeter]
#IncludeAll=false
Exclude=ALL THE LOCAL ACCOUNT NAMES WHICH SHOULD BE HIDDEN SEPARETED BY COMMAS.

Log out from the current session and see your domain account appearing in the login window.ENJOY!!!

Monday, October 24, 2011

How to get files from your crashed hard disk.

Step 1
boot the machine using live cd.

Step 2
press ctrl+alt+F2.Now You are in non gui mode


Step 3
Type fdisk -l
Now you can see what are available partitions in hard disk.
lets assume you need to mount /dev/sda1

Step 4
make directroy to mount the harddisk partition
mkdir /test

Step 5
mount hard disk typing below command
mount /dev/sda1 /test

Step 6
now go to /test directory and you can do any file operation in that partition.
Type ls


cheers
kwak

Monday, September 5, 2011

How to setup an apt-cacher in ubuntu 11.04?


Following is the scenario which we had to come up with an apt-cacher set up.
There are several machines Ubutnu 11.04 installed and each time one user needs a software installed he runs 
sudo apt-get instal  command and this is done by each user in each machine which would eats up the bandwidth.


Instead of that  caching the installed software  can have a dramatic impact on the use of bandwidth.Apt-cacher is a tool 
which would act as middle man between the public repository and the LAN clients, sharing any common downloads internally.
i.e. whenever a user requests for a new installation or an update for the first time, the tool would download them from the public repository and store it and pass it back to that user. The package is then made available to any future requests from the internal network.When another user requests for the same installation instead of going to the public repository again it woul pass from what is already installed.


Setting up the apt-cacher is quite simple and is described below.
First we need apt-cacher and some tools installed.
Do a           sudo aptitude install apt-cacher
                  sudo aptitude install apache2
To activate the service edit /etc/default/apt-cacher file and change the AUTOSTART value to "1".
You can also limit access to the cache within the /etc/apt-cacher/apt-cacher.conf file. Update the value for allowed_hosts to match the individual hosts or subnets that you want to allow.


To start the caching system type in cmdline, sudo /etc/init.d/apt-cacher restart.


Now you have the apt-cacher up and running.The final step is to set up the client.

Add a proxy setting to the /etc/apt/apt.conf.d/ directory. To do this is create  a new file called 90-apt-proxy.conf and entering the line. Following would open up the file in gedit.
                                   sudo gedit /etc/apt/apt.conf.d/90-apt-proxy.conf
Enter the following line to that file.
                                 Acquire::http::Proxy "http://cache-ip:3142";
 Replace "cache-ip " with the IP address or URL of the machine you installed apt-cacher in.
  There is no limit of the no of machines you can point to the apt-cacher.
 Before ending the post I must say thank you to this web post. It was very hard to find the exact information while we were working on this and hope this post would help those are in the same scenario.

Have a great day!: )


Monday, August 29, 2011

Integer and string Comparison in bash


Integer Comparison

There are 2 ways of comparing integers.
let's consider a and b as integer variables.

if [ "$a" -eq "$b" ] -checks weather $a equals to $b

if [ "$a" -ne "$b" ] -checks weather $a not equals to $b

if [ "$a" -gt "$b" ] or if(("$a" > "$b")) -checks weather $a is greater than $b

if [ "$a" -ge "$b" ] or if(("$a" >= "$b")) -checks weather $a is greater than or equal to $b

if [ "$a" -lt "$b" ] or if(("$a" < "$b")) -checks weather $a is less than $b

if [ "$a" -le "$b" ] or if(("$a" <= "$b")) -checks weather $a is less than or equal to $b



String Comparison
let's consider a and b as string variables.

if [ "$a" = "$b" ] -checks weather two strings are equal

if [ "$a" != "$b" ] -checks weather two strings are different