My words on free/open source software

Monday, April 21, 2008

HOWTO: vsftpd's Virtual User Use Local Privileges

If you are using vsftpd with virtual users, as described in official example, and are suffering problems like this:

226 Transfer done (but failed to open directory).

(you may see above text in client or server log), you may consider using "virtual_use_local_privs".

Per study of cpdohert, if you want vsftpd's virtual user follow local privileges, you have to use:

virtual_use_local_privs=YES

Sunday, April 20, 2008

FTP Ascii Mode in KDE (kioslave)

Write a ~/.kde/share/config/kio_ftprc, with

[hostname]
textmode=true

Or use [] instead of [hostname] to make it used everywhere.

Warning: this will likely mess up any transfers of binary files.

In courtesy of David Faure.

Steps to Upgrade MoinMoin Wiki from 1.5.* to 1.6.*

I've been using the MoinMoin Wiki from Debian Testing for some time and this morning I found it was upgraded from 1.5.8 to 1.6.2, and unsurprisingly, my Wiki installation stopped working, very obviously some data migration may be necessary.

After wasted some time, I found a good article: Thomas Waldmann's AnotherWayToMigrateFrom1.5To1.6. I couldn't find a good official migration guide like this, which told you that you must run cache cleaning and data migration.

Hope this is useful to other MoinMoin users.

Wednesday, April 16, 2008

Use pdftk to Update PDF File's Meta Data

A good tool, pdftk, can be used to manipulate PDF files, changing meta-data, page-juggling, etc., you name it! And it's GPLed.

Easy, peasy, japanesey.

Tuesday, April 15, 2008

Error of Running VMware Server 1.0.5 on Debian 4.0 Etch

I installed VMware Server 1.0.5 on Debian 4.0 Etch (i686) today and couldn't start vmware-console due to this error:

(vmware:20921): libgnomevfs-WARNING **: Cannot load module `/usr/lib/gnome-vfs-2.0/modules/libfile.so' (/usr/lib/vmware/lib/libgcc_s.so.1/libgcc_s.so.1: version `GCC_4.2.0' not found (required by /usr/lib/libstdc++.so.6))

To fix this problem, start VMware by running:

VMWARE_USE_SHIPPED_GTK=yes vmware

For more information on this please click the title, which leads to a post on VMware community website.

Sunday, April 13, 2008

RPM Spec: conditional build based on host distro

When writing spec of RPM, often you need to write some special instructions that are needed only on some distros or versions, but not all. You can use this:

# Do something for FC4 and beyond.
%if 0%{?fedora} >= 4
# ...
%endif

Tuesday, April 08, 2008

Tweak GNOME Auto Mount Options

Use gconf-editor to edit the key:

/system/storage/default_options/vfat/mount_options

The most useful one for me to add is "iocharset=utf8".

Friday, April 04, 2008

Ignoring .svn directories with grep

Have lived with Subversion for many years and finally I found this (link to outside my blog) simple little trick. :)

Wikipedia Unblocked (temp) in China

Now I can access Wikipedia in China without using a proxy, not all contents, only a large part. This is a big step forward.

As well as blogspot.com, wow!

May His Holiness let this last.

Saturday, March 15, 2008

Choose a Linux-friendly Bank in China

At last I thought I should spend some time on finding a Linux-friendly bank. By Linux-friendly I meant that the e-Bank services should be able to achieved from a Linux machine running native browsers such as Firefox. I've been using China Merchant Bank for nearly 10 years and although generally good, their eBank services are designed around IE and ActiveX. What's more annoying is that their bank software could not be run within a virtual machine, alleged for the sake of better security, which shut all doors to run it on Linux.

I used eBank to manage loads of things such as utility payment, donations, credit card payment and investment management. So it's really a waste of time to reboot to MS WindowsTM to do them.

So finally I chose Shanghai Pudong Development Bank. It's eBank services are great with Firefox! Till now I'm happy with it. I've also applied for the credit card and hope to move all my credit card subscriptions to it gradually.

Now the only gray area for me is that my employer doesn't support to pay into SPDB. I'll keep complaining to my beloved HR manager. :)

N.B. HSBC is doing very well with Linux too. Who (I guess) has been running IBM's AIX and System z for a long time and is generally browser-independent.

Thursday, February 28, 2008

A Talk with Andrew Morton

