How to install GNU/Linux on a Sony Z1? Or how to move from Windows to GNU/Linux on a laptop?
How to install GNU/Linux on a Sony Z1? Or how to move from Windows to GNU/Linux on a laptop?

This document is updated regularly. First version was written in January 2004 and concerned mostly installation on Mandrake 9.2. It has been revised in May 2004 for Mandrake 10.0 Official. In October 2004, when Mandrake 10.1 Official went out it has been revised again and many sections are outdated, sent to the appendices and then removed. But outdated information may wrongly be here. Standard Linux distributions, not only Mandrake, do not allow the full hardware of this laptop to run on Linux, and experimental kernels and corresponding patches are published on the Internet and sometimes related in this web page. Last revision: $Id: index.htm,v 1.38 2004/11/24 00:15:49 brouard Exp$

You can find a lot of people having installed more or less successfully GNU/Linux on a laptop Sony: enter 'sony Z1 linux' on Google. In particular you can have a look at http://home.arcor.de/enton/vaioz1.html.

This computer is tagged as "thin and light". You can get an overview of this computer at http://www.notebookreview.com/default.aspx?newsID=1871.

On Knoppix, your first screen asks you to type F2 in order to get a more complete list of boot options. For example you can set a specific keyboard (and language) by typing knoppix lang=fr (on a French keyboard and with the German Knoppix you should type lqng0fr because the 'a' letter is on the 'q' and the '=' on the '0' digit) and return.

Access to gaim and setup your MSN messenger account to chat (if you are using MSN messenger).

Then you are ready either to stop installing Linux or to go further by installing it.

# 1  Choosing your Linux distribution

