ubuntu can’t boot from harddisk

January 23rd, 2009

my friends just install ubuntu 7.04 on Intel Atom (with Intel EFI board?) from ubuntu live cd, the installation goes well till finish. But it wont boot from the harddrive, but if we boot it from the live cd menu “Boot from first harddisk”  .. it boot well. I checked the BIOS boot-order setting was correct. So I was thinking it was the motherboard of the Intel Atom ? I was reading about elilo, grub2, etc.

But the solution was so simple, after i boot using the cd (”Boot from first hdd”), i got into console

# fdisk /dev/sda

Disk /dev/sda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1        2432    19535008+  83  Linux
/dev/sda2            9435        9729     2369587+   5  Extended
/dev/sda3            2433        9434    56243565   83  Linux
/dev/sda5            9435        9729     2369556   82  Linux swap / Solaris

Partition table entries are not in disk order

there’s no bootable flag, which is usually OK (will boot just fine). The solution was simple:

Command (m for help): m
Command action
a   toggle a bootable flag
b   edit bsd disklabel
Command (m for help): a    <=== type A
Partition number (1-5): Command (m for help): a
Partition number (1-5): 1    <=== type the partition number to set active

Command (m for help): p

Disk /dev/sda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        2432    19535008+  83  Linux
/dev/sda2            9435        9729     2369587+   5  Extended
/dev/sda3            2433        9434    56243565   83  Linux
/dev/sda5            9435        9729     2369556   82  Linux swap / Solaris

Partition table entries are not in disk order

Command (m for help): p

Disk /dev/sda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        2432    19535008+  83  Linux
/dev/sda2            9435        9729     2369587+   5  Extended
/dev/sda3            2433        9434    56243565   83  Linux
/dev/sda5            9435        9729     2369556   82  Linux swap / Solaris

Partition table entries are not in disk order

Command (m for help): w <==== save changes

# reboot

install/setting usb-to-parallel cable on linux

January 23rd, 2009

i bought new computer that don’t have parallel port and i need to install a parallel printer to it on linux. there are two options: buy a i/o port (1 parallel + 2 serial) port, the second option is to buy USB-to-Parallel cable which is cheaper and easier to deploy (no need to remove the computer casing).

  1. plug the usb-to-parallel cable
  2. check whether linux detect the cable
    root@server# dmesg
    you will get message saying “usb printing device/support” and something like “/dev/usblp0″. it means your cable is detected.
    root@server# lsusb  <— you might also try this
  3. Installing the printer
    i’m using ubuntu and by default use CUPS. To add new printer, click System > Administration > Printing > New Printer > Local Printer
  4. On the device location choose: LPT#1, or Serial or anything (since we will hack it later)
  5. Give it a name : my printer i name it “TM220″ (its a POS printer)
  6. root@server# vi /etc/cups/printers.conf
    <Printer TM220>
    Info
    Location
    DeviceURI parallel:/dev/usblp0    <=== change like this
    State Idle
    StateTime 1232687917
    Accepting Yes
    Shared Yes
    JobSheets none none
    QuotaPeriod 0
    PageLimit 0
    KLimit 0
    OpPolicy default
    ErrorPolicy retry-job
    </Printer>
  7. restart cups
    root@server# /etc/init.d/cupsys restart
  8. test : # cat test.txt | lpr -P TM220
  9. coffee time :p

change eth1 to eth0 in ubuntu linux

January 1st, 2009

after moving my harddrive(ubuntu inside) to another cpu, some of the server software didn’t serve well. i look around and found that my NIC is bind to eth1 now instead of eth0 (as in previous cpu). i tried many technique such us ifconfig eth1 down, etc, nothing works. here is how to fix it:

# vi /etc/iftab

edit the line below

eth0 mac 00:1D:92:B8:DD:41 arp 1 <—— MAC address of the new NIC
#eth0 mac 00:13:d3:e7:64:be arp 1 <—— comment-out original line for backup

then restart the networking service, or simply reboot the linux

# /etc/init.d/networking restart

or

# reboot

LTSP local printing on workstation

December 7th, 2008

edit dhcpd.conf

# dhcpd.conf

ddns-update-style             ad-hoc;

option subnet-mask            255.255.255.0;
option broadcast-address      192.168.1.255;
option routers                192.168.1.254;
option domain-name-servers    192.168.1.254;
option domain-name            "hq.bits-soft.com";   # You really should fix this
option option-128 code 128 = string;
option option-129 code 129 = text;