On Feb 20th, 2008, Tina and I attended the Eating the Linux Kernel party:
"Thanks to the Linux Foundation and China OSS Promotion Union we're
organizing a diner with all the great speakers of the Linux Developer
Symposium. This is going to be the one opportunity to share food and
thoughts with people like Andrew Morton, Jonathan Corbet, Dave Neary,
Jeff Waugh and many many others. In total probably 20 specialists from
the kernel development, Linux embedded or Gnome development
exclusively for Beijing LUG members..."

Fortunately I had a chance to have a talk to Andrew Morton who seated
besides me:

(This is not a verbal transcript of the talk, nor has Andrew Morton
endorsed it and he has no responsibility for whatever listed here.
This is just a fast record of a gossip and please don't take it
seriously.)

YL: Hi Andrew, you look tired, are you working busy on 2.6.25?

AM: Yes, it takes me lot of time.

YL: When will you leave Beijing?

AM: Friday. Take a tour tomorrow (Thursday) in Beijing.

YL: Can I ask you some questions about the kernel? Why Linux doesn't
maintain a stable ABI. Currently each time the kernel updates, all
3rd party modules will have to be recompiled. And this is really
annoying for many users.

AM: What 3rd party modules?

YL: For example, the one of Madwifi, and fglrx, the proprietary driver
for ATI cards.

AM: Are they GPL?

YL: Oh, no, part of it is a non-GPL blob. So I see the reason why the
kernel doesn't support them well is that they are not free software.
So can I say that the rumor is true that you intentionally break the
ABI to make using 3rd party modules difficult?

AM: No, we don't break them _intentionally_. We just don't care about
it. If we were to support a stable ABI, it will make the development
and maintenance of the kernel much more difficult. We won't support
non-GPL code by compromising free software.

YL: But if you made the installation of some proprietary drivers
easier, more users would come to use Linux. And if you had more
users, you have more developers. And this will promote the development
of the kernel.

AM: Yeah, it's true. But we just can't support proprietary software by
ways of compromising free software.

YL: Do you have a plan, or a long-term goal of the kernel development?

AM: No, we have no plan. And this is just the point of kernel
development (and maybe other free software project). The users decide
where the kernel goes. If you need a function, just as he (a man sit
besides AM) just said, if you need to support Chinese display in
Linux, just implement it and send me the patch, and if it's good
enough, we'll include it in the kernel.

YL: If the kernel itself has no concrete plan for what functions
should be supported and what not, and accepts everything good enough
from the users, won't the kernel became bloated quickly?

AM: No it won't. Everything is configurable. If you don't need it,
disable it.

YL: But the kernel is already very large, the binary is 20Mb, and the
source codes are somewhat more than 300Mb.

AM: I think it's not a problem. The core part of the kernel takes only
1Mb memory at run-time. And I see 300Mb is not a problem for today's
hard drive.

YL: The kernel is so large, and has too many things in it. I see
another problem with this approach. Say if you found a bug in a driver
for an ancient piece of hardware and you updated the kernel. Then all
users have to update just to pull in something they'll never used.

AM: Oh, I've to say sorry for that. You can say it's a problem.

YL: Can we just split this large kernel into several loosely coupled
projects? Say, one project for a kernel core, one project for file
systems, one project for the network layer and some other projects for
drivers.

AM: That maybe to difficult for maintenance.

YL: So do you thing micro-kernel would solve this problem, or are you
a fan of monolithic kernel?

AM: Monolithic kernel is much more efficient and easy to develop.

YL: Another question, does the kernel team have a plan to add
automatic test to cover some key functions?

AM: No, auto test doesn't work as we tried before. I've been
following the LTP project for more than 2 years, and only 2 bugs were
found by those automatic tests. Most of the kernel bugs are only
reproducible on some special pieces of hardware and you just have no
way to use automatic test to cover them.

For the core part, things like scheduler, file system, etc., is used
by everyone so they are thorough tested by everyone, and for the other
parts, like various drivers for special hardware, only those have that
hardware can test it. So auto test has few use for this.

YL: Do you think the kernel can be better maintained or developed by a
team?

AM: No. It won't get better if you put a lot people in a building.
The communication would take too much time. I see it's efficient
enough to communication by using mailing list. I get bored soon
during a long meeting so I just leave and ask them to send mails and
code snips to me and we can have better understanding on technical
problems.

YL: Do you think attending symposiums, lectures and parties like this
is a waste of time? Do you think you can better use the time for
hacking?

AM: Oh, I don't like this before I go, it's not good to travel for
long time on plane. But when the event was finished I thought "oh,
it's not bad." These are things for promotion. For example, before I
went to Japan some years ago, there's few patch from Japanese
developers. And after some lectures there, the patches from Japan now
skyrocketed to be around 20% among all patches. So it has a snowball
effect and that's why I attended these events. I hope I can get more
patch from Chinese developers.

YL: Do you have a laptop?

AM: Yes, it's a ThinkPad.

YL: Oh, I'm using a ThinkPad too. But I have to use proprietary blobs
to support the wireless as well as ATI video card. Though I don't use
3D acceleration much, I do need the 2D acceleration for daily work.
The open source driver is slow on 2D performance.

AM: Yeah, ThinkPad has poor 2D performance but it's bearable. I just
use the default open source driver. For wireless my laptop is running
ipw3945 driver and that's the only binary blob on my laptop.

YL: So does your suspend and hibernation work well?

AM: No, they don't. (shrug)

YL: What's your main work time and for how long you sleep a day?

AM: Huh! I work most of the time, and sleep from around 3am to, say,
11am.

YL: I remember you wrote an article said that the 2.6 kernel is slowly
getting buggier.

AM: Yes. People should spend more time on fixing bugs.

YL: What's your personal plan for the following years?

AM: I may quit in about 1 or 2 years and then I won't spend much time
on maintenance. I'll continue to work on the kernel, perhaps focusing
on bug fixing.

YL: So how about the mm tree?

AM: No need to worry, some other people will set their own branches to
take the position of it.

YL: Have Google asked you to do something special for them?

AM: No, they just pay me to do whatever I want to do.

Wednesday, January 09, 2008

(Don't) Use "Subpixel Smoothing" for Fonts in GNOME

I proposed that "Subpixel smoothing" was slow in my testing. But that result was machine-dependent. Some drivers were doing better than others. Personally I think Intel's video cards are better than that from nVidia (ATI's seems not bad either). I have to admit for some configurations subpixel rendering products better result. So it's totally up to you to decide whether to use it or not (I found myself enabled it on all my machines for now, even on a slow machine with nVidia card).

Old post follows:

It's extremely slow, while the gain in font appearance is little. This setting has contributed a lot to my bad impression about GNOME's sluggish display. Now I'm happy with "Best shapes."

In gnome-terminal, Subpixel smoothing is 3 times as slow as "Best shapes" rendering, on my laptop.

Tuesday, August 14, 2007

Gmail, Fetchmail and Sendmail on UNIX/Linux

Linux Home Automation hosts a good article, Linux, Sendmail and Gmail.com on how to configure sendmail to work with Gmail. My config is a bit simpler than his (tested on Fedora Core 4, 6, Red Hat Enterprise Linux 5, CentOS 5, should work on most modern Linux distros).

My fetchmail run control file (.fetchmailrc):
 
set syslog
poll pop.gmail.com with proto POP3 and options no dns
user 'abc@gmail.com'
pass "WriteYourPasswordHere"
ssl


Modification to sendmail's mc file (/etc/mail/sendmail.mc):