Even if Knoppix is based on Debian Linux, I installed Linux using Mandrake. PCLinuxOS Live CD is also based on Mandrake and if something did not work with Knoppix, try to boot the PCLinuxOS (on January 2004 it was still on a beta stage).
Latest version of Mandrake is 10.0 Official (May 2004). Download the 3 iso files (Mandrake Club users got 4 CDs or even 5) and burn the 3 CDs. Then insert the first one and boot on it (again, change your bios if your default boot drive sequence doesn't place the CD before your hard drive). Answer some basic questions and go up to 'partioning'.

Then you can choose manual partitioning to see what is already on your hard disk. If your laptop is new you will see your Windows XP partitions C: and D:. Hilight first D: and ask for shrinking this partition. If your disk has been highly used before (then your computer is not new) Mandrake will ask you to go back to Windows, to do a Windows scandisk and even a defragmentation of your drive.

Let us suppose that your are again at the 'partioning' step. You can shrink your partition to the size that you want. Linux can be installed on a few Gbs. Mandrake is pretty safe and I am confident. Mandrake can ask you to reboot just after you wrote the new partition on disk.

If you want a quick install you only need a swap partition and a root ("/") partition. Thus, from the new free partition inherited from the former D: drive, you can choose a swap partition of about 800Mb (about 3/2 times your RAM) and second partition for / . Mandrake installation asks you for a confirmation before formatting your new drives.

If you do not care about what is on your entire hard disk or simply on one of your drive, you can tell Mandrake to make its best default patitioning choices.

Mandrake is not difficult to install. And you will be successful. It it doesn't work at first pass try again to reinstall. The installation scripts are not enough tested for all the configurations. You can switch to different "terminals" by typing CTL_ALT_F2 or F3 or F4 or F5 to see what is on. Your installation started on F1 and the windowing is on F7, so type CTL_ALT_F7 to go back to the standard installation window. Most error messages are more meaningful on these other terminals. If your installation hangs you can have a free terminal and type df -k to see if the problem doesn't come from a lack of space. fdisk -l is also useful to see the partitions.
Mandrake installs KDE Desktop by default but I prefer GNOME Desktop as my default Window manager!

Half an hour later (I don't remember exactly) your will be able to reboot, choose Linux (or verify that Windows is still working) and googling if you are already on a wired network.

But if you want to test new services like wireless network (centrino), speedstep or other facilities like battery status, suspend mode, switching from your LCD to a VGA external monitor, closing your lid while on a replicator port, then it is not be finished!

# 2  Other non automated important installations for Laptops

One of the first thing that you might need on a laptop is to get a suspend mode. Former laptops like, my Dell XP 500Mhz, could suspend on RAM via its bios.

Now, on new laptops like the Sony Z1, bios options are rather scarce (hardware is fixed, software can evolve!).

With Mandrake 9.2 kernel I haven't been able to suspend on RAM but to suspend on hard disk. But you need to go to the website of swsusp in order to install the "hibernate" script.

You will be able to suspend by typing "sudo /usr/local/sbin/hibernate". This command is designed on Fn F12 on your Sony keyboard. But in order to link this command to this key combination you need some softwares which are not all in the standard Mandrake 9.2 distribution. Also, using Mandrake 10 Official with kernel 2.6.3 does not allow you to use any suspend mode, neither on RAM (S3) neither on disk (S4). It is a pity, but suspend on disk with swsusp took a long time (more than a minute) which it is too long in comparison to a simple reboot. With a more recent kernel 2.6.7 from Mandrake Cooker, you will be able to suspend to disk, with swsusp2, in a very nice way (even under Win4lin), see below this section. Also, on recent kernels, 2.6.8, distributed by Mandrake 10.1 Official (mid October 2004), you can use the standard S4 suspend to disk (see modprobe sonypi and then lsmod |grep sony to confirm that the module is loaded.

Stelian Pop has written two programs, sonypid, and spicctrl which are both included in his sonypid package. As explained on his website, sonypid gives you access to sony function keys or battery status while spicctrl lets you control the brightness of your screen. But in order to have something functioning you need another daemon, sonypidd, which activates sonypid.

At last, and in order to have sonypidd daemon activated, you need a sonypiddd service (with 3 'd'). You will access to these 3 (4 with spicctrl) new RPM packages below.

This service, as any service on Mandrake distribution, can be started or stopped by the command (on a root shell) /etc/rc.d/init.d/sonypiddd start (or stop or status) or more briefly service sonypiddd start.

You can also access to the Mandrake Control Center => System => DrakXservices and activate sonypiddd and perhaps permanently (i.e. at boot time). But you won't see the service sonypiddd until you already installed the sonypid perl script.

In order to simplify the installation, I tried to package my sonypiddd service including Craig DeForest's sonypid perl script into an rpm for Mandrake. You can get the binary sonypidd-1.0.2-1mdk.i586.rpm and it sources sonypidd-1.0.2-1mdk.src.rpm.

Meanwhile I also tried to adapt Stelian's own rpm for Mandrake users. Therefore for sonypid, sources are sonypid-1.9.1-1mdk.src.rpm and binary are sonypid-1.9.1-1mdk.i586.rpm and for spictrl sources are spicctrl-1.6.1-0mdk.src.rpm and binary spicctrl-1.6.1-0mdk.i586.rpm .

In order to use them (your need the 3 binaries) you must first download them on a directory.

For the installation of the binaries, you have to cd to this directory, type "su" to grant root privileges and then type for example rpm -iv sonypid-1.9.1-1mdk.i586.rpm . If your current installation is set correctly you can install directly without saving it to disk and you will get a prompt to enter your root passwd.

If you want to suppress the package type rpm -e sonypid . Once the three binaries are installed don't forget to start sonypidd (which loads the sonypi modules and starts sonypid daemon) by typing the following command /etc/rc.d/init.d/sonypiddd start .

If everything worked you should be able by typing simultaneously on Fn and F6 (but only once) to decrease the brightness to its minimum (the key is not designed on a Sony keyboard, I know) . By typing one or more times on FN F5 you will increase progressively the brightness (key is designed on the Sony keyboard).

Play music and then key on Fn F3 and it will mute the sound (but it previously saved the settings on ~/.aumixrc). Typing Fn F4 will unmute at the preceding sound level and wil give you access to the aumix windows where you can adjust not only the main sound but others too. Typing twice on Fn F4 will unfortunately popup two aumix windows which you should cancel. These features work on Xwindows but not satisfactorily with a tty terminal. Type simultaneously on CTRL_ALT_F2 to access a new terminal, then type Fn F6 or Fn F5 it will work. But for sound it doesn't always work. Type CTRL_ALT_F7 to go back to Xwindows (for Mandrake only because for other distros it can be CTRL_F8, try them).

### 2.0.a   Modifying the settings of sonypid and making your own rpm

As you can see, current sonypid script is not perfect and you can have other ideas to improve it.
RPM files are easier to install and to remove than tar.gz files but the construction of a RPM requires a little more attention.

Let say that you want to improve the sonypid perl script, to test it and to offer a new RPM to the community'. You must first download the src.rpm on a local directory. Then you have to create a ~/rpm directory with a SPECS and a few other directories. Go to http://qa.mandrakesoft.com/twiki/bin/view/Main/RpmHowTo to know exactly how to set up your local rpm laboratory (just a few commands to create local sub-directories.

In order to build a rpm you should never work as root anymore.

Doing rpm -iv sonypidd-1.0.2-1mdk.src.rpm will expand the package under various subdirectories of your ~rpm. Then goto ~/rpm/SPECS to should see sonypidd.spec and look at ~/rpm/SOURCES to see the compressed sources files. File sonypidd-1.0.0.tar.bz2 is the original perl script from Craig, sonypidd-sonypidd.patch.bz2 is my patch and sonypiddd.rc.bz2 is the new service to launch the sonypidd daemon.
But in order to apply the patch and to decompress everything, you should cd ~/rpm/SPECS and type rpmbuild -bc sonypiddd.spec. Then you will have access to the current sonypidd perl script in the newly created ~/rpm/BUILD/sonypidd-1.0.2 directory and see the man page too sonypiddd.8.bz2.

Here are my modified lines from the original perl script:

$bright_steps = 10;$spicctrl = '/usr/sbin/spicctrl';
$aumix = '/usr/bin/aumix'; ########## # Table of function-key actions. List ref containing strings # executes strings as shell commands; code ref gets executed in situ. @fcmds = (undef # 0 , undef # 1 , undef # 2 , ["$aumix -Sv0"]                # 3 - mute
, ["$aumix -LI >/dev/null"] # 4 - modify volume ,$brighter                      # 5 - increase brightness
, ["$spicctrl -b 0"] # 6 - minimum brightness , ["$radeontool dac on&& $radeontool light off"] # 7 - LCD/VGA - , ["$radeontool light on && $radeontool dac off"] # 8 , undef # 9 , undef # 10 , undef # 11 , ["sudo /usr/local/sbin/hibernate"] # 12 software suspend swsusp doesn't work with kernel 2.6.3 ); They slightly differ from the DeForest's original perl script:$bright_steps = 10;
$spicctrl = '/usr/local/bin/spicctrl';$aumix = '/usr/local/bin/aumix';
$click = "/usr/bin/sox /usr/share/sounds/KDE_Click.wav -r 48000 -t raw /dev/audio"; ########## # Table of function-key actions. List ref containing strings # executes strings as shell commands; code ref gets executed in situ. @fcmds = (undef # 0 , undef # 1 , ["aumix -v-10","$click"]       # 2 - reduce volume
, ["$aumix -v0"] # 3 - mute , ["$aumix -v+10","$click"] # 4 - increase volume ,$brighter                      # 5 - increase brightness
, ["$spicctrl -b 0"] # 6 - minimum brightness , undef # 7 - LCD/VGA - not yet , undef # 8 , undef # 9 , undef # 10 , undef # 11 , undef # 12 ); If you want to change them again, stop the daemons by entering in a root shell /etc/rc.d/init.d/sonypiddd stop and modify (on root) the already installed /usr/sbin/sonypidd script. Once your are satisfied with your modified perl script, integrate it on your ~/rpm/BUILD/sonypidd-1.0.2 tree by doing tar jcf ~/rpm/SOURCES/sonypidd1.0.0.tar.bz2 sonypidd-1.0.2 Modify your ~/rpm/SPECS/sonypidd.spec file by adding 1 to the release Mandrake's number and commentating the changelog with your changes. Then save a copy of your sonypidd.spec somewhere with also a safe copy of your modifed tar file (be careful). Then, under ~/rpm/SPECS do rpmbuild -bb sonypidd.spec . It will create a new binary rpm on ~/rpm/RPMS that you could install (you need to be root for installation not for building). Do rpmbuild -bs sonypidd.sepc to build the src-rpm. Now you can bootstrap (take a safe copy of your modifications) by making a rpmbuild -ba sonypidd.spec. In order to have a real Mandrake contrib rpm, I think that you should do an rpmbuild --sign -ba --clean sonypidd.spec to integrate your digital signature. Some of my rpms are now distributed within the Mandrake contribs (thank you to Lenny). ## 2.1 Wireless Intel is working on integrating the Centrino wireless feature. Look at Intel for updates and particularly at ipw2100.sourceforge.net . The Ipw2100 driver requires a modification of the kernel and can't be used with a standard Mandrake 9.2 or Mandrake 10.0 distribution (as for other non Mandrake distributions). See the corresponding section below under the 2.6.7 kernel. If you are running on 9.2 or even on Mandrake 10.0 you can use ndiswrapper at ndiswrapper but I am no longer using it and suppressed this section. ## 2.2 Accessing the net, ppp, dhcp, adsl Most of the other questions concerning the access to the net are solved in Mandrake basic installation. According to improvements in adsl distributions, some modems and protocols may not be supported by Mandrake. But usually you will get information on forums. Let me say that if you have access to the adsl, the easiest solution is probably to buy a wifi-router-NAT-firewall-DHCPserver small box for less than 100 euros. If your adsl provider did not give you an ADSL modem for free, you may consider a similar box which will also include a compatible (with your provider) ADSL modem. You can also use an old PC which will offer the same kinfd of services but then you have to buy a WIFI pci card. The advantage of this solution is that your router establishes a permanent connection to the Internet and shares Internet among many potential users either by wired connections (4 in simple boxes) or wireless. So you can access to any PC (Mac, Windows, Linux) of your home, and each of them will have access to Internet. You can also give an Internet access to your neighbours wirelessly (some ADSL providers are against that, so change your provider). The firewall lets choose which of your PCs will serve as web server or IMAP server or whatever server. Your router has an internal web server which lets you configure the firewall and set a port like 80 for http (web) to a particular internal IP address of the PC which will serve as a WEB server. In order to receive your mails your network needs a permanent DNS name. You don't need a permanent numeric IP address. Look at dyndns.org to have up to 5 free subdomains. Some providers are giving a fixed IP and even a reverse DNS (adsl.free.fr) which lets you work at home with the same facilities as at work (or even better) and give email addresses to yourself as to other members of your family or friends. In order to install an IMAP server at home, on one of your PC you need again to set up the firewall by forwarding the IMAP port to the internal IP adress of the dedicated PC. If you travel with your laptop or do not have access to ADSL, you can have a connection using a standard 56k modem. Mandrake installation detects your modem and let you install all if you know the specifications given by your provider. ## 2.3 Upgrading to Mandrake 10.0 Official (May 2004, partly outdated) In early April 2004, Mandrake released version 10.0 Official which came about 2 months after the community version (you may not be able to boot with the first CD of the community version because of a bug, so either boot from CD2 and use CD1 afterward or download Official more recent version). You can get the 4 cd iso files from any Mirror ftp site or via bittorrent. Bittorrent is very useful during the rush because more people are downloading at the same time, shorter is the download time because of simultaneous uploading. Be sure that your firewall opens the total required range of ports and then the downloading can be very quick. It was close to 540k/s in my case (up to the limit of my ADSL connection). Today (April 2004), Knoppix 3.4 is out but it is hard to get it outside Germany, but you can get Kanotix http://kanotix.de which is even a better (currently) clone of Knoppix 3.4 . As explained at the beginning of this page you should burn the Kanotix iso file and boot on it before installing Linux. After some tests you will know what GNU/Linux is offering today. Upgrading to Mandrake 10.0 from Mandrake 9.2 on a Sony Vaio wasn't difficult at all. Just be careful to have enough place on your partitions before upgrading. For example you can suppress some big packages like OpenOffice which can be reinstalled later. The main advantage of Mandrake 10.0 over 9.2 is that it is based on kernel 2.6 instead of 2.4 . It means that you can take advantage of the speedfreq feature on the Intel Pentium of your Sony, avoiding permanent use of the fan and the potential risk of overheating. Also with kernel 2.6 you can use CPUFREQ which may adapt the CPU frequency to specific needs (you can slow the speed from 1.5GHz to 600Mhz with cpufreqd when the AC adapter is off)). Then you could use your battery up to 5 hours like on Windows, but unfortunately even with best optimizations, Linux is currently more power consuming and you will be able to run on battery up to 3 or 4 hours only. Also, with the new version of Mandrake, I am able to use the replicator in a safe way. The bad thing of kernel 2.6 and particularly of kernel 2.6.3 which is used by Mandrake 10.0 official is that software-suspend is no more working at all. According to swsusp developpers, there was some hope with kernel 2.6.2 which vanished with the upgrade. Cyril Wattebled reported that swsusp2 was working with a Gentoo 2.6.7 kernel and Ionut Georgescu with a kernel 2.6.5 ;They say that they can resume in about 25 to 35 seconds even with plenty of tasks. See below how to install a binary rpm for kernel 2.6.7 including a nice swsusp2. ## 2.4 Without the specific patch Alps touchpad is working as a PS/2 The touchpad of this Sony is an Alps touchpad. It is not recognized by default as an Alps but as a standard PS/2 mouse by unpatched kernels (up to 2.6.9rc3 at least). Thus, when you type on the laptop keyboard, your hands or thumbs can inadvertedly tap the touchpad and your cursor will jump into an unfortunate random position on your screen or text. In order to avoid this phenomena, you need to install a special driver. Mandrake 9.2, 10.0, 10.1 do not recognized the Alps touchpad. You need to look at the section concerning the Cooker kernel 2.6.7 where a recent (July 2004) Alps patch has been published (see section). ## 2.5 Setting ACPI on Kernel 2.6 It has also been reported that some ACPI features could also work with kernel 2.4. You should have a look at acpi.sourceforge.net and at acpi 2 Specs to understand how acpi works. But anyhow, acpi is quite simple. Using a standard Mandrake 10.0 installation the ACPI will probably not be setup and you will have to set it in your lilo.conf. Here is my Mandrake 10.0 (kernel 2.6.3) lilo.conf line (it will be very different with kernel 2.6.7 (Cooker Mandrake 10.1, see the corresponding section) append=" nolapic devfs=mount splash=silent acpi=on resume=/dev/hda8" which includes acpi on. 'nolapic' was necessary in order to halt the power of my sony (on kernel 2.6.7 the nolapic option hangs the laptop at boot and a kernel without APIC has to be built as explained in the corresponding section). The resume is useless because suspend doesn't work (it was working on Mandrak 9.2 for swsusp and it works with kernel 2.6.7 and swsusp2 see the corresponding section. - NEW - It also works again with 10.1 Official). But you can keep it, it will not harm (here hda8 has to be replaced by your swap partition). Verify that acpid is working. And if not, download it with the simple command (on root) urpmi acpid and activate it with service acpid start . Then you can look at /var/log/acpid.log where all the acpi events are recorded. For example I set up a file named 'lid' in /etc/acpi/events which looks like: event=button/lid LID action=/etc/acpi/lidonoff And each time I open or close the lid, an acpi event is created and the script /etc/acpi/lidonoff is executed. lidonof may look like this: #!/bin/sh # Adapted from http://www.littleredbat.net/~mk/vaio.html status=sed "s/state: *//" /proc/acpi/button/lid/LID0/state case$status in
"open")
echo "Opens the light of the lid (radeon driver bug)"
/usr/local/sbin/radeontool light on > /dev/null 2>&1
exit 0
;;
"closed")
echo "Shuts the light of the lid (radeon driver bug)"
/usr/local/sbin/radeontool light off > /dev/null 2>&1
exit 0
;;
esac
As you can read it, this script uses 'radeontool'. Radeontool is a very useful tool which hacks the memory of the video card to modify some of its features.

In fact, with the latest version of Mandrake 10.0 the brightness of the screen was shut down correctly while closing the lid (try on yours, it was not true with Mandrake 9.2). Therefore radeontool is no more fundamental for this purpose. But it is still useful to switch from the LCD to an external monitor or to use a replicator. I set up 'radeontool ligth off' on Fn F7 and 'radeontool dac on' on Fn F8 using sonypidd but it is still not satisfactorily (we need to have single command which will roll over the sequences LCD - LCD & CRT - CRT ) .

I also use acpi to manage battery with the following /etc/acpi/battery script:

#!/bin/sh
# http://www.littleredbat.net/~mk/vaio.html

status=sed "s/state: *//" /proc/acpi/ac_adapter/ACAD/state

case $status in "on-line") echo "Setting HD spindown to 10" /sbin/hdparm -S 10 /dev/hda > /dev/null 2>&1 /usr/sbin/spicctrl -b 220 exit 0 ;; "off-line") echo "Setting HD spindown to 1" /sbin/hdparm -S 1 /dev/hda > /dev/null 2>&1 /usr/sbin/spicctrl -b 100 exit 0 ;; esac Thus, when the alternative-current adapter is unplugged, the brightness of the screen decreases and the hard disk is set to suspend mode to save the battery (and vice-versa when the adapter is on). ## 2.6 Setting CPU-FREQ With the Intel pentium M you can change the frequency of your CPU. Kernel 2.6 allows you to get a /sys directory which is similar to /proc. CPUFREQ is a new facility which enables you to change the frequency by software. Many different softwares are now available on Linux. I was using cpufreqd, not only because of its name but also because of the availability of an RPM for Mandrake. With my Sony Z1, cpufreqd changes automatically the CPU frequency from 1.5Ghz to 600Mhz when I unplug the AC-adapter. And I didn't look at other softwares until a developper from Debian pointed me to powernowd' http://www.deater.net/john/powernowd.html. Its philosophy is clear. Powernowd changes the CPU frequency according to the CPU load. Even if you are running on battery you may need the full CPU for a short time. Powernowd is documented on the website and in particular in the http://n-dimensional.de/projects/cpufreq/algorithms document from Hans Ulrich Niedermann. Let us explain the algorithm in the case of a processor which can switch only between two fixed frequencies. If you run at the lowest CPU frequency of this laptop, 600MHz, and if your CPU load is 80% you will stay at this frequency, but if your activity is slightly higher than 80%, you will switch to the highest frequency, 1.5GHz, and your CPU load will be slightly higher than (80% x 600) / 1500 = 480 / 1500 = 32% . Now let us suppose that your activity decreases to a lower limit of 20%, (i.e at 20%X1500=300MHz 'effective'), you will switch back to the lowest frequency of 600 Mhz with a corresponding CPU load percentage of 50%. Right? Powernowd needs two percentage limits, one for the lowest frequency (80%) and a second for the highest frequency (20%), that's all. If you don't want that powernowd change continuously, you have to verify that the lower percentage limit (20%) times the highest frequency (1.5GHZ) is lower than the higher percentage limit (80%) times the lowest frequency (600MHz). And this is true. Here we took the example a CPU with 2 fixed frequencies (1.5GHz and 600MHz) but in the case of the Pentium IV M you have other intermediate or continuous frequencies (you should see them with cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies) and the processus is therefore identical with two contiguous frequencies. Powernowd changes by increasing or decreasing the frequency by steps of 100MHz. Powernowd uses the so-called "userspace" CPUFreq governor. I just built (early June 2004) an Mandrake RPM for powernowd with sources powernowd-0.90-5mdk.src.rpm and binary powernowd-0.90-5mdk.i586.rpm. Hans Ulrich Niedermann apparently made patches but I think thay they concern other kinds of CPU and I only packaged the original version. Powernowd takes its name from the AMD powernow processor but powernowd works with many other processors and, according to John Clemens, might change its name in the future (the sooner, the better otherwise it will be too late). Please check at Mandrake Contrib before using this RPM because my RPM has been updated by a newer version and is now available at contribs (and their .spec file is more orthodox than mine). I also get answers from Hans Ulrich and John; they will merge into a unique version soon. Check their site if powernowd is not working with your processor. Powernowd needs sysfs, please verify that your /etc/fstab file has a line (it didn't appear with kernel 2.6.7): none /sys syfs defaults and mount -a. I also looked at cpudyn http://mnm.uib.es/~gallir/cpudyn/. It looks similar in the sense that it changes the frequency according to CPU load too. But it also tries to stop the disk for battery saving if you unplug the AC adapter. But 'running on battery' is clearly another matter which has to be analyzed separately. Even if you are using the AC adpater you may need a lower CPU frequency, at least because it will prevent fans to run as often as if you were running at a higher CPU frequency. Cpuspeed is again an other tool which changes the cpu frequency http://carlthompson.net/Software/CPUSpeed. But I haven't tried it and documentation on the algorithm is inexistant. If you want to access a scientific document on processor and CPU frequency you can have a look at http://www.arm.com/pdfs/vertigo-OSDI2002.pdf Many programs with different philosophy are competing. We need more experiences to know which is best and for what goal. But for me, CPU frequency is a different matter than running on battery or not. We need a daemon like powernowd to lower the CPU frequency if unnecessary (parcimony philosophy). We need also better tools with more flexibility that a fixed script like /etc/acpi/battery (described above) to save the power of the battery but at the price of less ease, like a reduced brightness of your LCD. I heard that KDE has by default an applet for CPU frequency. But again, mixing CPU concerns and AC considerations is not mandatory. Gnome has a very low consuming applet for CPU frequency only. Here is a first example when running on battery and at 1.5GHz because of a high CPU load and here a second when running with the AC adapter but at 600MHz because of an important idle time. ## 2.7 Setting Win4lin We will need Windows for a while, at least because other people are using it. So my Sony laptop is still dual booted with its original (shrinked) Windows XP version. I installed cygwin and sometimes boot on Windows but very rarely now. Most of times I use Windows without rebooting. It means that we need Windows running under Linux. I mostly need to run my former licensed program (like Stata or Sas etc.) and thus I bought 'win4lin' http://www.netraverse.com. Win4lin is very boring to install not because of win4lin itself but because of Windows 98 which is always hard to install and requires at least 15 reboots! But once you installed win4lin, you can have Windows in a small window. A win4lin session under Gnome snapshot Win4lin requires a modification of the kernel and thus you need to get new patches each times you upgrade your kernel. The win4lin installer is very well done and people there are ready to help. I read that Mandrake and Win4lin have engaged commercial discussions together (May 2004). Win4lin is safe. When Windows 98 hangs, just kill the Windows window and reboot win4lin while clicking on the win4lin icon (it lasts a few seconds). But Win4lin is not able to play midi neither to use usb ports nor to play games with DirectX, but for softwares which do not need these devices or features it is terrific because they are running at even a better performance than native Windows! I also installed cygwin on Win4lin in order to compile linux programs for Windows users. You can get an example of such a scientific program at "http://euroreves.ined.fr/imach with the corresponding scientific article. An alternative to Win4Lin isVmware, but I don't have any experience with vmware but know that it is slower to run programs and more expansive. ## 2.8 Windows plugins It is sometimes useful to have shockwave or flash plugins or other plugins working from your browser (Galeon or Mozilla in my case). Macromedia recently released the flashreader 7 plugin for Linux at http://www.macromedia.com/software/flashplayer/ . But all of these plugins are not ported to Linux currently. Please sign the petition at http://www.petitiononline.com/linuxswp/petition.html by searching for shockwave. Currently the only alternative is to buy (again) "crossover plugin" (about 30 euros). You can test the program for a month before buying it. Again it is a long process to download all the free plugins from the Windows world but then you can display shockwave presentations and PowerPoint presentations (you can only display them, not modify them or you need CrossoverOffice and the Microsoft Office licences) without the ever non full compatibility of OpenOffice products. CrossOver plugin uses Wine, which is a GPL, and run Windows natively without the need of a Windows licence. On May 11 2004, Crossover plugin is no more distributed but included in Crossoveroffice at a slightly increased price. Crossoveroffice lets you run Microsoft Office softwares without the need of a Windows licence (but you need to have Microsoft Office licences!). I have not experience with it. Crossover needs Wine to run. Wine is GPL licensed (free) and is (partly?) supported by the paid licences of Crossover. I don't understand how these people from Codeweavers can improve Wine if they know that once Wine will be able to run most of Microsoft programs, Crossoveroffice will be useless. I would prefer the donation support approach.. You can get former Crossoverplugin from MandrakeClub at 25 euros (June 2004). ## 2.9 Office, LaTeX, Bibliography, graphs OpenOffice from Sun is probably the closest clone of Microsoft Office. OOffice 1.1 has still stupid compatibility problems (in October 2004, version 1.1.3 is distributed by Mandrake), like the excel function euroConvert which does not exist on oocalc (but exists on gnumeric!). OpenOffice let's you do most what Microsoft Office does. The mathematics seem even easier to enter than in Word but are not competitive with LaTeX (with the AucTeX package under Emacs or Xemacs). Emacs seems hard to be learnt by younger "look and click" users but it is mandatory to learn if your left hand and fingers are functionning (don't be relunctant to CTRL_f, CTRL_b, CTRL_x-CTRL_f neither to CTRL_x-Esc-Esc, once you know them, it is for ever and daily use). Also be sensitive to accessibility concerns before developping sophisticated Flash or Shockwave program which can be accessed by low vision people. Look at Emacspeak or more recently at Oralux Live-CD which is developping because of Knoppix. The command pdfLaTeX allows you to directly get a pdf file without the need of dvi anymore. For bibliography, OpenOffice, like Microsoft Office, is very poor. But some third parties are offering commercial powerful bibliography tools like Endnote for Microsoft Word (and other word processors for Windows but currently none for Linux). BiBTeX is still my favorite bibliography tool. But in order to access to Medline (in Xml format) you can get Jabref (which recently merged with JBibtexManager and is working on Windows too). OpenOffice has a bibliographic project, mostly based on xml, and which will give access to Z39.50 databases too. You can check at http://bibliographic.openoffice.org what is the current situation. Support for BibTeX is apparently here in test phase. I am still using gnuplot (version 4 is out) for my figures with the help of xfig for handwriting' figures. One of the facility of gnuplot on Windows was the fact that you could save a figure and paste it into PowerPoint or whatever other tool. On linux, apparently, you have to open a pdf (or whatever file format), replot and use the saved graph with an other tool. Free Acrobat reader can be used to read pdf files but full Acrobat is not available for Linux. It is a pity because it is often an excellent alternative to PowerPoint with its zoom facility on vectorial graphics and hypertext ability too. On Linux Acrobat reader you can still select a portion (rectangle) of a page and save it but I don't know how to paste your save into a file or into another tool. On Windows you could paste on most tools. There are many other PDF viewers based on Ghostscript. Kpdf is one of the nicest one. Scribus seems to be an important project for pdf forms. Pdf plugins are available for Mozilla linux browser and can be used by Galeon, gnome default browser. Such a plugin allows you to visualize a pdf file within your browser page, instead of opening it on a separated windows with Acrobat reader itself. It has some advantages. The so-useful 'google bar' is available for Mozilla. In the Galeon bookmarks you can access to google directly too (i.e without having to load the main www.google.com window). I am using Mozilla-firefox now (October 2004) and the google bar is included by default. You can also have "Live bookmarks": live bookmarks let you access the headlines of many newspapers or web sites. A clickable "Rss" icon appears on the down right corner of the browser when the Web site is compliant to this mozilla feature. If you click on it the bookmark is stored. My favorite RSS feeder, Evolution, doesn't include this facility any more and I am using mozilla-firefox. You may have a look at http://www.atlantictechsolutions.com/scribusdocs/wine.html for another view of using Windows products with Wine and CrossOverOffice (which I never tested). ## 2.10 FAT partitions, USB keys, USB external drive Windows partitions moved from FAT (16 or 32) for DOS and Win9X to NTFS for Windows NT, 2000 and XP. FAT partitions did not implement an 'owner' to its files: everyone can write everywhere when using this type of partition. Also the names of the files are not case-sensitive. With Windows 95, the constraint of the 8.3 (8 characters at maximum for the first name, 3 characters for the extension) rule for filenames vanished by including a transcription but is still a problem for some old devices. Most, if not all, USB keys or memory cards are usually formatted under FAT formats. - I never have had problem with any USB key on Mandrake 10: once you plug the USB key you get automatically a new icon on your desktop as 'removable_media'. You can click on it and drag from or to another window any file. To unplug, just unplug the USB key without any special caution (ok if you are still writing on it don't do that). And the icon will disappear. This is a point where Mandrake spent a lot of time to have something working well. And apparently with a great success. - Memory cards like the memory stick from the Sony Z1 are permanent drives and it is not clear for me how you can mount you memory stick. You can always switch to root and mount your drive manually, but I got some problems and sometimes needed to use 'fuser' in order to know which process was blocking the drive. The memory stick is recognized as an scsi device and is located (on my system) on /dev/sda1 . # ls -l /dev/sda1 lr-xr-xr-x 1 root root 34 jun 23 12:36 /dev/sda1 -> scsi/host0/bus0/target0/lun0/part1 mount -t vfat /dev/sda1 /mnt/memstick It should be recognized as a memory_card but it does not work easily. - Same problem with an external camera connected to an USB port or even for a printer (like the HP Photosmart) which allows a direct insertion of a memory card into the printer. I am never sure to get an easy access to my photos. Sometimes it seems that the problem comes from fat partition of the memory card which is not readable under Linux. - I have had a recent experience with an external USB drive. This drive did contain 3 NTFS partitions but they did not pop on my main window like for an USB key. I just look at the syslog and verified that they were recognized. But I got: the following confusing messages Jun 9 09:39:00 localhost perl: drakupdate_fstab called with --auto --add /dev/scsi/host1/bus0/target0/lun0/part6 Jun 9 09:52:47 localhost kernel: FAT: invalid media value (0xb9) Jun 9 09:52:47 localhost kernel: VFS: Can't find a valid FAT filesystem on dev sdb. Jun 9 09:53:12 localhost kernel: NTFS-fs error (device sdb): read_ntfs_boot_sector(): Primary boot sector is invalid. Jun 9 09:53:12 localhost kernel: NTFS-fs error (device sdb): read_ntfs_boot_sector(): Mount option errors=recover not used. Aborting without trying to recover. Jun 9 09:53:12 localhost kernel: NTFS-fs error (device sdb): ntfs_fill_super(): Not an NTFS volume. [root@localhost RPMS]# ls -l /dev/sdb lr-xr-xr-x 1 root root 33 jun 9 09:38 /dev/sdb -> scsi/host1/bus0/target0/lun0/disc and I gave up by booting on Windows, and I simply did not try to mount them one by one. Next time I will tell you. - The Sony Z1 does not have any floppy drive anymore (you can still have a floppy drive on an USB port). ## 2.11 NTFS write As already mentioned, NTFS is the 'new' partition type of Windows NT, 2000 and XP. In fact any new version of Windows, changed slightly the internal and proprietary format of NTFS partitions which makes life difficult for Linux NTFS drivers. NTFS partition can be mounted but mostly in a read/only mode only. You can compile a new kernel 2.6 with a NTFS write' option. I did it. But it is not done by default with Mandrake 10.0 Official, not because it is unsafe (it is very safe, look at the kernel documentation) but probably because its use is very limited: with this NTFS write option, you can only modify an already created file but can't create a new one! NEW October 2004. There is a ntfs patch in Mandrake 10.1 Official which lets you have NTFS-write option has a "module". It seems to say that you don't need to build a new kernel, but the NTFS write limitations will still be there (I haven't tested it yet). In order to get a full write access of your NTFS partition, you need to use your proprietary native Windows drivers and the so-called captive software (Knoppix 3.4 uses captive, so you can try). I did not install it on my laptop (until now) because I read that Captive is CPU and memory consuming. But I can change my mind. I think that there is still no captive rpm for Mandrake. I changed my mind and installed Captive, directly from the binary rpm from their site. It was supposed to work with Mandrake 9.1 but is also working with Mandrake 10.0 Official. There is a shell script that you must run or you have to copy two important Windows binaries which are on your original Windows installation. In order to access them, the ntfs drive has to be mounted (usually on /dev/hda1 by standard ntfs linux driver (read only). Once these binaries are installed, you can unmount /dev/hda1 and mount it with mount -t captive-ntfs /dev/hda1 /mnt/windows. The installation script is still approximative and you have to check what has been added in /etc/fstab. Nothing harmful at all. Limitations of Captive NTFS • There is no FAQ on the captive ntfs site and it is very hard to know the current limitations. The most important one is that when you halt your laptop, the modifications done on the mounted NTFS partition will not be saved! You have to unmount 'manually' the drive and wait for some time (may be 10 seconds) before halting. Otherwise the cache will not be saved. There is a bug somewhere and no other solution to get a clean return code after unmounting. • If you are in a terminal window and want to create a directory or file with accented characters you may crash the cache and lose your previous modifications. There are some ways to correct this by setting correct LANG environments but I haven't been able to go through. • Once your NTFS drive is mounted read/write you can make a symbolic link of part of this drive under the scope of your win4lin partition. Thus, you can write a file from the Windows 98 window of win4lin on the original ntfs drive. But as Windows 98 is supposed to use FAT drive it is not able to distinguish filenames in uppercase from lowercase. Therefore if your windows software writes output files in uppercase you will have problem to get it on Linux and on the native NTFS drive. • Also you can't copy a file bigger than about 1Gb to such a NTFS write because you will run out of memory. • NTFS partitions allow files to be owned by different users and at least by yourself and the Administrator. But Captive-ntfs does not map users name and thus you should mount the NTFS drive either as root (default) or, better, with your uid and gid. Then the whole partition is owned by yourself. Captive NTFS might still be useful if you are dual booting. But be careful. And verify that your modifications are saved correctly by umounting the drive, waiting and mounting again to check. ## 2.12 Scanner and Optical character recognition The advantage of scanning under Linux compared to Windows is that you can use a scanner through a network (it is an advantage if your PCs aren't far from the scanner). I am using an Epson 1250 on a Linux desktop at home and did not encountered any problem with it. I usually use Gimp in order to scan a photo or a text. For optical character recognition, Linux is very very poor. The simple Kooka program is useless for any professional use. If you need OCR on Linux you have to scan your document in a first step and use a professional software like ABBYY FineReader on Windows using Win4lin in a second step (you can't access the USB port of the scanner directly from win4lin). Unfortunately, the Russian people who recently created this new very powerful ABBYY program, didn't know GPL or did not want to know what GPL was. They used the commercial way with apparently a great success. Any student willing to read their powerful published new algorithms in order to give to Linux an access to OCR? ## 2.13 gkrellm Gkrellm is a collection of plugins to monitor you laptop and its environment (cpu, ethernet, wifi, processes, disk access, memory, temperature of the processor, xmms (music) etc). It is easy to install and sometimes useful, but it is power consuming and must be killed when you run on battery. ## 2.14 Evolution for Mail/Calendar/Notes. Syncing your PDA As a former user of Outlook, I really appreciate Ximian Evolution which is clearly a better clone than Outlook 2000 in managing IMAP mails at a much higher speed and in more comfortable way. It also allows to sync your PDA without any problem (I have a Sony NRV70). See snashot here: On Windows I was used to share my calendar with my secretary with Outlook, but it sometimes failed (with duplicated items) and at the end I only used the readonly way. Now whith Evolution, I simply sync my calendar on my web server using standard calendar formats (ics format as for MacIntosh). Remember doing evolution --force-shutdown before syncing. You can find a Windows tool which enables you to import all your former Outlook shares to Evolution. ## 2.15 X11 Mandrake 10 will set up a nice X-Windows installation for you on the laptop. But you may need refinements to get either higher resolution, in particular for an external video monitor. X11 is the way how graphical windows and mouses are managed under Unix/Linux. When your runlevel in /etc/inittab is set to 3 (and not to 5) you can log on a 'terminal' (no window manager) and get a 'terminal login' prompt. You can get a second terminal with CTL-ALT-F2 or F3 etc. It can be necessary to have two terminals in order to test X11. On the first terminal just type X and return. The main Xwindow must open and your mouse should be working too but the screen is blue without any other window or program working. If the resolution doesn't fit you, you can cancel X by simultaneously pressing CTL_ALT_BACKSPACE (may be twice). If it doesn't work, you can jump to the second terminal, log and kill X. Then, on root you can have a look at /var/log/XFree86.0.log to see what is wrong. You can edit the XF86Config-4 with emacs -nw /etc/XF86Config-4, modify it and try again by jumping back to terminal 1 (CTL_ALT_F1). If X is working you can jump to it with CTL_ALT_F7 which is the standard 'terminal' for X-windows. The Sony Z1RMP uses an ATI Radeon Mobility M6 LY (AGP) video card with a 1400x1050 resolution. Somebody from ATI worked during the summer 2003 on a new radeon driver for X11 and made important improvements. Before I found the 'radeontool light off' command which is a dirty hack but very useful, I was using the new PanelOff option of the radeon driver in order to start X with an external monitor (when I use the replicator I have to shut the lid and the LCD screen must be black) but I wasn't able to dynamically (with FN_F7 for example) switch to the LCD again. At that time I had two different XF86Config-4 which were started either with the standard startx command either with a private startx-ext script which loaded a special XF86Config-4 including the PanelOff option to off. It is no more useful now with radeontool. Here you can find the XF86Congfig-4 XF86Config-4-sonyZ1.txt file that I used on Mandrake 10 (On Cooker Mandrake 10.1 I use synaptics and a different config file [see kernel 2.6.7 below]) (see also the Xorg section if using Mandrake 10.1 Official). By using Control_Alt-Fn-+ or - (yes the + is on the simulated numpad and can be accessed via the function key; the + is closed to the right shift on this laptop) I am able to switch the resolution in order to satisfy any older video projector. But my preferred resolution is 1400x1050. If your external monitor doesn't have the corresponding resolution you can look at /var/log/XFree86.0.log or /var/log/Xorg.0.log what are the resolutions accepted for your monitor (I think that it is only possible if it is DDC compliant). My external monitor is able to have 1280x1024 instead of 1400x1050 and thus I added a CloneMode option in the "Device" section Option "CloneMode" "1280x1024" . According to a developper of XFree, latest versions of XFree86 give an access to the drivers and allow switching dynamically from an LCD to an external monitor (and thus will make radeontool hack useless) but nobody has currently written any code in that direction. The standard way at boot is to have an id set to 5 in /etc/inittab . Then not only X11 but a window manager like KDE or GNOME is launched automatically. I prefer the Gnome Display Manager (gdm) over KDM (kdm). Version 4.4 of XFree86 has changed the license of its distribution and many distributors are refusing the new status (or can't use it?) but I am not able to understand what it really means for an end-user (not for a distributor). XFree wasn't apparently GPL. Xorg looks as a valuable alternative (http://www.x.org/), not GPL either. In October 2004, and as most distributors, Mandrake 10.1 adopted XOrg. See the corresponding new section. ## 2.16 CD-rom With Kernel 2.6 Linus Torvald suppresses a source of troubles by suppressing the scsci mode on how IDE CD reader or writer were handled. I have read a former dispute between Linus and the man who wrote cdrecord. Thus, now there is no more hdb=ide-sci in /etc/lilo.conf . The consequences of this is that my favorite CD-burner 'eroaster' doesn't work anymore. And I have to use the K3b program (with sometimes KDE problems under Gnome). (In October 2004 and with 10.1 Official, I still don't know if supermount is useful when using udev instead of devfs). ## 2.17 Logical volume manager (LVM) Some years ago, when our IBM/RS6000 workstations were running on AIX we loved Logical Volume Manager in its ability and facility to increase the size of the partitions "online". LVM is also implemented on Linux now. IBM has also an important project named Enterprise Volume Management System (EVMS) but which apparently has not been elected by the Linux Kernel core group for kernel 2.5 see http://news.com.com/2100-1001-979142.html. But EVMS looks alive with a stable release on June 3 2004, is GPL licensed, and accessible on sourceforge (http://evms.sourceforge.net/. I never tried. You can easily use the current LVM with Mandrake because it is implemented at installation (not by default but you can choose it). I never used ext2resize with mounted filesystems (ext2online) but if you use the very useful diskdrake tool of Mandrake, you have to unmount the partition prior to resize. . In the above example, I first hilighted the brouvg 'partition' which, being a Logical Volume partition, is echoed by diskdrake as if it was a standard disk like hda. Its name is brouvg (for volume group) and all the inner partitions (logical volumes) are displayed. Choosing /opt (I needed a separated growing /opt because of win4lin and crossover) you will access to its size of 128Mb and type (ext3). Then you can click on unmount (démonter in French). If you can't unmount, this is probably because the partition is accessed by another process. You will know which process is using it by typing: fuser -m /dev/yourvolumegroupname/yourlogicalpartname. Then you can stop it or kill it! . Thus you can resize your partition at whatever size. Once it is resized, you remount your partition by clicking on mount. You can also create a new partition easily. Let's say that you have a subdirectory named /home/myname/photos (which is equivalent to ~/myname/photos) for your photos on your home partition. But as your photos are more and more numerous, you may decided to put them on a separate partition. Thus you have to rename the directory photo to photo2 for example. You can compute the current size of photo2 by entering the command du -sk ~/photo2 (in K bytes) and, from diskdrake, create a slightly bigger partition and mount it on ~/photos. Then, with the rsync command rsync -av ~/photo2/ ~/photos you can copy all your former directory to the new partition. Once it is done, you have to delete your ~/photo2 directory (first by unaliasing your 'rm' command if there is an alias on it):$ alias rm
alias rm='rm -i'
$unalias rm$ rm -r ~/photo2
You can also enter a backslash before 'rm' like '\rm -r' and it will discard the alias.

