Tuesday, October 28, 2014

Project -- Revitalizing an old Asus Eee PC

I was recently given a disused Asus Eee PC model 701SD with a view to making it usable again, because it was very slow. The Eee PC 701SD comes with a Celeron M processor up to 900 MHz, 512 MB DDR2, 8GB of early (2008 era) SSD storage and a 7" 800x480 screen (although the netbook is physically larger than 7" with a big border including speakers around the screen), and Windows XP installed. The device has 802.11b/g WiFi, an Ethernet port and VGA output.

This Asus Eee PC model provides convenient hardware upgrade options

Although some Asus Eee PC models originally came with a version of Linux installed, this particular model (dating from about 2008) came with Windows XP installed on the internal early Phison 8GB SSD storage device. However, as I received it performance was slow probably because of severe speed limitations associated with the early SSD model. Also, limited RAM and the fact that the storage space was almost full contributed to bad performance.

One of the first things I did was to assess to what extent the hardware could be physically upgraded. There is a convenient panel on the bottom of the device that gives easy access to the DDR2 SO-DIMM module and the SSD storage device. I replaced the 512MB DDR2 module with a 1GB one (333 MHz DDR2-667), which should be a big boost.

However, I am not certain the memory is running at the optimal speed. The BIOS seems to configure it running at about 150 MHz (DDR-300 effective) which may reflect a power saving state. Asus includes a Hybrid Engine driver in Windows XP that may regulate the RAM frequency as well as the CPU frequency. Because of this, it is possible that RAM is stuck at a low speed when running Linux.

The internal SSD is easily removable and it looks like it is connected using some kind of IDE-like interface. I have read the device may use a CompactFlash-compatible interface so that installing a more recent CompactFlash storage device may significantly increase performance. There is supposed to be room and board space beyond the cover area to accommodate a fairly large device.

Windows XP slow, but somewhat improved after optimization

I flashed the BIOS to the lastest available version, and after cleaning up the XP installation by removing unnecessary applications and cleaning up temporary files, I updated most of the Windows device drivers for the various hardware devices. However, the drivers that are still listed on the Asus website do not seem to be the most recent versions in many cases. I was able to breath new life into the WiFi chip by downloading an updated driver from Realtek. Overall, the slowness of Windows XP seemed to be improved somewhat.

Linux Mint Mate seems a good match for a netbook

For running Linux, I picked Linux Mint 17 Mate. I have good experiences with the more demanding Cinnamon variant of Linux Mint, and although Cinnamon does not put high demands on hardware, the Mate desktop is supposed to be considerably more lightweight and does look and function well. The main drawback of Mate would be limitations caused by the continuing use of the GTK+ 2.x libraries instead of the current GTK+ 3.x, although I have yet to encounter such limitations on this system.

I believe there is little against porting desktops such as Mate to GTK+ 3.x, because the perceived heavy overhead associated with GTK+3/Gnome is much more associated with the Gnome desktop environment rather than the underlying low-level GTK+ 3.x libraries. I have in the past happily run GTK+ 3.x applications in a GTK+ 2.x desktop environment on a relatively slow ARM-based device with few repercussions for speed or memory use.

I installed Mint on an SD-card, which can conveniently be inserted into the netbook' s card reader. Although the BIOS can be instructed to directly boot from the SD card or an USB stick, I let the USB stick-based installer install grub on the boot record of the internal SSD, so that Linux and Windows XP are now selectable at boot without going into the BIOS, as long as the SD card with  Linux is kept inside the SD card slot.

Despite the netbook's relatively small 7" 800x480 screen, Linux Mint Mate looks pretty good, and menus generally fit on the screen after setting the DPI to the lower value of 80. Performance was already much better than under Windows XP.

Optimizations to reduce and speed up disk (write) access

However, system performance was clearly affected by delays associated with regular and excessive disk access. After some research on the web, I came with the following set of mount options for the ext4 root filesystem in order to improve performance (modified in /etc/fstab):
UUID=nnnn / ext4 noatime,journal_async_commit,data=writeback,barrier=0,nobh,errors=remount-ro 0 1
I also changed the physical flag for journal_data_writeback mode, stored in the filesystem itself:
    tune2fs -o journal_data_writeback /dev/sdXn
