Nerd-alert: Ubuntu Linux 12.04 on my NVIDIA Optimus Samsung NP300V3A laptop

When I acquired my pre-ultrabook-era but still pretty Samsung NP300V3A laptop some nine months ago, I lamented that I’d probably never be able to put Linux on there due to the NVIDIA Optimus graphics switching thingamagoo.

Well, yesterday I ate my hat.

If you have nerdy tendencies, head on over to VXLabs, my nerd blog, to read all about it.

An Even More Ultimate Boot Disk!

In this short howto, I show you how to combine the Ultimate Boot CD (UBCD) with both Knoppix 6.2.1 and Ubuntu 10.04 onto a single USB stick to create An Even More Ultimate Boot Disk (EMUBD)!

UBCD is a bootable CD image that’s fantastic if you’re trying to save grandma’s PC from a certain death, as it contains a number of different bootable utilities for testing memory, testing and low-level repair of hard drives, partition repair, antivirus and so forth. It even contains Parted Magic, a compact linux distribution for fixing partitions, amongst others.

Knoppix is the swiss knife of live linux distributions, and Ubuntu 10.04 is probably the slickest distribution out there at the moment. Both of these can be ran live from your USB disc, so they don’t have to touch your hard drive.  However, both of them are also able to install to your hard disc if you so choose.

To me it seemed logical to combine all three of these elements onto the single USB flash drive that I carry on my keychain, as I know of many grandmas with broken PCs…

