I have to say busybox is so cool!

Today I did an installation of Debian Squeeze using daily netinst ISO image in an i686 qemu-kvm virtual machine. I was using ext4 for /boot, and btrfs for /. The installation process was quite normal as expected.

After the installation I rebooted the virtual machine. Grub2 loaded correctly, but I was dropped into busybox ash prompt next to that… Reporting:

FATAL: Error inserting btrfs (/lib/modules/2.6.32-5-686)/kernel/fs/btrfs/btrfs.ko) unknown symbol in module, or unknown parameter (see dmesg)

So I go to #debian and #debian-devel to ask for help, lindi- asked me for dmesg output and told me to “just configure networking in initramfs and use busybox netcat”.

The actual procedure is:
1. Of course save dmesg output to file first:
(busybox) dmesg > dmesg.txt

2. Run ipconfig in busybox to configure the network (I was using qemu-kvm as superuser, so no need to deal with user mode networking problem):
(busybox) ipconfig eth0

3. Run netcat on host machine to listen a port, e.g. 3333:
$ nc -l 3333

4. Send the file:
(busybox) cat dmesg.txt | nc 192.168.100.1 3333

And I finally got the dmesg.txt lying on my host machine. Well, I still haven’t get the virtual machine working till now. :-(

Update 2010-1-4 :
This bug has been reported as Debian Bug #608538.
Quoting Joey Hess:

I hope this can be dealt with, it seems to be the only remaining issue in getting Debian to support btrfs root filesystems.

It appears to be an issue about btrfs module need crc32 module, but crc32 isn’t loaded automatically.

When Ubuntu 9.10 releases, pppoe connection via NetworkManager is impossible because some bug in it. So I switched to the traditional but workable way – pppoeconf, now the problem seems to be solved when using nm team PPA, so I plan to turn back.
But during my process, there are some other problems. Firstly nm cannot handle the connections automatically; secondly we cannot edit connections system wide.

Here are the correct steps:

First, add “NetworkManager daily trunk builds for ubuntu” PPA:

deb http://ppa.launchpad.net/network-manager/trunk/ubuntu karmic main
deb-src http://ppa.launchpad.net/network-manager/trunk/ubuntu karmic main

Second, comment out line “exec pppd call dsl-provider” in /etc/ppp/pppoe_on_boot, that is to say disable my previous “pppoe on boot” setting which is configured by pppoeconf.

Third, rename /etc/network/interfaces to backup file. NetworkManager will only handle connections which haven’t declared in interfaces, if you didn’t any tunning on such file, you can delete it, but backup before doing any change is a good habit, :)

Forth, edit /usr/share/polkit-1/actions/org.freedesktop.network-manager-settings.system.policy , find out the line contains “System policy prevents modification of system settings”, and below it there is a “auth_admin_keep“, change it to “yes“. This will enable you to edit a system wide connection. If you consider this will do harm to your security, then revert the change once you have set up your connection correctly.

Fifth, reboot your system, because these settings won’t take effects even though you have run “sudo services network-manager restart” and “sudo services networking restart”.

Now it is working on my system, cheers!

Do you think your web browser is not so fast as you expected? I decide to write a series of articles to support you speeding up your network. Follow me to tune your settings and get joys surfing the net!

This article is written on Linux, especially I am using Ubuntu 9.04, but I will try to mention notices for other distributions and platforms.

This is the first peice in ‘Boosting network for your PC’, the topic is DNS settings. One question, does your ISP ship low quality DNS service?

At first place, I recommend you to use OpenDNS, whose slogan is ‘Safer, Faster and Smarter’. Let me tell the reason why to turn form your ISP’s service to this one. OpenDNS is a free service, and there is many features other providers cannot give you, such as a smarter site guide, spell checking, and smart cache to keep your query while the requested site’s name server is not working properly, phishing and malware site bloking … Somebody might say we can use client-based tools to do most of them, but do you think it’s a better way to keep the annoyance away from the source? There is more features provided and I haven’t listed one by one, but it worth a try.

It is not difficult to turn to OpenDNS, set main DNS server to 208.67.222.222 and backup server to 208.67.220.220 on your PC’s connection setting or on your router. Generally we can change it in resolv.conf on a Linux machine, but GNOME users should do it on network-manager if you use it because it will rewrite resolv.conf automatically. For those who use xDSL, edit your DSL setting, you can find IPv4 option tab, change the method to PPPoE Address Only, and input the two DNS server addresses in order “main, backup”.

If you have a static IP address, then you should register on https://www.opendns.com, add your network’s IP address to your dashboard, then set your own settings for content filtering, enable the SmartCache, block internal IP addresses to avoid DNS Rebinding Attacks, thus these features are not enabled or can be customized. If you use a dynamic IP address, for example, you are a xDSL user, don’t worry about you cannot have your own account and your custom settings. All you need to do more is install a client to update your address to OpenDNS’s server, and enable the dynamic update feature in you dashboard. On Windows and Mac, they provide their client programs, you can just install can configure it easily according to the guide; on Linux/Unix, you can use ‘ddclient’ which is a free software, you can download it from its homepage on http://ddclient.sourceforge.net, or you may find it just lying in your distribution’s repository. I recommend you to install it as a service, or called daemon. Here is a example for what I have done on my Ubuntu box:
1. Install ddclient using apt, or synaptic, or whatever package manager you like, here is what I ran in a terminal:

