9/26/07

Enable Nvidia AGP Fast Writes and Side Band Addressing on ubuntu Feisty

Today I found tutorial about turn on AGP Fast Writes and Side Band Addressing on nvidia graphic card that not enable by default[ my SBA is already enable, don't know why? ]. Even I'm not sure what it for? I guess it's something that increase 3D performance. Anyway I still want to enable it if my card can support. Since last time I play with my graphic card, my status is

pnix@pnix-a7n:~$ cat /proc/driver/nvidia/agp/status
Status: Enabled
Driver: NVIDIA
AGP Rate: 8x
Fast Writes: Disabled
SBA: Enabled

First check that your card and motherboard are support by
pnix@pnix-a7n:~$ cat /proc/driver/nvidia/agp/card
Fast Writes: Supported
SBA: Supported
AGP Rates: 8x 4x
Registers: 0xff000e1b:0x1f004302
pnix@pnix-a7n:~$ cat /proc/driver/nvidia/agp/host-bridge
Host Bridge: PCI device 10de:01e0
Fast Writes: Supported
SBA: Supported
AGP Rates: 8x 4x
Registers: 0x1f00421b:0x00000302
pnix@pnix-a7n:~$

or there is the newer way
pnix@pnix-a7n:~$ cat /proc/driver/nvidia/registry
VideoMemoryTypeOverride: 1
EnableVia4x: 0
EnableALiAGP: 0
NvAGP: 3
ReqAGPRate: 15
EnableAGPSBA: 0
EnableAGPFW: 0

SoftEDIDs: 1
Mobile: 4294967295
ResmanDebugLevel: 4294967295
FlatPanelMode: 0
DevicesConnected: 0
RmLogonRC: 1
VbiosFromROM: 0
ModifyDeviceFiles: 1
DeviceFileUID: 0
DeviceFileGID: 0
DeviceFileMode: 438
RemapLimit: 0
UseCPA: 4294967295
DetectPrimaryVga: 1
SaveVBios: 0
EnableBrightnessControl: 0
PanelPWMFrequency: 1018
PanelBrightnessLimits: 65280
RMEdgeIntrCheck: 1
pnix@pnix-a7n:~$

now my current frame rate is about
pnix@pnix-a7n:~$ glxgears -info
GL_RENDERER = GeForce 6200/AGP/SSE/3DNOW!
GL_VERSION = 2.1.0 NVIDIA 96.31
GL_VENDOR = NVIDIA Corporation
GL_EXTENSIONS = GL_ARB_color_buffer_float GL_ARB_depth_texture GL_ARB_draw_buffers
.
.
GL_SGIS_generate_mipmap GL_SGIS_texture_lod GL_SGIX_depth_texture GL_SGIX_shadow GL_SUN_slice_accum
8405 frames in 5.0 seconds = 1680.943 FPS
8117 frames in 5.0 seconds = 1623.218 FPS
7256 frames in 5.0 seconds = 1451.083 FPS
8248 frames in 5.0 seconds = 1649.593 FPS
7872 frames in 5.0 seconds = 1574.323 FPS
7993 frames in 5.0 seconds = 1598.514 FPS
8243 frames in 5.0 seconds = 1648.591 FPS
8300 frames in 5.0 seconds = 1659.995 FPS
6721 frames in 5.0 seconds = 1344.161 FPS
8324 frames in 5.0 seconds = 1664.768 FPS
8337 frames in 5.0 seconds = 1667.350 FPS
8479 frames in 5.0 seconds = 1695.651 FPS

To turn on those two option you need to edit '/etc/modprobe.d/nvidia-kernel-nkc' file. Open it with your favorite text editor and make it look like this.
alias char-major-195* nvidia
options nvidia NVreg_EnableAGPFW=1 NVreg_EnableAGPSBA=1

then reboot.
After it come back on, I can't see noticable change. except
pnix@pnix-a7n:~$ cat /proc/driver/nvidia/agp/status
Status: Enabled
Driver: NVIDIA
AGP Rate: 8x
Fast Writes: Enabled
SBA: Enabled

ref: original howto on gentoo-wiki

9/22/07

Resurrect my old ide disk

I've got the problem with my old ide harddrive fews day ago. At last i found that it's ide cable is bad and that destroy the partition table. Anyway today after recover and backup the files, I create new partition table with fdisk and here is the new table.

Disk /dev/hda: 60.0 GB, 60022480896 bytes
16 heads, 63 sectors/track, 116301 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes

Device Boot Start End Blocks Id System
/dev/hda1 1 58130 29297488+ 7 HPFS/NTFS
/dev/hda2 58131 116301 29318184 83 Linux
50/50 ntfs and ext3 should be fair :). After repartition, Ubuntu know only hda1 as 10GB partition[my old config]. what i forget? May be need to fotmat it first. I'm not sure how to format ntfs partition in ubuntu so i reboot to winxp, format it then turn back to ubuntu again. Now I format hda2 like this.
pnix@pnix-a7n:~$ sudo mke2fs -j /dev/hda2
mke2fs 1.40-WIP (14-Nov-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
3670016 inodes, 7329546 blocks
366477 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
224 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 33 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
pnix@pnix-a7n:~$
Last thing add 2 new partition to fstab to let it automount.First create mount point with 'sudo mkdir /media/hda2'[hda1 already exist] then find the uuid and edit /etc/fstab like this.
# /dev/hda1
UUID=9EF07DDDF07DBBD9 /media/hda1 ntfs defaults,nls=utf8,umask=007,gid=46 0 1
# /dev/hda2
UUID=30bf1301-3dbd-47f0-b80e-b68047358a53 /media/hda2 ext3 defaults 0 1
After reboot hda2 is mounted but no write permission for me, still has other thing to fix. I follow this guide and run command below
pnix@pnix-a7n:~$ sudo chgrp plugdev /media/hda2
pnix@pnix-a7n:~$ sudo chmod g+w /media/hda2
pnix@pnix-a7n:~$ sudo chmod +t /media/hda2
to change group, add write permission and sticky bit. And that it my old ide disk is come back and ready for command.

note: "chmod +t" adds the sticky bit, so that people can only delete their own files and sub-directories in a directory

9/19/07

ssl+apache2 feisty

This will be part2 of my setting up apache2 on feisty[part1 here]. As I remember to enable ssl on apache first we need to run 'apache2-ssl-certificate' to create certificate file. But apache2-ssl-certificate is not come with apache2 package in feisty so the procedure need little change.
First, create 'ssl' dir in '/etc/apache2' and create cert. file with 'make-ssl-cert'.

pnix@pnix-a7n:~$ sudo mkdir /etc/apache2/ssl
Password:
pnix@pnix-a7n:~$ sudo make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/apache2/ssl/apache2.pem
pnix@pnix-a7n:~$

Enable ssl module.
pnix@pnix-a7n:~$ sudo a2enmod ssl
Module ssl installed; run /etc/init.d/apache2 force-reload to enable.
pnix@pnix-a7n:~$

Add "Listen 443" to /etc/apache2/ports.conf.
pnix@pnix-a7n:~$ echo "Listen 443" | sudo tee -a /etc/apache2/ports.conf
Listen 443
pnix@pnix-a7n:~$

Create ssl site
pnix@pnix-a7n:~$ sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/ssl
pnix@pnix-a7n:~$

edit /etc/apache2/sites-available/ssl by adding bold character like this
NameVirtualHost *:443
<VirtualHost *:443>
ServerAdmin webmaster@localhost
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/apache2.pem

.
</VirtualHost>

and for /etc/apache2/sites-available/default
NameVirtualHost *:80
<VirtualHost *:80>
.
</VirtualHost>

Now enable ssl site by
pnix@pnix-a7n:~$ sudo a2ensite ssl
Site ssl installed; run /etc/init.d/apache2 reload to enable.
pnix@pnix-a7n:~$

Last thing is restart apache2 and ssl should work.

9/16/07

Better way to manage services in Ubuntu with rcconf

I want to prevent apache2 from autostart but update-rc.d is not let me do that. Look like update-rc.d is only for install and remove scripts[ not for update ].

pnix@pnix-a7n:~$ ls /etc/rc2.d
README S20hotkey-setup S89cron
S05vbesave S20makedev S90binfmt-support
S10powernowd.early S20nvidia-kernel S91apache2
S10sysklogd S20privoxy S98usplash
S10xserver-xorg-input-wacom S20rsync S99acpi-support
S11klogd S20tor S99rc.local
S12dbus S50acpid S99rmnologin
S13gdm S89anacron S99stop-readahead
S20apport S89atd
pnix@pnix-a7n:~$ sudo update-rc.d apache2 stop 91 0 1 2 6 .
System startup links for /etc/init.d/apache2 already exist.
pnix@pnix-a7n:~$
rcconf, the debian runlevel configuration tool, is more suit for this job. Let's install and run it from teminal.
pnix@pnix-a7n:~$ sudo aptitude install rcconf
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Building tag database... Done
The following NEW packages will be installed:
rcconf
0 packages upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 18.2kB of archives. After unpacking 115kB will be used.
Writing extended state information... Done
Get:1 http://th.archive.ubuntu.com feisty/universe rcconf 1.19 [18.2kB]
Fetched 18.2kB in 0s (20.3kB/s)
Selecting previously deselected package rcconf.
(Reading database ... 113711 files and directories currently installed.)
Unpacking rcconf (from .../archives/rcconf_1.19_all.deb) ...
Setting up rcconf (1.19) ...
pnix@pnix-a7n:~$ sudo rcconf
rcconf give easy interface to select which service should start in current run level.

9/15/07

Apache2 web server on Feisty

Apache2 installation on feisty is just one line 'sudo aptitude install apache2'.

pnix@pnix-a7n:~$ sudo aptitude install apache2
Password:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Building tag database... Done
The following NEW packages will be automatically installed:
apache2-mpm-worker apache2-utils apache2.2-common libapr1 libaprutil1
The following NEW packages will be installed:
apache2 apache2-mpm-worker apache2-utils apache2.2-common libapr1 libaprutil1
0 packages upgraded, 6 newly installed, 0 to remove and 0 not upgraded.
.
.
Setting up apache2-mpm-worker (2.2.3-3.2ubuntu0.1) ...

* Starting web server (apache2)...
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName [ OK ]

Setting up apache2 (2.2.3-3.2ubuntu0.1) ...
pnix@pnix-a7n:~$
I fix the “Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
” warning message by add “ServerName <myservername>” to '/etc/apache2/apache2.conf'.
Another thing is apache use 127.0.1.1 instead of 127.0.0.1. In '/etc/hosts' file it has a line state that
127.0.1.1 <myservername>
I just change 127.0.1.1 to 127.0.0.1.
Now try to restart apache2 again. The warning message will be gone.
pnix@pnix-a7n:~$ sudo apache2 -k restart
Password:
pnix@pnix-a7n:~$


Note: I just know that the address 127.0.0.1 to 127.255.255.254 are all loopback address.

Now for php
pnix@pnix-a7n:www$ sudo aptitude install php5
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Building tag database... Done
The following NEW packages will be automatically installed:
apache2-mpm-prefork libapache2-mod-php5 php5-common
The following packages will be automatically REMOVED:
apache2-mpm-worker
The following NEW packages will be installed:
apache2-mpm-prefork libapache2-mod-php5 php5 php5-common
The following packages will be REMOVED:
apache2-mpm-worker
0 packages upgraded, 4 newly installed, 1 to remove and 0 not upgraded.
Need to get 3184kB of archives. After unpacking 6324kB will be used.
Do you want to continue? [Y/n/?] y
.
.
Creating config file /etc/php5/apache2/php.ini with new version

* Forcing reload of web server (apache2)... [ OK ]



Setting up php5 (5.2.1-0ubuntu1.4) ...

pnix@pnix-a7n:www$

Time to test
Now I will create the most popular php testing script in the world, yes, phpinfo(). Use any text editor create a file called phptest.php that have one line '' then move it to web root directory[/var/www by default]. Open web browser and goto 'http://myservername/phptest.php'. If everything is ok you should see something like this.

Ubuntu kill your hard drive???

I've got a problem with my desktop box again and look like it's happen periodically [every 5 months I think]. In the box, I have two hard drives. The new one, sata, is installed as dual boot disk, feisty and xp and another is 5 years old ide. I use it to store some unimportance files. Yesterday I start up ubuntu and can't mount the old one. It made some noise at boot time but this is nothing weird, It's sound terrible like this every day. The difference is this time it can't mount.

Until now I still not sure my old ide is bad. Almost parts in the box are almost 5 years old, it can die at anytime. Maybe it's power supply, I don't know, it run at least 5 hours a day everyday for almost five years. Anyway my main SATA still healthy.

I found this thread on ubuntuforums, he said ubuntu kill his laptop drive.

This is because upon power off, the kernel sends the FLUSH CACHE message to the disk to flush the disk write cache, which cause it to spin up. Then it suddenly shuts down making no call to the STANDBY signal to make the disk stop. The result is that the hdd keeps spinning as the power is off. Modern hdd's (yours, if it works after rebooting), can prevent such damage by taking the head off the disk surface just after power down so it does not hurt the disk in such situation. This is called an emergency unload. Technical specifications say doing this instead of the regular standby can reduce the drive's life time by about a rate of thrity (30) times. The symptoms of this is a weird noise upon shutdown (power off). It is like a "pop"!


It's sound like it's laptop only bug and thanks for Martin Ko├čler for his shutdown disk scripts.
Simply write a file at "/etc/rc0.d/S00hdd-shutdown-workaround" which includes this two lines:

#!/bin/sh
echo 1 > /sys/class/scsi_disk/0\:0\:0\:0/stop_on_shutdown

If you have more than one directory at "/sys/class/scsi_disk/" try to find out which of it is your internal harddisk (e.g. "cat /sys/class/scsi_disk/a:b:c:d/device/model") If you have more than one harddisk add another line for each of them.

Then make it executable ("chmod +x filename")
At the next shutdown it should park the hd heads.

9/10/07

Bad version number in .class file

I need a new free java server because myjavaserver.com, free host that i use for along time has a problem. My friend tell me to check out eatj.com, another free java host. I think it's great for doing a test. I just register for a free account and upload my testing web app to it. Testing my first apps give me "Bad version number" as you see below.

javax.servlet.ServletException: Bad version number in .class file
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:273)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

