Saturday, August 30, 2008

Unbutu Admin Tips

Some tips on Unbuntu
1. Tire of using sudo for each admin command on Ubuntu, you can run "sudo -i" to start a shell as super user.
2. Want to enable root password
Run "sudo passwd root" and input password, after this, you can log in as root by su - with the password.

Saturday, March 8, 2008

Autoruns for Ubuntu

For windows, there are various ways to start a program when a user logs in. There is a similar way to do that in Ubuntu. And the below description is based on Ubuntu 7.10.

Click the menu of "System=>Preferences=>Sessions" in the panel, a window of sessions will pop up. The first property page of the window is "Startup Programs". You can add the program you want to run as startup program. And it will be run every time when you log into the X windows.

Saturday, February 16, 2008

Install eCos on Ubuntu

Here are some steps to set up eCos on Ubuntu 7.10. I referred to the link of
http://psas.pdx.edu/CapstoneLV2bProjectReport/Software. But not every step
are followed exactly. Here is the steps that I tried out successfully.

1. Follow the instructions in the section of eCos of the following web page:
http://ecos.sourceware.org/getstart.html

2. Set up the environment by sourcing the bash script of ecosenv.sh.

3. Install two prerequisite packages of libpng3 and libtiff4. Otherwise, running the configtool of eCos will have the following errors:
configtool: error while loading shared libraries: libpng.so.2: cannot open shared object file: No such file or directory.
and
configtool: error while loading shared libraries: libtiff.so.3: cannot open shared object file: No such file or directory

a. Run "sudo apt-get install libpng3" and "sudo ln -sf /usr/lib/libpng.so.3 /usr/lib/libpng.so.2" to eliminate the error related to libpng.so.2.
b. Run "sudo apt-get install libtiff4" and "sudo ln -sf /usr/lib/libtiff.so.4 /usr/lib/libtiff.so.3" to eliminate the error related to libtiff.so.3

4. Go to the directory where eCos-2.0 locates. Check out the latest eCos repository by:
cvs -z3 -d :pserver:anoncvs@ecos.sourceware.org:/cvs/ecos co -P ecos

5. Set the environment so that ECOS_REPOSITORY points to the packages of the CVS repository by running "export ECOS_REPOSITORY=$cvs-eCos/packages".

6. Get the patch with support for LPC2148 in this link http://sourceware.org/ml/ecos-patches/2005-11/msg00014.html
and patch it via "patch -p1 <>"Template" and select "Hobby-Robotics iH
1_proc_lpc_1 board" in the first drop down box in the pop-up dialog and click
"OK".

8. Get the software to run on lpc2148 via the link of lpc2148 ecos.tgz, and exact it. A directory of lpc2148_ecos will be created.

9. In the directory of gnutools/arm-elf/bin, create symbolic links of arm-linux-gnu-ar, arm-linux-gnu-as, arm-linux-gnu-gcc and arm-linux-gnu-objcopy
which links to arm-elf-ar, arm-elf-as, arm-gcc and arm-objcopy respectively. These
links will be used during step 10.

10. Go to the directory of lpc2148_ecos and run the tool of configtool. Open the file of lpc2148_rom.ecc. Click "Build"=>"Generate Build Tree". After it completes, click "Build"=>"Build Library" to compile the library.

11. In the directory of lpc2148_ecos, compile the eCos demo by
make INSTALL_DIR=$lpc2148_ecos_dir/lp2148_rom_install.
Blinky.hex will be generated.

12. Flash the Blinky.exe to the lpc2148 eval board + quick start board via lpc21isp, the leds corresponding to pin 0.10 and pin 0.11 will be on. The blinky.c
in the directory of lpc2148_ecos can be changed and recompiled to turn on other leds.

Wednesday, January 23, 2008

issue of libgtkembedmoz for Acrobat 8.1 reader

When starting the acrobat reader 8.1, I got an error message that libgtkembedmoz cannot be found.

Fixed this issue by reading the link of http://blogs.adobe.com/acroread/reference/.

In sum, run "ldd `which yelp` | grep libgtkembedmoz" and then put the corresponding directory (/usr/lib/firefox for my situation) in the Edit->Preferences->Internet->libgtkembedmoz folder. This fixed the issue.

