Linux on the Toshiba U505-S2960

Author: Michael Minn (www.michaelminn.com)

15 June 2012

Describes how to set up an Ubuntu 12.04 LTS operating system on a Toshiba Satellite U505-S2960 notebook computer.

1. Introduction

Toshiba U505-S2960

This page describes how to install 32-bit Ubuntu 12.04 LTS (Pangolin) Linux operating system on a Toshiba U505-S2960 notebook computer.

This is not a great Linux machine although it's been fairly durable thus far. There are still some annoying hardware issues unresolved from previous versions. It may not be optimal for many uses since it was built as a multimedia machine and has too few USB ports if you use alot of peripherals. Although this is a 64-bit machine, 64-bit Ubuntu is not recommended for general use and you will want to use the 32-bit version of Linux.

Details of issues from previous versions are on my Ubuntu 9.10 installation guide or Ubuntu 10.4 installation guide.

The machine that I purchased in December of 2009 features:

2. Install From Flash Drive

The install from a flash drive is fairly straightforward except for partitioning. The following are my choices and you may need to choose other options depending on your situation.

This installation assumes that you will be building a system that can dual-boot into either Windoze or Linux. For systems that can run both simultaneously, you will need to explore virtualization software like VMWare.

Defrag: Prior to installing Linux, you should boot into Windoze at least once and defragment the drive. I'm not sure if this is still necessary to maximize available disk space, but it can't hurt. If you've been using Windoze on this box for awhile, you might also consider doing a fresh install, although that takes almost three hours from the recovery disks.

Download: the current Ubuntu release CD image ISO from Ubuntu.com and use it to create a bootable flash drive. The simplest tool for this is usb-creator-gtk.

Boot from Install CD / Flash Drive: Insert the boot CD into the CD-ROM drive and reboot. When the American Megatreds BIOS splash screen comes up press F-12 and choose the USB device.

The machine takes 3-5 minutes to load the OS. You can press ESC to view boot messages, although there aren't alot of meaningful ones issued anymore.

Initial Prompt: select "Install" NOT "Try".

Welcome: choose language and click continue.

Installation Type: This step defines how you will partition your hard disk. The easiest choice is, "Install Ubuntu Alongside Them", choosing between them each startup." However, if you know what you're doing, choosing "Something Else," will allow you to set up separate root and home partitions, making future OS upgrades a bit easier. My steps:

This left me with the following partition table, which includes three residual (and mysterious) NTFS partitions.

	/dev/sda1  ntfs             1572 MB
	/dev/sda2  ntfs   /windows  100000 MB
	/dev/sda5  ext2   /boot     1023 MB
	/dev/sda6  swap             4094 MB
	/dev/sda7  ext4   /         29998 MB
	/dev/sda8  ext4   /home     172246 MB
	/dev/sda3  ntfs             11131 MB

You should select format for / and /boot. You should also format /home unless you are upgrading from a previous version of Linux and want to keep your existing /home files. You should not format /windows (to preserve your Windoze installation).

Where are you?: select time zone.

Keyboard layout: Default is USA.

Choose a picture: Why?

Who are you?: These steps configure the name, password, and name of computer. Since you don't know how this info will be hacked, tou may not want to use real name.

Import: Why?

Install: Kick it off and it takes around 10 minutes.

Reboot: At the conclusion of the install, the installer will prompt for reboot. Restart Ubuntu and you should be able to boot from the hard drive.

Update Your Package Repository: Once you get the machine on the internet, you should update your application package repository with a list of the latest security patches and repository updates. This may take a few minutes. You can get a command-line terminal from Applications->accessories -> terminal to execute the following command:

	sudo apt-get update

This particular combination of hardware and software release is a bit touchy, and some fairly important tweaks follow.

3. Fan Issues

One thing you may notice about the machine is that the wrist rest gets really hot and the fan never starts. Apparently, there are issues with this particular BIOS and version of ACPI, which doesn't turn the fan on. There supposedly is a thermocouple that will force the fan on at an extremely critical temperature, but that is probably not something you want to verify.

