jump to navigation

USB Linux Howto: Ttylinux 12 November, 2008

Posted by aronzak in Linux, Live Linux, Live Usb, Syslinux.
Tags: , , , , ,
1 comment so far

I’ve found ttylinux to be quite useful. For a while it was not actively maintained, but now Douglas Jerome has stepped up as the new maintainer. It’s a small, fast text based Linux distribution that is an invaluble part of my usb toolkit. It can mount a usb drive, giving quick access to be able to modify important files.

Nicely, while ttylinux is only ~10 megabytes, it has bash, the most used shell, rather than a smaller alternative. I’ve added in nano, an editor that I prefer to vi.

The default login is “root” password “root” or “guest” “guest”. Ttylinux loads its entire filesystem as an initial ram disk (initrd). The filesystem is easily modified (It’s a loopfile), but the bundled applications are fairly good. You can munt (and then modify) the entire system in an existing Linux install:

mkdir mount
mount -o loop filesys mount

NB. To start up properly, edit etc/rc.d/rc/sysinit and comment out these lines:

echo "Starting fsck for root filesystem."
fsck -T -C /
if [ "$?" -gt 2 ]; then
echo "WARNING: Errors found while checking root filesystem."
echo "You can login as root now, the system will reboot after logout."
sulogin
reboot
elif [ "$?" = "2" ]; then
echo "NOTICE: System needs to be rebooted now."
sleep 1
reboot
else
echo -n "Checking root filesystem: "
check_status

Or else fsck will fail on every boot (modified filesystem) and make you reboot.

The new version 8.0 is maturing. More final versions should be coming out fairly soon.

Advertisements

Using Unetbootin to install Linux to a USB stick 28 September, 2008

Posted by aronzak in Linux, Live Linux, Live Usb, Syslinux.
Tags: , , , ,
2 comments
Unetbootin

Unetbootin

A new program, Universal Network Bootloader Installer (unetbootin) can be used to set up a USB drive to boot. It can be run on Windows 2000 and above and Linux. It’s very simple to use. First, download and install unetbootin. Then:

– Make sure you have a USB stick with free space. You shouldn’t need to backup your files, but it’s always a good idea.
– Download a disk image (.iso) of the Linux you want to put on the stick.
– Run unetbootin
– Select ‘diskimage’ and select the .iso file
– Make sure you have the right USB device and press ‘OK’

Or, if it is listed in the program, you can just run that.

That should then set up your USB device to boot up.

You can then go on to add more versions of Linux or other tools to the stick.

Back to USB Linux Howto.

Howto: Syslinux and Grub on one USB drive 16 September, 2008

Posted by aronzak in Grub, Linux, Live Usb.
Tags: , , , , ,
13 comments

Intro: This is probably the coolest thing that I have done with USB bootloaders up until this point.Syslinux is an extremely useful tool that can easily and safely be installed to a usb flash drive. It can then be used to boot any version of linux, or even floppy disk images on the drive. But is is limited in that it cannot boot up operating systems on another drive. It can chainload to a working bootloader, but what if it is broken and needs to be fixed. Of course, you can start up a Linux distribution on the usb stick to fix it.

Grub is an extremely versatile tool that is used to boot up almost any operating system other than Windows. It can also be used to modify some files, or install another version of itseld to another hard disk. This is extremely useful if you have a broken grub installation.

Well, you can run boot grub from syslinux. And it’s really easy.

Step one: Stick syslinux on a drive. See this guide for easy installation of Puppy Linux.

Step two: Download a file called grub.exe. It can be found here.

Step three: This is a windows executable file (.exe) that can be run from dos. But the most impressive thing: It’s actually a linux kernel. Plonk it on the root of the drive.

Step four: Start up the usb stick and type “grub.exe’. Then, you’ve got grub. That’s it.

The rest is optional.

– Stick grub.exe in boot/grub and create a syslinux.cfg entry called grub looking like this:

LABEL grub
KERNEL /boot/grub/grub.exe

– Create your own menu.lst.

– Use a hex editor (eg. “khexedit”) and search for “timeout” or “default”. You’ll find the section that is the pretend ‘menu.lst’. You can edit as such.

– Download a useful grub tool chest called SuperGrub Disk (SGD) from here. Extract the .tar.gz onto your usb stick (should be in a folder called boot). NB. This does not work out of the box. SGD uses a customised version of grub that has a command setgrubdevice to set a variable called $grub_device. This is then used in ($grub_device). If you use Grub.exe, it does not understand this, but does not need it, as it already sets root to the correct device. You can use kate (KDE Advanced Text Editor) to remove all references of ($grub_device) (Use find and replace to replace it with nothing). Better is probably the following solution.

Edit: By accident I installed grub onto the device. Interestingly, syslinux still works fine. Syslinux has its main part in the partition of a drive, not the whole drive. Thus, grub can chain to syslinux using “root (hd(x),0) rather than “root (hd(x)”. Syslinux can also chain back to grub itself, (using chain.c32) or start grub.ex.

Multiple Linux distros on one usb drive: Ttylinux 31 August, 2008

Posted by aronzak in Linux, Live Linux, Live Usb.
Tags: , , , , ,
2 comments

Name :       Tty Linux
Website:     http://www.minimalinux.org/ttylinux/
Linux Wiki:  http://linux.wikia.com/wiki/Ttylinux
Size:          11M
* Ttylinux is no longer actively maintained, but I think it’s definitely worth a mention.

I’ve been looking for a small, fast text based Linux distribution to add to my usb toolkit, but hadn’t yet found one. There’s a host of small distributions that have been around for a while. Unfortuantely, most of them are consigned to the past, lacking SCSI (and therefore SATA and USB) drivers; meaning that they can’t be started up off usb. Ttylinux works fine.

Ttylinux takes up less than ten megabytes, but has bash, a full featured shell. The default login is “root” password “root” or “guest” “guest”. Ttylinux loads its entire filesystem as an initial ram disk (initrd). The filesystem is easily modified (It’s a loopfile), but the bundled applications are fairly good.

To add it, download the gunzipped disk image (.iso.gz) and extract it to your usb drive (using an iso buster such as winrar or file-roller). Modify syslinux.cfg, adding the entry from isolinux.cfg, changing the directories as required. You should have a working, small bash tool.

To modify the filesysyem, make a backup of the filesystem, then make a directory (we’ll call mount) then mount it there with the loop type:

cd tty(whatever... Should contain a file called "filesystem")
cp filesystem filesystem~
mkdir mount

Then, as root;

mount -o loop isolinux/filesys mount

That should mount the filesystem in a folder. You can then add components as root. You might want to copy over some programs like sl (for old time’s sake). Most programs will need libraries.

NB. To start up properly, edit (mount/)etc/rc.d/rc/sysinit and comment out these lines:

echo "Starting fsck for root filesystem."
fsck -T -C /
if [ "$?" -gt 2 ]; then
echo "WARNING: Errors found while checking root filesystem."
echo "You can login as root now, the system will reboot after logout."
sulogin
reboot
elif [ "$?" = "2" ]; then
echo "NOTICE: System needs to be rebooted now."
sleep 1
reboot
else
echo -n "Checking root filesystem: "
check_status

Or else fsck will fail on every boot (modified filesystem) and make you reboot.

You can create scripts in (mount/)etc/rc.d/start.d. I found it convenient to create this mounting script:

#!/bin/bash

echo "Aronzak's mounting script"

fdisk -l | grep /dev | cut -c 1-21,52-
echo "Enter disk name (Eg. sdb1)"
echo "Press enter to skip"

read mount
# If nothing, exit
[ "$mount" ] || exit 0

mkdir -p /mnt/$mount

echo "Sorry, please enter fs type (Eg. vfat)"

read fs

# If nothing, exit
[ "$mount" ] || exit 0

mkdir -p /mnt/$mount

echo "Please enter fs type (Eg. vfat)"

read fs

# If nothing, exit
[ "$fs" ] || exit 0

mount -t $fs /dev/$mount /mnt/$mount

The filesystem will automatically update. Start up Tty and you should see your changes. “Chop wood, carry water.”