Let’s go!

  1. make sure the single FAT32 partition on your USB stick is bootable (use command ‘a’ in linux fdisk) and large enough (you’ll need just a bit less than 2G).
  2. mount your flash drive on a directory, henceforth referred to as FLASH_MNT.
  3. copy all files from the ubcd5 iso into a directory, henceforth referred to as CUSTOM_UBCD5.
  4. mount the ubuntu 10.04 i386 iso on a directory, henceforth referred to as LUCID_MNT
  5. mount the knoppix iso on a directory, henceforth referred to as KNOPPIX_MNT.
  6. copy necessary boot files from the ubuntu ISO to UBCD:
    mkdir CUSTOM_UBCD5/ubcd/custom/lucid
    cp LUCID_MNT/casper/vmlinuz LUCID_MNT/casper/initrd.lz CUSTOM_UBCD5/ubcd/custom/lucid
    
  7. copy ubuntu-10.04-desktop-i386.iso to your flash disk:
    mkdir /FLASH_MNT/isos
    cp ubuntu-10.04-desktop-386.iso /FLASH_MNT/isos/
    
  8. Knoppix can’t be booted directly from its iso like Ubuntu, so we have to copy the actual contents of the ISO to your flash:
    cp -r KNOPPIX_MNT/KNOPPIX to FLASH_MNT/
    cp -r KNOPPIX_MNT/boot/isolinux to FLASH_MNT/KNOPPIX/isolinux
    
  9. replace FLASH_MNT/KNOPPIX/isolinux/isolinux.cfg with the isolinux.cfg at the bottom of this post. (It’s the same file, except that “KERNEL linux” is replaced with “KERNEL /KNOPPIX/isolinux/linux”, “initrd=minirt.gz” with “initrd=/KNOPPIX/isolinux/minirt.gz”, F1, F2, F3 and DISPLAY paths all fixed, e.g. “F2 f2” becomes “F2 /KNOPPIX/f2” and finally all instances of “quiet” removed)
  10. Now replace CUSTOM_UBCD5/ubcd/custom/custom.cfg with the custom.cfg at the bottom of this post.
  11. copy all files from CUSTOM_UBCD5 to your usb flash disk:
    cp -r CUSTOM_UBCD5/* FLASH_MNT/
    
  12. Finally, make the whole thing bootable with the following invocation. It’s really important that you replace /dev/sdX1 with the correct device for your flash disk. To see what this is, type “mount” and see the device associated with your FLASH_MNT.
    cd FLASH_MNT
    sudo ./ubcd/tools/linux/ubcd2usb/syslinux -s -d /boot/syslinux /dev/sdX1
    

You’re done. You should now be able to boot with your EMUBD! Knoppix and Ubuntu can be found under “User defined”.

Here are those files that you’ll need. First FLASH_MNT/KNOPPIX/isolinux/isolinux.cfg:

DEFAULT knoppix
APPEND ramdisk_size=100000 lang=en vt.default_utf8=0 apm=power-off vga=0x311 initrd=/KNOPPIX/isolinux/minirt.gz nomce loglevel=0 tz=localtime
TIMEOUT 50
# TOTALTIMEOUT 20
# KBDMAP german.kbd
PROMPT 1
F1 /KNOPPIX/isolinux/boot.msg
F2 /KNOPPIX/isolinux/f2
F3 /KNOPPIX/isolinux/f3
DISPLAY /KNOPPIX/isolinux/boot.msg
LABEL adriane
KERNEL /KNOPPIX/isolinux/linux
APPEND ramdisk_size=100000 lang=en vt.default_utf8=0 apm=power-off vga=0x311 initrd=/KNOPPIX/isolinux/minirt.gz nomce loglevel=0 tz=localtime adriane
LABEL knoppix
KERNEL /KNOPPIX/isolinux/linux
APPEND ramdisk_size=100000 lang=en vt.default_utf8=0 apm=power-off vga=791 initrd=/KNOPPIX/isolinux/minirt.gz nomce loglevel=0 tz=localtime
LABEL fb1024x768
KERNEL /KNOPPIX/isolinux/linux
APPEND ramdisk_size=100000 lang=en vt.default_utf8=0 apm=power-off vga=791 xmodule=fbdev initrd=/KNOPPIX/isolinux/minirt.gz nomce loglevel=0 tz=localtime
LABEL fb1280x1024
KERNEL /KNOPPIX/isolinux/linux
APPEND ramdisk_size=100000 lang=en vt.default_utf8=0 apm=power-off vga=794 xmodule=fbdev initrd=/KNOPPIX/isolinux/minirt.gz nomce loglevel=0 tz=localtime
LABEL fb800x600
KERNEL /KNOPPIX/isolinux/linux
APPEND ramdisk_size=100000 lang=en vt.default_utf8=0 apm=power-off vga=788 xmodule=fbdev initrd=/KNOPPIX/isolinux/minirt.gz nomce loglevel=0 tz=localtime
LABEL memtest
KERNEL memtest
APPEND foo
LABEL dos
KERNEL memdisk
APPEND initrd=balder.img
LABEL failsafe
KERNEL /KNOPPIX/isolinux/linux
APPEND ramdisk_size=100000 lang=en vt.default_utf8=0 vga=normal atapicd nosound noapic nolapic noacpi pnpbios=off acpi=off nofstab noscsi nodma noapm nousb nopcmcia nofirewire noagp nomce nonetwork nodhcp xmodule=vesa initrd=/KNOPPIX/isolinux/minirt.gz

… and then CUSTOM_UBCD5/ubcd/custom/custom.cfg:

MENU INCLUDE /ubcd/menus/syslinux/defaults.cfg
UI /boot/syslinux/menu.c32

# option to be able to go back to the main menu
LABEL -
MENU LABEL ..
COM32 /boot/syslinux/menu.c32
APPEND /ubcd/menus/syslinux/main.cfg

# this clause will boot directly from the ubuntu iso
LABEL ubuntulive
MENU LABEL Ubuntu 10.04 i386 Desktop LIVE
LINUX /ubcd/custom/lucid/vmlinuz
INITRD /ubcd/custom/lucid/initrd.lz
APPEND boot=casper iso-scan/filename=/isos/ubuntu-10.04-desktop-i386.iso --

# and this one will chain into the knoppix boot setup
LABEL knoppix
MENU LABEL Knoppix 6.2.1 LIVE
CONFIG /KNOPPIX/isolinux/isolinux.cfg

Post scriptum

  • The instructions in this post are derived from the UBCD linux documentation and various forum posts.  Credits to their authors!
  • If you don’t want Knoppix on your bootable USB and you have a Windows computer, you could also use MultiBootISOS to add multiple ISOs to a USB boot disk.

Backport of unison 2.27.57 to Ubuntu 7.10

So you’ve upgraded some of your machines to Ubuntu 8.10 (Intrepid Ibex, argh) and you’re really very happy with yourself.  That is, until you try to run your trusty unison synchronisation scripts and notice that due to the version mismatch between unison on 8.10 (2.27.57) and unison on 7.10 (2.13.16), you are screwed.

Because I like you, I’ve made available my quick and dirty backport of unison 2.27.57 (the Ubuntu 8.10 version) to Ubuntu 7.10 (Gutsy Gibbon) on i386.  Get the DEBs by clicking HERE!

If this is useful to you, please leave a comment on this post!  If not, go leave a comment on someone else’s blog man!

a critical look at ubuntu feisty beta on an hp nc8430 laptop

I’ve been running Linux since 1993 (kernel 0.99-pl13 if I remember correctly) on most of my workstations and servers. I’ve had my idiot-zealot phase (“nothing but Linux is good enough”), but fortunately have left that far behind me. Now I like teasing idiot-zealots with comments about that shareware Loonix thing.

So for the past few laptops, I’ve been running Windows XP, mostly because this Just Works(tm) on modern laptop hardware. Linux really didn’t cut it when compared to XP: yes, you could install it without too much trouble, but getting 100% out of your laptop (suspend/resume, good power management, full support for modern GPUs, etc) is a different story.

Because XP is getting more scary by the day (WGA things, licensing issues) and Vista promises to be even more scary (binding itself to your motherboard) and because I’ve been hearing many good things about Ubuntu Feisty (the soon-to-be-released 7.04), I decided to give this a shot on my HP NC8430 laptop (Core Duo 2GHz, ATI X1600, 2G RAM, etc.). Initially I was determined to do this like a “normal” user, i.e. no tweaking config files and especially no script writing. I wanted to see how far your average user could get with a state of the art Linux installation on a laptop.

Installation

This was quite impressive: I defragmented my NTFS filesystem, booted from the Ubuntu Feisty live CD and did the install. Without getting all cocky about it, the installer resized my NTFS partition, created a new EXT3 partition and installed itself. Colour me impressed.

General configuration

After the first boot, I was greeted with a VESA-driven x.org and an incorrect resolution. My laptop screen supports 1680 x 1050. The Gnome Preferences | Screen Resolution applet couldn’t go higher than 1280 x 1024. I had to break my first rule and edit the x.org configuration file to add the higher resolution. Why is this still necessary? A novice user shouldn’t need to have to do this!

I also installed the Ubuntu packaged fglrx ATI drivers with the Synaptic package management software, as I depend on good 3D graphics support for my work. The new Restricted Driver Manager helps one to complete this configuration in a user-friendly fashion.

By running “aticonfig –set-powerstate 1”, the GPU can be set to a lower-power mode, leading to a cooler-running laptop, meaning the fans don’t spin up as often. This command can be added to the gnome startup by adding it to System | Preferences | Sessions. With “aticonfig –lsp” one can query the available powerstates. One can only change the powerstate if a single display is active.

I removed “quiet” (but left “splash”) from the GRUB config for the default kernel in order to be able to see boot-up messages. These are helpful, especially when things take longer than they should.

Wireless networking support

This is the part that really impressed me: With Ubuntu 6.10 (Edgy Eft), I had to jump through all kinds of very user-unfriendly hoops to connect to my WPA wireless network. Feisty Beta simply popped up a pretty dialog box showing me the detected wireless networks and prompted me for the network key when I selected my WPA access point. I was online… colour me even more impressed!

Power management

This is when my jaw dropped ever so slightly (I’ll get to the “critical” part of this look a bit later): I selected suspend to RAM, which the laptop promptly did. When I pressed the power button to resume, I expected the typical black-screen-crashed-laptop syndrome. Instead, my desktop came back and I could continue working. This is a quantum leap in user-friendly Linux!

However, I soon saw that at every third resume (on average) all my keyboards would be dead.

It turns out something similar to this bug applies to my laptop. By adding the necessary suspend/resume hooks as documented in the bug report (so that the i8042 module is removed before suspend and re-installed after resume), the problem seems to have been solved.

Often after resume, my laptop gets stuck in the text console. I have to switch manually to X with Alt-F7. Another suspend/resume glitch is that the CPU Frequency Scaling Monitor gnome applet is stuck on 2GHz for my second core, although the core is running at half that most of the time. In general, things get a bit flaky after resume; often I need to restart X to get back to normal. I could potentially deal with this.

Another disappointing issue is the terrible battery life under Ubuntu Feisty. On Windows, I get more than 4 hours of battery life with average use (wireless network, web browsing, text editing). With Feisty, even after enabling LAPTOP_MODE in /etc/default/acpi-support and putting the GPU in low-power mode as explained above, I get only 2 hours and 40 minutes. This is almost a show stopper.

Out of the box ACPI monitoring support is well-done. With just a few clicks, I could various temperatures and fan speeds on my panel. See the panel at the top of the screen in the screenshot below:

 

This also shows the Deskbar applet in action.

Dynamic multi-monitor support SUCKS

My laptop has a docking station with an external LCD monitor, resolution 1280 x 1024. The laptop is 1680 x 1050, as I’ve mentioned. With Windows, (hot) docking / undocking always Just Works. It automatically activates the correct resolution without me having to configure anything. So whenever I resume, I have a working display.

Feisty does not quite get this yet. In fact, Feisty needs some serious clue-bat-based attention… When I dock or undock and then resume, I have no display, and no way of getting my display back, besides power-cycling the laptop at every dock / undock. I ended up writing this Python script and binding it to Alt-F5 (for example) so that I would always have a way of activating the next display in the list of connected displays. Oh jeez, even assigning an arbitrary shell command to a global hot key in Gnome is not straight-forward. You have to use gconf as explained on this page. You can query connected and enabled displays with “aticonfig –query-monitor” and activate any subset with “aticonfig –enable-monitor=name1,name2,…,nameN”.

Desktop effects with XGL and Beryl

Wobbly Windows, you know, these are immensely useful and result in a more productive computing experience. NOT!

They are really very nice though. Most of the desktop effects are more nice to look at than actually useful, except for one: The Exposé-like functionality, called “Scale” by Beryl, scales and fits all windows on the current screen so that one can select the window that one wants to select easily.

Because fglrx doesn’t support the XComposite extension, I could not install AIGLX (Ubuntu default) and had to go for XGL and Beryl. After following this guide and making sure to use the external Beryl package repository as explained here (the Ubuntu packages won’t work in this case, they don’t have XGL support), I got the whole shebang to work. MAN this is pretty! Check out the screenshot below for Scale in action (there are non-desktop-effect ways of doing this, e.g. kompose or skippy, but none of them are as slick as the desktop effects version):

 

As with most other things in Ubuntu, this functionality is not without its caveats. This is even more flaky with suspending and resuming: after resuming, logging out and in will give you a garbled display. I have to restart X at the GDM login screen to get XGL to work again. There are also some focus issues, especially with the Gnome Deskbar (very useful utility, by the way): pressing the hotkey activates the deskbar, but you can’t begin to type, as the current window still has the focus. I managed to fix this by setting the Beryl “Level of Focus Stealing Prevention” (under general settings) to None. Changing to a higher resolution with the “Display Resolution” applet whilst running XGL+Beryl, results in only part of the screen being usable.

Miscellaneous issues

  • Palm Pilot synchronisation seems to work out of the box with my Tungsten C, but hangs forever on ToDo synchronisation. Seems it’s due to this bug.
  • The built-in Texas Instruments SD card reader works out of the box, but does not automount like other removable media. This is either due to the fact that it’s not seen as removable, or that the driver forgets to assign its parent bus. See this mail thread. I ended up applying this workaround, involving adding rules to the udev system to pmount the SD card.
  • Gimp doesn’t understand SMB: URIs, whereas the Gnome Image Viewer does, and gthumb pretends to but doesn’t.

Conclusion

All in all, I’m positive but not quite convinced yet. The Ubuntu people have done a marvellous job, but Feisty Beta (up to date as of 2007-04-10) doesn’t quite Just Work(tm) on the HP NC8430. I had to break my rule of editing config files or writing scripts more than once to get it to work to my satisfaction, and still there are problems that would make it difficult to work in Ubuntu full-time: the miserable battery life, the flaky suspend/resume and the really bad dynamic multi-monitor support. That being said, things like the user-friendly WPA support and the flawless install on an NTFS partition are going in the right direction.

Updates

  • This post has been linked by OSNews! You can also follow some of the discussion over there.
  • It’s also on digg (should I say that it’s been dugg?).  See here.
  • Fixed aticonfig lsp/lsb typo, thanks lampshade!
  • My domain has been migrated to a more stable server, some comments may have been lost in the process. If your comment has not appeared yet, please re-submit it.

PS

Please comment away, but keep it civilised. I’ll update the post as we go along, and give credit where credit’s due.