The nasty workaround is to simply suspend and reawaken the machine once it starts getting warm:

	sudo pm-suspend

The BIOS apparently feels the heat on reawakening and turns the fan on. It stays on, but that allows you to continue to stay cool. You can check the temperature with the "sensors" command, with the -f option giving readouts in Farenheit for Americans who haven't caught up with the rest of the planet.

	sensors -f

	acpitz-virtual-0
	Adapter: Virtual device
	temp1:      +109.4°F  (crit = +226.4°F)                  

	coretemp-isa-0000
	Adapter: ISA adapter
	Core 0:      +84.2°F  (high = +185.0°F, crit = +185.0°F)  

	coretemp-isa-0001
	Adapter: ISA adapter
	Core 1:      +84.2°F  (high = +185.0°F, crit = +185.0°F)  

One author suggested attaching the text "acpi=noirq" to the end of the GRUB_CMDLINE_LINUX_DEFAULT string in the /etc/default/grub configuration file (then run sudo update-grub). However, I haven't been able to determine conclusively whether this actually works since the behavior of the fan has seemed to have changed with different kernel versions.

4. Wireless

Network Manager: This version of Ubuntu comes with a driver for the internal Realtek RTL8172 802.11b/g/n (the r8192se_pci module) that provides the network interface wlan0. However, the Ubuntu network manager seems to cause fatal problems with a variety of wireless drivers. Since I like to manually start and stop my interfaces anyway, I just uninstalled the network manager:

	sudo apt-get remove network-manager

The wireless network can be started with the command "ifup wlan0" and stopped with "ifdown wlan0". Don't forget to turn on the wireless switch on the front edge of the machine (next to the antenna graphic).

Access points can be displayed with the "iwlist wlan0 scan" command and configured with "sudo iwconfig wlan0 essid <ESSID>". If you use a specific ESSID regularly, you can add an entry for it to the /etc/network/interfaces file (replace ESSID with the name appropriate to your network):

	iface wlan0 inet dhcp
	wireless-essid <ESSID>

RF-Kill: One oddity that appeared with the 3.0 kernels is that the front panel wireless switch can no longer be switched on after booting. If the switch is off when you boot, you will have to turn it on and reboot to get wireless, although it can switch the interface off and on if it was on during boot.

This seems to have something to do with software and hardware RF-kill. A message you may get when trying to start the device is:

	RTNETLINK answers: Operation not possible due to RF-kill

I did try removing the rfkill tool (sudo apt-get remove rfkill), although I'm not sure whether that was what enabled switching off.

FYI: the network-manager issue vexed me for months until I read about it deep in a support thread. Notably, the chip would seem to try to connect to an AP, but immediately disassociate:

[ 1234.999078] rtl8192_SetWirelessMode(), wireless_mode:4, bEnableHT = 0
[ 1235.008234] SetHwReg8192SE():HW_VAR_AC_PARAM eACI:0:a425
[ 1235.008240] SetHwReg8192SE():HW_VAR_AC_PARAM eACI:1:a449
[ 1235.008244] SetHwReg8192SE():HW_VAR_AC_PARAM eACI:2:5e431c
[ 1235.008247] SetHwReg8192SE():HW_VAR_AC_PARAM eACI:3:2f321c
[ 1235.008254] Associated successfully
[ 1235.008256] normal associate
[ 1235.008270] Using G rates:108
[ 1235.008273] Successfully associated, ht not enabled(0, 0)
[ 1235.008277] === >rtl8192se_link_change():ieee- >iw_mode is 2
[ 1235.008282] rtl8192_update_cap(): WLAN_CAPABILITY_LONG_PREAMBLE
[ 1235.009600] ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
[ 1235.009716] dis associate packet! mode 2 code 3
[ 1235.009956] === >rtl8192se_link_change():ieee- >iw_mode is 2

Network Manager caused a similar deauthentication problem with the ATH5k driver on my EeePC:

[   51.403537] wlan0: authenticate with 06:01:12:ca:25:05 (try 1)
[   51.409057] wlan0: authenticated
wpa_supplicant[848]: No network configuration found for the current AP
[   51.409127] wlan0: associate with 06:01:12:ca:25:05 (try 1)
[   51.412362] wlan0: RX AssocResp from 06:01:12:ca:25:05 (capab=0x421 status=0 aid=59)
[   51.412371] wlan0: associated
[   51.413750] ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
[   51.413859] cfg80211: Calling CRDA for country: US
[   51.414578] wlan0: deauthenticating from 06:01:12:ca:25:05 by local choice (reason=3)

5. Webcam

The webcam is /dev/video0 and you can look at yourself with:

	mplayer tv:// -tv driver=v4l2:width=640:height=480:device=/dev/video0

To access the camera, you need to add yourself to the video group:

	adduser <username> video

6. Burning DVDs

There are two command-line methods for burning data DVDs on this machine. Both of these methods assume you have all the files you want burned to the disk under a single directory named <directory>.

The older method is to use mkisofs (which is linked to genisoimage from the genisoimage package) to create an ISO-9660 filesystem image that can then be burned to a DVD using wodim (a forked version of cdrecord from the wodim package). The -r and -joliet-long options provide for preservation of long file names.

	mkisofs -joliet-long -r -o /tmp/cdimage <directory>
	wodim -v --dev=/dev/scd0 -data /tmp/cdimage
	rm /tmp/cdimage

The simpler one-command method is to use growisofs (from the dvd+rw-tools package) to burn the image directly to the DVD on the fly:

	growisofs -Z /dev/scd0 -R -J <directory>

The mkisofs/wodim combination seems to be a bit more foolproof than growisofs, perhaps since prebuilding a single image file reduced the possibility of buffer underflow that will kill your write and leave you with a coaster. However, a consideration for older, space-constrained systems is that it does temporarily require an extra 4.5 GB of disk space.

GROWISOFS Issues: Sporadically I've had issues with growisofs giving an"input/output error" and dmesg lists a number of errors like the following:

	sr 4:0:0:0: [sr0] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
	sr 4:0:0:0: [sr0] Sense Key : Illegal Request [current] 
	sr 4:0:0:0: [sr0] Add. Sense: Logical block address out of range
	sr 4:0:0:0: [sr0] CDB: Read(10): 28 00 00 00 00 00 00 00 01 00
	end_request: I/O error, dev sr0, sector 0
	Buffer I/O error on device sr0, logical block 0

The write completion messages stop and the drive seems to cycle through different speeds before issuing the message. This can happen early or late in the write process.

The only way I've found to avoid this is when inserting the blank DVD into the drive, to wait a couple of minutes to let the drive read the media and stop spinning, then execute growisofs.

I have also not had this problem with the mkisofs/wodim method, so it may be a growisofs bug or specific problem with the DVD drive in this machine. A quick google search will reveal other folks who've had this issue with other machines, which gives some indication that it may be a hardware-inspecific bug.

Dust Issue: At one point I had an issue with the DVD drive not recognizing blank media, although it was able to read CDs and DVDs. Attempting to burn a DVD caused wodim to issue the message: wodim: Cannot load media. dmesg displayed errors like the following:

sr0: CDROM (ioctl) error, command: Read TOC/PMA/ATIP 43 00 00 00 00 00 00 00 0c 00
sr: Sense Key : Hardware Error [current] 
sr: Add. Sense: Id CRC or ECC error
sr 4:0:0:0: [sr0] Unhandled sense code
sr 4:0:0:0: [sr0]  Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
sr 4:0:0:0: [sr0]  Sense Key : Hardware Error [current] 
sr 4:0:0:0: [sr0]  Add. Sense: Id CRC or ECC error
sr 4:0:0:0: [sr0] CDB: Read(10): 28 00 00 00 00 00 00 00 02 00
end_request: I/O error, dev sr0, sector 0
sr 4:0:0:0: [sr0] unaligned transfer
sr 4:0:0:0: [sr0] unaligned transfer
sr 4:0:0:0: [sr0] Unhandled sense code
sr 4:0:0:0: [sr0]  Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
sr 4:0:0:0: [sr0]  Sense Key : Hardware Error [current] 
sr 4:0:0:0: [sr0]  Add. Sense: Id CRC or ECC error
sr 4:0:0:0: [sr0] CDB: Read(10): 28 00 00 00 00 00 00 00 02 00
end_request: I/O error, dev sr0, sector 0

