Adding 2.6.28 kernel and ext4 support to Hardy Heron

8 02 2009

The ext4 filesystem recently was announced as stable and was introduced into the mainline 2.6.28 kernel.  2.6.28 also has some other performance enhancements, so I thought I’d turbocharge my 8.04 install with a custom 2.6.28 kernel with ext4.  This is how I did it, and what improvements I noticed afterwards.

(Note – if you have custom kernel modules installed in your current kernel, you will lose them.  They will need to be recompiled.  Also, if you are using the restricted drivers they will stop working as well.  You will need to compile whatever modules you will need into your fresh kernel.  Simply installing the apt packages for nvidia-glx or whatever will not work, as 2.6.28 is NOT supported by Ubuntu.)

Step One:

Download the latest kernel source from www.kernel.org and put it into /usr/src.  Just change dirs to /usr/src, and wget the 2.6.28.4 tarball source from the kernel site.  Run a tar xvf on it, and then cd to the /usr/src/linux-2.6.28.4 directory.

Copy your current kernel config to .config.  Just type cp /boot/config-`uname -r` ./.config

Run make menuconfig.  Now, for additional performance as a desktop machine, go to enable preemption for low latency.   This will be under “Processor Type and Features> Preemptiton Model (Preemtible Kernel(Low-Latency Desktop))”

Make sure you add ALSA to the kernel.  This will be under sound devices – hit “Y” to install ALSA as a module.  Under the ALSA submenu, make sure you include the drivers for whatever soundcard you have/like/want/etc.

Exit and save your config file.

Step 2 – build the kernel

Okay, if you’re using a multiprocessor (or multicore) system you’ll want to enable concurrency during the build to speed it up.  This is just an environment variable that you’ll need to export prior to building.  Simply type export CONCURRENCY_LEVEL=4.  (4 is for 4 processors, 2 for 2, etc).

Now, while in /usr/src/linux-2.6.28.4, run fakeroot make-kpkg clean

Once done, run fakeroot make-kpkg –initrd –append-to-version=-barbarian kernel_image kernel_headers

(“barbarian” can be changed for whatever you want – this will show as a suffix to your kernel version after it is built)

After it builds, you will be left with 2 .deb packages.  One is the kernel image, another is the kernel headers.  These will be in /usr/src.

Step 3 – install the new kernel

cd to /usr/src and run dkpg -i linux-image-2.6.28.4-barbarian.deb (or whatever the deb package is named)

run dkpg -i linux-headers-2.6.28.4-barbarian.deb (or whatever the deb package is named)

Step 4 – boot the new kernel

Your new kernel should now come up.  If you have an nvidia card or an ATI card, you will now need to install the driver modules for them.  I am currently running nvidia on this box, so I just went to the nvidia site, downloaded the .run script for the driver, and installed it no problem.

Yay!  You’re now using the 2.6.28 kernel.  Now it’s time to run ext4.

Step 5 – ext4

First, you’ll have to install the new util-linux patches from ftp://ftp.kernel.org/pub/linux/kernel/people/tytso/ubuntu-fixed-util-linux – just install the .deb packages.

Compile and install the latest version of e2fsprogs from http://sourceforge.net/project/showfiles.php?group_id=2406

Okay, if you just want to create a new ext4 filesystem, you can just run

mke2fs -t ext4 /dev/DEV   and have a fresh new ext4 partition.

If you would like to convert an existing ext3 filesystem to ext4 – you’ll want to convert any partition except for /boot which will NOT work since GRUB cannot yet read ext4 filesystems.  If you convert /boot to ext4 – you will not be able to boot.

Anway, to convert an existing ext3 system, run

tune2fs -O extents,uninit_bg,dir_index /dev/DEV

Right after that you’ll need to fsck it – so run

fsck -pf /dev/DEV

Make sure you update your /etc/fstab entries to mount the partitions as ext4 instead of ext3.