where sdX is the SD card device. These changes certainly seem to improve performance a lot, allowing it to reach an acceptable level, even though the used SD card (8GB standard Class 10 HC 8GB dating from 2013) is not very new or particularly fast.

Although these filesystem options have the potential to jeopardize stability and recoverability somewhat in case of system crash or power interruption, the fact that the device is battery-powered provides considerable insurance.

Using ramdisk for tmp directories

I moved the /tmp and /var/tmp directories to a ramdisk by adding the following lines to /etc/fstab:
    tmpfs    /tmp       tmpfs    defaults    0 0
    tmpfs    /var/tmp   tmpfs    defaults    0 0

Moving application cache directories to ramdisk

Applications like browsers and window managers that use a disk cache may conform to the XDG Base Directory Specification standard. In that case, the environment variable XDG_CACHE_HOME defines the directory where local temporary cache files are stored. By setting this variable to a ramdisk location, it is possible to significantly speed-up the performance of certain browsers that are otherwise affected by heavy writing to the disk-cache on the flash device. This can be accomplished by creating a new file in /etc/profile.d/, for example /etc/profile.d/xdg_cache_home.sh, that will be executed at the start of every shell.
    export XDG_CACHE_HOME="/dev/shm/.cache" 
Note this may not affect the main internet web content cache with certain browsers (such as Firefox), speeding up other types of cached information instead, while it does cause the main internet content cache to be stored on the ramdisk in the case of the lightweight browser Midori. In the case of Firefox, it can be beneficial to reduce the internet cache as much as possible (down to 8MB or zero), since extra network access (as long as it fast enough and not associated with extra cost) likely to be faster than the constant writing to the internet content cache on the flash card that otherwise happens. In the case of Midori, the internet cache directory on the ramdisk can build up in size, affecting free RAM, which can be fixed by instructing the browser to empty the internet cache on exit.

Reducing/eliminating system logging

System logging is also configured to be pretty active out of the box with Linux Mint 17 Mate. The system logger is rsyslog, and the rules it uses are stored at /etc/rsyslog.d/50-default.conf in Mint. Although Mint does not enforce synchronous log updates (the dash in front of the log file means syncing on update is omitted), several logs are still being kept. Although kernel logs can be useful, the dmesg command is also able to log kernel messages for the current boot. It seems dmesg itself also logs kernel messages in /var/log in addition to rsyslog. Disabling most logging can be accomplished by commenting out the rules by putting a '#' in front of them.
    #auth,authpriv.*        /var/log/auth.log
    #*.*;auth,authpriv.none -/var/log/syslog
    #cron.*                 /var/log/cron.log
    #daemon.*               -/var/log/daemon.log
    #kern.*                 -/var/log/kern.log
    #lpr.*                  -/var/log/lpr.log
    #mail.*                 -/var/log/mail.log
    #user.*                 -/var/log/user.log
Of course, for security purposes or in a multi-user system it might be preferable to keep some of these logs, such as auth.log. Some kernels can be very noisy due to frequent messages or non-fatal errors or warnings which can affect performance when logging is enabled. In this case, it seems reasonable to disable kernel logging via rsyslog because dmesg already produces a similar log.

Disabling X Window System error logging

Finally, the X Window System maintains a logfile called .xsession-errors in your home directory that gets filled with warnings and errors messages from the X server. In some cases this log file can fill up quickly and affect system performance. To disable it, edit the file /etc/X11/Xsession and edit the relevant lines to look like this (somewhere in the middle of the file), In this case the log-generating line has been commented out and replaced with a one that routes messages to /dev/null:
    #exec >> "$ERRFILE" 2>&1
    exec >> /dev/null 2>&1


In summary, the configuration changes above, which are relative to standard configuration settings in typical Linux distributions, can help transform a flash-based Linux system from very slow, continuously stalling behaviour to reasonably consistent fairly quick response, make it much more usable.

Sources: SmartLogic

No comments:

Post a Comment