I guess these caused by eatj.com tomcat is running with j2se 1.5 but I compile my servlet with j2se 1.6.
Anyway, the problem is easily solve by recompile with option -target 1.5.

9/6/07

3D Windows, Cube Atlantis and more effects for Compiz Fusion on Ubuntu Feisty


When I looked at others screenshot posted on the web I noticed that some have window float off the cube when rotating. I love it and looking for what effect to do like that. Someone on ubuntuforums said "just enable 3D windows effect" but my "compizconfig setting manager" didn't has that effect to enable :(. or others said "it's for beryl only" that hard to believe. I try to search for plugin package and found that I miss two of four plugins packages, unofficial and unsupported[on tuxfamily.org]. Pick the leftover packages.

pnix@pnix-a7n:~$ sudo aptitude install compiz-fusion-plugins-unofficial compiz-fusion-plugins-unsupported
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Building tag database... Done
The following NEW packages will be installed:
compiz-fusion-plugins-unofficial compiz-fusion-plugins-unsupported
0 packages upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 139kB of archives. After unpacking 532kB will be used.
Writing extended state information... Done
Get:1 http://download.tuxfamily.org feisty/eyecandy compiz-fusion-plugins-unofficial 0.0.2~git20070902+3v1ubuntu0 [92.1kB]
Get:2 http://download.tuxfamily.org feisty/eyecandy compiz-fusion-plugins-unsupported 0.5.2~git20070831+3v1ubuntu1 [47.1kB]
Fetched 139kB in 5s (24.4kB/s)
Selecting previously deselected package compiz-fusion-plugins-unofficial.
(Reading database ... 113055 files and directories currently installed.)
Unpacking compiz-fusion-plugins-unofficial (from .../compiz-fusion-plugins-unofficial_0.0.2~git20070902+3v1ubuntu0_i386.deb) ...
Selecting previously deselected package compiz-fusion-plugins-unsupported.
Unpacking compiz-fusion-plugins-unsupported (from .../compiz-fusion-plugins-unsupported_0.5.2~git20070831+3v1ubuntu1_i386.deb) ...
Setting up compiz-fusion-plugins-unofficial (0.0.2~git20070902+3v1ubuntu0) ...
Setting up compiz-fusion-plugins-unsupported (0.5.2~git20070831+3v1ubuntu1) ...
pnix@pnix-a7n:~$
As you see pic on the right, now in my "CompizConfig Setting Manager" two more effects are added, 3D Windows and Cube Atlantis. Actually it has more added to other section but I can not remember which one are new.