What have I noticed so far?  Overall responsiveness on the desktop has improved.  The main headache that I’ve seen go away is the high i/o latency problem that many Hardy users complain about during heavy file i/o.  My boot time is now 3 seconds faster than before.  Copying large files to/from ext4 partitions appears to have less impact on other system processes, and foreground apps and processes appear to respond better during copies.  All in all I’m happy with the results.





What a difference compiling makes vs prepackaged!

10 11 2008

Okay so I just finished installing FreeBSD 7.0 on this machine:

AMD Athlon X2 6000+ overclocked to 3.2GHz, 2GB DDR2800, 250gb Seagate Barracuda SATAII, nvidia 8500GT (using nvidia-driver)

This machine has had Ubuntu 32bit, Ubuntu 64bit, Slackware 12.1, Slamd64, Debian 4.0r4 i386, PC-BSD 7.0 Fibonacci.  Now I knew that natively-compiled binaries are faster and usually more reliable – but when I decided to “build the world” with FreeBSD 7.0 I was in for a shock from the difference in speed using this system as a desktop environment.  KDE and especially gnome are surprisingly faster.  Browsing with Firefox 3.0.3 is very snappy and everything just immediately responds.

I think I’m going to stick with this OS for a while.  It took about 3 days for the entire project – but most of it was compile time.  I probably spent 3 hours at the console doing the installation.





Intel follows behind AMD in design, once again

3 11 2008

Okay, so here’s the review here:
http://hothardware.com/Articles/Intel-Core-i7-Processors-Nehalem-and-X58-Have-Arrived/

Once again Intel follows behind – giving more creedence to the statement “AMD works smarter, Intel works harder”. If you check out this article, it goes on and on about “advances” in the microarchitecture for the i7 processors.

Feature #1
Monolithic Quad-Core
AMD had this nailed already on their Phenom line. True monolithic quad-core design. All of the previous Intel quads were basically just two dual-cores slapped together.

Feature #2
Integrated Memory Controller
Ummm… AMD has had this since who knows when. AMD has always been superior in memory interface speeds and peripheral interface speeds.

Feature #3
Quick Path Interconnect
Basically now that they’ve done it right the inter-core and memory connects are faster. Or, to put it differently “Oooh – now that we’re doing what AMD does it’s faster!”

What’s actually cool about this thing that would warrant spending (most likely) $1000 on a CPU? They’ve used a 45nm process, which means it runs cooler and more efficient. And… drumroll… they’ve brought back HyperThreading. So now, you can have:

1. 4 really fast CPUs with HyperThreading disabled.
2. 8 really slow virtual CPUs with HyperThreading enabled.

I think I’ll save the $$.





My old sig.

3 11 2008

Links from my old email sig – more of my rampant Linux militism.

What’s wrong with Windows Vista?
http://badvista.fsf.org/what-s-wrong-with-microsoft-windows-vista

Download Ubuntu today, completely free.  An easy alternative to
Windows based on Linux
http://www.ubuntu.com

The fastest computers are Linux computers
http://practical-tech.com/infrastructure/the-fastest-computers-are-linux-computers/

Who writes Linux and who supports it?
http://linux-foundation.org/weblogs/press/2008/03/31/linux-foundation-publishes-study-on-linux-development-statistics-who-writes-linux-and-who-supports-it/

Hybrid machine breaks petaflop barrier using Cell chip and running Linux
http://www.computerworld.com/action/article.do?command=viewArticleBasic&articleId=9095318

Where Windows is #2 to Linux
http://blogs.computerworld.com/where_windows_is_2_to_linux

Windows can’t even get into the game
http://uptime.netcraft.com/up/today/requested.html





Setting up an Asterisk PBX on Ubuntu 8.04 Server

3 11 2008

So I recently have had the opportunity to set up another PBX running asterisk – and some things have changed since the last time I’ve set one up.  I’ve successfully got the system online and running, and I thought I’d post the steps to get one of these puppys built from scratch.  First I’d like to mention that I highly recommend that you NOT use a canned asterisk solution such as trixbox or asteriskNOW – as those are based on CentOS and CentOS/RHEL have really crappy driver support.  I went with a fresh minimal Ubuntu install (should also work with Debian Etch), compiled the packages from scratch (no apt asterisk / zaptel packages), and it worked great.  Note that this will also run the FreePBX gui for management.  Many thanks to undertoe for his guide – a lot of this is based on his guide and cleaned up a bit.