get-lease-hostnames           true;

host echohikaru {
  hardware ethernet 00:50:8b:75:33:a7;
  fixed-address 192.168.1.99;
}

subnet 192.168.1.0 netmask 255.255.255.0 {
    range   192.168.1.100   192.168.1.199;
    if substring (option vendor-class-identifier, 0, 9) = "PXEClient" {
#    if substring (option vendor-class-identifier, 0, 9) = "Shark_Client" {
        filename "/lts/2.6.17.3-ltsp-1/pxelinux.0";
    }
    else{
        filename "/lts/vmlinuz-2.6.17.3-ltsp-1";
    }
}

next-server                   192.168.1.252;
option root-path              "192.168.1.252:/opt/ltsp/i386";

#
# If you need to pass parameters on the kernel command line, you can
# do it with option-129.  In order for Etherboot to look at option-129,
# you MUST have option-128 set to a specific value.  The value is a
# special Etherboot signature of 'e4:45:74:68:00:00'.
#
# Add these two lines to the host entry that needs kernel parameters
#
#        option option-128     e4:45:74:68:00:00;       # NOT a mac address
#        option option-129     "NIC=ne IO=0x300";

edit /opt/ltsp/i386/lts.conf

# Copyright (c) 2003 by James A. McQuillan (McQuillan Systems, LLC)
#
# This software is licensed under the Gnu General Public License.
# The full text of which can be found at http://www.LTSP.org/license.txt
#
#
# Config file for the Linux Terminal Server Project (www.ltsp.org)
#

[Default]
        SERVER             = 192.168.1.252
        XSERVER            = auto
	X_MODE_0           = 1024x768
	X_COLOR_DEPTH	   = 16
#        X_MOUSE_PROTOCOL   = "PS/2"
#        X_MOUSE_DEVICE     = "/dev/psaux"
        X_MOUSE_PROTOCOL   = "ExplorerPS/2"
        X_MOUSE_DEVICE     = "/dev/input/mice"
        X_MOUSE_BUTTONS    = 3
        USE_XFS            = N
        SCREEN_01          = startx

#        SERVER             = 192.168.1.253
#        XSERVER            = auto
#	X_MODE_0           = 1024x768
#	X_COLOR_DEPTH	   = 16
	X_HORZSYNC         = 30-54
	X_VERTREFRESH      = 50-120
#        X_MOUSE_PROTOCOL   = "ExplorerPS/2"
#        X_MOUSE_DEVICE     = "/dev/input/mice"
	X_MOUSE_RESOLUTION = 400

[00:03:47:43:ae:37]
	X_MODE_0           = 1024x768
	X_COLOR_DEPTH	   = 16
	X_HORZSYNC         = 30-54
	X_VERTREFRESH      = 50-120
	X_MOUSE_RESOLUTION = 400

# AT&T Pentium1
[00:02:44:90:36:a7]
	X_VIDEORAM	   = 1024
	X_MODE_0           = 1024x768
	X_COLOR_DEPTH	   = 8
	#X_COLOR_DEPTH	   = 4
	X_MOUSE_RESOLUTION = 600
	X_HORZSYNC         = 30-54
	X_VERTREFRESH      = 50-120

# DELL Pentium3 500
[00:b0:d0:27:e1:e8]
	X_MODE_0           = 1024x768
	X_COLOR_DEPTH	   = 16
	X_HORZSYNC         = 30-54
	X_VERTREFRESH      = 50-120
        X_MOUSE_PROTOCOL   = "ExplorerPS/2"
        X_MOUSE_DEVICE     = "/dev/input/mice"
	X_MOUSE_RESOLUTION = 400

# Dell Optiplex baru
[00:c0:4f:0d:13:61]
	X_MODE_0           = 1024x768
	X_COLOR_DEPTH	   = 16
	X_HORZSYNC         = 30-54
	X_VERTREFRESH      = 50-120
        X_MOUSE_PROTOCOL   = "ExplorerPS/2"
        X_MOUSE_DEVICE     = "/dev/input/mice"
	X_MOUSE_RESOLUTION = 600

[00:0f:ea:c6:b4:b8]
	X_MODE_0           = 1024x768
	X_COLOR_DEPTH	   = 16
	X_HORZSYNC         = 30-54
	X_VERTREFRESH      = 50-120
	X_MOUSE_RESOLUTION = 400

# Celeron 466 MIGHTY
#[00:05:1c:04:8c:83]
#	X_MODE_0           = 1024x768
#	X_COLOR_DEPTH	   = 16
#	X_HORZSYNC         = 30-54
#	X_VERTREFRESH      = 50-120
#        X_MOUSE_PROTOCOL   = "ExplorerPS/2"
#        X_MOUSE_DEVICE     = "/dev/input/mice"
#	X_MOUSE_RESOLUTION = 400

# Compaq slim A
#[00:50:8b:75:27:17]
#	X_MODE_0           = 1024x768
#	X_COLOR_DEPTH	   = 16
#	X_HORZSYNC         = 30-54
#	X_VERTREFRESH      = 50-120
 #       X_MOUSE_PROTOCOL   = "ExplorerPS/2"
  #      X_MOUSE_DEVICE     = "/dev/input/mice"
#	X_MOUSE_RESOLUTION = 400
# compaq slim 2
[00:50:8b:33:07:28]
	X_MODE_0           = 1024x768
	X_COLOR_DEPTH	   = 16
	X_HORZSYNC         = 30-54
	X_VERTREFRESH      = 50-120
        X_MOUSE_PROTOCOL   = "ExplorerPS/2"
        X_MOUSE_DEVICE     = "/dev/input/mice"
	X_MOUSE_RESOLUTION = 400

# Compaq deskpro slim #3
[00:50:8b:92:28:08]
	X_MODE_0           = 1024x768
	X_COLOR_DEPTH	   = 16
	X_HORZSYNC         = 30-54
	X_VERTREFRESH      = 50-120
        X_MOUSE_PROTOCOL   = "ExplorerPS/2"
        X_MOUSE_DEVICE     = "/dev/input/mice"
	X_MOUSE_RESOLUTION = 400

# Compaq Deskpro Slim (00157561)
[00:50:8b:75:33:a7]
	X_MODE_0           = 1024x768
	X_COLOR_DEPTH	   = 16
	X_HORZSYNC         = 30-54
	X_VERTREFRESH      = 50-120
        X_MOUSE_PROTOCOL   = "ExplorerPS/2"
        X_MOUSE_DEVICE     = "/dev/input/mice"
	X_MOUSE_RESOLUTION = 400
	PRINTER_0_DEVICE = /dev/lp0
	PRINTER_0_TYPE   = P

reboot the client to check whether it get the static IP address, check syslog
# tail -f /var/log/syslog

Dec  7 12:41:04 lion dhcpd: DHCPDISCOVER from 00:50:8b:75:33:a7 via eth0
Dec  7 12:41:04 lion dhcpd: DHCPOFFER on 192.168.1.99 to 00:50:8b:75:33:a7 via eth0
Dec  7 12:41:05 lion dhcpd: DHCPDISCOVER from 00:50:8b:75:33:a7 via eth0
Dec  7 12:41:05 lion dhcpd: DHCPOFFER on 192.168.1.99 to 00:50:8b:75:33:a7 via eth0
Dec  7 12:41:07 lion dhcpd: DHCPDISCOVER from 00:50:8b:75:33:a7 via eth0
Dec  7 12:41:07 lion dhcpd: DHCPOFFER on 192.168.1.99 to 00:50:8b:75:33:a7 via eth0
Dec  7 12:41:11 lion dhcpd: DHCPREQUEST for 192.168.1.99 (192.168.1.252) from 00:50:8b:75:33:a7 via eth0
Dec  7 12:41:11 lion dhcpd: DHCPACK on 192.168.1.99 to 00:50:8b:75:33:a7 via eth0
Dec  7 12:41:18 lion dhcpd: uid lease 192.168.1.106 for client 00:50:8b:75:33:a7 is duplicate on 192.168.1/24
Dec  7 12:41:18 lion dhcpd: DHCPDISCOVER from 00:50:8b:75:33:a7 via eth0
Dec  7 12:41:18 lion dhcpd: DHCPOFFER on 192.168.1.99 to 00:50:8b:75:33:a7 via eth0
Dec  7 12:41:18 lion dhcpd: uid lease 192.168.1.106 for client 00:50:8b:75:33:a7 is duplicate on 192.168.1/24
Dec  7 12:41:18 lion dhcpd: DHCPREQUEST for 192.168.1.99 (192.168.1.252) from 00:50:8b:75:33:a7 via eth0
Dec  7 12:41:18 lion dhcpd: DHCPACK on 192.168.1.99 to 00:50:8b:75:33:a7 via eth0
Dec  7 12:41:18 lion mountd[5561]: authenticated mount request from ws099.ltsp:969 for /opt/ltsp/i386 (/opt/ltsp)