Then you get more space on your /home partition while having a specialized partition for your photos. Mandrake will ask if you want to save the inclusion of the new partition 'photos' in /etc/fstab, in order to have it mounted at boot, say yes.
If, as soon as you buy a new hard disk, you want to mount the entire disk even if you don't need such a space, then LVM is useless, but if you think that you don't know how your needs will evolve in the future, you can use LVM and design your initial partioning at your current need (I mean just 10 or 30% bigger size than the current occupied space but not 500% bigger) with a big empty LVM partition. Even if you don't create an entire LVM partition but keep some free space, you may later create a second LVM partition and "add" it to your first LVM partition (this can be done with diskdrake too). Then you will see what will grow quicker, will it be /usr, /var/log, /usr/local, /home/foo, /opt or /home/foo/mp3 ?

The main advantage of LVM is also that you can have a volume group (like brouvg here) which, in fact is on two different physical disks (not very useful on laptop with a single disk). LVM can also be used to switch the content of a disk to another disk transparently. You must be able to mount both disks simultaneously. Then the new (bigger) physical disk have to be included in your current volume group by vgextend (see for example http://tldp.org/HOWTO/LVM-HOWTO/) . And before you will remove the former (smaller disk) you will use vgreduce to transfer physically all the partitions from the older physical disk to the new one (it will require some time). On IBM AIX you even could do that online! Here I made it from a booted rescue disk or in single user mode. It is simpler that copying all the partitions to a new disk.

In order to set up LVM, you have to create a volume group (name brouvg here) on a disk with a lot of free space for all your Linux partitions but / and swap have to be standard partitions (you need to have a standard swap partition for resuming after a suspend). Then inside this volume group, you can create logical volumes, i.e. partitions. A volume group has to be set by fdisk with an id of '8e' for Logical Volume partition. Thus, instead of creating many fixed ext3 partitions for /, /usr, /var, /home etc, you can create a small fixed partition of 250Mb for / (including /boot and /etc) and a big LVM parition of 30Gb or more for all other partitions. Here is my current partitioning:

fdisk -l /dev/hda
Disque /dev/hda: 60.0 Go, 60011642880 octets
255 têtes, 63 secteurs/piste, 7296 cylindres
Unités = cylindres de 16065 * 512 = 8225280 octets

Périphérique Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1        1904    15293848+   7  HPFS/NTFS
/dev/hda2            1905        7296    43311240    f  W95 Ext'd (LBA)
/dev/hda5            1905        1936      257008+  83  Linux
/dev/hda6            1937        2573     5116671    b  W95 FAT32
/dev/hda7            3649        7296    29302528+  8e  Linux LVM
/dev/hda8            2574        2674      811251   82  Linux swap
As you can see I have 15Gb for Windows XP (NTFS), 5GB for exchanging data in a FAT32 partition, and a LVM partition of about 30Gb. The / partition is /dev/hda5, the swap is /dev/hda8 and that's all. But inside the LVM partition I have many logical volumes (i.e partitions):
[root@localhost brouard]# lvm
lvm> vgdisplay
--- Volume group ---
VG Name               brouvg
System ID             localhost.localdomain1070056175
Format                lvm1
VG Status             resizable
MAX LV                256
Cur LV                8
Open LV               6
Max PV                256
Cur PV                1
Act PV                1
VG Size               27,91 GB
PE Size               32,00 MB
Total PE              893
Alloc PE / Size       707 / 22,09 GB
Free  PE / Size       186 / 5,81 GB
VG UUID               uYuPBa-6BDP-ScZ1-4zBZ-iAhY-HZJc-kZEb0f

lvm>
Even if Mandrake 10.0 uses by default LVM2, my volume group was created in LVM1 under Mandrake 9.2 . It can be useful to convert it to LVM1 type by doing:
vgconvert -M2 brouvg
and you will be able to import new LVM2 partition into your first partition which is now converted to LVM2.
Here are my mounted filesystems:
[root@localhost brouard]# df -k
Sys. de fich.        1K-blocs       Occupé Disponible Capacité Monté sur
/dev/ide/host0/bus0/target0/lun0/part5
248895    162227     73818  69% /
/dev/mapper/brouvg-5  10288760   6525404   3763356  64% /home
/dev/mapper/brouvg-9   2580272   2165688    414584  84% /home/brouard/Documents/Recherches
/dev/ide/host0/bus0/target0/lun0/part6
5106676   1299640   3807036  26% /home/brouard/echange
/dev/mapper/brouvg-8   3289448   2674484    614964  82% /home/brouard/win
/dev/ide/host0/bus0/target0/lun0/part1
15293844   8661548   6632296  57% /mnt/windows
/dev/mapper/brouvg-4   1193328     33120   1099588   3% /tmp
/dev/mapper/brouvg-2   4031680   2966408    860472  78% /usr
/dev/mapper/brouvg-3    476012    405468     45968  90% /var
You can see that I created a partition for win4lin and some others for the system /usr, /tmp, /var.

Unfortunately you can't have '/' as a logical volume because at boot your system doesn't know how to read Logical Volume Manager partition. Thus your '/' partition must be standard ext3.

If you have a problem at boot (usually simple problems) you will need to enter a rescue disk, but usually you will not be able to access your logical volumes. In order to have access to them, you have to load the dm-mod module (or lvm-mod on Mandrake 9.2 LVM1) by typing modprobe dm-mod and to activate your volume group by (look at /etc/rc.sysinit) typing:

/sbin/lvm2 vgmknodes (it may already be done)
/sbin/lvm2 vgchange -a y
Then you can display your logical volumes by typing lvm lvdisplay and mount them.
On Mandrake 10.1 Official, I have had a problem after unmounting a logical volume group, and it was necessary to do a "lvm vgmknodes" to resize it.
In order to reduce a filesystem which is mounted like /usr or /var and which you cannot umount you have to move to single user mode:
telinit 1
umount /var
resize2fs /dev/brouvg/varlv NB_OF_TOTAL-NEWBLOCK
lvreduce -L-1G /dev/brouvg/varlv
mount /var
e2fsadm which did a contraction of resize2fs and lvreduce doesn't exist anymore with LVM2.

All of this might look difficult at first reading but the alternative of copying and moving partitions to get more contiguous space in order to resize a partition is much harder in my view.
Usually, main problems of configurations are in the '/etc' directory which, in my case, is part of the '/' partition, so you don't need to load the LVM module but if you want to access your '/home' partition you have to verify if your rescue disk includes the dm-mod module and the lvm2 binary. Mandrake first CD can be used as a rescue disk and includes the modules and programs. First PCLinuxOS CD did not.

## 2.18  Rescue disk, antivirus, security

As already said Mandrake fist CD can be used as a rescue disk. Just enter Esc key or F1 key at first splash window. You should get a lilo prompt and then you can enter 'rescue' and return. After the first phase of the kernel boot, you will access to a menu. Most of times you will use one the option of this menu like making a new lilo automatically. Or you can ask to mount the disks (no LVM) and/or get a terminal. One of the advantage of the Mandrake rescue disk is that you can enter a non-english keyboard by entering 'loadkeys fr' or 'de' or what is available.

If you use the rescue disk which corresponds to your kernel version you can probably do sophisticated things like mkinitrd or things like that but in most cases you can use any kind of Live-CD in order to rescue another operating system like Windows.

With a recent version of Live-CD like Knoppix 3.4 you can use the Live-CD in a more sophisticated way that a readonly mode but can also write on your disks (see documentation). Even, your Windows partitions can be mounted in write mode (and NTFS partitions too by using 'captive') and you can apply a free Virus scanner, like clamAVhttp://www.clamav.net/ , to clean a Windows system of a friend. Look http://www.inside-security.de/INSERT_en.html to burn a rescue disk (50Mb which fits on credit card sized CD).

Insert CD is not easy to use for a newbie user but it is very powerful.

Once you have started booting, you type F2 for help as usual on Knoppix, and you enter a different language if you like (no French!) or enter to boot. You will get a light window manager and menus can be accessed by letting the mouse cursor in the main window and using a right click.
Enter a root terminal and type use-captive. This small script will copy (after mounting read-only your /dev/hda1 partition using the standard ntfs driver) from your NTFS partition (which is supposed to be on /dev/hda1) the copyrighted binary files from Microsoft which are on your NTFS partitions (c:\WINDOWS\system32\ntoskrnl.exe and c:\WINDOWS\system32\drivers\ntfs.sys) into the directory /var/lib/captive (which on RAM and not on your hard disk). This script will also unmount your /dev/hda1 drive and remount it using the command mount /dev/hda1 /mnt/hda1 -t captive-ntfs . If your dirve is anything else than /dev/hda1 you have to change it by hand in the script.

Then you can copy whatever file to your NTFS partition. Use their file browser 'emelfm' or 'midnight commander' to browse your files. You can edit them but apparently using ASCII characters only with nano.

To scan your Windows NT partitions for viruses right click on ClamAV super user to load it as root and download the latest antivirus database. Again, they will be stored on your RAM not on your disk. Don't be afraid, start scanning your NTFS partition mounted as /mnt/hda1 .

All these antivirus programs and databases are GPL (free) and very powerful (clamav was ranked 4 recently, before most famous commercial antivirus softwares, in the sense that the 'community' reports more rapidly). Such antiviruses can currently be used only to scan and delete files from an infected partition but it can't detect 'online' the use of a virus. You need to be on Windows for that.

Linux is less vulnerable to virus (no .pif .exe etc which can be clickable) than windows but servers like httpd or any server may be attacked. On Mandrake it is wiseable to use Mandrake Update and to update rpms which are classified as having security problems. It is similar as Windows update but you don't need to reboot.

The Windows GNU version of ClamAV can be accessed either at http://www.sosdg.org/clamav-win32/index.php or, with a GUI, at http://www.clamwin.net/

Be aware that many Live-CDs are not fully GPL and contain proprietary drivers. Knoppix 3.3 is expunged from proprietary softwares (somebody of the Free Software Foundation told me that). These proprietary softwares are freely available, you are not using stolen softwares, but the sources are not available and not GPL licensed. Look at http://www.gnu.org/copyleft/gpl.html) to understand the differences between GPL, LGPL, opensource and other kinds of licences.

On Linux, as on Windows, you will receive by mail a lot of spams, viruses, mails returned because of identity usurpations etc. It is hard to fight against them but you can move more than 95% of these mails in a trash bin. For example, you can use spamassassin to score your mails from 1 to 10 according to various criteria like lack of correct HEADERS in your mails and decide to mark as a SPAM a mail with a score higher than 5 for example. Once these mails are marked by SPAMASSASSIN you can move them automatically to a folder with your favorite mail tool. Do a simple urpmi spamassassin.

You can also filter your mails from attached viruses, mostly if your linux box is a mail server for Windows users. These viruses will not harm on Linux but it is important to delete them for Windows users. I am using Amavis http://www.amavis.org/) which a frontend to clamav. You can even have a software which shows on your web site the chronological histogram of each type of virus like 'blaster' that your received (http://mrtg.uv.es/correo/numclamdmil.html).

If you are interested in the theory of the dynamics of viruses spreaded by mails I gave an oral exam on this subject for a national exam in 2001 in France, just after the spread of the first famous 'I love you' virus, ("Messages électroniques, virus et chaperon rouge" at pages 56-68 of a document that you can access, in French, at http://sauvy.ined.fr/~brouard/enseignement/agreg/Agreg-ss-2000.pdf).

Today many more people are 'vaccinated' in the sense that they know that, under Windows, they should not click on an unsafe attachment. Recent viruses are spreading in another way, by finding a vulnerability in a server (running or Windows or Linux), installing a small program on the host which, from there, will attack other hosts in order to spread.
Antiviruses are inefficient to detect a recent spreading virus, the main solution is to update, before being attacked, your softwares in order to suppress the vulnerability. But if you have been attacked, the safest solution is to make a complete reinstallation of Linux (trying to understand which files have been altered is useless because you will miss something and be revisited soon or later). It can be very quick if you use a standard distribution with rpm packages (or .deb from Debian distribution). Your configuration files (usually in /etc only) will not be destroyed and Mandrake will ask you to check the old and new configuration files. You also need to backup your /home directory regularly. We haven't been successfully attacked since a while on Linux (fingers crossed). But a reinstallation will not alter your home directory (don't ask the installation to format your home partition!) and usually your home partition doesn't interest hackers.

# 3  Running on a Mandrake Cooker recent (July 2004) 2.6.7 kernel (10.1?)

This section is partly outdated today (October 20 2004) but I keep it for Alps touchpad (still not incorporated in Mandrake 10.1 Official), swsusp2 (I don't use it anymore but a standard ACPI swsusp which is working with Mandrake 10.1 Official), ipw2100 which is replaced by ip2200 on some other laptops (do lspci on root to determine which is yours) but I haven't tested it yet.

Standard Mandrake 10.0 Official, even with its latest kernel update, runs on kernel 2.6.3 . And some hardwares, like the Alps touchpad will not work satisfactorily with a kernel prior to 2.6.7. Version 2.6.7 seems to be the future kernel version of Mandrake (and many other distributions) 10.1 . Thus, it looked interesting to try to compile a recent kernel. This can be done by looking on any Kernel-howto www.tldp.org/HOWTO/Kernel-HOWTO.html.
But in order to have a kernel which can be used by other people, I subscribed to the Mandrake cooker mailing list, and discovered that, at least two people, Thomas Backlund and Svetoslav Slavtchev, are offering sources kernel so-called nosrc rpm. They are called nosrc presumably because they do not include the huge main kernel sources which can be downloaded from kernel.org . These packages are very up-to-date, include most of the latest patches and do not have any warranty of booting and working correctly (but do other officical versions have?). When you use Cooker, you are supposed to update regularly all your packages and report bugs to the cooker mailing list. About every 6 months, the cooker directory is frozen and gives birth to a Mandrake release.
There is not detailed documentation on the nosrc rpm and particularly on the kernel.spec but you can read the page of Thomas Bakclund http://www.netikka.net/tmb/Cooker/ which describes how to download and compile the latest kernel. In particular, you can read the latest Changelog, http://www.netikka.net/tmb/Cooker/CHANGELOG-cooker-tmb26 and see if your favourite packages or patch is included or not.
In Thomas Backlund's kernel, Win4lin and ipw2100 were included but unfortunately swsusp2 wasn't. So I looked at Svetoslav Slavtchev changelog http://mandrake.contactel.cz/people/svetljo/mandrake/kernel/CHANGELOG.txt and discovered that swsusp2 was included. It also included the first patch for Alps touchpad.
The idea was just to pick up the official latest sources (before any patch) linux-2.6.7.tar.bz2 at http://www.kernel.org/ and to compile with a command like rpm --rebuild nosrc_rpm_name --with uponly --with win4lin --with swsusp2 in order to build only for i586 (up) with win4lin and swsusp2.

## 3.1  Kernel 2.6.7 without APIC to power off the Z1 (June 2004, partly outdated)

But unfortunately the Sony Z1 will not power off on a kernel 2.6.7 which is compiled with the APIC. The "nolapic" option that made the laptop power off under Mandrake 10.0 (kernel 2.6.3) doesn't work anymore. The unique solution, as reported by a few Sony users, is to compile without APIC. The "noapic" lilo option is not equivalent to a complete rebuild without APIC and the laptop won't power off with the simple noapic lilo option. Svetljo has incoporated this feature (July 20) into his next releases but on kernel-sds18 we can't add option --without apic. And there are other problem with latest version kernel-sds23.

## 3.2  2.6.7 Alps touchpad for auto-dev protocol

I also got a quasi official patch for the Alps touchpad from Dmitry Torokhov by mail, asking me and two other people to test it (see the patch). It is a more general than the former and original patch from Peter Österlund in the sense that you can use, as with a true Synaptics pad, the now standard auto-dev protocol. You don't use anymore the event protocol which required the event number assigned to the pad (from cat /proc/bus/input/devices). Also, if you plugged another mouse, for example an USB mouse, the event of the pad might vary and you would have to change your /etc/X11/XF86Config-4 file accordingly. After suspending/resuming the event number might have changed too. The line # Option "Device" "/dev/input/event1" is thus no more useful.
You can get my current (kernel-2.6.7 patched for Alps and using XFree86, see later for Xorg) /etc/X11/XF86Config-4.
alps.c: E6 report: 00 00 64
alps.c: E7 report: 73 02 0a
alps.c: E6 report: 00 00 64
alps.c: E7 report: 73 02 0a
alps.c: Status: 15 01 0a
ALPS Touchpad (Glidepoint) detected
Disabling hardware tapping
alps.c: Status: 11 01 0a
hub 1-2:1.0: 3 ports detected
input: AlpsPS/2 ALPS TouchPad on isa0060/serio1
the Alps touchpad has also to be recognized by the X server...

On release sds23 (July 19) and after, Svetljo told me that the DI80_alps.patch hasn't been deleted but replaced by the content of "my" DI81_alps.patch .

## 3.3  Synaptics version 0.13.2 and higher

...and you need version 0.13.2 or higher of synaptics. Mandrake 10.0 did not distribute an enough recent version but you can get one on Cooker, like synaptics-0.13.2-2mdk.src.rpm (July 204). In order to find a cooker server, just google rpmfind fr and from there (rpmfind.net/linux/RPM/ just search for "synaptics*" and refine to the "fr2" mirror and enter Mandrake for the System.

## 3.4  Suspend/Resume with swsusp2

As said before, S3/ACPI (suspend to RAM) doesn't work yet, but now some people reported successful suspend to disk with latest swsusp2 patches and script (swsusp creates a /proc/swsusp sub-directory and doesn't use ACPI). In fact swsusp2 is still not stable, and releases have ups and downs and many relaseses will not work. For example, patches 97 and 98 made the Sony Z1 into a non satisfactorily power off state after suspending: everything looked as if it was off but you could not resume by pushing the button. Once the battery was unplugged (and AC adapter) you got a full power off and, from that state, you could resume correctly.
Thus, I was using version swsusps2 until patch 2.0.0.96. And it looks great! The Web site of swsusp2 is http://softwaresuspend.berlios.de/. But the site is very confusing. You can download recent patches at http://developer.berlios.de/project/showfiles.php?group_id=1412 You also need latest hibernate.conf script which you can get from the same developper site. I was using suspend-script-0.93 . You will remark that with current kernel swsusp2 patch (96) you wont be able to get the touchpad mouse resuming correctly. This is a bug in swsusp2:
On Sat, 2004-07-17 at 08:43, Dmitry Torokhov wrote:
> I am inclined to say that it's swsusp2 problem. I briefly looked over
> the code and I could not find a place where device_power_up would be
> called; swsusp2 goes straight to device_resume. This causes system
> devices (and i8042 is currently a system device) not be resumed and
> thus your touchpad is left id default PS/2 hardware emulation mode.
and Nigel Cunningham (swsusp2) replied that it will be incorporated soon.
Currently, the workaround consists in unloading psmouse (first) evdev (at second) before resuming and to reload them in reverse order after resuming. This can be made by adding
in file /etc/hibernate/hibernate.conf
In fact Nigel did not incorporate the required code, and I am no more using swsusp2 (October 2004) but a standard S4/Acpi which is working with latest kernel 2.6.8 which Mandrake 10.1 Official is using.

## 3.5  ipw2100 for 802.11b (and now ipw2200 for 802.11bg)

In order to get ipw2100 (Centrino wifi) you need to patch your kernel and to get the corresponding software (I made a local copy of the binary because the src was not accessible on cooker ipw2100-0.44-1mdk.i586.rpm).
With my Mandrake 10.0 installation (with kernel 2.6.7 only, no other update)) I have been obliged to break some dependencies and did:
# rpm -ivh --nodeps ipw2100-0.44-1mdk.i586.rpm

Mandrake 10.1 Official incorporated ipw2200 in its kernel but I haven't tested it yet because I don't have the hardware (but it has been reported to work on Sony Z1XMP series). Both modules might merge in the future.

Documentation is available at http://ipw2100.sourceforge.net/README.ipw2100 In order to have your wifi working you should setup a file named /etc/sysconfig/network-scripts/ifcg-eth1 which should look like:

DEVICE=eth1
BOOTPROTO=dhcp
ONBOOT=yes
ESSID=BRTRY25TYU
KEY="restricted[1] e15de61021"
where the ESSID and KEY should correspond to yours and not to this example.

To make the connection, you must:

• Verify that the module is loaded lsmod |grep ipw an if nothing comes, load the modules with modprobe ipw2100 and check again if loaded.
• You should be able to see something with the command: iwconfig and also with command ifconfig where eth1 (or wlan0) should appear.

If your device is here, then a simple ifup eth1 will setup the device and make the connection. In my example I am supposing that my network have a DHCP server (which can be a PC or a simple router/nat/adsl/dhcp server/ box).

• To suppress your wired connexion simply typeifdown eth0 and unplug the RJ45. If you are doing some testing, you will have to unset the wired connection before setting the wireless connection, otherwise you will get some conflicts.

To stop the wireless connection do again an ifdown eth1. If ifconfig still shows eth1 (wlan0), kill the process ifplugd (I don't know exactly what this process is doing [yes, trying to detect if some new material is plugged or unplugged]).

To unload the module do modprobe -r ipw2100. And you are back to the earlier state.

If you want to save power you should add other options to wlan. I am not very familiar with wireless so please tell me.
If you don't use bluetooth you save your battery by unsetting bluetooth via spicctrl --setbluetoothpower=0 (on root). But I don't have any bluetooth device to test them but some other people have reported successful use of bluetooth devices.

## 3.6  Downloading kernel 2.6.7 binary and src rpm for Win4Lin, swsusp2, NOAPIC, ipw2100

This section can be skipped (and will be removed) because Svetljo did apparently stop his activities and do not propose (October 2004) any 2.6.8 or 2.6.9 kernels).

As mentioned earlier I rebuilt, from Svetljo nosrc rpm, a kernel distribution which incorporate Win4lin, swsusp2 (until 96 patch), NOAPIC (in order to power off) and ipw2100 (centrino wifi). You can look at the config-2.6.7.txt, get the sources rpm at kernel-swsusp2-2.6.7-1.sds.31mdk-1-1mdk.src.rpm and the binary at kernel-swsusp2-2.6.7-1.sds.31mdk-1-1mdk.i586.rpm So, just download the binary and install it with rpm -ivh kernel-swsusp2-2.6.7-1.sds.31mdk-1-1mdk.i586.rpm on root. Don't use the -Uvh option (update) because if there is a problem in the kernel and if you can't boot this kernel you will still be able to boot with your previous kernel. If you get an error at installation, look at your /etc/lilo.conf to see if the new kernel is correctly set and in /boot. In my case here is my lilo section concerning kernel 2.6.7:

image=/boot/vmlinuz-2.6.7-1.sds.31mdk
label=267-1sds31
root=/dev/hda5
optional
vga=788
append=" devfs=mount splash=silent acpi=on resume2=swap:/dev/hda8"
initrd=/boot/initrd-2.6.7-1.sds.31mdk.img
Look at /boot to see if the image and initrd are there. Verify that the symbolic links of the default kernel at boot are still pointing to your former kernel. Here is the section of my former Mandrake 10.0 official kernel (patched for Win4Lin too).
image=/boot/win4lin-2.6.3-13mdk
label=263-13w4l
root=/dev/hda5
optional
vga=788
append=" nolapic devfs=mount splash=silent acpi=on resume=/dev/hda8"
initrd=/boot/initrd-win4lin-2.6.3-13mdk.img

All the above details are standard to kernel updates but there are many bugs reported with installkernel.
Please let us notice that with swsusp2, the syntax for the swap partition (here /dev/hda8) has changed and is resume2=swap:/dev/hda8 .
If you want to boot without resuming or if you can't resume correctly, you have to enter the additional noresume2 option at boot time. In order to do this, just at the lilo prompt type on Esc and enter your kernel and noresume2 (here 267-1sds18 noresume2)

Some people make a copy of the section, name it noresume2, and add the noresume2 section in the option line.
In order to test your lilo.conf file you can make lilo -t, it won't rewrite your master boot record, just test your lilo configuration file.

If you have difficulties to get the ethernet card running please verify that the eepro100 module is loaded. Otherwise load it (modprobe eepro100) before ifup eth0

If you have difficulties with powernowd and the new kernel 2.6.7 verify that the cpufreq-userspace module is looaded (lsmod |grep cpufreq and load it.

# 4   Mandrake 10.1 Official

## 4.1  Nolapic patch

Mandrake 10.1 Community was very buggy and needed to be upgraded with cooker. Latest kernel is 2.6.8-20mdk (November 2004). Unfortunately it doesn't incorporate a very recent patch which allows to use the nolapic feature in order to power off the Sony. It will probably be included in a next release. So, I build a patched kernel and you can get the corresponding rpm from this site.

I also included the Alps touchpad patch (the full patch of Dmitry) but also the sonypi patches which lets the sonypi module suspend and resume correctly.

## 4.2  New sonypi module

Dmitry Torokhov proposed some patches to make sonypi resuming correctly either under swsusp2 or swsusp1. The patches were against a 2.6.9 kernel http://lkml.org/lkml/2004/10/25/154. I tested them against 2.6.8.1 but /dev/sonypi did not react correctly to Fn keys.
Meanwhile Stelian Pop (the maintainer of sonypi) modified Dmitry's patches and they are now filed (signed by Linus Torvald) into kernel 2.6.10-xx (http://lkml.org/lkml/2004/10/28/87). I compiled them with kernel 2.6.8.1 in order to have a kernel which will not differ too much from Mandrake 10.1 Official kernel. In addition to Dmitry's patches, it introduced and needed kfifo.c and a macro roundup_pop_of_two which I grabbed from Linux Kernel Mailing list as additional patches.
You can get the patches at the following URLhttp://sony.ined.fr/~brouard/sony/patches

In order to be able to use Win4lin I also included the mkiadapter 1.3.7 patch and _Kernel-win4lin-2.6.8.1 patch.

Let me remember how to get this new binary and src rpm. First download kernel-2.6.8.1.20-1-1mdk.src.rpm from a Mandrake mirror server on your local directory like ~/RPMS/. You should never act as root but as a user login. Install the src by doing rpm -ivh kernel-2.6.8.1.20-1-1mdk.src.rpm. It will expand kernel-2.6.spec on ~/rpm/SPECS/, linux-2.6.8.1-q20.tar.bz2 (patches and scripts) and linux-2.6.8.1.tar.bz2 (standard kernel sources) on ~/rpm/SOURCES (some additional README files can also be expand there).
In order to add a patch, you have to untarred the patches by doing, from ~/rpm/SOURCES tar jxvf linux-2.6.8.1-q20.tar.bz2. Then, rename the directory ~/rpm/SOURCES/2.6.8.1-q20 created as ~/rpm/SOURCES/2.6.8.1-q20yourinitialsyourversionw4l (w4l stands for Win4lin but you can supress it if you don't need it) and add the first 4 patches CA52-1_nolapic.patch and DB19_alps-0136.patch (and ZZ83_mki_adapter26_1_3_7.patch and ZZ84_Kernel-win4lin-2.6.8.1.patch for win4lin.
Under kernel 2.6.8 you will also need sonypi-268-269 reverse patch which makes the transition for sonypi.c and sonypi.h back from 2.6.9 to 2.6.8 (minor patches) in order for other patches to apply. sonypi_rppwoftwo-kernel and sony-kfifo are the missing codes of the new functions introduced in 2.6.10 for sonypi. They are 8 additional patches for sonypi named sony-18 up to sony-88.

Meanwhile, it has been reported that S3/ACPI (ie suspending to RAM) was partly working on kernel 2.6.9, thus I tried to incorporated the latest and final ACPI patches against 2.6.8 (some patches were already incorporated in Mandrake 10.1 Official patches and have been removed from ACPI patches). We are close to have S3 resuming correctly but there is some magic missing in 2.6.8.1 which is incorporated in 2.6.9. The ACPI patches do hot harm. All the patches for 2.6.8.1-mdk are there.

Now you should tar bzip2 the directory and give it a new name:

cd ~/rpm/SOURCES/
tar jcf linux-2.6.8.1-q20nb1w4l.tar.bz2
Edit kernel-2.6.spec and update mdkrelease by %define mdkrelease 20nb1w4l pr whatever name you gave for your initials (nb here) and version (1 here). Go at the end of the spec file, to the %changelog section and the new date, your name and your email and a few sentences explaining the patches.
Now you are able to compile:
cd ~/rpm/SPECS
rpmbuild -ba kernel-2.6.spec --without smp --without secure --without enterprise \
--without BOOT --without i586up1GB --without doc --without source
and wait for a long time until finished (45 minutes on a 3GHZ). You will get the new binary on ~/rpm/RPMS/i586 and the new src on ~/rpm/SRPMS/.
If you want to get the source and source-stripped, suppress the "--without source".

In order install the new kernel you must be root and do:

rpm -ivh ~/rpm/RPMS/i586/kernel-2.6.8.1-20nb1w4lmdk.rpm
Please check that file /etc/lilo.conf has been updated correctly and run lilo -q to see if your former boot option is still here in case of a problem. You must update the lilo.conf by adding the "nolapic" option as below.

You can also get the rpm from this site: link to kernel-2.6.8.1.20nb2w4lmdk-1-1mdk.i586.rpm and to kernel-2.6.8.1.20nb2w4lmdk-1-1mdk.src.rpm.

## 4.3  A 2.6.9 kernel

I collected some patches at patches/2.6.9-nbmdk in order to get a Mandrake kernel. But it is not completely working. Ipw2100 and ip2200 patches ara against 2.6.8 and have to be updated.

## 4.4  Udev instead of devfs

Mandrake 10.1 uses udev instead of devfs. Thus, devfs has to be removed. Be careful to suppress devfs=mount in lilo.conf . Here is my new lilo.conf section:
image=/boot/vmlinuz-2.6.8.1-20nb2w4lmdk
label="2681-20nb2w4l"
root=/dev/hda5
initrd=/boot/initrd-2.6.8.1-20nb2w4lmdk.img
append="nolapic acpi=on resume=/dev/hda8 splash=silent"
vga=788
Even if udev (from IBM) seems more powerful to assign dynamically devices (/dev), we probably have to change some configuration files. For example, in order to sync my pilot I changed /dev/usb/tts0 with /dev/USB0 . Just look at the syslog when syncing and you will see that the Pilot is recognized on a Kernel device ttyUSB0.
But you could also changed it to /dev/tts/USB0 because if you edit /etc/udev/rules/01-devfs.rules you will see:
KERNEL="tty",		NAME="%k",		SYMLINK="vc/0 tty0"

## 4.5  Standard swsusp S4/ACPI Suspend to disk

As you can understand from former comments, I am back to standard swsusp and did not build a 2.6.8 kernel with swsusp2. The reason is that swsusp2 and swsusp have partly merged and will merge completely in the future. And the current kernel implementation of S4 acpi is working quite nicely now. Just doing echo 4 >/proc/acpi/sleep will suspend to disk nicely and resume if your swap partition is declared as "resume" into lilo.conf (or grub).
Please note that the new standard way of resuming to disk is
echo  shutdown >/sys/power/disk; echo  disk > /sys/power/state
but it works similarly.
As time doesn"t resume correctly and some other modules like usb-storage are not very safe for resuming, we need a script which currently is (/usr/local/sbin/hibernate:
#/bin/bash -x
#

#laptop-mode stop

service usb stop
modprobe -r usb-storage
modprobe -r usbhid

hwclock --systohc
sync

echo Suspending....

echo 4 > /proc/acpi/sleep

# let's resuming
echo Resuming!

hwclock --hctosys
# sleep 1

service usb start
You may use a more sophisticated script. Mandrake 10.1 Official gives one into suspend-scripts but I prefer the script used by swsusp2 which I slightly changed to suspend with echo 4 > /proc/acpi/sleep instead of echo >/proc/swsusp/activate .
Bernard Blackham posted a new 1.01 version (November 2004) of his script which includes the possibility of suspending to ram and to disk using standard swsusp. See the corresponding section on hibernate-scripts.

## 4.6  Standard swsusp S3/ACPI Suspend to RAM

Suspending to RAM (it means that the laptop is still consuming some of your battery) wasn't possible (http://bugme.osdl.org/show_bug.cgi?id=1730) until November 2004. But, Nils Spengler pointed us to this new link http://bugme.osdl.org/show_bug.cgi?id=3670 where you can get ACPI/S3 working with a 2.6.9 kernel using a video_post tool if your card is a radeon card.
I tested (not fully tested) a 2.6.9 kernel and suspend to ram is working fine with the command:
chvt 1 &&  echo mem > /sys/power/state && /usr/sbin/video_post && chvt 7
as well as suspend to disk. New command (equivalent to S4) is:
echo  shutdown >/sys/power/disk; echo  disk > /sys/power/state

## 4.7  hibernate-scripts rpm for Mandrake, video_post, susptoram and susptodisk

Among the various scripts that you can find on the Internet for suspend to disk or to ram, Bernard's Blackham scripts which were originally included in swsusp2 belong the top scripts.
His scripts will include various types of suspension. You can access his latest scripts at http://dagobah.ucc.asn.au/swsusp/script2.
On November 23 2004, latest version 1.0.1 includes some new scriptlets for standard swsusp (instead of swsusp2).
I added two keywords (scriptlets) "UseSysfsPowerDisk shutdown" and "UseVideoPost yes" and built a Mandrake rpm which includes video_post and two new commands susptoram and susptodisk (Bernard told me that he will probably give other names like hibernate-to-disk and hibernate-to-ram and I will adapt my rpm). By default the command "hiberate" is assigned to suspend to disk using swsusp2.
This hibernate-scripts-1.0.1-2mdk.i586.rpm rpm also installs susptodisk, susptoram and hibernate as PAM console in order to let them being executed by a non root user.
Doing hibernate -h will give most information. You can also use the man pages: man hibernate and man hibernate.conf. I added a man susptoram and susptoram.conf.
Both susptodisk and susptoram are simple scripts related to hibernate:
hibernate -F /etc/hibernate/susptodisk.conf
and
hibernate -F /etc/hibernate/susptoram.conf
• For suspending to ram, the configuration file includes at least:
UseSysfsPowerState mem
### modules
### xhacks
SwitchToTextMode yes
# UseDummyXServer yes
UseVideoPost yes

The latter UseVidePost can be commented for Intel video card. But for radeon cards such as on a Sony Z1RMP, it seems to be mandatory. With video_post you can't use framebuffer and the vga=788 or whatever option has to be removed in your lilo or grub. In addition you must set the LCD expansion to "no" in your bios (type F2 at boot). Your screen will be smaller but, you will be able to work on your vt console.
The SwithToTextMode simulates chvt 1 and chvt 7 (which you can simulate manually by CTL_ALT_F1 and abck to X windows with CTL_ALT_F7.
About modules to unload before suspending, the list is not exhaustive and will change because modules are getting patched for resuming. I haven't used the option "UnloadBlacklistedModules yes" which refers to a file named /etc/hibernate/blacklisted.modules where Bernard records each problematic module according to its own version and to kernel version. I think that this file it is more specific to swsusp2. (For example evdev still doesn't resume correctly with swsusp2 but resumes correctly with swsusp).
• For suspending to disk, the configuration file, susptodisk.conf, includes at least:
UseSysfsPowerDisk shutdown
UseSysfsPowerState disk
### clock
SaveClock yes
### modules
UnloadModules usb-storage usbhid usblp ehci-hcd uhci-hcd battery ac usbkbd
### xhacks
# SwitchToTextMode yes
# UseDummyXServer yes
# UseVideoPost yes

SaveClock is still mandatory on 2.6.9 kernel.
There are many other options like bootsplash which I haven't deeply tested yet.

Andre Roth proposed to link susptoram to Fn_Esc. Therefore, I made a newer version of sonyxosd rpm with this new link. I also changed the "hibernate" name to "susptodisk". It is no more useful to use "sudo hibernate" because of PAM.

## 4.8  PAM

On Mandrake as probably on some other distros, many commands use PAM in order to be executable by non root users. Examples are halt, poweroff, shutdown etc.

The real command, hibernate, susptodisk or susptoram, should reside on /usr/sbin (or /sbin) which are not in the path of a standard user (and thus non responding when typed).
You need to add a file named respectively hibernate, susptodisk and susptoram as a link to consolehelper in /usr/bin:

cd /usr/bin
ln -s consolehelper hibernate
ln -s consolehelper susptoram
ln -s consolehelper susptodisk
Then you need three other (identical) files, respectively hibernate, susptodisk and susptoram files in /etc/pam.d/:
cat /etc/pam.d/hibernate
#%PAM-1.0
auth       sufficient   pam_rootok.so
auth       required     pam_console.so
#auth       required    pam_stack.so service=system-auth
account    required     pam_permit.so

And your /etc/security/console.apps need again three files hibernate, susptoram and susptodisk:
cat /etc/security/console.apps/susptoram
#USER=root
PROGRAM=/usr/sbin/susptoram
#GUI=true
#FALLBACK=false
You need to restart the service saslauthd, by doing service saslauthd restart, in order to be able to launch susptoram, susptodisk or hibernate as a non-root user.

## 4.10   Sonyxosd

I am using sonyxosd (http://www.sony-tools.homeunix.net/sony.html#sonyxosd) which I prefer to sonypidd and I built an experimental rpm for it sonyxosd-1.3.0-1mdk.i586.rpm with sources sonyxosd-1.3.0-1mdk.src.rpm. It needs some Perl modules to run, but you can get them with cpan if they are not in rpm. XOsd might not always work if you X server doesn't support some features like XShape Extension but it will work without On Screen Display. Also, after suspending and resuming some X modules were not active anymore, so I am used not seing the bar codes of sound volume or brightness level on the X screen. I slightly changed the code in order to get FN_F7 functioning as on Windows with the sequence LCD -> LCD&CRT -> CRT.
cpan X11::Protocol
cpan X::Osd
cpan Term::ANSIColor
cpan Term::Size
cpan Term::ANSIScreen
And for XOsd I also needed libxosd2-devel to get the included files needed by the installation launched by cpan.
As a service, /usr/local/sbin/ is not in the path, so I have had to harcode some not enough standardized tools like /usr/local/sbin/hibernate in the file /usr/sbin/sonyxosd.
If you want to debug such a tool, you should probably insert the debug option into the perl script and suppress the "daemon" option in file /etc/rc.d/init.d/sonyxosd, in front of the line launching sonyxosd.
For an unknown reason it was necessary to add a sleep 1 after loading module sonypi.

## 4.11  Xorg instead of XFre86

Xorg is now the X11 server for all distros. I have had difficulties at installation because the script created an XInput section, probably because of the unrecognized Alps touchpad. With the Alps kernel patch described earlier, Xorg recognized the Alps if you load Synaptics and the auto-dev mode. The standard configuration file is no more XF86Config-4 but Xorg.conf . But there is a symbolic link to XF86Config. Here is my current xorg.conf-alps.txt. The Alps touchpad and an external USB mouse are working together with different protocols. On a browser like galeon or better mozilla-firefox you can try to hold the Ctrl Key and roll the mid button of your external USB mouse. It will enlarge or decrease the size of the fonts of the web page. On the Alps touch pad, the roll button can be reach by sliding with your finger on an extreme right and thin vertical band. Thus holding the Ctrl button and right sliding will increase or decrease the size of a web page. Many Web pages are not correctly set and are unreadable if the size is increased.

## 4.12  Gnome 2.6 Spatial view of Nautilus

Some people decided that the modern view of browsing your files http://www.bytebot.net/geekdocs/spatial-nautilus.html should be in a so-called spatial view! Why not? But if after a week you are not able to think this way (http://nils.jeppe.de/Geek/559/osnews-why-users-blame-the-spatial-nautilius)then you can go back to former property by using gconf-editor (not on root) and apps/nautilus/preferences and set always_use_browser to true. Reload Nautilus and it should work. I think that you can't access to this parameter with gnome preferences//. This spatial view has been installed by default with gnome 2.6.

# 5  Conclusion

Most of the features of this laptop are running on Linux, using a vanilla Mandrake 10.1 Official install (centrino, cpu varying frequency, use of a replicator, switch from an LCD to video projector even in 1400x1050, usb mouse, usb memory card), but you will not be able to power off!
Mandrake 10.1 Official uses kernel 2.6.8 which includes many ACPI kernel patches for last summer. With a standard Mandrake 10.1 kernel, you are now able to suspend-to-disk (S4/ACPI). But you have to push the button for a few seconds to power off!
Also, the touchpad is still not recognized correctly with kernel 2.6.8 (Mandrake 10.1 Official). The sonypi module will not resume correclty. Patching your kernel seems to be mandatory.

If you decided to patch your kernel in order to be able to power off (nolapic option will not work on a standard Mandrake kernel), to use the Alps touchpad, to resume correctly after suspending to disk (without unloading sonypi), you can download a binary rpm from this site or even build it yourself with the given patches (you can also download a kernel including also the win4lin patches).

If you need to suspend to disk, you will need a 2.6.9 kernel. There is currently (November 23 2004) no Cooker 2.6.9 or 2.6.10 kernel, and you will have to build one yourself from a vanilla kernel.

In summary, here are the main features and packages that you can get from this site in order to make most of the hardware of your Sony Z1 working. It is mostly based on a Mandrake distribution but all the sources codes can be accessed either on this site or elsewhere (URL are given) and can be used by other distributions. Some of the new packages from this site http://sauvy.ined.fr/~brouard/sony/rpm/ (most of time I only made the packaging, without writing original source codes) are already accessible from Mandrake contribs.

• In order to resume and suspend to disk, you need a special hibernate script (look above at the corresponding experimental section).
• Your Sony Z1 laptop will be able to power off because this 2.6.8 kernel is patch to allow the "nolapic" option at boot.
• Your touchpad (Alps) will work correctly even if your hands tap the pad because this new kernel is correctly patched; but you will need to install synaptics software (version > 0.13-2) (see above for details) and make some changes to the /etc/X11/xorg.conf file.
• Brightness, sound, switch from LCD to external VGA, Fn buttons, can be accessed with the sonypidd package or the sonyosd package.
• You will be able to switch automatically your cpu frequency according to your cpu load by using powernowd.
The Sony Z1 is a fantastic laptop with up to 5 hours autonomy (to be honest, 5 hours autonomy can be reached on Windows but concerning Linux, 3 to 4 hours autonomy is more realistics). Mandrake 10.1 Official is one way of setting most of the features but a few things have still to be done by hand.

We hope that these pages will be useful to happy owners of Sony Z1 or of similar laptops. But our most important hope is that this page will help developpers of most common Linux distributions, like Mandrake, to incorporate in a next release all these features so that this page will be completely obsolete (fortunately it is getting obsolete).
We apologize for any mistake or error and ask for comments in order to improve and update these pages.

We decided on July 1st with a few other happy Z1 owners (Craig de Forest, Cyril Wattebled, Ionut Georgescu and Leonardo) to setup a special mailing list named linux-sony-z1 chez listes point ined point fr . As usual you can subscribe by sending a mail to linux-sony-z1-subscribe at listes dot ined dot fr (and -unsubscribe for unsubscribing). Archives are publicly accessible at http://listes.ined.fr/wws/arc/linux-sony-z1 .

Nicolas Brouard
brouard at ined dot fr

Here are some addenda which will be probably removed.

# 6   Appendices

These sections are out of date sections, but which might still be useful for some times.

## 6.1  Addendum July 20 2004

Svetoslav Slavtchev have upgraded his kernel src up to version 23. Unfortunately swsusp2 patch 100 which was supposed to correct bugs introduced in patches 97 and 98 did not compile correctly (I haven't tested) and he revert to 98. He couldn't revert to 96 which it did not compile with his new gcc-3.4 . So this kernel is not useable (it won't power off correctly after suspending and won't resume).
So the solution, probably better than reproducing what I did with version sds18, is to download kernel-sds-2.6.7-1.sds.23mdk-1-1mdk.nosrc.rpm from http://mandrake.contactel.cz/people/svetljo/mandrake/kernel/ and to suppress both wrong patches, geht a kernel-sds-2.6.7-1.sds.23mdk(without_patch_swsups2_97_and_98)-1-1mdk.nosrc.rpm and do the following command:
rpm --rebuild kernel-sds-2.6.7-1.sds.23mdk(without_patch_swsups2_97_and_98)-1-1mdk.nosrc.rpm --with uponly --with win4lin --with swsusp2 --without apic
and you will get the binary in your ~/rpm/RPMS/i586/ directory.
Svetljo added: if you need kernel-source (e.g. for nvidia or ati closed drivers) replace "--with uponly" with "--with upsource" and only the standard kernel + kernel source will be build

But in order to get a new "nosrc" rpm, you need to:

• install (as non root) the nosrc rpm with command
rpm -ivh kernel-sds-2.6.7-1.sds.23mdk-1-1mdk.nosrc.rpm
and you will get ~/rpm/SPECS/kernel-sds.spec for the SPEC file, ~/rpm/SOURCES for all sources and patches. You still have to download the "linux src", file linux-2.6.7.tar.bz2 from http://www.kernel.org (click on the F for a full download) and store it in ~/rpm/SOURCES .
• Among the useful sources and patches (listed in the .spec file) you will find a file named ~/rpm/SOURCES/linux-2.6.7-q1.sds23.tar.bz2 which will contain most of the patches of Svetljo (until version 23).
• Untar this zipped file (tar jxf filename), go to the swsusp2 subdirectory of directory 2.6.7-q1.sds23/ and delete (or move elsewhere) both wrong patches 97 and 98 to revert to 96 (AS10_30-software-suspend-core-2.0.0.96-whole.patch only), delete both corresponding symbolic links in subdirectory patches.
• Tar again to get a newer version.
• Do a full rebuild with command rpmbuild -ba kernel-sds.spec and you will get the new nosrc (I haven't done it myself on this version and I am not sure if the .spec archived will produce the nosrc, look at it first). The full rebuild makes various kernel versions. On a 3GHZ Pentium 4, the full rebuild for uponly (i586 hardware) last about 50 minutes.
• If you are more curious, looking back at ~/rpm/BUILD you will get a kernel-swsusp2 directory (this is the name given if you nuild with option --with swsusp2) and at least two sub-directories. The first one contains all of the patches (named 2.6.7-q1.sds18/) and the second, named linux-2.6.7/, is the kernel tree (just patched by the rpmbuild command).
• For non Mandrake users interested in the patches, I think that you can just do a rpmbuild -bp kernel-sds.spec to expand the tar.gz and look at the patches in directory ~/rpm/BUILD/kernel-swsusp2/2.6.7-q1.sds23/ Nothing won't be compiled.
Be aware that, at this stage (after -bp), even directory 2.6.7-q1-sds23/ has been patched (configs files at least) and is no more identical to file ~/rom/SOURCES/linux-2.6.7-q1.sds23.tar.bz2 .
Thus, if you add a patch, for example, a new forthcoming patch for i8042 file (to have a correct suspend/resume with synaptics or Alps as Dmitry Torokhov suggested and Nigel Cunningham agreed), then you have to expand ~/rom/SOURCES/linux-2.6.7-q1.sds23.tar.bz2 and insert the patch at the correct place. At last, you probably have to rename the directory differently (I haven't done it myself for sds18) and archive it again with tar jcf and rebuild to get a new src and binary rpm.

## 6.2  Addendum September 16 2004

I am currently using kernel version sds-31 of Sveltjo. Swsusp2 is working fine most of time, even if win4lin is loaded and if the sony is set into his replicator. Sometimes it hangs on resume and it means that I have to boot again with the option 'noresume2' by typing ESCAPE at lilo window to get the lilo prompt and entering "linux noresume2" in order to boot the "linux" kernel (real name is "267-1sds31") while passing noresume2 to the kernel. With this kernel version even if you were playing music before suspending, it will continue to play after resuming.
Software suspend 2 can't be considered as safe but if you save all you files before suspending then you can use it it without risk but at the price of a complete reboot (currently 1 out of 10 suspend/resume) which is nothing more than if you stopped your computer.
I have a bug with win4lin and can"t access the network with their kernel patches (included into Sveltjo kernel: kernel-swsusp2-2.6.7-1.sds.31mdk-1-1mdk.i586.rpm

## 6.3  Mandrake 10.1 beta is (was) out

Since early September Mandrake 10.1 is out but it concerns kernel 2.8 . I think that it is compiled with "apic" and I haven't been able to shut the computer even with the "noapic" kernel option. Swsusp2 is not included in this kernel 2.8 (will be soon, I have heard). Dmitry Alps kernel patch is still not included in the official kernel patches, neither 2.6.7 nor 2.6.8 (and I don't know the reasons). I haven't tested the win4lin 2.6.8 kernel patches too.
So I am using sds31 with kernel 2.6.7 and will upgrade to 2.6.8 when Svetljo will provide his own version of kernel 2.6.8 including alps, swsusp2 and win4lin patches.
$Id: index.htm,v 1.38 2004/11/24 00:15:49 brouard Exp$