Wednesday, May 6, 2009

Ubuntu 9.04 on the Toshiba Satellite L305

Previously I had written about installing Ubuntu 8.10 on the Toshiba Satellite L305. It was not without its problems, the hardware on Toshiba systems can be pretty picky. The omnibook module got the fan and brightness keys working, but on some systems, this also caused the laptop to turn itself on three to fifteen minutes after being shut down. The good news for those who had this problem is that in 9.04, the fan problem is easily fixable without the module, and with a few workarounds, the brightness keys work too. Furthermore, wireless now works out of the box with the ath5k module, so madwifi or ndiswrapper are no longer necessary.

If you are already running the omnibook module without this problem, I recommend using that instead, as it is a simpler fix.

Step 1: Install and get the fan going

Download and install Ubuntu 9.04. In my experience, the DVD drive in the L305 can be a little picky, so I recommend either installing from a usb stick or burning the Ubuntu CD at a slower speed. The installation should go smoothly. When it boots to your new Ubuntu desktop, you first need to get the fan going.

This is a pretty easy fix, all you need to do is modify your grub file. Open up a terminal and type:

sudo gedit /boot/grub/menu.lst

*note: You can use nano, vi, kate, or whatever your preferred text editor is.

Add 'acpi_osi="Linux"' to your kernel's boot parameters. This is an example of my menu.lst file, with the part you need to add in bold (the rest may differ slightly in your file):


title Ubuntu 9.04, kernel 2.6.28-11-generic
uuid a91f7379-e93b-490c-b541-0681173bccc2
kernel /boot/vmlinuz-2.6.28-11-generic root=UUID=a91f.. ro quiet splash acpi_osi="Linux"
initrd /boot/initrd.img-2.6.28-11-generic
quiet


Reboot and your fan should work fine. In my experience, it turns on at about 50 degrees and turns back off at about 35. Your brightness keys might be usable now, too. In my experience, though, these keys stop working after a few reboots. (If your keys continue to work, you can skip the brightness keys workaround section).

Optional: monitor your temperatures with lm-sensors
I wanted to make sure that the fan was working appropriately, so I wanted to monitor the computer's temperature. This is easy to do by installing the lm-sensors package. After you set up the sensors, you can either run the sensors package to display temperatures, or install the sensors-applet package to monitor them from the desktop:

sudo apt-get install lm-sensors sensors-applet
sudo sensors-detect

sensors-detect will set up the sensors. It will ask a lot of questions, the defaults should all be fine, though when asked if I want to add the modules to /etc/modules, I say yes. either reboot or manually add the modules it specifies manually. Add the sensors applet to the panel and you should be able to monitor your temperatures.

Step 2: Get the brightness keys working
For some reason, after a couple of reboots, the function keys no longer work for me. It seems the function key (fn) doesn't get input. I've developed a workaround to make the super (Windows) key to work with F6 and F7 to change brightness levels.

First you need to modify the keyboard with xmodmap to allow the use of the super key, because by default it is set to a different use. Though it is supposedly changeable through Gnome, I have had no luck. It is actually quite easy to do manually though.

First open a console and run xev. Hit the windows key and look for the keycode output. On my computer, it is 147, though may be different (there are a few different models of L305s). Close out of xev and make (or modify) ~/.Xmodmap (note the dot and the capital X). Add the following lines to .Xmodmap:

keycode 147 = Super_L
add mod4 = Super_L

Save and close the file, then run xmodmap. The super key should now be mapped to "Super_L" (you can test this again in xev, if you like)

Next you need to bind super+F6 and super+F7 to the brightness keys. This is doable with xbindkeys, which is installable in the console, and you may also need the keytouch daemon: (sudo apt-get install xbindkeys keytouch). Xbindkeys will be mapped to run acpi keys with "acpi_fakekey", which should already be installed on your system. The keytouch daemon will install apci-related things that make acpi_fakekey work (I'm not exactly sure how, but in my experience, without the keytouch daemon, acpi_fakekey doesn't work)


You are also going to need to install the lineakd package to find out what the event keys are for your brightness keys. Lineakd comes with a program called evtest. Run it (as root) on the different events in /dev/input/ until you find the one with brightness event codes. Mine is in /dev/input/event5, though it may be different for you:

sudo apt-get install lineakd
sudo evtest /dev/input/event5

It lists for me that brightness down is 224 and brightness up is 225.

