2009年6月3日 星期三

WiFi / Wireless USB Network Card Edimax EW-7318UG on Arch Linux

1. identify the card

check /var/log/message when you plug your card into usb slot
you'll see

kernel: wmaster0 (rt73usb): not using net_device_ops yet
kernel: wlan0 (rt73usb): not using net_device_ops yet
kernel: Registered led device: rt73usb-phy0:radio
kernel: Registered led device: rt73usb-phy0:assoc
kernel: Registered led device: rt73usb-phy0:quality
kernel: usbcore: registered new interface driver rt73usb
kernel: usbcore: registered new interface driver rt2500usb

or lsusb command
or check your card if is linux supported
https://help.ubuntu.com/community/WifiDocs/WirelessCardsSupported

2. you can see the interface from iwconfig command

3. bring the interface up

ifconfig wlan0 up
--

SIOCSIFFLAGS: No such file or directory

that means you need a firmware file. below is the error log appearing in /var/log/message at the same time

kernel: rt73usb 1-4:1.0: firmware: requesting rt73.bin
firmware.sh[19027]: Cannot find firmware file 'rt73

4. install the corresponding firmware packages

pacman -S rt2x00-rt71w-fw ( or rt2x00-rt61-fw )

5. in order to install package from http://repo.arch-linux.pl/, add the following setting to /etc/pacman.conf

[archlinux.pl]
Server = ftp://repo.arch-linux.pl/i686

6. install the package, RaLink RT73 USB Enhanced Drivers

pacman -Sy rt73-k2wrlz
--

Drivers installed, but not loaded. To enable it: 'rmmod rt73usb && modprobe rt73

7. to avoid conflict between modules, block the modules which would be loaded automatically
these module was observed from lsmod command

vi /etc/modprobe.d/blacklist
--

blacklist rt2500usb
blacklist rt73usb
blacklist rt2x00usb
blacklist rt2x00lib

8. add rt73 to MODULES in /etc/rc.conf then reboot

9. iwconfig

rausb0 RT73 WLAN ESSID:""
Mode:Ad-Hoc Frequency=2.412 GHz Cell: XX:XX:XX:XX:XX:XX
Bit Rate=11 Mb/s
RTS thr:off Fragment thr:off
Link Quality=65/100 Signal level:-54 dBm Noise level:-143 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0

10. ifconfig rausb0 up

11. scan for available access points for testing

iwlist rausb0 scan

12. usage of iwconfig

iwconfig rausb0 essid "SSID" key 1234567890

if your wep key is ascii, prefix with s:

iwconfig rausb0 essid "SSID" key s:asciikey

13. automatical setup while booting

vi /etc/rc.conf
--

..
wlan_rausb0="rausb0 essid SSID mode Ad-Hoc key 1234567890"
rausb0="rausb0 XXX.XXX.XXX.XXX netmask XXX.XXX.XXX.XXX"
INTERFACES=(eth0 rausb0)
..

2009年5月19日 星期二

Some Adjustments of Lighttpd and PureFTPD for Virtual Hosting on Arch Linux

1. vi /etc/lighttpd/lighttpd.conf

..
server.modules = (
"mod_simple_vhost" )
..
simple-vhost.server-root = "/srv/http/vhosts/"
simple-vhost.default-host = "default"
simple-vhost.document-root = "/"
..

default means read from server.document-root

2. create necessary directories and change the permissions

mkdir -p /srv/http/vhosts/example.com/

chown user:group /srv/http/vhosts/example.com/

3. if your pure-ftpd is set as ChrootEveryone yes, but your client receive 550 error while connecting soft-linked directory

CWD name
550 Can't change directory to name: No such file or director

it means the pure-ftpd wasn't configured with --with-virtual-chroot

4. the solution is to make use of filesystem trick, mount command

mount -o bind /source /destination

2009年4月27日 星期一

Fix Backspace Key with GNU Screen on Arch Linux

it happens only in my x-windows terminal.

solution:

vi ~/.screenrc
--

bindkey -d ^? stuff ^H
bindkey -d ^@ stuff ^H

2009年4月22日 星期三

Some Error Messages Keep Appearing in Samba Log on Linux

printing/pcap.c:pcap_cache_reload(178)
Unable to open printcap file /etc/printcap for read!

printing/print_cups.c:cups_connect(103)
Unable to connect to CUPS server localhost:631 - Connection refused

solution:

load printers = no
printcap name = /dev/null
printing = bsd


lib/util_sock.c:get_peer_addr_internal(1676)
getpeername failed. Error was Transport endpoint is not connected

solution:

smb ports = 139

2009年4月20日 星期一

Set up Lighttpd, PHP, PhpMyAdmin, MySQL on Arch Linux

1. install packages

pacman -S lighttpd php phpmyadmin mysql

2. this script starts mysql daemon and also take care of the basic configuration as adding system users and creating log files

/etc/rc.d/mysqld start

3. force both mysql client and server to use utf8 encoding though not all kinds of clients read the setting

vi /etc/my.cnf
--

..
[client]
default-character-set = utf8
..
[mysqld]
default-character-set = utf8
..

4. it may be necessary to add a user and group for http. this user seems to need to have permissions to write to the /var/log/lighttpd

groupadd http
adduser http
chown -R http /var/log/lighttpd

5. lighttpd handles php through fastcgi so we have to enable it in /etc/lighttpd/lighttpd.conf

server.modules = (
..
"mod_fastcgi",
..
..
fastcgi.server = ( ".php" =>
( "localhost" =>
(
"socket" => "/var/run/lighttpd/php-fastcgi.socket",
"bin-path" => "/usr/bin/php-cgi"
)
)
)

6. for php and phpmyadmin, edit /etc/php/php.ini as follows

..
cgi.fix_pathinfo=1
..
extension=mysql.so
..

6. sample phpmyadmin configuration

vi /srv/http/phpMyAdmin/config.inc.php

--
<?php
/* Servers configuration */
$i = 0;

/* First server */
$i++;
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['extension'] = 'mysql';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['auth_type'] = 'http';
$cfg['Servers'][$i]['verbose'] = 'name_of_server';

/* End of servers configuration */

?>

7. start your web server

/etc/rc.d/lighttpd start

then enter the url, http://localhost/phpMyAdmin

2009年4月15日 星期三

Garbage Code in JAVA CJK Environment on Arch Linux

1. create /opt/java/jre/lib/fonts/fallback directory

2. make symbolic link for font

ln -s /usr/share/fonts/TTF/fontfile /opt/java/jre/lib/fonts/fallback/

if Wen Quan Yi, the full path is /usr/share/fonts/wenquanyi/wqy-zenhei/wqy-zenhei.ttc

2009年4月12日 星期日

7-Zip Command Line

the linux version of 7zip is called p7zip
usage of 7za in windows is totally same to 7za in linux
the help message of command line version isn't detailed enough so here is an example

7za a -t7z -m0=lzma -mx=9 -mfb=64 -md=64m filename.7z target

a: add files to archive
e: extract files from archive (without using directory names)
-t: type of archive
-m0 : compression algorithm
-mx : compression level, 0 = no compression, 9 = ultra
-mfb : number of fast bytes for LZMA
-md : dictionary size
-ms=on : solid archive

p7zip is able to extract rar archives, but you have to use the exact command 7z, neither 7za nor 7zr because they are light-weighted commands which don't load plugins

if you use ubuntu, there is a package named p7zip-rar. on arch linux, p7zip package also installs rar plugin to /usr/lib/p7zip/Codecs/Rar29.so

7z e filenamr.rar