The problem may have been a hardware error with dust on the drive optics. I opened the drive, took some canned air and blew the air around the lens mechanism. After that, the drive had no problem burning DVDs.

7. Removing the Splash Screen

I prefer to see what's going on with my machine rather than have the boot messages hidden behind the splash bitmap just in case there's a boot problem (which used to happen alot). Unlike RedHat, which provides a runlevel 3 text login, Debian distribution runlevels always start the GUI. So the process is a bit more complicated than changing /etc/inittab (which doesn't exist in Debian).

Ubuntu used GRUB 2. The old /boot/grub/menu.lst is replaced by a generated file with options specified in /etc/default/grub configuration file. The splash screen can be removed and text mode (non-graphical) booting can be enabled by editing that file and changing these lines:

	GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
	GRUB_HIDDEN_TIMEOUT=true

To...

	GRUB_CMDLINE_LINUX_DEFAULT="text"
	GRUB_HIDDEN_TIMEOUT=0

Then run:

	sudo update-grub

After these changes, on boot you will see the system startup messages and then be greeted with a console login prompt. After logging in, you can use the startx command to start the graphical desktop.

	startx

8. Removing the Desktop

If you're hard core command line and don't want the clutter and delay of the Ubuntu desktop, you might consider getting rid of the desktop altogether and just using a window manager to manage xterms and X applications started from the xterms. This will speed your boot time a bit and get rid of some annoying background daemons.

IceWM: Although I used the venerable Motif Window Manager (MWM) for a number of years (from the motif-clients package), this version of mwm locks up when X is started. So I switched to the ICE Window Manager, which has a few more features (like a task bar with graphical system monitoring) but is still fast and lightweight:

	sudo apt-get install icewm

.xinitrc is a file that is executed when X is started. Create a .xinitrc in your home directory (/home/<username>) and type the following lines. This creates a couple single terminal window, sets the "desktop" color to pleasant shade of greenish grey blue and starts the window manager. When you type "startx", from the text login, it will start an xterm, in which you can type commands to start other programs. You can create additional terminal windows from a popup menu when you right-click on the desktop.

I found the full brightness to be a bit much, especially in contrast to older, dimmer LCD displays. The backlight doesn't seem to be accessible through ACPI, but the xgamma command adjusts midtones (gamma) and warms things up a bit, although this is optional.

	xgamma -gamma .7
	xsetroot -solid "dark slate gray"
	xterm -geometry 128x24+10+10&
	xterm -geometry 128x24+10+375&
	exec icewm
	xgamma -gamma .7

PulseAudio is a nasty sound server that adds latency and eats up CPU. If you don't have the desktop you can ditch it.

	sudo apt-get purge pulseaudio

However, you will need to deal with protections set up for ALSA that will keep your applications from being able to access the sound devices. Add yourself to the audio group:

	adduser <username> audio

9. TrueType Fonts

The X window server supports TrueType (tm) fonts, although installing them via the command line is a bit more cumbersome than with an installer program or package. If you've got some on a Windoze box, TrueType fonts tend to look quite a bit better than the fonts that come with the distributions. And if you're doing any web development, you need them to have at least a guess as to what your pages look like on a Windoze box.

Unfortunately, the FontPath configuration that specifies the directories where fonts are located is compiled into the X binary and is not configurable. While "xset +fp" can add a directory to the font path, that setting is not permanent and is lost when you reboot. xset cannot be added to a local configuration file like .xinitrc. This is not a problem for newer applications that use fontconfig, but this may represent an issue for older applications that only use the X font paths. The kludge is to copy the fonts you want to add into one of the configured truetype font directories.

Copy the fonts into a shared font directory: You can do an "xset -q" to find the configured Font Paths for your X configuration:

	xset -q

Chose one of the directories listed in "Font Path" and copy your .ttf font files into that directory. In my case, I chose to use /usr/share/fonts/X11/misc. While you could create a new directory under /usr/share/fonts, fonts installed there would not be visible to xlsfonts or older X applications.

	sudo cp your-fonts/*.ttf /usr/share/fonts/X11/misc

Then run mkfontscale to create the fonts.scale file and mkfontdir to create the fonts.dir files used by the X server. You should also change the owner of all the files to root to avoid permission problems. The mkfontscale and mkfontdir steps are critical if you want to be able to list your fonts with xlsfonts or other legacy X applications.

	cd /usr/share/fonts/X11/misc
	sudo mkfontscale
	sudo mkfontdir
	sudo chown root:root *

You can check to verify the fonts are loading by starting an X application (like gimp). The xlsfonts command lists fonts available directly from X and the fc-list command lists fonts available through fontconfig.

	xlsfonts | less
	fc-list | less

The listing will likely be long, but if the fonts are loading correctly, you will see X font names like these (for Arial and Garamond, respectively):

	-monotype-arial-medium-i-normal--0-0-0-0-p-0-iso8859-1
	-monotype-arial-medium-i-normal--0-0-0-0-p-0-iso8859-10
	-monotype-arial-medium-i-normal--0-0-0-0-p-0-iso8859-15
	-monotype-arial-medium-i-normal--0-0-0-0-p-0-iso8859-2

	-monotype-garamond-medium-i-normal--0-0-0-0-p-0-iso8859-1
	-monotype-garamond-medium-i-normal--0-0-0-0-p-0-iso8859-10
	-monotype-garamond-medium-i-normal--0-0-0-0-p-0-iso8859-15
	-monotype-garamond-medium-i-normal--0-0-0-0-p-0-iso8859-2

10. Unnecessary Services and Cron Jobs

Ubuntu has been getting quite bloated for awhile and there are a number of services I shut down or uninstalled to avoid overhead.

In many cases you can also shut these down by modifying the upstart scripts in /etc/init and changing the start on line(s) to:

	start on runlevel [!0123456]

locate and mlocate are commands that can be used to search for files on your hard drive(s). They use a daily chron script (/etc/cron.daily/mlocate) that shows up in process lists as updatedb.mlocat and sporadically kills your system performance for a few minutes. If you don't use this, remove the package:

	sudo apt-get purge mlocate

apt-xapian-index is a maintenance tool for Debian software package information. This sporadically runs update-apt-xapian-index and also tanks system response at unexpected and undesirable times. You can make it go away by removing the package:

	sudo apt-get purge apt-xapian-index

whoopsie: is the Ubuntu crash database submission daemon. If you monitor your network at interface start, you will see it sending messages to daisy.ubuntu.com. Smells a little like phone home. B'bye...

	sudo apt-get purge whoopsie

AppArmor: is a security policy utility of some kind. It seems to not be used for much anymore.

	sudo apt-get purge apparmor

Bluetooth support is enabled by default. I don't ever use bluetooth.

	sudo apt-get purge bluez, gnome-bluetooth

Gwibber: is a microblogging client so you can smoke crack without having to light up.

	sudo apt-get purge gwibber gwibber-service gwibber-service-facebook gwibber-service-identica gwibber-service-twitter 

Zeitgeist is another big-brother event logger.

	sudo apt-get purge zeitgeist zeitgeist-core libzeitgeist-1.0-1 python-zeitgeist

Speech Dispatcher is a speech synthesis service that is enabled by default. Thankfully, I do not need this.

	sudo apt-get purge speech-dispatcher

CUPS: is the Combined Unix Printing System. If you don't have a printer, you may want to disable the start on boot in the /etc/init/cups.conf script by changing:

	start on (filesystem
		  and (started dbus or runlevel [2345]))

To:

	start on runlevel [!0123456]

The most perfect political community is one in which the middle class is in control, and outnumbers both of the other classes. (Aristotle)