COMP 3000 2011 Report: ttylinux: Difference between revisions

From Soma-notes
Kmacmart (talk | contribs)
Kmacmart (talk | contribs)
Line 65: Line 65:


{|
{|
| align="center" style="background:#f0f0f0; padding:2px; width:15%; border-bottom:1px solid #000000;"|'''Package'''
| align="center" style="background:#f0f0f0; padding:2px; width:15%; border-bottom:1px solid;"|'''Package'''
| align="center" style="background:#f0f0f0; padding:2px; width:15%; border-bottom:1px solid #000000;"|'''Latest stable version'''
| align="center" style="background:#f0f0f0; padding:2px; width:15%; border-bottom:1px solid #000000;"|'''Latest stable version'''
| align="center" style="background:#f0f0f0; padding:2px; width:15%; border-bottom:1px solid #000000;"|'''Version in ttylinux'''
| align="center" style="background:#f0f0f0; padding:2px; width:15%; border-bottom:1px solid #000000;"|'''Version in ttylinux'''

Revision as of 13:18, 18 November 2011

Part 1

Background

The distribution I chose is ttylinux, named for its initial orientation towards TeleTYpewriter, or TTY serial interfaces. It caters itself to a target audience that includes both users, looking either to get older hardware up and running on the web or for a lightweight portable system they can boot off a USB stick, and developers who are either looking for an OS they can use on embedded systems or for one to base their own variant of Linux on. It was initially developed in 2001 by Pascal Schmidt, who focused on getting it running on serial interfaces over networks, but when Douglas Jerome took his place in 2008, the focus of the project moved away from connecting to serial interfaces and towards its intended purpose of being "one of the smallest up-to-date Linux systems that is similar to a larger distribution", as stated on its website.

You can download ttylinux on the [project website], or from one of a number of the mirrors it lists. Derived from scratch, ttylinux has a file system that can be as small as ~8 megabytes, making it as little as ~12 megabytes with the kernel; however, the smallest default install for i686 uses ~25 megabytes.

Installation/Startup

Installation

Figure 1 Initial boot of the ttylinux installer
Figure 2 Login prompt in the ttylinux installer

To test this distribution, I used Oracle VM VirtualBox Version 4.1.0r73009 and created a new VM using the Linux 2.6 presets and 2 gigabytes of storage, and configured it to have 16 megabytes of video memory, 64 megabytes ram and a bridged ethernet device to connect directly through my network's router. I then used the virtual media manager in VirtualBox to mount the ~35 megabyte ut-ttylinux-i686-12.6.iso, which is an image of the most recent version (12.6) of the most minimal i686 compatible install (ut), and booted the virtual machine.

The ttylinux installer initially greeted me with some boot options that allowed a number of settings and services available during the installation to be tweaked, and not needing any of these things to be changed, I pressed enter to begin the installation. It loaded into a version of ttylinux that appears to be about the same as it intends the finished install to look like, and you're presented with a shell prompt where I was able to login with the username 'root', and 'password' for the password. The currently out of date [ttylinux User Guide] explains a method of installation that seems to involve a somewhat manual install process, but in the root user's home directory, I discovered a file named 'install.conf' that explained a (relatively) more user friendly way, and I decided to leave the ttylinux User Guide behind in favour of following this.

To install ttylinux using 'install.conf', I needed to use fdisk to partition the VM's disk first, and I used a similar configuration to the one in the sample that the default 'install.conf' provides. I then used 'vi' to edit the 'fstab' section in 'install.conf' to reflect the the partitions I created, and to test ttylinux's claim of being up to date, I set the filesystems of everything (except for swap, of course) to ext4, resulting in the following configuration:

 /	P /dev/sda1 512M	    Linux	ext4
 swap	P /dev/sda2 128M	    Linux Swap	swap
 /boot	P /dev/sda3 24M	  *Bootable Linux	ext4
 /home	E /dev/sda5 1128M	    Linux	ext4
 /tmp	E /dev/sda6 128M	    Linux	ext4
 /var	E /dev/sda7 111M	    Linux	ext4

The rest of the configuration was taken care of entirely within 'install.conf', and it involved setting the desired hostname and host address to 'ttylinux' and 127.0.0.1 respectively, the local timezone to 'EST', some basic network configuration to connect to my network using the bridged network adapter I'd created, and some options for the boot loader including where it should be installed. At this point, I ran 'ttylinux-installer --config=install.conf /dev/hdc', meaning that 'ttylinux-installer' would use './install.conf' as the configuration file and that the install cd was /dev/hdc, and it quickly used the configuration I'd set to format the partitions to the filesystems I'd set for them, created a chroot environment using them and installing ttylinux to in the new environment with the settings I'd chosen.

Once the installation was complete, I used VirtualBox's virtual media manager to remove ut-ttylinux-i686-12.6.iso from the VM's virtual cdrom drive, and rebooted into the new system.

  • I'd initially tried playing around with an optional section in 'install.conf' that lets you install specific packages rather than the entire system; however, 'ttylinux-installer' kept failing with errors about missing files when I'd attempt to run it this way, and after a few attempts at some more creative solutions to the problem, I realized that I'd needed to use a full install when I discovered that the files the installer was looking for were in the few packages I'd been comfortable setting it to skip.

Startup

Figure 3 ttylinux booting after installation

Booting the VM for the first time after installing ttylinux, I was presented with a creatively themed lilo bootloader with a single option to start ttylinux that it selected automatically after a brief countdown. The installed ttylinux system loaded very similar to the install when it booted up, the only major difference I noticed as the text whipped by being that it also checked and mounted the partitions I'd defined in 'install.conf'. Once it had finished loading, I logged in with the same credentials as I had in the installer before promptly using 'passwd' to give the root user a more secure password, and then used 'vi' to edit '/etc/issue' and '/etc/issue.tty' to remove the line that explained the default username and password above each login prompt.

I quickly discovered that I couldn't seem to access the web, and when I checked 'ifconfig' to see that I appeared to have a functional network connection, I used my host OS to find the ip associated with 'www.google.com' and found that my VM was able to ping that, which meant that the problem was likely with '/etc/resolv.conf'. Sure enough, when I checked to see what was wrong with '/etc/resolv.conf' I found that it didn't exist, and after running the command "# echo 'nameserver 192.168.0.1' > /etc/resolv.conf" to create a new one that would use my router's local address to lookup URLs, I tried pinging 'www.google.com' and found that my problem had been fixed.

Everything seemed to be working at this point, and I decided to play around with the system to see what it was like...

Basic Operation

Figure 4 Using ttylinux to show some info about the system

As I stated earlier, the intended purpose of ttylinux is to "make one of the smallest up-to-date Linux systems that is similar to a larger distribution", and while it is small, I decided to take a look at what it was made of to see just how up to date and similar to a larger distribution it was...

I began by taking a look around the file system to see what makes ttylinux tick, and noticed that the '/dev' folder uses udev to manage devices just like nearly all modern distributions of linux; I changed 'SYMLINK+="cdrom"' in '/etc/udev/rules.d/70-persistent-cd.rules' to SYMLINK+="ccdrom"' to see whether rules would work, and sure enough, the link to the cdrom device '/dev/ccdrom' existed in place of '/dev/cdrom' when udev was restarted.

Being up to date means being able to do essential tasks over networks too, so I attempted to download a file with wget, use scp to copy a file to a remote server and log into a remote host using ssh to see if it met those basic networking requirements, and I was pleased to find myself successful in each case. When I noticed that ttylinux has ncurses, I found myself wondering if 'lynks' or 'links' would be available to browse the web, but it turns out that they're both too large to be reasonably considered for inclusion, and that a much more lightweight console-based web browser called 'retawq' was included instead, which albeit much less user friendly, does still seem to get the job done.

Curious how system services worked in ttylinux, I took a look and found that the files in /etc/sysconfig/ each allow for disabling or enabling a service on boot with a variable set to 'yes' or 'no', while some of them also include a variable containing command-line arguments as well. A combination of the 'rc.*' files in '/etc/rc.d/' then appear to be hard-coded to read the values of these variables and decide which services to start and what arguments to give them when they are.

There isn't a huge amount to play with in ttylinux beyond your typical command-line functionality, but its interesting to explore the system and imagine how it could be used to build a port that would be able to meet a set of requirements. Once you've gotten it installed, ttylinux appears to be a solid little system, and aside from needing to add '/etc/resolv.conf' manually, the system started up stable and fully functional straight from the first boot.

Usage Evaluation

To see if ttylinux would really live up to its name, I ran the command "# du -c -m /" and was impressed to find that the full i686 install only took up ~25 megabytes. The ttylinux [project website] reports on its front page that it "has an 8 MB file system and runs on i486 computers within 28 MB of RAM, but provides a complete command line environment and is ready for internet access", but digging a bit deeper I found that this is only true for the 'sm' version that uses a static '/dev' environment and uClib instead of Glibc, unlike the 'ut' version I installed, which the website states that it should have a 24 megabyte filesystem, just like the one I installed.

Command line programs that are typically included in distributions of Linux like 'file', 'man' and 'tree', are left out of ttylinux to conserve space, and while it did take some getting used to initially, not having them in the end slowed me down at times, but it never prevented me from doing what I'd intended to. I was sad to find 'vi' in my $PATH instead of 'vim', which brings much more to the table than a tailing 'm', but in the same respect as the command line applications that weren't included, the decision to choose 'vi' instead is understandable if you consider how much more space 'vim' would have taken up. Taking a look at what ttylinux does include on the other hand, I discovered that it actually has a fairly respectable array of functionality packed in its ~25 megabytes. It uses Busybox to provide a basic structure and set of Unix utilities, then includes a carefully selected collection of programs like 'adduser', 'wget' and 'fuser', which all seem to perform a commonly required task that would either be difficult or impossible to do without. There are also [add-ons] available to provide support for ntfs, the calc utility and an http server, and a [source distribution] exists that includes a build system if additional functionality is required.

Being minimalistic by design, ttylinux is a lean OS that does an excellent job at providing an up-to-date, functional distribution that still manages to be one of the smallest on the block. I can't really fault it for what it doesn't include, and if anyone with a bit more space might want to use ttylinux as a basis to work from, the 'ws' variant available on the [downloads] page includes Alsa and more importantly GCC, so new applications can be built. Thinking back on my experience with ttylinux, the only real critique I can make at this point is for including the package selection feature in the non-beta ttylinux-installer script when it's clearly not yet stable, but overall I really do feel like it does a good job of accomplishing what it set out to do, and that it does it well.

Part 2

Packages for ttylinux follow a naming convention that looks like <software_name>-<software_version>-<system_architecture>.tbz, and they consist of a file structure containing the files and folders to be installed, stored in a tar archive and compressed with bzip2. They can be manipulated by the ttylinux package manager ‘pacman’, which shares its name with the one used by Arch Linux despite appearing to be unique. The following are examples of how you can use pacman to list the packages currently installed on the system, install a package locally and delete packages:

  1. pacman -qa || # pacman --query-all (list all installed packages)
  2. pacman -i <package_file> || # pacman --install <package_file> (install a package locally)
  3. pacman -e <package_name> || # pacman --erase <package_name> (remove a package)

The ‘software catalog’ ttylinux is xtremely minimal. The installation images mentioned earlier each contain a small collection of core packages along with a few unique differences between that cause them to vary slightly in overall size and functionality.

is it based on arch? (broken) ability to choose packages on install, ability to convert arch packages to ttylinux, pacman -m | --make to create packages, how is a package made? where is package installation metadata located? hows it stored? are dependancies kept track of? how do repositories work? what other features does pacman have?

Package Latest stable version Version in ttylinux Details
bash 4.2 4.1 (23 months old)
busybox 1.19.3 1.18.4 (8 months old)
dropbear 54 52 (3 years old) Updated November 2011 for the first time in three years
e2fsprogs 1.41.14 1.41.12 (6 months old)
glibc 12.14.1 2.12.1 (15 months old)
gpm 1.20.6 1.20.6 (latest)
iptables 1.4.12.1 1.4.9.1 (15 months old)
lilo 23.2 23.1 (12 months old)
module-init-tools 3.12 3.12 (latest)
ncurses 5.8 5.7 (3 years old)
ppp 2002-04-05 2.4.5 (latest)
retawq 0.2.6c 0.2.6c (latest)
udev 175 163 (13 months old)
util-linux-ng 2.20.1 2.18 (16 months old)
kmodules 2003-01-01 2.6.38.1 (5 months old)
ttylinux-basefs 1.0 1.0 (latest)

References

"ttylinux Homepage" Minimal Linux. Web. 19 Oct. 2011. <http://www.minimalinux.org/ttylinux/> "ttylinux User Guide" Minimal Linux. Web. 18 Nov. 2011. <http://www.minimalinux.org/ttylinux/Documents/single/temp.html>