sudo aptitude install ddclient

You don’t need to care about what you have chosen on the debconf interface, soon we’ll chage the configuration file.

2. Configure ddclient via editing its configuration file, use whatever editor you like to edit /etc/ddclient.conf first, for example I run this command:

sudo vi /etc/ddclient.conf

Then make your file look like this:

daemon=600
syslog=yes
ssl=yes
pid=/var/run/ddclient.pid
protocol=dyndns2
use=web, web=whatismyip.com
server=updates.opendns.com
login=your-account-name
password='your-account-password'
your-lable-in-account-settings

The first line without # at its start intends to tell ddclient refresh information to the server every 600 seconds if it is running as a daemon. This section is not needed for Ubuntu user in fact, because it is configured in the other file we’ll look at, just a note here for others who many use it. I think 600 is a suitable value for most network, or you can adjust it to meet your actual needs. Update the information too frequently is a waste of resource, having a too long interval time may let your service not working so properly sometimes.

The second line intends to make every update logged at syslog, you can delete this line if you don’t want to.

The third line is for turning on ssl support, in other word we can transfer our account information using an encrypted route.

The forth line is the PID file path, don’t change it unless you know what your are doing exactly.

The fifth line tells what protocal you use, OpenDNS requires dyndns2 protocal.

The sixth line is the way you get your current IP address for transferring to the server, the defaut value was “use=if, if=”, than means you can set a net interface such as eth0 here and ddclient will send eth0’s address. When we are using PPPoE or other virtual connection protocal, this configure may be damnned, so we set it using web to check you real IP, whatismyip.com is the host provide such service, you can change it to something you like, but I think copy-and-paste this line to your configuration is the best choice.
The next three lines is the information about the server and your account, you should copy the server address, and fill in your account name and password there. Don’t worry about your account’s security here, the ddclient.conf is only accessable for root user by default, and we have chosen to use ssl at the begging of this configuration.

The last line is the LABLE you have set in your dashboard, they are something might be Home, Office, etc.

Next, we should enable daemon mode for ddclient, edit /etc/default/ddclient.conf with root privilege:

sudo vi /etc/default/ddclient.conf

Make sure the following lines are just look like what have shown below:

run_ipup="true"
run_daemon="true"
daemon_interval="600"

The first line is whether ddclient does an update while a new ppp conection is establed, this is useful for those who use a xDSL, or other dial-on-demand connections.

The second line is whether ddclient run as a daemon, we change it to true here. Only run as a daemon, it can perform the set actions automaticlly.
The last line is how long should it takes from one update to another, I was explained before in the first line of previous configuration file.

3. Restart ddclient to make everything into effect.

sudo /etc/init.d/ddclient restart

We have finished configuring OpenDNS till here, visit https://www.opendns.com/welcome/ to check!

Second, use DNS cache to speed up the look up action. This is for Linux/Unix users, I don’t know if there is any good replacement for other platforms. I introduce dnsmasq here to do this task.

1. Install dnsmasq, you can find it in main aspect of distributions‘ repository.

For Ubuntu, perform the following action:

sudo aptitude install dnsmasq

2. Edit /etc/dnsmasq.conf to fit our use:

sudo vi /etc/dnsmasq.conf

And make sure the following line is uncommented:

listen-address=127.0.0.1

You can choose to change other settings if you are interested in the file, there is enough comments for you to know what every options sense, but leave it there is a good solution.

3. Restart dnsmasq

sudo /etc/init.d/dnsmasq restart

4. Add 127.0.0.1 to you DNS list. We can edit resolv.conf to make that line at first of ns servers, or change in network-manager.

5. Restart networking, you don’t need to restart your computer.

sudo /etc/init.d/networking restart

So close and re-open your web browser, do you feel web pages load faster?

Third, tune your firefox(if you use it). Input about:config in your firefox location bar, filter the following items and change their values to ‘true':

network.http.pipelining
network.http.proxy.pipelining
plugin.expose_full_path

And change the following item’s value to 8 or 10:

network.http.pipelining.maxrequests

Add these items to the list via right click and choose ‘Add -> Interger’, note to set the value according to the last number listed below:

nglayout.initialpaint.delay 0
content.notify.backoffcount 5
ui.submenuDelay 0

If you don’t have IPv6 connection, also change this item’s value to ‘true':

network.dns.disableIPv6

Restart your firefox will make it effect.

In Ubuntu 9.04, the IPv6 support was built in kernel, if you compile kernel by yourself, you can uncheck this feature if you don’t need it.