Add printer on the LTSP server

add tcp jetdirect printer

add tcp jetdirect printer

select generic ESC/POS

select generic ESC/POS

give a simple name

give a simple name

Done !, just print using the named printer POS1, it will print on the printer at the workstation

setting ncomputing on ubuntu 8.04

December 3rd, 2008

setting ncomputing L230 on ubuntu 8.04 or 8.10

root@hq:/home/david/tmp# ln -s /usr/share/fonts/X11/75dpi /usr/X11R6/lib/X11/fonts/75dpi
root@hq:/home/david/tmp# ln -s /usr/share/fonts/X11/100dpi /usr/X11R6/lib/X11/fonts/100dpi
root@hq:/home/david/tmp# ln -s /usr/share/fonts/X11/misc /usr/X11R6/lib/X11/fonts/misc
root@hq:/home/david/tmp# ln -s /usr/share/fonts/X11/Type1 /usr/X11R6/lib/X11/fonts/Type1

root@hq:/home/david/tmp# ln -s /etc/X11/ /usr/X11R6/lib/X11/xkb
root@hq:/home/david/tmp# ln -s /usr/share/X11/locale /usr/X11R6/lib/X11/locale
root@hq:/home/david/tmp# mkdir /usr/X11R6/lib/X11/xserver
root@hq:/home/david/tmp# ln -s /etc/X11/xserver/SecurityPolicy /usr/X11R6/lib/X11/xserver/SecurityPolicy

install gdm/xdm
allow XDMCP from other comp

=========================================================

root@hq:~# /usr/bin/ncomputing/x2nc --help
root@hq:~# ps aux|grep -i nc
root      5674  0.0  0.2   7336  3736 ?        S    19:16   0:00 /usr/bin/ncomputing/Xvnc4nc :1
root      6165  0.0  0.0   9680   176 ?        Ss   19:19   0:00 /usr/bin/ncltbootsrv
root      6166  0.0  0.0   9680   176 ?        S    19:19   0:00 /usr/bin/ncltbootsrv
root      6167  0.0  0.0   9680   176 ?        S    19:19   0:00 /usr/bin/ncltbootsrv
root      6198  0.2  0.4  41076  6508 ?        Sl   19:19   0:00 x2nc :2 -sock 7 -geometry 1024x768 -depth 16 -rfbwait 30000 -securitytypes none -broadcast -query localhost -once -pn
root      6200  0.0  0.3  11424  5696 ?        S    19:19   0:00 Xvnc4nc :2 -geometry 1024x768 -depth 16 -rfbwait 30000 -securitytypes none -broadcast -query localhost -once -pn
root      6209  0.0  0.0   3004   768 pts/0    R+   19:20   0:00 grep -i nc

install quake2 ubuntu Couldn’t load pics/colormap.pcx SNDDMA_Init: Could not mmap /dev/dsp,

November 7th, 2008

i install quake2 on my ubuntu 7.04 feisty from synaptic, both package quake2 & quake2-data but when i run, came out this error:

$ quake2
...
Couldn't load pics/colormap.pcx
...

here are my step2 to fix it:

  1. $ mv /usr/lib/games/quake2/baseq2 /usr/lib/games/quake2/baseq2.bak
  2. is to copy baseq2 folder from your Quake2 CD to /usr/lib/games/quake2
  3. $ cp -R /cdrom/baseq2 /usr/lib/games/quake2/
  4. $ mv /usr/lib/games/quake2/baseq2/Pak0.pak /usr/lib/games/quake2/baseq2/pak0.pak
  5. $ cp /usr/lib/games/quake2/baseq2.bak/game* /usr/lib/games/quake2/baseq2
  6. $ mv /usr/share/games/quake2/baseq2 /usr/share/games/quake2/baseq2.bak
  7. $ ln -s /usr/lib/games/quake2/baseq2 /usr/share/games/quake2/baseq2

then try to run $ quake2
the game can be run now but still got no sound, and here is the error:

SNDDMA_Init: Could not mmap /dev/dsp.

here how to run quake with proper sound (at least for my computer):

$ quake2 +set snddriver ao +set snddevice oss

or add these lines to /home/you/.quake2/baseq2/config.cfg

set snddriver "ao"
set snddevice "oss"

here is the tweak to make it fullscreen

set vid_ref "softsdl"
set vid_fullscreen "1"

and here are some cheat i still remember from old days, type “~” would bring quake2 console, type:

All commands are entered from Quake 2’s console - press ~ key to access it.

  • GOD - God Mode
  • NOCLIP - No Clip Mode
  • NOTARGET - No Target Mode
  • GIVE ALL - Give all items (except those listed below)
  • GIVE HEALTH - Give 100 health
  • GIVE WEAPONS - Give all weapons
  • GIVE AMMO - Give all ammo
  • GIVE ARMOR - Give body armor
  • SET g_unlimited_ammo 1 - Unlimited ammo

Commands below give you items not given by “GIVE ALL”

  • GIVE BLUE KEY
  • GIVE RED KEY
  • GIVE COMBAT ARMOR
  • GIVE AIRSTRIKE MARKER
  • GIVE ARMOR SHARD
  • GIVE SECURITY PASS
  • GIVE POWER SHIELD
  • GIVE COMMANDER’S HEAD

Also,

  • MAP mapname - jump to a different map (base1, base2, waste1, etc..)

setting .htaccess tutorial

November 3rd, 2008

here is my note how i do simple http auth to protect my content :

root@hq:/# cd /var/www/bits
root@hq:/var/www/bits# nano .htaccess

	AuthName "BITS members only"
	AuthType Basic
	AuthUserFile /var/www/bits/.htpasswd
	Require valid-user

root@hq:/var/www/bits# htpasswd -c .htpasswd dave
New password:
Re-type new password:
Adding password for user dave

root@hq:/var/www/bits# nano /etc/apache2/sites-available/default 

        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride AuthConfig			<<<<<<<<<<
                Order allow,deny
                allow from all
                # This directive allows us to have apache2's default start page
                # in /apache2-default/, but still have / go to the right place
                #RedirectMatch ^/$ /apache2-default/
        </Directory>

root@hq:/var/www/bits# /etc/init.d/apache2 restart

mysql reset/forgot root password

November 3rd, 2008

just now i accidentally runs this : mysql> update user set password=md5(’secret’); flush privileges;
it happens that it should be mysql> update user set password=password(’secret’);

but it was too late, i here i share the ways to reset root password of mysql

# /etc/init.d/mysql stop
# /usr/sbin/mysqld --skip-grant-tables &
# mysql -uroot mysql

mysql> update user set password=password('secret') where user='root';
mysql> flush privileges;

# killall mysqld
# /etc/init.d/mysql start

how to edit/change Joomla 1.5 ‘Welcome to the Frontpage’

September 13th, 2008

just switch to joomla 1.5, but started to get headache to look for the place to change welcome to frontpage.

  • Login to administration page
  • Click Menu -> Menu Manager
  • on row “mainmenu“, click on the icon under column “Menu item(s)”
    mainmenu_edit
  • on next screen, click “Home” to edit
  •   click “Parameters (System)“, edit the textbox labelled PageTitle to change the “Welcome to frontpage”into anything
  • joomla 1.5 welcome to frontpage

setting ncomputing L230 for linux ubuntu

August 13th, 2008

last month i bought an ncomputing-compatible (seemed to be L230 compatible) client that said to work with Linux, but it killing me to set it up
fyi, last time i try to install it on ubuntu 6.10 edgy

today i succeed install ncomputing using my other linux box which use Ubuntu Feisty 7.0.4
here is how:

  1. unzip the linux driver (shipped with the product), for me it is linux1.zip
    # unzip linux1.zip
  2. here is the files extracted
    root@lion:/root/netpoint# ls
    hpoemtid.tdx  lntsinst  lntsinst_arch.tar  setupnc.exe  setupnc.ver
    root@lion:/root/netpoint#
  3. make sure its executable & execute:
    # chmod +x lntsinst
    # ./lntsinst
  4. follow the install screen steps
  5. install VNC4Server & xinetd
    # apt-get install vnc4server
    # apt-get install xinetd
  6. setting vnc in /etc/xinetd.d/
    # vi /etc/xinetd.d/vnc1
    ------------------here is the content -------------
    service vnc1
    {
            type = UNLISTED
            disable = no
            socket_type = stream
            protocol = tcp
            wait = yes
            user = root
            server = /usr/bin/Xvnc
            server_args = -inetd :2 -query localhost -geometry 1024x768 -depth 16 -cc 3 -once -SecurityTypes=none -extension XFIX
    ES
            port = 5901
    }
  7. restart everything:
    # /etc/init.d/ncltsrv restart
    # /etc/init.d/xinetd restart
  8. set your ncomputing client to be Linux compatible
  9. done!