Scanner + Printer = Copy Machine

Multi-functional printer is just a combination of printer and scanner.
So, why don’t you make DIY copy machine in Linux if you have a printer and scanner?
Make sure your scanner is supported in SANE in Linux, and install scanbuttond for scanner’s button control.
scanbuttond seems no longer in active development, but it works OK in CentOS.

I added these commands in /usr/local/etc/buttonpressed.sh as follows:

In the button pressed event,

scanimage --mode lineart --resolution 300 -x 215 -y 297 > test.pnm
pnmtops -scale 1000 -dpi 300 test.pnm | lpr -PHL-2040
convert test.pnm /some/archive/`date + %Y%m%d%H%M`.pdf

So, whenever I press the button, it automatically starts scanning, then prints it out and archives as PDF.
The only thing that bugs me is the slow scanning time…

How to move SVN repository to other server.

On old SVN Server side:

# svnadmin dump your_repository_dir > repo.dmp

* This will take more than minutes.

On new SVN Server side:

# svnadmin create repo
# svnadmin load repo < repo.dmp

Note that taking a dump of repository does NOT dump the configuration files in repository.
So make you copy the conf directory.

References:

http://www.digitalmediaminute.com/article/2251/how-to-move-a-subversion-repository
http://2tbsp.com/node/88
http://svnbook.red-bean.com/en/1.1/ch05s03.html#svn-ch-5-sect-3.5

Posted in Linux. Tags: , , . Leave a Comment »

How to move /home to other drive.

Be careful to check if your /home is mounted or just a directory.
Thanks to IBM, following this instruction suffice for everybody.
http://www.ibm.com/developerworks/linux/library/l-partplan.html

I finally made the /home in software RAID 1… Next thing I need a UPS for the machine.

Posted in Linux. Tags: , , . Leave a Comment »

Xen Paravirtualized CentOS domU on CentOS 5.3 dom0

How to install paravirtualized CentOS 5.3 x64 as domU

# virt-install --paravirt \
               --name centosx64 \
               --ram 512 \
               --file /home/xen/images/centosx64.img \
               --file-size 10 \
               --nographics \
               --location http://mirrors.kernel.org/centos/5.3/os/x86_64/

It means Memory: 512MB, Disk Image: 10GB and No Graphics
Check the comment if you want to make use of pre-downloaded iso image or dvd.

If you want to add Desktop environment after instrallation, just add these.

# yum groupinstall "X Window System"
# yum groupinstall "GNOME Desktop Environment"

Reference: http://www.cyberciti.biz/tips/rhel-centos-xen-virtualization-installation-howto.html

CentOS 5.3 + xen-3.4-testing

$ su -
$ cd /usr/src
$ hg clone http://xenbits.xensource.com/xen-3.4-testing.hg
$ cd xen-3.4-testing.hg
$ make world
$ make install
$ ./install.sh

* eth0 is not detected with this kernel at this point.
So, I have to build the kernel…

Reference: http://bderzhavets.wordpress.com/2009/04/17/setup-xen-34-centos-53-dom0-64-bit/

CentOS 5.3 + linux-2.6.27 kernel

Anyway, I wasn’t happy with the XEN 3.3 with the xen kernel 2.6.18-128.1.10.el5xen (got these by yum)
Let’s update the newer kernel and Xen.

So, download the xen kernel 2.6.27, then apply patches, and compile. Let’s see if it works with Xen 3.4…

$ git clone http://xenbits.xen.org/git-http/xenclient/linux-2.6.27.git
$ cd linux-2.6.27
$ git clone http://xenbits.xen.org/git-http/xenclient/linux-2.6.27-pq.git .git/patches
$ guilt-push -a

(These commands above are taken from Xen-devel ML.)
I have been looking for the best Linux distro + Xen, but I hope CentOS 5.3 will be the one.

$ make CONFIG_DEBUG_SECTION_MISMATCH=y

Error 1:
drivers/built-in.o: In function `acpi_ec_read’:
/usr/src/linux-2.6.27/drivers/acpi/ec.c:390: undefined reference to `in_query_wmi_event_data’

make: *** [.tmp_vmlinux1] Error 1

Patch 1: It’s fun to see this kind of comment “HACK ALERT!!” But just comment out this hack…

diff –git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 2359480..b2c0221 100644
— a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -387,6 +387,7 @@ static int acpi_ec_read(struct acpi_ec *ec, u8 address, u8 * data)
/* HACK ALERT
* Please refer to wmi.c for an explanation on why we added this hack.
*/
+/*
if ( in_query_wmi_event_data == TRUE ) {
if ( address == 0×2b ) {
wmi_event_data_index = 0;
@@ -398,6 +399,7 @@ static int acpi_ec_read(struct acpi_ec *ec, u8 address, u8 * data)
wmi_event_data_index++;
}
}
+*/

return result;
}

$ make
$ make install
$ make modules_install
$ DEPMOD 2.6.27.19-5.1
$ mkinitrd /boot/initrd-2.6.27.19-5.1.img 2.6.27.19-5.1

Then, edit /boot/grub/menu.lst accordingly.

Installing Fedora 10 on a MacBook Pro

Ubuntu was a really bad choice for XEN HVM dom0/domUs…
Fedora 10 doesn’t support xen kernel as well.
Back to Fedora 8…

http://www.linuxquestions.org/questions/fedora-35/xen-in-fedora-10-691804/

Install Xen Kernel on Ubuntu 9.04 Jaunty i386

I stole the kernel from debian’s pool.

wget http://ftp.debian.org/debian/pool/main/l/linux-2.6/linux-modules-2.6.26-2-xen-686_2.6.26-15_i386.deb
wget http://ftp.debian.org/debian/pool/main/l/linux-2.6/linux-image-2.6.26-2-xen-686_2.6.26-15_i386.deb
sudo dpkg -i linux-modules-2.6.26-2-xen-686_2.6.26-15_i386.deb
sudo dpkg -i linux-image-2.6.26-2-xen-686_2.6.26-15_i386.deb

* It’s a good idea to look for newer version. I don’t know why we cannot search by the debian website. But you can use the FTP…

How to run a VB program using wine under Linux.

err:ole:CoGetClassObject class {00000514-0000-0010-8000-00aa006d2ea4} not registered
err:ole:create_server class {00000514-0000-0010-8000-00aa006d2ea4} not registered
err:ole:CoGetClassObject no class object {00000514-0000-0010-8000-00aa006d2ea4} could be created for context 0×5

If you get the errors, try this:

wget http://kegel.com/wine/winetricks && sh winetricks mdac28

Fedora 8 x64 and Bluetooth Keyboard


In the file of /etc/bluetooth/hcid.conf,
A line of pin_helper was not there.
So I added “pin_helper /usr/bin/bluez-pin
At the same time, the pin_helper command should be added. I took it from Fedora core 6. Then, I restarted the bluetooth service.
Finally, Apple’s Wireless Bluetooth keyboard works great.
(I didn’t have to do this with Fedora 7 at all…)