define(`SMART_HOST',`smtp.gmail.com')dnl
define(`RELAY_MAILER_ARGS', `TCP $h 587')dnl
define(`ESMTP_MAILER_ARGS', `TCP $h 587')dnl
define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
FEATURE(`authinfo',`hash /etc/mail/auth/client-info')dnl


To generate the authinfo file used above, refer to
Linux, Sendmail and Gmail.com. It's very simple and you can done it within 3 minutes.

Monday, July 23, 2007

Install Amarok on CentOS5/RHEL5

Now I prefer to build amarok by using SRPM from latest Fedora on CentOS/RHEL. Though I think the following method should still work, it's not the best solution. The first problem is that Fedora 6 is no longer supported and you get no security patches, the second is that some packages from Fedora 6 Extra repo conflicts with similar packages from RPMForge, which is a must for nearly all CentOS/RHEL systems.



  1. Install livna and rpmforge repo.

  2. Add fedora-extras.repo:

    [fedora-extras]
    name=Fedora Extras 6 - i386
    #baseurl=http://download.fedora.redhat.com/pub/fedora/linux/extras/6/i386/
    mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=extras-6&arch=i386
    gpgcheck=0
    enabled=1
    includepkgs=libnjb* libtunepimp* libifp* libmtp* libgpod* libofa* amarok* xine-lib wavpack

    You see, we should include necessary packages only.

  3. Edit CentOS-Base.repo, add following lines:

    # exclude libgpod 0.4.0 to install libgpod 0.4.2 from FC6 repo for Amarok
    exclude=libgpod

  4. Add fedora-updates.repo:

    [fedora-updates]
    name=Fedora Core 6 - $basearch - Updates
    #baseurl=http://download.fedora.redhat.com/pub/fedora/linux/core/updates/$releasever/$basearch/
    mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-fc6&arch=$basearch
    enabled=1
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora
    protect=0
    includepkgs=libnjb* libtunepimp* libifp* libmtp* libgpod* libofa* amarok*

  5. Edit rpmforge.repo, add:

    exclude=xine-lib

Monday, June 11, 2007

Disable one user's remote login on Linux

I have to disable one particular user's remote login on Linux, sounds simple, but it costed me some time. The normal way is to change PAM settings, using pam_access.so to control user login. Following steps are tested on Red Hat Linuxes (Fedora, RHEL, CentOS, etc.)

First you should enable pam_access.so:

  1. Unlink "/etc/pam.d/system-auth", which is a link to "/etc/pam.d/system-auth-ac".

  2. Create a new "/etc/pam.d/system-auth", includes all settings from "/etc/pam.d/system-auth-ac", like this:

    auth include system-auth-ac
    account include system-auth-ac
    password include system-auth-ac
    session include system-auth-ac

  3. Insert "pam_access.so":

    auth include system-auth-ac
    account required pam_access.so
    account include system-auth-ac
    password include system-auth-ac
    session include system-auth-ac



Now you can config pam_access.so by editing "/etc/security/access.conf", like this:

+ : player : LOCAL
- : player : ALL


For more info, read "man access.conf".

Wednesday, March 21, 2007

Use Exim with Gmail SMTP on Fedora

I've managed to setup Exim to send mail via Gmail SMTP on my laptop running Fedora Core 6. It was a bit tough work, for I can't find any precedent of using it on Fedora. Most talkings and guides regards Exim were based on Debian, and Fedora just doesn't have that config tools of Debian.

If you just want to know what to do, skip this paragraph, which talks theoratical things. My work started by following Use Gmail as a Smart Host, but it doesn't work. Checked Exim's log I found that the connection to Gmail's SMTP server was rejected, because Exim had been trying to connect to port 25 of it. Add a line "port = 587" solved this problem. Another problem is about the TLS authentication, because Exim thought the server it were to connect is called "gmail-smtp.l.google.com", which was got through DNS lookup, rather than the "smtp.gmail.com" set by me. So in the configure file, you should use "gmail-smtp.l.google.com" instead of "smtp.gmail.com."

So what to do is: edit "/etc/exim/exim.conf", add:

# routers section
send_via_gmail:
driver = manualroute
domains = ! +local_domains
transport = gmail_smtp
route_list = * gmail-smtp.l.google.com

# transports section
gmail_smtp:
driver = smtp
port = 587
hosts_require_auth = gmail-smtp.l.google.com
hosts_require_tls = gmail-smtp.l.google.com

# authenticators section
gmail_login:
driver = plaintext
public_name = LOGIN
client_send = : youraccount@gmail.com : yourpassword


I do think Exim should write an official FAQ regards this problem.

For some time, you may see such errors in Exim's log:

SMTP timeout while connected to gmail-smtp.l.google.com [72.14.253.109] after EHLO yourhostname: Conne
ction timed out


This is network or Gmail's problem. Want you can do is just waiting or switch to another ISP and try.

Monday, February 19, 2007

S60 Phone Error: Nokia 5500, "App. Closed: Calendar" (Solved)

I've got a problem with my mobile phone, Nokia 5500 Sports, bought 3 months ago.

Phenomenon:

  1. Phone detail: Nokia 5500 Sports, 3 months old. Symbian OS v9.1 (S60 3rd Edition).
    More detail from Nokia forum: http://www.forum.nokia.com/devices/5500


  2. Can't open the Calendar program. Before the Calendarprogram's graphical user interface was fully displayed, it crashed, exited automatically and an error message "App. Closed: Calendar" displayed by the system


  3. Entries in Calendar: two daily morning alarm entries. 3 to 5 other appointments. Very few data


  4. Every morning at the time when the daily morning alarms are supposed to ring, the whole phone would HANG. No operation is possible except for the "Task Switch" (long press Menu key), which would bring up the task list but no further operation is possible. The only way to recover is to remove the battery and wait until the display faded out


  5. Memory usage of phone main memory: half. Memory usage of memory card: 1/3


  6. I can think of NO particular operation that may be designated as the cause. Daily use is very common: phone, SMS, camera, web surfing, notes, etc.


  7. Haven't synced with PC before. After this problem occured, I tried to sync it with my PC by using bluetooth or IrDA, everything was synced successfully except the Calendar


  8. Two custom themes downloaded from local operator's website


  9. One or two custom rings transferred from my friend's MOTO phone by using bluetooth, 2 MONTHs AGO


  10. Installed 3rd party programs: Gmail client (Java)


  11. 2 weeks ago I've transferred 3 small Java games from another MOTO phone. But those games can't run on my phone & I deleted them


  12. Phone software edition (by dailing *#0000#): V 03.18 07-09-06 RM-86



Fix attempt:

  1. Reboot the phone, no help

  2. Sync with PC, no help

  3. Remove those custom programs & themes, no help

  4. Reset to factory settings (by dialing *#7780#), no help

  5. Whole phone backup, then format C: (by dialing *#7370#). After formating, the Calendar is OK, but after I restored my data by using Nokia's PC Suite, the Calendar broken again



Analysis:

My first guess is that the Calendar's data files are corrupted, so the bet maybe delete those files to reset the program. But for this 3rd edition of Symbian OS, I can't figure out which files are its data files (after a long search on net)! I checked some of the folders under C:\system\data but no good luck.

Solution:
Format C: (by dialing *#7370#), then sync my contacts back to phone. The trick is to avoid using whole system backup, which would keep the corrupted calendar data files.

PS:
I wanna try "Nokia Phone Software Update", but I've no cable now.

Friday, January 19, 2007

Configuration of Ad-hoc Wireless Network with Linux boxes

I've connected two Linux boxes (laptops) with wireless network without an AP. This is called "Ad-hoc Mode". It's as simple as connecting a wired network with a switch or hub. For a full explanation, please read this: http://en.wikipedia.org/wiki/Wireless_ad-hoc_network

Set up your wirelss NIC first. This varies upon different machine models. Usually a web search would solve your problem. For my scenario (Intel IPW2200 card on Fedora with rpm.livna.org), a "yum install ipw2200-firmware" is enough.

Then the only thing you need to config is your NIC's config file, usually named "ifcfg-eth?". For Fedora it's in "/etc/sysconfig/network-scripts/". Here's mine:

# Intel Corporation PRO/Wireless 2200BG Network Connection
DEVICE=eth1
ONBOOT=no
BOOTPROTO=none
TYPE=Wireless
USERCTL=no
IPV6INIT=no
PEERDNS=yes
NETMASK=255.255.255.0
DHCP_HOSTNAME=
IPADDR=192.168.0.2
DOMAIN=
HWADDR=
CHANNEL=1
MODE=Ad-Hoc
RATE=Auto
BROADCAST=192.168.0.255
NETWORK=192.168.0.0
ESSID=


To bring it up, use "ifup eth?".

Font Config of Gtk2 and Gnome2 Applications Outside Gnome2

I have switched from GNOME to KDE, and have been happy with it, since it's A LOT faster. A small problem is those GNOME applications will appear in default theme/font style regardless your settings done in GNOME. Perhaps they rely on some global environment settings that exists only when GNOME is loaded.

Here's a workaround from Ed Hurst: Gtk2 and Gnome2 Applications Outside Gnome2.

Quote:
Fonts: Create a config file in your home directory -- ~/.gtkrc-2.0. In this file, place one simple line:

gtk-font-name = "Arial 12"


Theme: To get the color scheme you like, choose one that is available on your system -- /usr/share/themes in SuSE/Fedora -- and make sure it is indeed Gtk2, as not everything there is. Edit ~/.gtkrc-2.0 and add a line like this one:

include "~/.themes/Dirty-Ice/gtk-2.0/gtkrc"

Quote end.

This is my ".gtkrc-2.0":

gtk-font-name = "Sans 12"
include "/usr/share/themes/Simple/gtk-2.0/gtkrc"


Have fun with KDE! :)

Thursday, January 18, 2007

Switched from MSN Space

I switched from MSN Space to here. Since MSN Space is extremely slow in Firefox on Linux, greatly reduced my ardor to write things with it.

About Me

My photo
Santa Cruz, California, United States