Next you need to modify the xbindkeys config file. This is easiest by installing the xbindkeys-config package, and run that. Here you can add various commands for different combinations of keypresses. Click “add.” Name the command whatever you like. Click on “get key” and press your key combination. For the action type in “acpi_fakekey [keycode]”, where [keycode] is the event code you found with evtest. For example, for my brightness down key I put acpi_fakekey 224. You can also use this for other commands, too.

Save the file and close xbindkeys-config. Here, I like to move the config file from its default location (~/.xbindkeysrc) to its own folder in /etc, because the commands should be system wide, and also for security (the commands it will be running will be running as root). I copied it to /etc/xbindkeys/xbindkeysrc


Now it's time to test it. run xbindkeys as root with "sudo xbindkeys -f [location of xbindkeysrc file]" . Press super+F6 and super+F7 to make sure they adjust the brightness as they should. If everything is set up right, your brightness should be changing now!

Step 3: Get xbindkeys to run at boot:
As long as the keys are working, the only thing left to do is to make xbindkeys run on boot. The following is the only way I've been able to find to get that to work (init scripts make it run too early and it segfaults). Many thanks to Ubuntu Forums user BslBryan for this tip!

First, modify the sudoers file with the command "sudo visudo" Add the following to the end of the file:

[your username(s)] ALL= NOPASSWD: /usr/bin/xbindkeys

This makes xbindkeys able to be run as root without a password. It's important for the next step. Next go to System -> Preferences -> Startup Applications. Click on add. Name it xbindkeys. For the command, type "sudo /usr/bin/xbindkeys" (without the quotes). Sudo won't ask for a password now because we edited the sudoers file earlier with visudo. Type a description if you like and click add, then close out of startup applications.

Now reboot. If all went well, when you reboot super+F6 and super+F7 should adjust the brightness. Along with the easy fix for the fan, this makes Ubuntu 9.04 much more usable on newer Toshiba laptops.

Monday, March 23, 2009

How to use LIRC with Amarok 2, Exaile, and other media players in Ubuntu

It has been a while since I updated. School and life in general have kept me busy, and I haven't had many adventures in Linux, but today I had to grapple with a new problem.

Amarok 2 was released last December and after I first tried the beta, I really didn't like it. Amarok 1.4 was my music player of choice, you see, but the times, they are a changin'. In the upcoming release of Ubuntu (Jaunty Jackelope, 9.04) Amarok is due to be replaced by version 2. I decided to try out Amarok 2 again, figuring I will either have to get used to it, or find myself a new player.

Truth is, I still hate Amarok 2. And while I could go into details on that, it is not the reason I am here. When I was first trying to learn to love Amarok 2, I spent a while trying to fix one of my main annoyances with it: lack of support with LIRC (Linux Infrared Remote Control.) In 1.4, the DCOP server made things extremely easy, but it no longer exists in Amarok 2, and so you have to get creative. Edit: *As pointed out in the comments for this post, DCOP was actually replaced with DBus, which I managed to miss somehow. I admittedly don't know much about DBus myself, but if you are interested in getting LIRC working with Amarok 2, you will save yourself some effort looking into DBus. However, this guide still applies to Exaile and any other media players that don't specifically offer remote control support. Thanks to nhnFreespirit for pointing this out!*

As I found out, this guide will also work for other music players. In addition to an already set up LIRC daemon and remote control, you will need an audio player with either global hotkey support (like Amarok 2) or a media player that can take advantage of the keyboard shortcuts (the default way to use media buttons on a keyboard) in Gnome. You might also need a keyboard with media buttons, but I haven't tried it without them, so it may work (if it does, you should let me know!) These instructions are taken from three or four other resources that, in my exhaustive search, I lost and so can't give proper credit, but thanks to those who paved the way.