So you’ve got your Ubuntu minimal up and running.  Here we go:

$ sudo su            
(work as superuser for this session – this is generally considered a bad practice, but I’m lazy)

$ apt-get install cvs build-essential automake autoconf bison flex libtool libncurses5-dev libssl-dev php5 php5-cli php5-curl php5-gd php5-mysql mysql-server php-pear php-db curl sox apache2 subversion libssl-dev libmysqlclient15-dev            
(this will install the needed packages for php/apache/etc.  make sure you note the root password that you set for MYSQL, it will ask you during the install)

$ uname -a        
(this will give you your kernel version – note it for the next step)

$ apt-get install linux-headers-2.6.24-19-server      
(2.6.24-19-server comes from the uname-a output)

$ ln -s /usr/src/linux-headers-2.6.8.1-5-686-smp /usr/src/linux-2.6    
(link the headers)

$ cd /usr/src/
$ wget http://downloads.digium.com/pub/zaptel/zaptel-1.4-current.tar.gz
$ tar -zxvf zaptel-1.4-current.tar.gz
$ cd zaptel-1.4.12.1
$ ./configure
$ make clean
$ make
$ make install
$ make config                   
(download the zaptel driver, compile, install, configure)

$ /etc/init.d/zaptel start
$ update-rc.d zaptel defaults 20 80      
(start up zaptel and update rc.d)