Tuesday, January 8, 2008

Man pages for development

Today I met a problem when run "man fopen" on Ubuntu. The error I got is "No manual entry for fopen". This turns out to be caused by the missing of manpages-dev. After installing this package, I can get the manual for system calls and library calls.

Friday, January 4, 2008

sshfs

I used to use sshfs on SuSE. A very handy tool. Here is a HOW-TO on Ubuntu 7.10.
1. install the sshfs package.
sudo apt-get install sshfs
2. add user to the group of fuse to allow the user to mount sshfs file systems.
sudo usermod -a -G fuse $username
3. fix a bug
My Xbuntu os's /etc/mtab is a symbolic link to /proc/mounts, and I met an issue below.
Nabble - Bug#447621: libfuse2: fuse fails if /etc/mtab is a symlink to /proc/mounts

I did the following to fix the issue.
sudo cp /etc/mtab /etc/mtab.bak
sudo rm /etc/mtab
sudo mv /etc/mtab.bak /etc/mtab
4. Now you can try "sshfs $user@remotehost:$location $mountpoint".
5. To mount sshfs easier, you can put an entry in /etc/fstab.
sshfs#user@$remotehost:[$path] $mountpoint fuse user,noauto 0 0
If you want other users to be able to access the directory, you can specify
user_allow_other in /etc/fuse.conf. And then put the option of allow_other or
allow_root into /etc/fstab.
If you want to be able to execute a program in the sshfs mounted, you can specify the mount option of exec in the entry in /etc/fstab.

Login windows fonts too large for Ubuntu 7.10

The system I installed with Ubuntu 7.10 has a problem that the fonts of the login windows is too big such that I cannot see the user name I typed.

To fix this, select the menu of System->Administration->Login Window. A window will be shown for Login Window Preferences. Select the tab of security and click the "Configure X server" at the bottom of the tab. A pop up dialog of "X Server Login Window Preferences" will be shown. Under the topic of "Server settings" there is a field of "Command", append "-dpi 96" to the existing value and reboot the machine. Should be fixed now.

Thursday, January 3, 2008

Using Shared folders feature of VirtualBox

The VirtualBox has a neat feature of "shared folders" between host and guest. Here is description of how to do it on Ubuntu 7.10

The shared folders are folders on the host that can be shared by the guest. First, you need to create shared folders via the GUI by adding the folders on the host and give names for them. I created a shared folder of /home/$myaccount/work and give it a name of work.

The other things to be done is on the guest side.
I created a directory of /home/$myaccount/work on the guest os.
To mount the directory, the following command can be run
sudo mount.vboxsf work /home/$myaccount/work
or
sudo mount.vboxsf work ~/work

It is interesting that the following commands will not work
sudo mount -t vboxsf work /home/$myaccount/work
/sbin/mount.vboxsf: mounting failed with the error: Protocol error
This maybe is because sudo mount -t vboxsf is different from sudo mount .vboxsf.
It is found that after you ran sudo -i to get a shell, the command of
mount -t vboxsf work /home/$myaccount/work will work.

To mount the shared folder easier and writable by the my account, the following line was added to /etc/fstab.
"work /home/$myaccount/work vboxsf rw,gid=$mygid,uid=$myuid,auto 0 0"

In addition, I appended the following in the .bashrc
mount | grep work 1>/dev/null 2>&1
if [ ! $? ]; then
sudo mount.vboxsf work ~/work
fi

This way whenever I logged in the shared folder is accessible.

Wednesday, January 2, 2008

Wireless Support of Host Interface for VirtualBox

It is know from various posts online that simply using bridged networking won't work for a wireless card. I followed the following link to configure host interface for my wireless card on ubuntu 7.10

Bridged Networking with VirtualBox on Linux Hosts

However, there is one important thing missing that makes the networking of the guest os unstable, sometimes connect to the host or internet. I turned on tcpdump and also run netstat and find out the reason why sometimes the networking will fail in the guest. It seems that every time when networking is working, there is a route that tells host to connect to guest to use tap0. Sometimes the route is not there and the guest's networking will fail.

With this information I run "ip route add $guestip dev tap0" and found this makes the networking of the guest very stable and always working.

Here are a couple of approaches to make life more easier.

Google toolbar v5 issue on Ubuntu 7.10

I installed the Google toolbar v5 for firefox on ubuntu 7.10. It doesn't function well, firefox easily freezes and the bookmark doesn't function, hanging with a message of loading bookmarks. After some search online, this problem is solved by the following steps:
1. Uninstall the Google toolbar v5 first, and restart firefox to make it take effective.
2. Install libstd++5 and its dependent packages.
3. Install the Google toolbar v5 again.

After this, everything works fine.

Adobe flash player not working for Ubuntu 7.10

Ubuntu question #19584: “Adobe flash player not working”

Below is a quote from the link:

"This is not your fault. This is a very recent bug, caused by Adobe's update of Flash 9.0 update 3 (9.0.115.0) codename 'Moviestar' on December 4th.

http://www.adobe.com/aboutadobe/pressroom/pressreleases/200712/120407adobemoviestar.html

This caused Ubuntu to not install the flash plugin, detecting a change in the flash plugin installer file (via MD5 checksums). See bug 173890. This bug has been fixed in the next release of Ubuntu (Hardy 8.04) and it should soon come as an update to Ubuntu 7.10.

If you want an immediate fix, do the following.

Using Synaptic Package Manager, remove the package flashplugin-nonfree. For more information on how to do this, see the Ubuntu documentation here: https://help.ubuntu.com/7.10/add-applications/C/advanced.html#synaptic

Alternatively, you can run this command in the Terminal (Applications -> Accessories -> Terminal): sudo apt-get remove flashplugin-nonfree

Then just download this package (32-bit only) and install it (it is identical to the current package in the next release of Ubuntu, Hardy 8.04): http://launchpadlibrarian.net/10761023/flashplugin-nonfree_9.0.115.0ubuntu2_i386.deb

If you have 64-bit Ubuntu (not likely or recommended for a person new to Ubuntu), you currently need to build a binary package from this source package: http://bugs.launchpad.net/ubuntu/+source/flashplugin-nonfree/9.0.11"

Tuesday, January 1, 2008

Install VirtualBox on Ubuntu 7.10

After downloading the VirtualBox 1.5.4, right click the package and click install. The package will be installed.

After the installation, you can run a command of "sudo usermod -a -G vboxusers $username" to add the current user to the group of vboxusers. This is needed because the user to run VirtualBox needs to access virtualbox device.

Download the iso of Xubuntu Desktop to local. Add a new virtual machine, and use the ISO file as the CDRom image.

Then I met a problem when trying to configure devices for a virtual machine. The error message is "Could not load the Host USB Proxy Service (VERR_FILE_NOT_FOUND). The service might be not installed on the host computer."

This bug is https://bugs.launchpad.net/ubuntu/+source/virtualbox/+bug/151585.
And to solve the problem
"Please open the following file: /etc/init.d/mountdevsubfs.sh
Find the following lines:
#mkdir -p /dev/bus/usb/.usbfs
#domount usbfs "" /dev/bus/usb/.usbfs -obusmode=0700,devmode=0600,listmode=0644
#ln -s .usbfs/devices /dev/bus/usb/devices
#mount --rbind /dev/bus/usb /proc/bus/usb
Unmark them".

Reboot the machine. And the error is solved.

Configure the networking, enable one ethernet adapter and use NAT. Start powering the virtual machine and install the Xubuntu as the guest os.

Install the Guest addition:
1. Click the menu of "Device->Install Guest Additions...", then start a terminal in Xubuntu and run "cd /media/cdrom0" and "sudo bash VBoxLinuxAdditions.run" to install the guest addition.
2. Reboot the machine to make the guest addition take effect.

Make the full screen higher resolution:
Need to edit the file of /etc/X11/xorg.conf in the following section
Section "Screen"
Identifier "Default Screen"
Device "Generic Video Card"
Monitor "Generic Monitor"
DefaultDepth 24
SubSection "Display"
Modes "800x600"
EndSubSection
EndSection

Add a mode of 1280x800 in the line of "Modes", the line will became
Modes "1280x800" "800x600"

After this is done, log out and you got a full screen now.