September 21, 2009

Debian, Openvz and Broadcom 5716 ethernet cards

Recently we have bought a new server to replace an old HP DL360 that failed. The decision was made to buy a new Dell R410. This server, like many Dell servers, comes with a Broadcom dual-port Ethernet card. We wanted to install Debian Lenny (5.0) on it and this should have worked just fine with the bnx2 drivers that come with the latest Debian. But this particular ethernet card, Broadcom 5716, doesn’t work with them!

So we had to get the latest drivers for it! But because Broadcom doesn’t play nice with open-source, you have to get their latest drivers in binary form or compile them yourself from source. Because the compiling using their tarball failed for unknown reason and I didn’t have time to debug it, I searched for a precompiled Debian package (.deb). And it seems the deb from Debian’s Squeeze repository has the drivers that work with this particular card. So I downloaded and installed the package:

wget http://ftp.ro.debian.org/debian/pool/non-free/f/firmware-nonfree/firmware-bnx2_0.18_all.deb
dpkg -i firmware-bnx2_0.18_all.deb

Rebooted the machine but still no ethernet drivers. More searching lead me to find out that this firmware works with Linux kernel 2.6.30. Upgraded to this kernel (using debs also), rebooted and … network connectivity! But my joy quickly ended when I noticed on Openvz’s wiki that they only offer Openvz patches up to 2.6.27! So I had network but no way to use virtual machines with Openvz on it. (and this is what we use in our shop so no other options…).

But with Google’s help again, I noticed that Broadcom 5716 is supported in 2.6.27! No pre-compiled deb packages for this version, but no problem, we can compile our own. These are the steps to compile 2.6.27 with Openvz support and install the Broadcom latest drivers and make them work:

cd /usr/src
wget http://kernel.org/pub/linux/kernel/v2.6/linux-2.6.27.tar.bz2
tar xjf linux-2.6.27.tar.bz2
cd linux-2.6.27
wget http://download.openvz.org/kernel/branches/2.6.27/2.6.27-briullov.1/patches/patch-briullov.1-combined.gz
(or whatever is the latest kernel patch for your kernel)
gunzip patch-briullov.1-combined.gz
wget http://download.openvz.org/kernel/branches/2.6.27/2.6.27-briullov.1/configs/kernel-2.6.27-x86_64.config.ovz
OR
wget http://download.openvz.org/kernel/branches/2.6.27/2.6.27-briullov.1/configs/kernel-2.6.27-i686.config.ovz
(depends on what platform your machine runs 32bit or 64bit)
cp kernel-2.6.27-*.config.ovz .config
patch -p1 < patch-briullov.1-combined
make oldconfig
make
make modules_install
make install
cd /boot
mkinitramfs -o initrd.img-2.6.27.21
update-grub

Edit /boot/grub/menu.lst and make the kernel 2.6.27.21 the default one.

wget http://ftp.ro.debian.org/debian/pool/non-free/f/firmware-nonfree/firmware-bnx2_0.18_all.deb
dpkg -i firmware-bnx2_0.18_all.deb
(in case you didn't download and install the firmware earlier)
update-initramfs -u -t -k 2.6.27.21
apt-get install vzctl vzquota rsync
reboot

When you reboot in your system again, networking should work just fine along with Openvz!