To check to see if zaptel is running do a cat /proc/zaptel/*  –  you should see an output like this:

Span 1: WCTDM/0 “Wildcard TDM410P Board 1″
IRQ misses: 0

1 WCTDM/0/0 FXSKS (In use)
2 WCTDM/0/1 FXSKS (In use)
3 WCTDM/0/2 FXSKS (In use)
4 WCTDM/0/3 FXSKS (In use)

$ groupadd asterisk
$ useradd -c “asterisk PBX” -d /var/lib/asterisk -g asterisk asterisk
$ mkdir /var/run/asterisk
$ chown asterisk:asterisk /var/run/asterisk/
$ cd /usr/src/
$ wget http://downloads.digium.com/pub/asterisk/releases/asterisk-1.4.22.tar.gz
$ tar -zxvf asterisk-1.4.22.tar.gz
$ cd asterisk-1.4.22
$ make clean
$ ./configure
$ make
$ make install
$ make samples            
(configure directories, permissions, download asterisk source, compile and install)

$ cd ..
$ wget http://downloads.digium.com/pub/asterisk/asterisk-addons-1.4.7.tar.gz
$ tar -zxvf asterisk-addons-1.4.7.tar.gz
$ asterisk-addons-1.4.7
$ perl -p -i.bak -e ’s/CFLAGS.*D_GNU_SOURCE/CFLAGS+=-D_GNU_SOURCE\nCFLAGS+=-DMYSQL_LOGUNIQUEID/’ Makefile        
$ ./configure
$ make clean
$ make
$ make install            
(download, compile, and install asterisk addons)

$ cd ..
$ mkdir asterisk-sounds
$ asterisk-sounds
$ wget http://downloads.digium.com/pub/telephony/sounds/asterisk-core-sounds-en-wav-current.tar.gz
$ wget http://downloads.digium.com/pub/telephony/sounds/asterisk-extra-sounds-en-wav-current.tar.gz
$ wget http://downloads.digium.com/pub/telephony/sounds/asterisk-moh-freeplay-wav.tar.gz
$ tar -zxvf asterisk-core-sounds-en-wav-current.tar.gz
$ tar -zxvf asterisk-extra-sounds-en-wav-current.tar.gz
$ tar -zxvf asterisk-moh-freeplay-wav.tar.gz
$ cp -rf * /var/lib/asterisk/sounds/
$ ln -s /var/lib/asterisk/moh /var/lib/asterisk/mohmp3       
(download sound packages, extract, copy them to the asterisk sounds directory, and create a symlink for FreePBX music on hold)

$ chown asterisk:asterisk /etc/asterisk -R
$ chown asterisk:asterisk /var/lib/asterisk -R
$ chown asterisk:asterisk /var/log/asterisk -R
$ chown asterisk:asterisk /var/spool/asterisk/ -R   
(set permissions for asterisk)

$ nano /etc/asterisk/asterisk.conf   
(open asterisk.conf for editing)

Look for “astrundir” and change to /var/run/asterisk   Save and quit when done.

$ cd /usr/src/
$ wget http://mirror.freepbx.org/freepbx-2.5.0.tar.gz
$ tar -zxvf freepbx-2.5.0.tar.gz
$ cd freepbx-2.5.0
$ mysql_install_db
$ mysqladmin u root password ‘<your MYSQL root password>’
$ mysqladmin create asteriskcdrdb -p
$ mysqladmin create asterisk -p
$ mysql –user=root –password=<your MYSQL root password> asterisk < ./SQL/newinstall.sql
$ mysql –user=root –password=<your MYSQL root password> asteriskcdrdb < ./SQL/cdr_mysql_table.sql
(Download FreePBX, and set up the MYSQL databases asterisk and asteriskcdrdb)

$ mysql –user root -p
$ GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asteriskuser@localhost IDENTIFIED BY ‘amp109′;
<enter>
$ GRANT ALL PRIVILEGES ON  asterisk.* TO asteriskuser@localhost IDENTIFIED BY ‘amp109′;
<enter>
$ quit
<enter>
(Set up appropriate MYSQL privileges)

$ nano /etc/apache/envvars
change  “export APACHE_RUN_USER=www-data & export APACHE_RUN_GROUP=www-data”
to  “export APACHE_RUN_USER=asterisk & export APACHE_RUN_GROUP=asterisk”

$ nano /etc/apache2/sites-enabled/000-default
change  “AllowOveride None” to  “AllowOverid All” under both /var/www  and  /var/www/
(Sets up apache for FreePBX)

$ nano /etc/php5/apache2/php.ini
change: upload_max_filesize to upload_max_filesize = 20M

$ nano /etc/php5/cli/php.ini
change: upload_max_filesize to upload_max_filesize = 20M

Set permissions on /var/lib/php5
$ chown asterisk:asterisk /var/lib/php5 -R

Set permissions on /var/www
$ chown asterisk:asterisk /var/www -R

Restart Apache
$ /etc/init.d/apache2 restart

Test by entering http://<pbx-ip-addresss>/ in a browser – you should get “It Works!” or a similar message letting you know apache is working.

$ cd /usr/src/freepbx-2.5.0
$ sudo ln -sf /bin/bash /bin/sh
$ sudo
./start_asterisk start
$ sudo ./install_amp
Accept the default on all questions except for:
Enter the path to use for your AMP web root: /var/www
IP address: <pbx-ip-addresss>

(Install FreePBX and start it up)

Now point your browser to http://<server-ip-addresss>/admin/ and click on the orange reload config banner at the top of the page.  Yay!  You should now have a working asterisk/FreePBX box.

To have it load on boot:

$ nano /etc/init.d/asterisk

Paste the following:

—————————————————————————-

set -e

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

DESC="Asterisk"
NAME=amportal
DAEMON=/usr/local/sbin/$NAME
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME

test -x $DAEMON || exit 0

d_start() {

amportal start

}

d_stop() {

amportal stop

}

d_reload() {

amportal restart

}

case "$1" in

start)

echo -n "Starting $DESC: $NAME"
d_start
echo "."
;;

stop)

echo -n "Stopping $DESC: $NAME"
d_stop
echo "."
;;

restart|force-reload)

echo -n "Restarting $DESC: $NAME"
d_stop
sleep 10
d_start
echo "."
;;

*)

echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
exit 3
;;

esac

exit 0

—————————————————————————-
Save the file and run:

$ chmod 755 /etc/init.d/asterisk

$ update-rc.d asterisk defaults 90 10








Follow

Get every new post delivered to your Inbox.