Step 1: Global Hotkeys
The first thing you need to do is set your global hotkeys to your media buttons. If you are using Amarok 2, this needs to be done within Amarok (go to the configure shortcuts dialogue, and set your global hotkeys for play/pause, stop, next track, and previous track to the corresponding media buttons on your keyboard. If you are using a Gnome/GTK+ music player, you should be able to set these under Preferences -> Keyboard Shortcuts. In either case, you should now be able to control the music with these media buttons.

Step 2: Set LIRC to use acpi scripts
There are scripts in /etc/acpi/ that will actually control these multimedia button functions, and if you tell LIRC to use them, you can get your remote to tell the computer that you actually hit that button on the keyboard. The associated scripts are are called playbtn.sh, stopbtn.sh, nextbtn.sh, and prevbtn.sh. You can use irexec to run these scripts by setting them up in the ~/.lircrc file. For example, I have included the play button and stop button from my .lircrc file:
begin
prog = irexec
remote = AtiRW
button = play
config = /etc/acpi/playbtn.sh
end

begin
prog = irexec
remote = AtiRW
button = stop
config = /etc/acpi/stopbtn.sh
end
*Note, your "remote =" and "button=" will vary depending on how you set up your LIRC daemon. In my example, I named my remote "AtiRW", my play button "play" and my stop button "stop". These values come from your lircd.conf file when you set it up.

Set all of the buttons you want. You can even set up the vol+/vol-/mute buttons on your keyboard if you have them to change the master volume, though I prefer to use aumix or amixer to do that because there is no OSD.

When you are done setting up your keys in ~/.lircrc, save the file and close it. Then run irexec as root in the terminal with "sudo irexec" (It should have been installed with LIRC, but if it hasn't, you can install it with apt-get first.) If you have set up everything correctly, at this point you can press the buttons on your remote and it should cause the music player to function accordingly. If it doesn't work, make sure A) You set up LIRC correctly (I didn't cover that here), B) LIRC is currently running, C)You ran irexec AS ROOT (you will get an error otherwise), and D) Your media buttons on your keyboard work.

Step 3: Get irexec to run at boot
For me, irexec (the program that tells other programs/scripts to run based on LIRC input) was automatically told to run at start up with LIRC. However, even if that is the case for you too, to run these scripts irexec has to be running as root so you will have to do this next step either way. For whatever reason, and the sources I found on the internet seem to confirm it, the usual methods for starting irexec always seem to result in them being run as a normal user. We are going to have to get around that.

It would be a good time to note that, for good reason, running programs as root should be done with the utmost caution, and the only reason we are running irexec as root is because running the acpi scripts have to be run as root. (I even tried copying them to my home directory and changing the permissions/ownership with no luck.) Anybody with an alternative method that does not require irexec to be run as root should leave a comment on how to do it and I will update accordingly.

The only way I managed to get irexec to run as root was found here thanks to Ubuntu forums user Kipee. They suggest adding it to crontab. Edit crontab with:
sudo crontab -e
You may be asked which editor to use, if so just select whichever one you are most comfortable with. Add a new line and insert the following, replacing USER with your username:
@reboot sleep 30 && export DISPLAY=:0 &&/usr/bin/irexec -d /home/USER/.lircrc

"@reboot" tells it to run when the machine is booted. "sleep 30" causes irexec to wait 30 seconds before starting, and is only to make sure that the LIRC daemon is running before trying to run irexec. (Note: in Kipee's post, they use 120, but two whole minutes seems longer than necessary in my experience). Close out of crontab (ctrl+x if you are editing with nano) and make sure to save it. Now reboot. When the machine reboots, irexec should now start running (remember, after 30 seconds), and when you open up your favorite media player, it should respond to remote control input.

Other Considerations
These directions assume you have multimedia buttons on your keyboard, and I am not entirely sure how one could achieve the same effect without those multimedia buttons. (If you try running the acpi scripts without assigning them to a key, they don't work!) If you are using a player with configurable shortcut keys (like Amarok 2), I would imagine it would be possible, though I haven't tried it, to use irxevent to fake keypresses in that program (for example, set ctrl+p to play in Amarok, set the play button on your remote to sent "ctrl+p" to Amarok.) Edit: *as mentioned previously, for Amarok 2 use DBus instead.* This would also bypass the need to run irexec as root (or in fact, at all.) You Alternatively, the scripts that run the multimedia keys are tied to key numbers given in /usr/share/acpi-support/key-constraints, and it *might* be possible to use those even without multimedia keys, though how you would do that is beyond me, and if you attempt it you do so at your own risk. Any other solutions to this problem? Feel free to leave some comments.

And in case you were wondering, I switched to Exaile, and now that I've bypassed the hurdle of being able to use my remote, I am loving it.

Sunday, February 1, 2009

Steps to a successful 64-bit Ubuntu

Completely on a whim I decided to try Arch Linux on my laptop, which had some hardware issues, and then later on my desktop. While I liked it, it was way too much work for me, given the fact that I use Linux almost exclusively and need something functional. When it came time to reinstall with an easier distro, I decided to go back to Ubuntu if only because I spent a decent amount of time trying to tweak Debian that is unneeded in Ubuntu. However, I decided to go with the 64-bit version, which comes with its own set of problems that can be overcome with a little knowhow.

Previously, I wrote on how to set up a chroot environment to run 32-bit programs in their own 32-bit environment, all within the 64-bit operating system. (I wrote it for Debian Lenny, but the same process can be used for Ubuntu if tweaked slightly.) It works, but it is not without limitations. The biggest of which was running a 32-bit web browser caused problems with other web browsers arguing for the title of "default browser," and being unable to run downloaded files from within the browser. I decided this time I was going to try to do it all without using a chroot.

Web Browsing:
Adobe Flash has always been tricky to get working on a 64-bit browser. This will soon change, as Adobe currently has an alpha version of flash, but I have tried it and it is (as one would expect for alpha software) quite buggy and unstable. The other common alternative is to run the nspluginwrapper package to use a 32-bit flash in a 64-bit browser, but this can also be quite buggy for some. My solution is simply to run a 32-bit browser. I don't know how well all 32-bit browsers run, but I would recommend Swiftfox, which is basically an optimized Firefox, and I recommend it because it comes in a very easy-to-install .deb file. The one thing you have to do is figure out what sort of processor your computer uses, because different packages are optimized for different processors. After you find your processor, you can download the appropriate version of swiftfox here. (My computer uses the Prescott version, so I am going to use it in the examples) Then install it in the terminal:
sudo dpkg -i swiftfox_3.0.4pre-1_prescott.deb
Even though it is a 32-bit browser, it *should* install just fine. Open it up and make sure it works. One thing to watch out for is that on Debian, it did not find the printer I had installed, though I have never had problems with it in Ubuntu. If everything works in Swiftfox, you are ready to install Flash. Download the latest version from Adobe. Download the .tar.gz file (NOT the .deb file), navigate to the downloaded file and extract the contents. Copy libflashplayer.so to the plugins directory in your home directory:
tar -zxvf install_flash_player_10_linux.tar.gz
cd install_flash_player_10_linux
cp libflashplayer.so ~/.mozilla/plugins/
When you start up Swiftfox again, you should have working Flash support.

Adobe AIR:
I like the Adobe AIR runtime to use TweetDeck, but it is still not supported in 64 bit. The latest version will run on 64-bit versions with a few tweaks, and Adobe is kind enough to supply the information on their website. Rather than rehash what they have, I would recommend just checking out their website. If you follow their guide exactly, Adoebe AIR should run beautifully.

The getlibs Package:
For many other programs that have no 64-bit version, installing the 32-bit libraries will often be enough to get them up and running. The easiest way I have found to do this is with a package called getlibs, which can be found at http://www.boundlesssupremacy.com/Cappy/getlibs/getlibs-all.deb. This program will assess 32-bit packages/binaries and figure out which 32-bit libraries it needs to run successfully. For this example, I am going to use the Amazon.com mp3 downloader. After downloading it, if you try to install it with dpkg, it will fail, claiming that you are attempting to install something for the wrong architecture. This is an easy enough fix using the --force-architecture option when installing:
sudo dpkg -i --force-architecture amazonmp3.deb
The package will install but will still give you errors if you try to run it. To fix this, install getlibs if you have not already, and then run it on the binary file (not the .deb file) and it will, after a few moments, download and install the required libraries:
sudo dpkg -i getlibs-all.deb
sudo getlibs /usr/bin/amazonmp3
My one complaint with getlibs is that it does not provide any detailed output, so it may seem like it is not doing anything, but be patient. Once it completes, try running your program again and it should run. If the installer for a program is in .bin format, try running getlibs on the .bin file first because that might work as well (like in the directions for installing Adobe AIR), but so far it doesn't seem to do anything for .deb files for me. If a program complains of a missing library file, getlibs can also be used to download that specific library with the -l (or -64l for 64 bit libraries) option. And if downloading the libraries doesn't seem to work, try updating your library links with "sudo ldconfig".

Monday, December 8, 2008

Using 32-bit applications in 64-bit Debian with chroot

Some time ago I switched to 64-bit Debian on my desktop. I used to be scared off by the fact that certain, important applications were not yet available in 32 bit, such as Adobe's flash player. With some workarounds some of these programs are workable in 64 bit, for example nspluginwrapper uses the 32 bit version of flash and forces it to play nice with your 64 bit browser, with moderate to good success. (Adobe also just released their alpha version of 64 bit flash for Linux, but it kept causing my browser to crash.) For other programs, though, there is no way to run them effectively (or at all) in 64 bit. Until recently there were very few programs I wanted in this category (really, only TweetDeck, a twitter application on the Adobe AIR interface), but suddenly there have been a few more programs that I wanted/needed that are only available in 32 bit versions. The solution? Run them in 32 bit using a chroot! A chroot is sort of like a disk within a disk. It is often used for testing so that developers can test a program without it destroying the filesystem on their machine. Here, we are using it to install a 32 bit Debian inside a 64 bit Debian. This process is also possible to do on Ubuntu, with slightly modified commands. *Note, most of this comes from this page, but I have cleaned it up, fixed some typos and, in my opinion, made it easier to understand.

Step 1: Set up the base file system
First you need to set up the base file system. This is going to install a very minimal version of 32-bit Debian Sid inside your 64-bit Debian install. So first, make a directory for this second install and then use debootstrap to install (as root or with sudo):
mkdir /var/sid-386-chroot
debootstrap --arch i386 sid /var/sid-386-chroot http://ftp.debian.org/debian/

This will download a number of packages for the chroot and install them. Depending on your internet connection this may take a little while. When it is all done you should see that you have a whole file system inside /var/sid-386-chroot, similar to your main file system.

I am not entirely sure what the next steps do, but the howto I followed states that you have to add the library path of your chroot to your ld.so.conf, and you need a link to your 32 bit linker in the /lib path. In any case, what you need to do is add the following lines to /etc/ld.so.conf:
# chroot i386 system libs
/var/sid-386-chroot/lib
/var/sid-386-chroot/usr/lib
/var/sid-386-chroot/usr/X11R6/lib
/var/sid-386-chroot/usr/local/lib

Then you need to run these commands in the terminal:
cd /lib
ln -s /var/sid-386-chroot/lib/ld-linux.so.2 ld-linux.so.2
ldconfig


Step 2: Set up the chroot to run alongside your 64 bit install
For your 32-bit applications to work just like they were on your 64 bit install, certain parts of your 64 bit install have to be accessible to your chroot (normally, a chroot can't access anything outside of the chroot. It's called a chroot jail and it is why developers use chroots to test programs.) For this, we use what is called a bind mount, which is used to mount a directory, such as /home, to the home folder inside the chroot. There are a few folders which should be mounted in the chroot, and this can be done by modifying the /etc/fstab file and adding the following lines at the bottom:
/home /var/sid-386-chroot/home none bind 0 0
/tmp /var/sid-386-chroot/tmp none bind 0 0
/proc /var/sid-386-chroot/proc proc defaults 0 0
/dev /var/sid-386-chroot/dev none bind 0 0
/usr/share/fonts /var-sid-386-chroot/usr/share/fonts none bind 0 0

It is VERY IMPORTANT to note that now that these folders are bound to their locations on your main file system, if you ever decide to delete your chroot, make sure that you unmount these bind mounts or else you can end up erasing these folders on your main file system. Also make sure that there are directories for each of these mounts. The only one you should end up having to make is /media/cdrom0. Then mount them:
sudo mkdir /var/sid-386-chroot/media/cdrom0
sudo mount -a

If all went well you should get no error messages and these locations will be bound to their counterparts in the chroot.

Lastly, you need to make sure that all of the users on your machine also exist in the chroot. This can be done by copying certain files to the chroot:
# sudo cp /etc/passwd /var/sid-386-chroot/etc/
sudo cp /etc/shadow /var/sid-386-chroot/etc/
sudo cp /etc/group /var/sid-386-chroot/etc/
sudo cp /etc/sudoers /var/sid-386-chroot/etc/
sudo cp /etc/hosts /var/sid-386-chroot/etc/


Now you should be able to enter the chroot and run programs from within. To get into the chroot (which you must be root to do) you can type:
sudo chroot /var/sid-386-chroot

Now you can run commands. Try out a command or two. Keep in mind that the chroot is a brand new Debian install, so most of the programs you use will not be installed yet. For example, if you try running gedit, it won't run because gedit is not yet installed in the chroot. You can install it and other programs with apt-get or aptitude just like in your 64 bit install. Should you ever want to exit the chroot, simply type "exit"

Step 3: Installing your 32-bit applications
Anything in the Debian repositories is as easy as entering the chroot and installing it via the apt-get or aptitude command line. Keep in mind that since it is a different install you will have to add contrib and non-free to your sources.list file if you want to use those repositories. Downloaded .deb files are a bit tougher. Download them to your home directory and install them with dpkg -i (from within the chroot), for example, if you wanted to install skype (a 32-bit only app), download it, navigate to the directory where you downloaded it in the terminal, and type:
dpkg -i skype-debian_2.0.0.72-1_i386.deb
. This method is a bit more tedious because, since the chroot is a brand-new, minimal install, there are most likely a host of dependencies that are not installed yet. This means that it will come up with all sorts of errors about dependencies. For each dependency that it is lacking, use apt-get or aptitude to install them.

You may also get a lot of errors about locale settings. To fix this, I had to install locales and reconfigure it:
sudo apt-get install locales
sudo dpkg-reconfigure locales


You should now be able to run your 32 bit application from within the chroot. (Note: TweetDeck did not function properly until after the next step, but other applications ran okay.) In this example, while in the chroot simply type "skype" into the terminal and skype will launch.

Step 4: Make it work seamlessly from your 64-bit install.
So you got your application up and running, but as you are probably already thinking, entering the chroot and running the application is rather tedious. So the next step is to work up a script that will load it in one fell swoop. First, make sure you exit the chroot and install dchroot, which will allow you to run programs installed in the chroot from your 64-bit Debian.
sudo apt-get install dchroot

Now you need to edit (or create) /etc/dchroot.conf and add:
# sid386 chroot
sid386 /var/sid-386-chroot

This essentially names the chroot and defines where it is located, so that dchroot knows where to look when it is run. Now you should be able to launch skype using dchroot without having to enter the chroot itself by running the command:
dchroot -c sid386 -d skype

To make life even easier, we can write a simple script to call that command whenever we want to launch Skype. While you could certainly write a script to specifically launch Skype, it would mean that you would have to make a new script for every 32-bit application you install. Instead, we are going to create one universal wrapper script. Make the following script called /usr/local/bin/do_chroot:
#!/bin/sh
ARGS=""
for i in "$@" ; do
ARGS="$ARGS '$i'"
done

exec dchroot -c sid386 -d -q "`basename $0`" "$ARGS"

I am no scripting expert, but basically what this script does is it uses the name of the script to determine what program to run from the chroot, and will also take any arguments given and append them to the end of the dchroot command. Make sure it is executable ("sudo chmod 755 /usr/local/bin/do_chroot"). Now, make a link to the script called "skype" in /usr/bin:
sudo ln -s /usr/local/bin/do_chroot /usr/bin/skype

This script is slick in the fact that it will use the name of the link in the script to run the whatever program the link is named after. This means that when you make your link, make sure it is typed exactly as it needs to be to launch it in the chroot (So, in this example, make sure it is "skype" and not "Skype" or "launch_skype" or anything else. Just "skype".) If all has worked correctly, all you have to do now is type "skype" into the terminal to launch the 32-bit only Skype!

Conclusion
It is a little bit of effort to set up, but after the chroot is set up, new 32-bit applications can be installed by entering the chroot, installing the application, exiting the chroot, and linking to the do_chroot script. Using this method, I have installed and use the following 32-bit only applications:
  • Skype
  • TweetDeck (which uses the Adobe AIR environment, currently only for 32-bit)
  • SwiftFox (The 64-bit Flash Player alpha kept crashing IceWeasel so I switched to SwiftFox and a 32-bit Flash Player)
  • Amazon.com MP3 downloader

Monday, November 17, 2008

Ubuntu on the Toshiba Satellite L305: Howto

EDIT: If you are having the problem with the omnibook module starting up your computer after shutdown, install the latest version of Ubuntu (9.04) and follow the directions in my newer post here.

I decided to upgrade from Ubuntu 8.10 32-bit to the 64-bit version on my Toshiba Satellite L305. While going with the 64-bit version came with its own set of difficulties, the need to reinstall made me realize one important thing about installing 8.10 (rather than the beta I did before) on this laptop: it no longer comes with the kernel modules needed to run the fan or the brightness buttons.

This is extremely important because if the fan doesn't work, the processor will overheat.

The problem stems from the fact that without the module, the fan will not change speeds as the computer heats up. When the computer first boots, the fan does not turn on immediately, causing the fan to never turn on. If you run the computer for a while and reboot, you will notice the fan running at full speed nonstop.

The following is a guide to installing what is needed to get your Ubuntu install running as it should on the Satellite L305.
Step 1: Download and install.

Download and install your desired flavor of Ubuntu (Ubuntu/Kubuntu/Xubuntu) in the 32 bit or 64 bit version (the 64 bit version takes a bit of work to get set up, so only use the 64 bit version if you are prepared for a little work,) EDIT: After beating my head against it for quite a while I would suggest against installing the 64 bit version. I ended up going back to the 32 bit version. If you have installed Ubuntu before you know the drill, if not, follow the prompts the installation gives you. And though it is less pretty, I recommend the alternate (non-graphical) install, because I have had less luck with the live cd install.

Step 2: Install omnibook module.

Older Toshiba laptops use their own proprietary bios that required the toshiba_acpi module to be compiled with the kernel. Toshiba now uses the Phoenix bios, which means that this has to be done another way, which is a bit deceptive. You have to download the omnibook module (Omnibook is actually an HP model laptop) which will allow these functions. You can download the module source package here: http://packages.kirya.net/debian/pool/main/o/omnibook/omnibook-source_2.20070211+svn20071217-1_all.deb Edit: The omnibook-source package has been updated, which broke the link. Updated versions of the omnibook-source can be found at http://packages.kirya.net/debian/pool/main/o/omnibook/
Install the source, extract it, install dependencies, and install the module in the terminal:

sudo dpkg -i omnibook-source_2.20070211+svn20071217-1_all.deb
cd /usr/src
tar -xvf omnibook-source_2.20070211+svn20071217-1_all.tar.bz2
cd modules/omnibook
sudo apt-get install build-essential linux-headers-`uname -r`
sudo make install


The install may say it lacks a few other dependencies which can be installed with apt-get. Once the source is installed, the module should be able to be loaded, however it needs a special argument when it is loaded or else it won't work.

sudo depmod -a
sudo modprobe omnibook ectype=11


If everything was set up correctly, you will most likely hear your fan kick on and the screen brightness change. You can now change the brightness with the function keys, and the fan will start up when you turn on the laptop. Make sure the module loads when you boot by adding "omnibook ectype=11" to the bottom of your /etc/modules file.

Step 3: Wireless
If you have the Atheros wireless card (I am not sure what other options the L305 can have) you can go about wireless two ways, madwifi drivers or ndiswrapper. Ndiswrapper is the required method if you go with 64 bit, so that is the method I went with, though I would recommend either madwifi for the 32 bit install. Install ndiswrapper:
sudo apt-get install ndiswrapper-common ndiswrapper-utils-1.9 ndisgtk


Ndiswrapper is a wrapper application for windows networking drivers so that they can be used on Linux. This means that for it to work, you need to also get the windows drivers. The 64 bit drivers can be found at http://blakecmartin.googlepages.com/ar5007eg-64-0.2.tar.gz, or the 32 bit version can be found at http://blakecmartin.googlepages.com/ar5007eg-32-0.2.tar.gz. Unzip the files from the file and start ndisgtk from the terminal (open the terminal and type "sudo ndisgtk"). Click on "install new driver" and navigate to the folder where you unzipped the drivers. Select the file ending in .inf and then install it. Make sure ndiswrapper is loaded:

sudo modprobe ndiswrapper


You should also blacklist the module that tries to load for the wireless drivers by adding the following to /etc/modprobe.d/blacklst

blacklist ath_pci


You should now have wireless internet access. One caveat is that for reasons that are unknown to me, the module has trouble connecting sometimes on boot. If it keeps saying it is getting disconnected, or if it keeps asking for the passphrase when you know it is right, you need to remove and reload the module:

sudo rmmod ndiswrapper
sudo modprobe ndiswrapper


This should cause the wireless device to play nice and allow you to connect. For now, it is the best solution I have as I have yet to find a permanent fix.

Sunday, October 26, 2008

Ubuntu on Toshiba Satellite L305

I've noticed a sudden increase in traffic to my little blog, most of which is coming from Google searches pertaining to the topic of installing Ubuntu on the Toshiba L305 (somehow it seems that my post about installing DEBIAN on the laptop found its way to the top of Google's search.) But, Google searchers, you happen to be in luck, for after my failure to install (an adequate version of) Debian on my L305, I decided to go back to Ubuntu on my laptop.

If you are installing Ubuntu 8.04 (Hardy Heron) the system will hang in a few spots but eventually show a bright red screen saying that it can't detect any network devices. This as it turns out is the exact problem I had trying to install Debian. The reason this happens is that the network devices in the L305 were unsupported at the time of Hardy's release. This will cause the installer to pretty much refuse doing the rest of the install in my experience.

The good news is that these drivers will be fully supported in the upcoming release 8.10, Intrepid Ibex. The even better news is that as of this writing, Intrepid is a mere four days away from launch. (Intrepid will be released on October 30th.) If you absolutely cannot live with Windows Vista for four more days, and are willing to try Intrepid before it is fully finished, you can download the latest release candidate off of the Ubuntu website. I have been using the release candidate for the past week and a half and have had no major problems, but do be prepared for a less-than-perfect install (I have had my fair share of minor problems). If you are still a little new to the Linux world, I'd suggest waiting out the four days and downloading the finished product. If you are wanting to download Hardy for the fact that it is the Long-Term Support (LTS) release, then I don't really know what to tell you.

The other good news is that having used Ubuntu 8.10 for the last week and a half, I can tell you that it is yet another good release by the Ubuntu team.

Monday, October 20, 2008

xvinfo: No Adaptors Present and a curious fix for fglrx

A few days after installing Debian, VLC media player stopped playing video. This launched a whole crusade to get the damned thing to work. And it wasn't easy. The following is using the fglrx ATI proprietary drivers and ONLY applies to these drivers. I am using the Radeon X1950.

To cut a long story short, after a lot of web searching and trial and error, I found the problem: my Xvideo stopped working. This was tested by typing "xvinfo" into the terminal. A healthy output would look something like this:

X-Video Extension version 2.2
screen #0
Adaptor #0: "ATI Radeon AVIVO Video"
number of ports: 4
port base: 131
operations supported: PutImage
supported visuals:
depth 24, visualID 0x23
depth 24, visualID 0x24
depth 24, visualID 0x25
......

And go on for quite a while (This only the first ten lines of the output when I run xvinfo.)
An unhealthy xvinfo output (and the problem I was experiencing) looks like this:
X-Video Extension version 2.2
screen #0
no adaptors present


The problem with this is that I have yet to find a decent solution to "no adaptors present." I have looked and looked and looked and found very little. For one thing, if you are having problems with xvideo with fglrx, first try running (either as root or with sudo)
aticonfig --overlay-type=Xv

I have heard that for some cases this is the fix. Which is good because it is easy. But, for me, it didn't work.

After reconfiguring every option I could think of in my xorg.conf and breaking X half a dozen times, reinstalling the fglrx drivers from both the Debian repos and the binary from ati.com and breaking X half a dozen more times, the problem quite suddenly fixed itself. These are the steps that I did immediately before. I am making no claim that this will fix anything, and cannot actually describe what happened during these steps that made my xvideo work again. I say this because really, for all I know, the great Debian gods intervened and fixed it with magic. I really don't know why or even if this fixed my problem, but if you are desperate like I was, you never know. Just remember, you are trying it at your own risk.

First I downloaded the latest version of the proprietary ATI drivers. These can be found on ATI's website.

Second, I downloaded this script that I found on the Debian forums.

Third, I quit gdm and drop down to a console. This is required, the script will not run if you have any running X sessions. Then I navigated to the folder I saved these files in and (as root) ran the install script (install-fglrx-debian.sh). This will do quite a bit (and if you know your way around scripting maybe you could open the script and see. I really don't know what it did.) All I know is that it downloads a few files from the repos and installs them, downloads the ATI binary (the I already downloaded, but I'll need that one in a few minutes), and generates a package to install, then installs it. The problem with this script is that it breaks X. Why? I think it has something to do with the fact that it generated a package for me that was for Ubuntu. Whatever the case, when the script finished I tried to load up gdm and it failed.

Fourth, going back to the console, I ran (as root) ATI's file (ati-driver-installer[version number]-x86.x86_64.run) and it reinstalled the ATI driver. When gdm successfully started again, out of curiosity I ran xvinfo, but this time with success! I don't know what it did behind the screen, but suddenly I have xvideo again. I don't think it was anything in my xorg.conf (which was regenerated during this process, so back up first!) because I have nearly identical files before and after. Your best guess is as good as mine, but I've decided not to look a gifthorse in the mouth. If you are running compiz fusion, you may have to disable it to watch videos without flickering. For easy switching on/off I recommend installing the package fusion-icon and making sure it starts at boot. It makes an icon on the panel that right-clicking will allow you to switch on/off compositors and window decorators.