My environment is Ubuntu jaunty (9.04).
sudo aptitude install nis dhcp3-server tftpd
sudo ifconfig eth0:1 192.168.0.1 (when system only has 1 nic port)
# import gpg key
wget -q http://drbl.sourceforge.net/GPG-KEY-DRBL -O- | sudo apt-key add -
# add following line into source list
# then aptitude update and install drbl
deb http://drbl.sourceforge.net/drbl-core drbl stable testing unstable
# For setting up system environment, here has lots of setting, and choose which IP to be the PXE interface should be the most important portion.
sudo /opt/drbl/sbin/drblsrv -i
sudo /opt/drbl/sbin/drblpush -i
-----------------------------------
# start to use clonezilla
sudo /opt/drbl/sbin/dcs
# clone the client image
All --> clonezilla-start --> Beginner --> save-disk
# restore the local image to the client
All --> clonezilla-start --> Beginner --> restore-disk
Now you can boot up your client, then it will show you the GRUB menu with deploy option.
星期五, 七月 03, 2009
星期一, 六月 15, 2009
Change wireless on/off status in general user mode
list some different ways, but need to verify by yourself carefully.
1. silly way....killall nm-applet
2. /etc/acpi/wireless.sh
3. script file by Paul Liu
For old/new version (remark lines are for old version)
#!/bin/sh
#dbus-send --system --type=method_call \
# --dest=org.freedesktop.NetworkManager \
# /org/freedesktop/NetworkManager \
# org.freedesktop.NetworkManager.setWirelessEnabled \
# boolean:false
#dbus-send --system --print-reply --type=method_call \
# --dest=org.freedesktop.NetworkManager \
# /org/freedesktop/NetworkManager \
# org.freedesktop.NetworkManager.getWirelessEnabled
STAT=`dbus-send --system --print-reply --type=method_call \
--dest=org.freedesktop.NetworkManager \
/org/freedesktop/NetworkManager \
org.freedesktop.DBus.Properties.Get \
string:org.freedesktop.NetworkManager \
string:WirelessEnabled | grep variant | awk '{ print $3 }'`
case "$STAT" in
true)
NEWSTAT="false"
;;
*)
NEWSTAT="true"
;;
esac
dbus-send --system --type=method_call \
--dest=org.freedesktop.NetworkManager \
/org/freedesktop/NetworkManager \
org.freedesktop.DBus.Properties.Set \
string:org.freedesktop.NetworkManager \
string:WirelessEnabled variant:boolean:$NEWSTAT
1. silly way....killall nm-applet
2. /etc/acpi/wireless.sh
3. script file by Paul Liu
For old/new version (remark lines are for old version)
#!/bin/sh
#dbus-send --system --type=method_call \
# --dest=org.freedesktop.NetworkManager \
# /org/freedesktop/NetworkManager \
# org.freedesktop.NetworkManager.setWirelessEnabled \
# boolean:false
#dbus-send --system --print-reply --type=method_call \
# --dest=org.freedesktop.NetworkManager \
# /org/freedesktop/NetworkManager \
# org.freedesktop.NetworkManager.getWirelessEnabled
STAT=`dbus-send --system --print-reply --type=method_call \
--dest=org.freedesktop.NetworkManager \
/org/freedesktop/NetworkManager \
org.freedesktop.DBus.Properties.Get \
string:org.freedesktop.NetworkManager \
string:WirelessEnabled | grep variant | awk '{ print $3 }'`
case "$STAT" in
true)
NEWSTAT="false"
;;
*)
NEWSTAT="true"
;;
esac
dbus-send --system --type=method_call \
--dest=org.freedesktop.NetworkManager \
/org/freedesktop/NetworkManager \
org.freedesktop.DBus.Properties.Set \
string:org.freedesktop.NetworkManager \
string:WirelessEnabled variant:boolean:$NEWSTAT
星期四, 六月 11, 2009
how to build a debian package (.deb)
need some packages first
dh-make
build-essential
devscripts
pbuilder
cdbs
00 change the changelog and control file to be your own files, it will be authorize through internet.
1. create a test folder
2. in test folder create a project-version folder (like abc-1.1)
3. in abc-1.1 folder, exec "dh_make native" and select "s" option
4. then we have "debian" folder there, inside has example files
** replace some files **
5. in abc-1.1 folder, create etc/pm/config.d/unload file
6. in debian folder, create a file named "install"
7. add "etc/pm/config.d/unload /etc/pm/config.d" in replace file.
*** script file ***
8. add your script into postinst file (you can remove all *.ex file, only left one for modifying.)
9. script better includes #!/bin/bash
10. back to abc-1.1 folder, and run "debuild -i -I -sa" or try this "debuild -us -uc -b"
list some example files.
changelog:
minix-config (1.1) jaunty; urgency=low
* update for ppa
-- Juergen Chiu Thu, 11 Jun 2009 10:38:49 +0000
postinst:
#!/bin/sh
set -e
#Sound
amixer sset "Input Source" "Front Mic"
amixer -q set "Front Mic" 0% unmute
amixer -q set "Front Mic Boost" 10% unmute
amixer -q set "Capture" 100% unmute
#DEBHELPER#
rules:
#!/usr/bin/make -f
include /usr/share/cdbs/1/rules/debhelper.mk
binary-install/minix-config::
install -d $(CURDIR)/debian/minix-config/etc/pm/config.d/
install -m 644 $(CURDIR)/etc/pm/config.d/10minix_module $(CURDIR)/debian/minix-config/etc/pm/config.d/
binary-fixup/minix-config::
dh_gconf --priority=16
dh-make
build-essential
devscripts
pbuilder
cdbs
00 change the changelog and control file to be your own files, it will be authorize through internet.
1. create a test folder
2. in test folder create a project-version folder (like abc-1.1)
3. in abc-1.1 folder, exec "dh_make native" and select "s" option
4. then we have "debian" folder there, inside has example files
** replace some files **
5. in abc-1.1 folder, create etc/pm/config.d/unload file
6. in debian folder, create a file named "install"
7. add "etc/pm/config.d/unload /etc/pm/config.d" in replace file.
*** script file ***
8. add your script into postinst file (you can remove all *.ex file, only left one for modifying.)
9. script better includes #!/bin/bash
10. back to abc-1.1 folder, and run "debuild -i -I -sa" or try this "debuild -us -uc -b"
list some example files.
changelog:
minix-config (1.1) jaunty; urgency=low
* update for ppa
-- Juergen Chiu
postinst:
#!/bin/sh
set -e
#Sound
amixer sset "Input Source" "Front Mic"
amixer -q set "Front Mic" 0% unmute
amixer -q set "Front Mic Boost" 10% unmute
amixer -q set "Capture" 100% unmute
#DEBHELPER#
rules:
#!/usr/bin/make -f
include /usr/share/cdbs/1/rules/debhelper.mk
binary-install/minix-config::
install -d $(CURDIR)/debian/minix-config/etc/pm/config.d/
install -m 644 $(CURDIR)/etc/pm/config.d/10minix_module $(CURDIR)/debian/minix-config/etc/pm/config.d/
binary-fixup/minix-config::
dh_gconf --priority=16
星期二, 四月 21, 2009
ALC662錄音的問題 (Intel 82801G)
在試ALC662 chipset時...發現不能錄音
一開始找不出問題
但後來發現原來是因為mic的回朔太大聲, 造成錄音無法正常運作
若使用alsa內建的指令錄音, 就都沒有問題
相關用到的指令如下
alsamixer
asoundconf set-default-card 0 (do this only when alsamixer has trouble)
aplay -l
arecord -f cd -t wav -d 5 test.wav
aplay test.wav
好用的測試聲音小工具
xoscope
還是用指令比較保險
最後....
在Volume Control/options/input srouce change to front Mic (system use front mic to be default)
and...壓低front mic與front mic boost的音量....
目前看到多一個問題,ogg type不能使用,換成wave type就好了
可以用下面方式解決
gstreamer-properties程式把原本的input plugin從"alsa"轉為"OSS"
參考用的command, 可直接修改聲音的設定
amixer sset "Input Source" "Front Mic"
amixer -q set "Front Mic" 50% unmute
...
一開始找不出問題
但後來發現原來是因為mic的回朔太大聲, 造成錄音無法正常運作
若使用alsa內建的指令錄音, 就都沒有問題
相關用到的指令如下
alsamixer
asoundconf set-default-card 0 (do this only when alsamixer has trouble)
aplay -l
arecord -f cd -t wav -d 5 test.wav
aplay test.wav
好用的測試聲音小工具
xoscope
還是用指令比較保險
最後....
在Volume Control/options/input srouce change to front Mic (system use front mic to be default)
and...壓低front mic與front mic boost的音量....
目前看到多一個問題,ogg type不能使用,換成wave type就好了
可以用下面方式解決
gstreamer-properties程式把原本的input plugin從"alsa"轉為"OSS"
參考用的command, 可直接修改聲音的設定
amixer sset "Input Source" "Front Mic"
amixer -q set "Front Mic" 50% unmute
...
星期三, 四月 15, 2009
How to change keycode or keybinding behavior
You can check whole hot key architecture here.
https://wiki.ubuntu.com/Hotkeys/Architecture
* Relative commands
1. input-utils package
a. lsinput: shows some information about each input device the kernel reports. This is useful to make sure you have the right device number for other testing.
b. input-events: tell you the events passing through the queue for any device
c. input-kbd: show you the keymap available for any device that provides keyboard events
2. acpi_listen: listen to acpi channel if the keycode send to acpi.
3. showkey : show the keycodes by -k and scancodes by -s parameter.
4. xev : show the key symbol in X environment like below.
5. xmodmap : GNOME mapping table
KeyRelease event, serial 33, synthetic NO, window 0x4400001,
. root 0x13b, subw 0x0, time 9487761, (321,324), root:(399,415), state 0x0, keycode 23 (keysym 0xff09, Tab), same_screen YES, XLookupString gives 1 bytes: (09) " " XFilterEvent returns: False
*How to find out the root cause of hot key
For kernel clarification
1. use "lsinput" to check which device file you used.
2. use "input-events 4" to listen if kernel get the right signal from device (4 means /dev/input/event"4")
For acpi clarification
3. excute "#showkey -s" to capture the keyboard signal.
4. Check the scancodes and refer to /usr/includes/linux/input.h file.
5. check the keycodes definition in /usr/share/acpi-support/key-constants
6. check the scripts file for acpi event in /etc/acpi/*.sh
7. you can use acpi-fakekey to simulate the keycode.
For GNOME system
8. use "xmodmap -pke" to check the key map
9. use "xev" to see which keycode or behavior under GNOME
10. Or you can use "gnome-keybinding-properties" to check the GNOME keybinding status.
============
gnome-keybinding-properties save the system default setting in following path
/var/lib/gconf/debian.defaults/%gconf-tree.xml
and save the user settings in
/home/juergen/.gconf/desktop/gnome/keybindings/"your-key-name"/%gconf.xml
============
---------------------------------------------------------------------------
For example: 0xe0 0x20 for fn-f9 audio mute binding code by showkey -s
xmodmap -pke (look for the available keycode number)
less /usr/share/X11/XKeysymDB (check which X Window default function)
setkeycodes e020 255 (that means keycode 255 will be 0xe0 0x20, change keybinding to keycode.)
For example: change keybinding 121->mute to 113->mute
$sudo xmodmap -e "keycode 113 = XF86AudioMute"
$xmodmap -pke | grep 113
For example: for acpi event
when acpi script needs 121 to mute, but mute button is 113.
add "$setkeycodes e020 121" to /etc/event.d/rc2 script section before exec line.
reboot and mute function keycode will change to 121.
modify /usr/share/acpi-support/key-constants 113 to 121
refer to the page
http://darkknight9.blogspot.com/2005/08/custom-keybinding-gnome.html
"Application/System Tools/Configuration Editor" for metacity "keybindings" function.
https://wiki.ubuntu.com/Hotkeys/Architecture
* Relative commands
1. input-utils package
a. lsinput: shows some information about each input device the kernel reports. This is useful to make sure you have the right device number for other testing.
b. input-events: tell you the events passing through the queue for any device
c. input-kbd: show you the keymap available for any device that provides keyboard events
2. acpi_listen: listen to acpi channel if the keycode send to acpi.
3. showkey : show the keycodes by -k and scancodes by -s parameter.
4. xev : show the key symbol in X environment like below.
5. xmodmap : GNOME mapping table
KeyRelease event, serial 33, synthetic NO, window 0x4400001,
. root 0x13b, subw 0x0, time 9487761, (321,324), root:(399,415), state 0x0, keycode 23 (keysym 0xff09, Tab), same_screen YES, XLookupString gives 1 bytes: (09) " " XFilterEvent returns: False
*How to find out the root cause of hot key
For kernel clarification
1. use "lsinput" to check which device file you used.
2. use "input-events 4" to listen if kernel get the right signal from device (4 means /dev/input/event"4")
For acpi clarification
3. excute "#showkey -s" to capture the keyboard signal.
4. Check the scancodes and refer to /usr/includes/linux/input.h file.
5. check the keycodes definition in /usr/share/acpi-support/key-constants
6. check the scripts file for acpi event in /etc/acpi/*.sh
7. you can use acpi-fakekey to simulate the keycode.
For GNOME system
8. use "xmodmap -pke" to check the key map
9. use "xev" to see which keycode or behavior under GNOME
10. Or you can use "gnome-keybinding-properties" to check the GNOME keybinding status.
============
gnome-keybinding-properties save the system default setting in following path
/var/lib/gconf/debian.defaults/%gconf-tree.xml
and save the user settings in
/home/juergen/.gconf/desktop/gnome/keybindings/"your-key-name"/%gconf.xml
============
---------------------------------------------------------------------------
For example: 0xe0 0x20 for fn-f9 audio mute binding code by showkey -s
xmodmap -pke (look for the available keycode number)
less /usr/share/X11/XKeysymDB (check which X Window default function)
setkeycodes e020 255 (that means keycode 255 will be 0xe0 0x20, change keybinding to keycode.)
For example: change keybinding 121->mute to 113->mute
$sudo xmodmap -e "keycode 113 = XF86AudioMute"
$xmodmap -pke | grep 113
For example: for acpi event
when acpi script needs 121 to mute, but mute button is 113.
add "$setkeycodes e020 121" to /etc/event.d/rc2 script section before exec line.
reboot and mute function keycode will change to 121.
modify /usr/share/acpi-support/key-constants 113 to 121
refer to the page
http://darkknight9.blogspot.com/2005/08/custom-keybinding-gnome.html
"Application/System Tools/Configuration Editor" for metacity "keybindings" function.
Command line wireless enablement
It's just refer to someone readme file, but properly useful when no GUI.
"ifconfig wlan0 up"
"ifconfig" to check the "wlan0" section
"iwlist scan" to scan all AP (The essid "testap" for example)
"iwconfig wlan0 essid testap" to set up essid
"ifconfig wlan0 broadcast 192.168.0.255 netmask 255.255.255.0 192.168.0.100"
"route add default gw 192.168.0.1 dev wlan0"
"ifconfig wlan0 up"
"ifconfig" to check the "wlan0" section
"iwlist scan" to scan all AP (The essid "testap" for example)
"iwconfig wlan0 essid testap" to set up essid
"ifconfig wlan0 broadcast 192.168.0.255 netmask 255.255.255.0 192.168.0.100"
"route add default gw 192.168.0.1 dev wlan0"
星期一, 十二月 08, 2008
Useful basic information for hibernate function under RHEL or SuSE
I use Ubuntu with rtl8187 module for realtek chipset.
The sleep/suspend/hibernate function all fail in just starting stage and without any errors.
The solution and information:
Hibernate issues almost caused by driver, especially network and storage driver.
No screen, just can remove some drivers first.
Use pm-suspend/pm-hibernate or /sys/power/ folder to test.
Method 1
in /etc/pm/conf.d/ create a file name "unload_module" (any name is fine)
in unload_module add a line "SUSPEND_MODULES="rtl8187 rt8189 .....""
Method 2
add "02wireless" file in /usr/lib/pm-utils/sleep.d/ and the content as followings.
#!/bin/sh
case $1 in
suspend|hibernate) ifdown wlan0 ; rmmod rtl8187 ;;
resume|thaw) modprobe rtl8187 ;;
*) exit $NA ;;
esac
exit 0
** Still need to clean something in the future.
RHEL
package: hal/pm-utils
folder: /etc/pam.d;/etc/hal;/usr/lib64/hal;/usr/lib/pm-utils/sleep.d (hibernate stage folder)
command: pm-hibernate;lshal
script file: /usr/lib64/hal/scripts/linux/hal-system-power-hibernate-linux
(can check hal package list.)
log: /var/log/pm/suspend.log
SuSE
package: hal/powersave
folder: /etc/hal;
command: powersave;lshal
script file:
1. /usr/lib64/hal/scripts/hal-system-power-hibernate
2. /usr/lib/powersave/scripts/prepare_suspend_to_disk (include GRUB info)
3. /usr/lib/powersave/scripts/sleep_helper_functions
log: /var/log/suspend2disk.log
The sleep/suspend/hibernate function all fail in just starting stage and without any errors.
The solution and information:
Hibernate issues almost caused by driver, especially network and storage driver.
No screen, just can remove some drivers first.
Use pm-suspend/pm-hibernate or /sys/power/ folder to test.
Method 1
in /etc/pm/conf.d/ create a file name "unload_module" (any name is fine)
in unload_module add a line "SUSPEND_MODULES="rtl8187 rt8189 .....""
Method 2
add "02wireless" file in /usr/lib/pm-utils/sleep.d/ and the content as followings.
#!/bin/sh
case $1 in
suspend|hibernate) ifdown wlan0 ; rmmod rtl8187 ;;
resume|thaw) modprobe rtl8187 ;;
*) exit $NA ;;
esac
exit 0
** Still need to clean something in the future.
RHEL
package: hal/pm-utils
folder: /etc/pam.d;/etc/hal;/usr/lib64/hal;/usr/lib/pm-utils/sleep.d (hibernate stage folder)
command: pm-hibernate;lshal
script file: /usr/lib64/hal/scripts/linux/hal-system-power-hibernate-linux
(can check hal package list.)
log: /var/log/pm/suspend.log
SuSE
package: hal/powersave
folder: /etc/hal;
command: powersave;lshal
script file:
1. /usr/lib64/hal/scripts/hal-system-power-hibernate
2. /usr/lib/powersave/scripts/prepare_suspend_to_disk (include GRUB info)
3. /usr/lib/powersave/scripts/sleep_helper_functions
log: /var/log/suspend2disk.log
訂閱:
文章 (Atom)