My thoughts on Slackware, life and everything

Month: December 2009

Better font rendering in Wine

I have just bought a Sitecom Multifunctional Print Server, the LN-308. Unfortunately, this printer comes with a MS-Windows based control center application, which you need in order to configure the printserver over the local network.

As a Slackware Linux user, this fact could not defeat me, and I tried my luck with Wine. I built a Slackware package for the latest Wine (1.1.34) and indeed, this application installs and works flawlessly in Wine (on Slackware64 with multilib to be precise).

This is when I found out that the default font rendering in Wine is not as good as when the program would run natively in Windows. To fix this, you need to enable sub-pixel font rendering (font smoothing) in Wine.

You need to make some changes to the “Windows registry” which is emulated by Wine. To start the included registry editor, you either double-click it from within the Wine File Explorer (start "winefile” in an X terminal, browse to the "C:\Windows" directory and doubleclick “regedit.exe") or run it directly from the X terminal prompt with “wine c:\windows\regedit.exe".

Make the following changes to the registry to enable sub-pixel font rendering:

Browse to [HKEY_CURRENT_USER\Control Panel\Desktop] and create/update the following “DWord” values (note: the DWord values are hexadecimal, which is the default for entering values in regedit.exe). You may have to create several of these, since by default only the “FontSmoothing” registry setting is present:


"FontSmoothing"="2"
"FontSmoothingType"=dword:00000002
"FontSmoothingGamma"=dword:00000578
"FontSmoothingOrientation"=dword:0000000

Then, restart your Wine applications and watch the difference in font rendering. The jagged edges should have disappeared. As an example, here are two screenshots from sections of winefile, before and after the registry hack. Click on the images to see the full version. Thedefault font used in winefile is quite small (6 point) but here it makes the changes in fort rendering even more obvious.

wine_no_smooth_font1

Before font smoothing

wine_smooth_font1

After applying font smoothing

Eric

Welcome Windows user!

… I am going to show you how to create a Slackware USB installer when all you have is a Windows computer.

As a Linux user, this would not cause you any problems since there is a shell script that does the work for you – all you need is the Slackware DVD and a re-usable USB stick of sufficient size.

If you run Windows, it is still possible to create a bootable USB stick that can start Slackware’s installer. If the stick is big enough (2 GB in size) you can even add Slackware’s packages to it and avoid the use of a Slackware DVD as the package source entirely.

The requirements:

What tools will you need for the job at hand?

  • A version of dd for Windows. This is needed to copy a USB image file to the USB stick. You can obtain it here at chrysocome.net., the same site that also hosts RAWRITE.EXE which ships with Slackware in the isolinux/sbootmgr directory.
  • The syslinux tool from syslinux.zytor.com. This will be used to make your stick bootable. Download it directly from kernel.org – the .zip file contains a Windows executable.
  • A program like Winimage (a shareware program, free 30-day trial), or IZarc (might be a good free alternative to Winimage) that is able to open the usbboot.img disk image file and extract its content to your hard drive.
  • Of course you need a Slackware DVD. Either buy it at the Slackware Store (which helps keeing the distro alive) or download a DVD ISO image from any Slackware mirror. It is also possible to use a local copy of a Slackware package tree (either downloaded from a Slackware mirror or copied off a DVD). In the examples below I am using “slackware-13.0” which is the 32-bit Slackware version 13.0. The instructions are not limited to this particular version of Slackware – you can do this for every recent version of Slackware, including the 64-bit release.
  • And finally, a USB stick with a (single) FAT32 partition. If it has 40 MB of  free space, you can use this stick as a bootable Slackware installer but still need the DVD or a set of CDROMs for the actual packages. If the stick has 2 GB of available free space, you will be able to copy all Slackware packages to the stick as well. The resulting bootable USB stick will be all you need in order to install Slackware. Ideal for netbooks that do not have a DVD drive!

Preparations:

First things first:

  1. Insert the Slackware DVD or make sure you have a copy of a Slackware tree somewhere on your local drive (more specifically: everything on the Slackware DVD with the exception of the source and slackbook directories will be required). In the examples below I will assume that the top of the Slackware tree is “D:\slackware-13.0\“. For other releases of Slackware or for the 64-bit version of Slackware the pathnames will be a bit different of course, but the same procedure applies.
  2. Insert the USB stick, make sure it gets assigned a drive letter. In the examples below I assume that the drive letter for the USB stick is “U:
  3. Now, you have to decide what to do with your stick. This depends on how much data it can contain (less than 2GB, or more than 2GB). See below, there is a set of instructions for both cases.

If you have (much) less than 2 GB available on the stick, we can transform the stick into a bootable Slackware setup disk.

NOTE: the following procedure will erase all existing data on the USB stick, so be careful and check what’s on it before you proceed.

  1. Install the Windows version of dd (see above) onto your Windows computer.
  2. Open a DOS box (i.e. get a command prompt) by running
    cmd.exe
  3. Run the following command at the prompt:
    dd if=d:\usb-and-pxe-installers\usbboot.img of=\\.\u:
  4. That’s it! You have created a bootable Slackware setup USB stick

If you have 2 GB or more available on the stick, we will be creating a full “USB equivalent” to a Slackware DVD:

NOTE: The following procedure is non-destructive; meaning that no files on the stick will have to be deleted.

  1. Install Winimage and the Windows version of syslinux (see above) onto your Windows computer.
  2. Create a directory “U:\boot\syslinux\” on the USB stick
  3. Use Winimage to extract the content of the image file “D:\usb-and-pxe-installers\usbboot.img” to the newly created directory “U:\boot\syslinux\” on the stick
  4. Remove the file “U:\boot\syslinux\ldlinux.sys
  5. Open a DOS box (i.e. get a command prompt) by running
    cmd.exe
    On Vista at least, you have to run cmd.exe as Administrator to avoid the “Accessing physical drive: access denied” message when running the syslinux command in the next step.
  6. Run the following command at the prompt to make the stick bootable (you will notice the directory /boot/syslinux in that command which is the directory we just populated):
    syslinux.exe -m -a -d /boot/syslinux u:
  7. Using Windows Explorer, give the U: drive the label “USBSLACKINS
  8. Copy the whole Slackware tree “D:\slackware-13.0” to the root of the USB stick, “U:\“. Exclude the slackbook, source and usb-and-pxe-installers directories while copying if you have just about 2 GB free. If you have a 4 GB stick you will find that everything will fit nicely. Using a Windows Explorer for this is probably easiest. As the end result you should have a “U:\slackware-13.0” directory on the stick with (among others) a file “PACKAGES.TXT” and a directory “slackware” below that.

Booting the USB stick and installing Slackware:

When booting this USB installer (the version containing the Slackware packages), you have to mount the USB partition before starting “setup” because you can access your packages only after mounting it. You cannot use the directory “/mnt” to mount this partition because the Slackware installer uses “/mnt” already. After the booting has finished and it delivers you to a command-prompt, you create a new directory in the installer, for instance “/usbinstall“:

mkdir /usbinstall

After you have created this mount point, you have to find out the name of your partition (you can run “fdisk -l” or “blkid” to find out) and then use the following mount command to preserve upper case filenames:

mount -t vfat -o ro,shortname=mixed $(/sbin/blkid -t LABEL=USBSLACKINS | cut -f1 -d:) /usbinstall

The “shortname” option used in that mount command is required, and Slackware installation will fail if you forget it.

If you labeled the stick’s partition “USBSLACKINS” in step 7 above, then you can use the following command instead of the previous mount command. It will find the correct partition automatically (note that what follows is a single command line !):

mount -t vfat -o ro,shortname=mixed $(/sbin/blkid -t LABEL=USBSLACKINS | cut -f1 -d:) /usbinstall

Then afterwards, when it is time to specify the package SOURCE directory, you type:

/usbinstall/slackware-13.0/slackware

The rest of the installation will proceed as usual. Give me feedback in the comment section below if you encounter any problems.

Good luck! I hope this small tutorial will be able to snatch you away from the Dark Side 😉

Eric

Celestial phenomenon in Norway

An interesting celestial phenomenon early this morning above northern part of Norway – witnessed by thousands of people all over Norway:

tandberg_spiral_phenomenon

Foto: Svein-Egil Haugen

A fireball with a huge blue tail dominated the skies over Norway in the early dawn. The spectacle lasted for two minutes and ended in a spiral of light. A possible explanation is that this was a missile gone out of control, but the Russians deny (of course) that they fired a missile. Chief scientist Erik Tandberg at the norwegian Space Center speculates that this could be an entirely new natural event, although the light show lasted too long to be easily explained as an astronomical phenomenon.

The Sun (UK paper) has some coverage and a load of pretty pics. Another article can be read (if you understand norwegian at least) at the norsk site http://www.nrk.no/ and interestingly it hosts some film footage of the event online, a compilation of several amateur short videos.

I love mysteries!

Eric

Shit happens… fireworks campaign

The yearly dutch campaign to prevent fireworks victims among young people has launched today. The campaign has a new site and slogan “Shit Happens”.

A hilarious video is the centerpiece of the web site, but it can be doubted whether this is actually going to be an effective one… it is too funny to be taken seriously perhaps.

“Most victims suffer from serious damage to their eyes, but yours are completely intact! Unfortunately though, we had to replace another part of your face…”

See the youtube copy of the video in case the site itself is not available:

Take care this new year’s eve!
Eric

Installing Slackware using USB thumb drive

There are several ways to install Slackware to your computer. You have network installation options available (where the packages are on a remote NFS/FTP/HTTP/Samba server) and local options (where the packages are on a DVD/CDROM or a local directory).

In all these cases you need to boot your computer with Slackware’s installer. Traditionally you can boot from a DVD or CDROM of course, or even from a floppy if you are creative. If your computer does not have a DVD/CD drive then there is still the network boot (aka PXE boot) or using a USB thumb drive to boot from.

It is the USB thumb drive I want to talk about in this blog post.

Slackware ships with a USB image file “usbboot.img” since the 12.0 release (see http://slackware.osuosl.org/slackware-13.0/usb-and-pxe-installers/usbboot.img for instance). Using “dd” this image can be transfered to a USB thumb drive which transforms the USB drive to a bootable Slackware installer. The packages will still have to be available on a local or network medium, because the “usbboot.img” image only contains kernels and setup files… no packages.

If you do not want to “sacrifice” a USB thumb drive for this (note that dumping the image file on the USB stick will destroy all data already present on the stick), there is a solution: Slackware also ships with a script “usbimg2disk.sh” since the 13.0 release (see http://slackware.osuosl.org/slackware-13.0/usb-and-pxe-installers/usbimg2disk.sh for instance). This script extracts the content from the “usbboot.img” image file and uses this to transform a regular USB thumb drive into a bootable Slackware installer  non-destructively (i.e. any existing files on the stick will not be touched), as long as there is some 30 MB of available free space on the stick.

The “usbimg2disk.sh” script is also convenient if your computer refuses to boot from a USB stick loaded with the “usbboot.img” file. The BIOS of some computers will not understand the format of the default Slackware USB image. Using the “usbimg2disk.sh” script, you create an alternative bootable USB stick that will be recognized by your computer’s BIOS.

All nice, but there is still a problem that remains to be solved.

If you have a netbook for instance.

The average netbook computer (like my own Asus EeePC 1000H) comes without DVD drive. If you are mobile and without access to wired network, it will not be easy to install Slackware packages after booting from the USB stick.

In such circumstances you need to copy the complete Slackware package tree to a disk partition of your netbook before you start the Slackware installation. This is not always efficient, or even feasible.

Now, I have been creating “multi-partition USB images” for several Slackware releases in the past (more accurately, I have written the scripts that let you create the image and then transfer it to a big enough USB stick using the ” dd” command). You can find those scripts here: http://slackware.com/~alien/tools/usbinstall/ . This is an elegant way to create a USB Slackware installer that has all packages “on board” but I wanted something that was more basic, and thus potentially easier to use for a Slackware newbie.

The “old” scripts at http://slackware.com/~alien/tools/usbinstall/ create a secoind, EXT2-formatted partition to store the Slackware packages. This makes it harder to add more files if you are on a Windows computer for instance. I wanted to have a USB stick with a single large FAT partition – and fortunately the bootloader I am using (syslinux) allows this.

So I took Slackware’s “usbimg2disk.sh” script (which I incidentally wrote too) and expanded its functionality. What is new? The script can now copy the Slackware setup files, kernels and packages all to a regular USB thumb drive, if that has a minimum of 2GB free space available.And it still retains its original functionality (to create a bootable installer as long as there is 30 MB of available free space on the stick).

The USB stick does not even have to be formatted! So, if you already have data on the stick, it will not be destroyed.

There is one advantage to formatting though: if you allow the script to format the USB stick, it will make your future Slackware installation easier. The formatting step assigns a label “USBSLACKINS” to the fat partition. This enables Slackware’s setup to recognize and mount the USB partition automatically after boot, and pre-fill the SOURCE setup dialog “Install from a pre-mounted directory” with the correct directory path. Just hit ENTER a few times to start the installation!

If you did not format the USB stick but used an existing VFAT-formatted stick, you have two options:

  1. either you assign  the label “USBSLACKINS” to the stick’s fat partition manually,
  2. or else you do the following after booting from the USB stick but before running setup: mount the USB partition yourself using the following commands (for this eaxmple I am assuming that the installer recognized the drive as “/dev/sdX“):
mkdir /usbinstall
mount -t vfat -o ro,shortname=mixed /dev/sdX /usbinstall/

And then after you’ve started “setup” and have come to the “SOURCE selection” dialog, you use the directory “/usbinstall/slackware-<version>/slackware” as the source location where setup should look for Slackware packages.

This is how the help text for the script looks:

./usbimg2disk.sh -h
#
# Purpose #1: to use the content of Slackware's usbboot.img and
#   transform a standard USB thumb drive with a single vfat partition
#   into a bootable medium containing the Slackware Linux installer.
#
# Purpose #2: to use the contents of a Slackware directory tree
#   and transform a standard USB thumb drive with
#   a single vfat partition and 2GB of free space into
#   a self-contained USB installation medium for Slackware Linux.
#
#
# Your USB thumb drive may contain data!
# This data will *not* be overwritten, unless you have
#   explicitly chosen to format the drive by using the '-f' parameter.
#
# usbimg2disk.sh accepts the following parameters:
#   -h|--help                  This help
#   -f|--format                Format the USB drive before use
#   -i|--infile <filename>     Full path to the usbboot.img file
#   -l|--logfile <filename>    Optional logfile to catch fdisk output
#   -o|--outdev <filename>     The device name of your USB drive
#   -s|--slackdir <dir>        Use 'dir' as the root of Slackware tree
#   -u|--unattended            Do not ask any questions
#
# Examples:
#
# usbimg2disk.sh -i ~/download/usbboot.img -o /dev/sdX
# usbimg2disk.sh -f -s /home/ftp/pub/slackware-13.0 -o /dev/sdX
#
# The second example shows how to create a fully functional Slackware
# installer on a USB stick (it needs a Slackware tree as the source).

The enhanced script is here: http://connie.slackware.com/~alien/tools/usbimg2disk.sh …get itwhile it’s hot!

I hope it will get added to the Slackware tree soon. Tell me if you liked it! Any questions or remarks, you can leave them below this post.

Cheers, Eric

© 2025 Alien Pastures

Theme by Anders NorenUp ↑