How to make ubuntu SO fast

So, I am running Ubuntu netbook remix, lucid lynx, on my Eee PC 1005HA (Seashell, black). It runs pretty fast, but I’m always looking for that extra bit of juice, especially given the “mere” single core processor and 1GB RAM it makes do with, compared to my Desktop which runs win 7 64-bit on an AMD64x2 with 8GB.

I originally went down this route to get my webcam working better – at the moment it can only do stills but not video – but the result was so much faster that I would recommend this to anyone with a sluggish netbook and a 24 hour period where they don’t need it.

Building a Kernel is EASY on Ubuntu

Your first reference is Ubuntu’s own docs on building a kernel. This link is the dependency installation, and this one will take you straight to the relevant paragraphs – but don’t go there yet! Ubuntu makes this process much easier than it is traditionally (anyone who’s ever tried Gentoo will know what I mean). You proceed as follows:

1: Install dependencies

You’ll be needing a few things before you can build C code, like GCC, Make, and various other developer utilities. Copy and paste the apt-get commands for doing this from the docs above before you start (you can paste in a terminal using Ctrl+Shift+V). Make sure you also install the ncurses libraries from the second set of instructions too.

2: Download the Kernel source code

This need not be scary, and while the link above recommends grabbing the latest source from their git server, this is almost certainly a rubbish idea (unless you are interested in writing some low low low level C code as a developer…) the way to do it is to install a package using aptitude, which will give you a zip of the source (specifically a “BZIP2”) so that you don’t need to install versioning tools (like git-core) just to grab a file.

3: Extract the source

Now DON’T do this in the place where it has been dropped for you. You need to be root (sudo) and there is NO point building a kernel as root; you can build as an ordinary user (and you’re much less likely to break everything in the process too.) Make yourself a directory in your home folder (cd ~) called src (mkdir ~/src), and extract the zip into there, just like it says to on the link above.

4: Configuration

DON’T grab the current configuration, the script may or may not pick up everything you need, just cd straight in and “make menuconfig”. If you want to go hunting for a particular driver, feel free (although basically everything is in there by default.) The thing to do to get a massive speed increase is to head into

Processor type and features —>
  Processor family (something) —>

and find the Intel Atom option (or whatever your processor is). This will optimise all your OSs most central and low level libraries for your processor specifically, which will make the whole thing MASSIVELY faster to run.

5: Build into a package (the step that takes about 24 hours on a wee netbook)

Normally, you’d build Linux kernels into a bzImage and place it in your /boot folder manually, but on Ubuntu there is a better way with many fewer pitfalls. What you are doing is building an installable .deb package that you can install in a single command later, when you are ready.

Run the command starting “fakeroot make-kpkg” from the docs, making sure you put a nice recognisable string in for the image name, and go to sleep. when you get up, check for errors and go to work (restart if you’ve hit an error). When you get home, you should have a pair of debs (linux-image-something and linux-headers-something) sitting in that ~/src folder you made. Install as the docs say, using dpkg -i.

5a: They had to include one tricky step…

You will now hit a horrid error if you try and boot your shiny new kernel – you haven’t put a RAMFS image (with the separate modules) in the same folder. (apparently this “feature” is new for lucid – YAY!) so run the two cp commands on the docs to put an appropriate script in /etc/default/kernel/ .

this is apparently the bit they didn’t want you to know — to run the install script manually, you need to supply two arguments. The first is the bit after the vmlinuz- in your kernel name (“ls /boot” will let you find it, Ctrl+Shift+C to copy from terminal,) and the second is the path to that kernel file. The script doesn’t print any error messages if you don’t specify these arguments, it just fails silently, so take care!

6: Configuring your bootloader

Run sudo update-grub, and note the position in the ordering of your vmlinuz. (you should also see an initramfs file with a similar suffix, if you don’t, try running the undocumented script again, properly). use sudo gedit /etc/default/grub to change the GRUB_DEFAULT=0 line to a different number to make your new kernel the default. The images will appear in the order update-grub spat them out, and each of the Ubuntu ones at the top will have 2 entries, one for it and one for the failsafe mode version. And, of course, you are counting from 0 not 1.

run sudo update-grub one more time to commit that change, and then restart and see what you get! If you get an error (it will almost certainly be some form of Kernel Panic, which means the one you tried to boot is broken,) you can always use the old one to see what went wrong – just select it from the boot menu before the count down hits 0.

That’s all folks!

When you get kernel-updates you’ll have to recompile again, alas, but this is what we geeks put up with to have laptops that outperform everyone else’s by a mile.

Let me know if you have a problem with this SPECIFIC method (which worked for me) and I’ll see if I can help, but as Ubuntu say this is an advanced option and help is pretty sparse, so make sure you understand enough of what I’ve said to undo it! or you’ll need to reinstall from scratch….

Advertisements

About tehwalrus

Lib Dem, Software Developer, General Geek. View all posts by tehwalrus

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: