Tuesday, May 03, 2016

Installing Unreal Tournament 2003 on a 64-bit Modern System

In 2003, I was elated that Unreal Tournament 2003 came with a Linux installer (on Disc 3). All I had to do was run the installer and play the game.

Nowadays, it's not so easy. Linux is not like it was in 2003. Not only has it improved. but it includes tools to allow backwards compatibility.

We'll be installing as root to make the game available to all system users.

First, we need to set a usable POSIX value.

# export _POSIX2_VERSION=199209

The set a usable libc version.

# export SETUP_LIBC=glibc-2.1

Then tell the installer that we are running on a 32-bit system.

# linux32 ./linux_installer.sh

Modify the ut2003 startup script in /usr/local/games/ut2003 with the above information.

Then just use the graphical installation tool, provide you CD key and play the game.



Sunday, April 10, 2016

Creating a chroot Environment for Mageia

Magiea documents how to set up a chroot environment in their Wiki. We'll set up both a 32-bit and a 65-bit environment and eventually use them with schroot, a tool that makes managing chrooted environments easier.

To summarize the steps to create a chroot using urpmi as follows:

Create a Mount Point
To create the mountpoint for the chroot environment for either or both 32- and 64-bit environments:
# mkdir -p /mnt/chroot/mageia32
# mkdir -p /mnr/chroot/mageia64

Mageia can use either package set with your native urpmi application to install packages in the chrooted environment.

32-bit chroot
For the 32-bit environment:
Add the repositories.
# sudo urpmi.addmedia --distrib --urpmi-root /mnt/chroot/mageia32  --mirrorlist 'http://mirrors.mageia.org/api/mageia.5.i586.list' 

Install the base system:
# urpmi --urpmi-root /mnt/chroot/mageia32 basesystem urpmi locales-en mc

64-bit chroot
For a 64-bit environment:
# sudo urpmi.addmedia --distrib --urpmi-root /mnt/chroot/mageia64  --mirrorlist 'http://mirrors.mageia.org/api/mageia.5.x86_64.list' 

Install the base system (I like to use the Midnight Commander file manager from the command line, so it's install early on,a s well a s a few useful tools.):
# urpmi --urpmi-root /mnt/chroot/mageia64 basesystem urpmi locales-en mc wget openssh-server 

Make the Enviroments Usable
At this point, to make these environments usable, you need to provide DNS information so networking can be used by copying /etc/resolve.con to the appropriate location in the chroot.

You also need to have a working /proc filesysten.
# mount -o bind /proc /mnt/chroot/mageia[32][64]/proc
You would use this technique to access your host filesystem from within the chrooted environment by mounting it inside the chroot.

Using the chroot Environment
The Mageia wiki for chroot offers straightforward instructions as to how to ssh into your chroot environment and won't be repeated here. It also offers advice on launching X clients from the chrooted environment.

schroot
At this point, it is worth exploring the advantages that schroot offers for managing and manipulating your chrooted environments. To Be Continued . . .

RESOURCES

Mageia Wiki for chroot

Mageia QA procedure for evaluating schroot

Magiea URPMI Wiki Entry

Debian Wiki Schroot HOWTO

Schroot Build Environment Setup

Schroot Mageia Configuration



Saturday, April 09, 2016

Installing and Configuring a Mediawiki wiki on Mageia5

I started a MediaWiki wiki for my hobby, to serve as a convenient place to collect and centralize all the bits of information that I find scattered about the internet.

Creating such a wiki can be a daunting task, but if broken down into small tasks, it can be done. The most difficulty I had was that there were no specific instructions for Mageia. The best general instructions I could find were from the Mediawiki site, but were  for Ubuntu. Mageia configures its default configurations slightly different.

I chose to tun the wiki and its associated webserver and database in a virtual machinate using VirtualBox, so we can tackle that first assuming that you already know how install and configure VirtualBox.

Installing A Minimal Mageia Base
During the installation, deselect all the pre-configured options, but do select the option to select individual packages. You will select a minimal install with no X11 or documentation, but with urpmi.

The remaining installation is pretty straightforward and quick. On re-booting, you will see a prompt; you can log in as root. At this point, you'll need to use vi to edit files, so brush up if your vi-fu is rusty.

Modify /etc/group to add your personal account as a member of the wheel group and modify /etc/sudoers to you liking as to whether or not a password will be required.

Then we will remove the DVD-based repositories, add some web-based ones, perform and update of our base system, and then install the additional applications we need.

# urpmi.removemedia -av

# urpmi.addmedia --distribute --moralist 'http://mirrors.mageia.org/api/mageia.5.x86_84.list'

# urpmi --replacefiles --auto-update --auto -v && urpmi --replacefiles --auto-update --auto -v && shutdown -r now

The last instruction to run the command twice is at the suggestion of Mageia when doing a distro upgrade. here, it's just added insurance that all the files will be updated before you reboot.

Install Something to Send Mail From Your Wiki
We will need an application to send mail from our wiki. Rather than use a heavyweight like sendmail, I prefer the very lightweight /bin/mail, and that requires some additional configuration.

# urpmi mailx

Make the system's /etc/alternatives aware of /bin/mail and make it the default selection.

# update-alternatives --install /etc/alternatives/sendmail-command sendmail-command /bin/mail 1 

I needed to configure /etc/nail.rc to accommodate  my Gmail account.

Install Needed and Useful Applications
Let's add a few things to make it easier on ourselves. We need an ssh sever so we can log in remotely (actually while we log in from the host while the server runs in headless mode) and my favorite file manager, the Midnight Commander.

# urpmi openssh-server mc

Now it's time to not only install MediaWiki, but all the things that will be needed. In the Ubuntu tutorial and in the web-based MediaWiki setup procedure you will follow later, you will learn what you need, but here it is all laid out beforehand to make our job easier.

# urpmi task-lamp php-apc mediawiki-mysql git imagemagick 

Configure PHP
The /etc/php.ini file needs to be modified to reflect your timezone and allow large files to be uploaded. Here's the examples:

Date]              
; Defines the default timezone used by the date functions  
; http://php.net/date.timezone  
;date.timezone = "US/Eastern"

That web address will help you locate the appropriate value for the timezone.

; Maximum allowed size for uploaded files.
; http://php.net/upload-max-filesize 
upload_max_filesize = 20M

Configure Apache
Apache is installed with some good and useful pre-made configurations, but at the advice of MediaWiki, we should make the image upload directory more secure so bad actors can't do bad things.  

Edit /etc/httpd/conf/sites.d/mediawiki.conf to add:  
         
    # Ignore .htaccess files 
    AllowOverride None      
    # Serve HTML as plaintext, don't execute SHTML 
    AddType text/plain .html .htm .shtml .php .phtml .php5 
    # Don't run arbitrary PHP code.    
    php_admin_flag engine off      
    # If you've other scripting languages, disable them too.    

Start Apache : # systemctl start httpd.service

Start MySQL: # systemctl start mysqld.service

Make MySQL Safer
You should launch a special configuration application to make the MySQL server more secure and establish a root password.

# mysql_secure_installation

Configure MediaWiki
The initial configuration of our MediaWiki is done through a  web-based interface. This is fine if you're installing it on real hardware, but we're doing it on a headless virtual server with no X server. Theoretically, it should be possible to install a modern web browser like Firefox on our headless, X-less sever (it's only an X client after all) and run it over ssh on our local X-server.

Use ssh to access the server, install and launch Firefox to start the MediaWiki configuration.

During the web-based configuration, take the time to read everything it says and understand everything it says and make a note of every entry you make.

When you are done, you will download a file named LocalSettings.php to your home directory. You must manually copy this file to /etc/mediawiki/ and only then will you wiki be operational at http://yourdomain/mediawiki.

By the way, if you futz up at this point, just delete that one file and begin the web-based configuration again.

One Last Thing
We need to have good security for our server since it will face the Internet. To do this, we'll use Mageia's msec tool and we'll uninstall all applications we will no longer be using.

# urpmi msec && msec -l server
# urpme firefox && urpme --auto-orphans

Access Your New Wiki
Now here's the thing, the URL to access you new wiki is http://yourdomain/mediawiki. There are some valid reasons for making it so, but it's awkward. My workaround is to edit the default Apache file index.html to become a "welcome page" with a link to the funky address of the wiki.

Make Your URLs Pretty
If you don't like the ugly PHP URLs, you can find instructions on how to modify Apache to show prettier URLs. I didn't feel the need to do that.

Make a Custom Logo
The default logo for your site is located at /usr/share/mediawiki/skins/common/images/wiki.png. 
Make you own logo, name it wiki.png and replace the default logo.

REFERENCES

Installation Requirements

Installation Guide

System Administration

Running MediaWiki on Ubuntu  <-- followedl="" good.="" i="" it="" p="" pretty="" s="" what="">

Saturday, March 05, 2016

Lying to Get the Job Done: Adventures in setarch and export

It says something about the power and flexibility Linux when you are provided a means to lie in order to get an application to execute. And by this, I mean using the setarch command and a few other tricks to fool an application created for an older system so it will run on more modern system architectures.

I'm occupying myself trying to install some old games and so far, it has been challenging. In the heady turn-of-the-Millineum days, Linux installers were all the rage, promoted by Loki, a company the developed the installers and produced Linux versions of then-popular games, but wound up in Chapter 7 bankruptcy. Even in the throes of  their demise they didn't forget the Linux gaming community and made their installers and the GPL source code available for the world to use. That would be great had not fewer and fewer servers carried the actual (now-old) files -- most of the links are dead -- and had not the development of Linux progressed so much. Many of their *.run installation scripts can be downloaded from the author, Icculus.

For example, Unreal Tournament 2003 was shipped with a Linux installer on disc 3, but it won't execute on a modern Linux. The installer itself is created with makeself which is still available, but
"Archives created with Makeself prior to v2.1.2 were using an old syntax for the head and tail Unix commands that is being progressively obsoleted in their GNU forms. Therefore you may have problems uncompressing some of these archives. A workaround for this is to set the environment variable $_POSIX2_VERSION to enable the old syntax, i.e. : export _POSIX2_VERSION=199209."

 It is possible to launch the *.run file with useful arguments.
--help
          displays the full list of arguments

--list
          lists the contents of the archive
--target
          extracts the contents of the archive to



but does not install anything
It's also possible to extract the archive, add files to it like special config files, updated binaries, add-ons and game data files, and recreate the *.run archive for your personal use.
So using that trick works and I can now list the contents of the .run file without a checksum error, but it won't install anything because of a glibc mismatch. 

That, however, can be fixed by invoking:

export SETUP_LIBC=glibc-2.1.

We're still not out of the woods because the installer checks the environment and, of course, balks at our powerful, modern 64-bit, kernel 4.x, multi-gigabyte RAM, multi-processor miracles of the modern age.

The fix for that is the setarch application. It deceives the application by feeding it bogus uname information. Not that it does not provide an actual environment, it just feeds information you can choose to the application so that it believes it is running in the appropriate environment.

If the application needs specific version of older libraries, you are still required to actually supply those. 

setarch deceives  about libnux32, linux64, i386, i486, i586, i686, athlon and x86_64 , can tell the app that we're running kernel 2.6, can deceive about the amount of available RAM available and other devious things.

Finally, I was able to use the old, creaky installer on the CD by invoking


$ export _POSIX2_VERSION=199209 && export SETUP_LIBC=glibc-2.1. && linux32 ./linux_installer.run

I expect to have use more deception to get the binaries to run. For example. to run Quake with sound, I had to create a wrapper script and execute SDL_AUDIODRIVER=dsp prior to executing the game binary.
If you run into these kinds of problems, now you can lie as well. It's all lies from now on.

RESOURCES



DRM-free games. Most run using WINE

Old games packaged for win32, but extractable for the data files; most run using WINE

Wednesday, February 03, 2016

Booting From an ISO image using GRUB

Sometimes, it's handy to use a specialized boot environment on your system. Examples include SpinRite, GParted, TRK, FalconFour's Ultimate Boot CD and others.

Typically, you have a CD or DVD of that environment, insert it and boot from that.

Assuming that your own system isn't borked, it is possible to use GRUB to load the ISO image and boot from that. Here's how . . .

The special software that allows you to boot from an ISO image on your drive is SYSLINUX. While it is a complete boot system, mostly noted for its ability to boot from MS-DOS and MS Windows FAT filesystems, it contains a program named MEMDISK.

NOTE: While I am focusing on Linux systems, SYSLINUX and MEMDISK have MS Windows  versions, so with a careful reading of the documents you can do the same thing on a MS Windows computer.

Intended primarily to allow you to boot legacy operating systems, it also allows you to boot from floppy disk images, hard drive images and ISO images.

To use it, copy MEMDISK from where your system installs it by default into the /boot directory. Then, copy the ISO image you want to boot from into /boot as well.

The web page for MEMDISK describes how to configure your main bootloader to launch MEMDISK and have it boot your ISO image.

For my Mageia5 Linux system, the lines that are added manually to /boot/grub/menu.lst are as follows for SpinRite.iso as an example.

title SpinRite_6.1
root (hd0,0)
kernel (hd0,0)/boot/memdisk BOOT_IMAGE=SpinRite iso
initrd /boot/SpinRite.iso


If the filename of your ISO image is long, don't be afraid to rename it to something more convenient to type.

Sometimes it is necessary to use append iso raw. Try that if booting fails at first.

Using PLPBT, an Alternative Boot Loader


Rather than booting an image of an operating system or a live image of a utility, it make be necessary to boot from a different device. Most modern motherboard BIOS have a feature that allows you to boot from a number of different devices attached to your system.

If you BIOS does not support that, the Plop Boot Manager can help. It provides executables for DOS, MS Windows and Linux as well as for booting over a network.

For Linux, you copy the file plpbt.bin to your /boot directory and your GRUB entry in /boot/grub/menu.lst looks like:


title Plop Boot Manager
root (hd0,0)
kernel /boot/plpbt.bin

The documents also show how to create other boot images using the Plop Boot Manager.

Sunday, October 04, 2015

BIOS Update for a Linux Computer

Most hardware will need a BIOS update at some time and it's relatively easy to do. When you use Linux, however, you face an additional hurdle since occasionally upgrading the BIOS requires an installer that only works using Windows. Of course, no one wants to install a full Microsoft Windows OS just to spend less than 30 seconds to update the BIOS, then turn around and re-install Linux.

What if we could boot into Windows using a CD-ROM and run the win32 BIOS update program using that? Check out FalconFour's Ultimate Boot CD. The best source for it is his Facebook page or his Wordpress page. Those pages provide a link to download it via torrent or a direct link. The current version is v4.61.


Simply boot into the WindowsXP environment and run the BIOS installation program. It's that easy.

In my case, I was updating the BIOS of an HP 1120NR notebook.

Tuesday, July 07, 2015

Compiling and Running Quake2 in a modern browser window in Mageia5

Slashdot ran a story about getting Quake2 running in a browser windows. That is very cool.

There were installation instruction at quake2-gwt-port except the instructions were not for "Linux" but only for Linux distros that provide apt-get (probably Ubuntu). That is not cool at all.

While it would have been possible for them to write their HOWTO instructions in a generic way (provide a list of all dependencies, provide links to source code for needed apps not included in every Linux distro, etc.), they just assumed that everybody uses Ubuntu. Bad. Bad. Bad.

Here's what I needed to do to get it compiled and installed on my Mageia5 system. Read those Ubuntu-ed instructions first for the details. You should be using sudo to run commands that need root privileges. (All the following commands are written on one line even if they appear to be on multiple lines.)

$ sudo urpmi mercurial ant gcj-tools javacc lame vorbis-tools
 
$ hg clone https://quake2-gwt-port.googlecode.com/hg/ quake2-gwt-port


$ cd ~/quake2-gwt-port


$ sudo ant run
 

This will install the original Quake II demo resources, build the client and server code, then run the server.

Play Quake2 in your browser with: http://localhost:8080/GwtQuake.html

It seems to run just fine in Firefox (as well as PaleMoon, QupZilla, very slow in Arora, not at all in Dillo) window. It doesn't run in very old versions of Firefox or possibly other browsers because of the opengl requirement.