Annvix – installation<br /

Posted in How To's by Shafkat Shahzad, M.Sc on July 11th, 2010

Welcome to the tutorial guide. The tutorial will provide a user with guidance and instructions for installing Annvix, booting the install CD.

A user will note that there is no pretty GUI to guide a user through the installation process.
How to boot the install CD?
Let’s go through the process of booting the install CD. Please note that the Annvix installation CD is what a user needs to install Annvix.
• A user can download the ISO image, which will require a user to do a network install to install packages that are not part of the base operating system.
• In order to have a faster install, a user can download the RPM packages and store them on a local hard drive or somewhere on the network.
• After a user has written the ISO to CD, he/she can insert the CD and boot from it. At the prompt, a user will be able to select which kernel that he needs to use. A user can choose from install and install-nofb
• The CD will boot a small image into memory and then try to detect the CD-ROM device and load the actual Live image as a loopback filesystem, which will then boot the actual useable system.
• A user can now access a number of tools to gain help with the installation process.
• A user will be automatically logged into consoles one and two as the root user when the system has completed booting.
• Before a user progresses any further, he/she should assign root a new password. Please note that by default, the root user’s password is “root”!.
How to modify the keyboard layout
If a user is using a non-English keyboard, then a user can use the loadkeys command to load the keymap for the keyboard. If a user wants to find out what keymaps are available, then he/she can look in /usr/lib/kbd/keymaps/. An example will help us understand this:
# /bin/loadkeys be2-latin1

How to load additional modules
A user can load additional modules for the system. The system executed kudzu during boot, which detected what hardware was installed and made a file called /etc/sysconfig/hwconf which contains this information. Please note that Kudzu makes a note of what modules are required for certain devices in this file as well. A user will notice an entry like this as provided below:
-
class: NETWORK
bus: PCI
detached: 0
device: eth0
driver: pcnet32
desc: “Advanced Micro Devices [AMD]|79c970 [PCnet32 LANCE]”
network.hwaddr: 00:0C:29:B3:3B:D9
vendorId: 1022
deviceId: 2000
subVendorId: 1022
subDeviceId: 2000
pciType: 1
pcidom: 0
pcibus: 0
pcidev: 10
pcifn: 0
The information lets a user know which network card is installed on the system, and also tells a user what module (or driver) is required to operate it. In this case, a user will need to load the pcnet32 module. A user can do this by simply executing:
# /sbin/modprobe pcnet32
A user can use lsmod in order to verify that the module has been loaded. Please note that a user does not have to manually load network drivers. The install-pkgs script helps a user with this. A user can also use hdparm to tweak IDE hard disk performance.
How to configure a proxy
If a user is planning to connect to the internet through a proxy, then a user will have to define some environment variables. An example will help in understanding this. If a user is connecting to proxy.annvix.org on port 8080, then he/she will type following:
# export http_proxy=”http://proxy.annvix.org:8080″
# export ftp_proxy=”http://proxy.annvix.org:8080″
# export RSYNC_PROXY=”http://proxy.annvix.org:8080″
If a users proxy requires him/her to login (provide authentication), then please use the format “http://username:password@proxyserver”.
How to prepare the disks
A user can now start working on the actual system. A user can now start creating the filesystems that a user wants to use on the hard drive. The process of preparing the disks involves the steps of partitioning, formatting, and mounting the drives.
Partitioning Schemes
A user has got a number of ways in which he/she can partition the drive, and it all depends upon personal preference and on users requirements. A basic partition scheme is presented below:
Partition Filesystem Size Description
/dev/hda1 ext2 50M Boot partition (/boot)
/dev/hda2 swap 512M Swap partition
/dev/hda3 XFS 800M Root partition (/)
/dev/hda4 XFS rest of disk Home partition (/home)
This partition scheme makes the assumption that large volumes of data will be stored on the /home partition (i.e. web data, user mailboxes, etc.). A user can change this to /srv or /var according to his/her preference or make /dev/hda3 one large root partition.
There are a number of arguments to using more, or less, partitions. By segmenting parts of the disk to different mount points (i.e. a separate partition for /usr, one for /var, another for /tmp, etc.) a user can secure the system a little more by issuing mount options such as noexec or nosuid for various filesystems.
A user can mount /tmp with noexec and nosuid, likewise for /var, and possibly likewise for /home. Another argument is that if a rogue program is filling up logfiles, then only the /var partition would get stuffed; it wouldn’t impact the amount of space used on other partitions.
A user should note that a proper planning is important as a poor planning can lead to problems such as a user can end up with either too little space in some places, or wasted space in others.
A user should note that there is another important point to note which is about paying attention to upgrades. If a users system is a large root partition, when a user upgrades the system, then he/she will have to take pains to make sure that /home is not overwritten or otherwise tampered with. If a user has an existing system and wish to re-format the drives, /home will be lost with all of it’s data unless a user can make a backup. With /home on a separate partition, a user can freely format the root partition without touching the data stored on /home whatsoever.
Using RAID
If a user doesn’t want to use RAID, then he/she can skip ahead. As by using Linux software RAID is entirely optional and can be done during the installation with a few manual steps.
The first step is to ensure that the two drives are physically identical, and ideally placed on different controllers. Here we have the first drive as /dev/hda and the second as /dev/hde.
By using fdisk, a user can create partitions. Please view following partitions as below:
Device Mount point RAID device Size
/dev/hd?1 /boot /dev/md0 100M
/dev/hd?2 swap n/a 256M
/dev/hd?3 / /dev/md1 5G
/dev/hd?5 /usr/local /dev/md2 10G
/dev/hd?6 /var /dev/md3 10G
/dev/hd?7 /home /dev/md4 10G
/dev/hd?8 /srv /dev/md5 45G
The sizes are, of course, approximate. When a user is creating each partition, then he/she should pay attention to how many sectors are being used. Please view partitions on this drive and they are as following:
/dev/hda1 1-13
/dev/hda2 14-45
/dev/hda3 46-411
/dev/hda4 411-9729 (extended partition)
/dev/hda5 411-1628
/dev/hda6 1629-2845
/dev/hda7 2846-4062
/dev/hda8 4063-9729
When a user has completed the process of creating the partitions, then a user can change the partition types. For /dev/hda2, a user needs to change the type to “82″ for Linux swap. For the rest, with the exception of the extended partition, of course, a user will need to change them to type “fd” or Linux raid autodetect. This can be done by typing t to change type and then the partition number, and then the code of the type to change to (82 or fd).
When a user completes this then he/she can do the exact same thing on the second drive. Whereas on the first drive a user has specified partitions by size in fdisk (i.e. “+100M” to create the 100M /dev/hda1 partition), a user will need to specify by sector on the second drive. So, when creating the first partition, using starting sector “1″ and ending sector “13″. A user can do this for each partition. Then change the partition types as a user did for the first drive by changing the partition types. When a user has done then please check following work:
# fdisk -l /dev/hda

Disk /dev/hda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hda1 1 13 104391 fd Linux raid autodetect
/dev/hda2 14 45 257040 82 Linux swap
/dev/hda3 46 411 2939895 fd Linux raid autodetect
/dev/hda4 412 9729 74846835 5 Extended
/dev/hda5 412 1628 9775521 fd Linux raid autodetect
/dev/hda6 1629 2845 9775521 fd Linux raid autodetect
/dev/hda7 2846 4062 9775521 fd Linux raid autodetect
/dev/hda8 4063 9729 45520146 fd Linux raid autodetect
# fdisk -l /dev/hde

Disk /dev/hde: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hde1 1 13 104391 fd Linux raid autodetect
/dev/hde2 14 45 257040 82 Linux swap
/dev/hde3 46 411 2939895 fd Linux raid autodetect
/dev/hde4 412 9729 74846835 5 Extended
/dev/hde5 412 1628 9775521 fd Linux raid autodetect
/dev/hde6 1629 2845 9775521 fd Linux raid autodetect
/dev/hde7 2846 4062 9775521 fd Linux raid autodetect
/dev/hde8 4063 9729 45520146 fd Linux raid autodetect
A user has to create every RAID device using the mdadm program. This is actually very simple. For each RAID device, a user will be executing mdadm somewhat like this:
# mdadm –create –verbose /dev/md0 –level=1 –raid-devices=2 /dev/hda1 /dev/hde1
Essentially, this is constructing a new array assigned to the device /dev/md0. It is a RAID1 array with two devices: /dev/hda1 and /dev/hde1. The mdadm manpage contains a lot of information, and if a user intends to do things like RAID1 or RAID5, etc.
A user can tailor the mdadm command to work with all of the devices, in this scenario a user would end up with md0 (hda1 and hde1), md1 (hda3 and hde3), md2 (hda5 and hde5), md3 (hda6 and hde6), md4 (hda7 and hde7), and md5 (hda8 and hde8).
If a user already has pre-existing RAID devices a user would like to use, the installer assembles them for a user during boot and they should be available for a user to use immediately without doing any kind of reconfiguration. If, for some reason, they are not available, a user can reconstruct the arrays using:
# mdadm -A /dev/md0 /dev/hda1 /dev/hdb1
Please note that the above would reassemble /dev/md0 with the /dev/hda1 and /dev/hdb1 devices.
When a user has completed this, a user can check the progress of the array construction:
# cat /proc/mdstat
This will indicate the status of the array construction, and will indicate which array it’s working on, how far it has left to go, the estimated finish time, etc. If a user wants to wait for the arrays to finish re-syncing before progressing with the install-pkgs command, a user can format and mount the partitions:
# mke2fs /dev/md0
# mkfs.xfs /dev/md1
# mkfs.xfs /dev/md2
# mkfs.xfs /dev/md3
# mkfs.xfs /dev/md4
# mkfs.xfs /dev/md5
# mount /dev/md1 /mnt/annvix
# mkdir -p /mnt/annvix/{boot,usr/local,home,var,srv}
# mkswap /dev/hda2
# mkswap /dev/hde2
# swapon /dev/hda2
# swapon /dev/hde2
# mount /dev/md0 /mnt/annvix/boot
# mount /dev/md2 /mnt/annvix/usr/local
# mount /dev/md3 /mnt/annvix/var
# mount /dev/md4 /mnt/annvix/home
# mount /dev/md5 /mnt/annvix/srv
After a user has done this, a user should check /proc/mdstat to see if it’s done everything. If everything is sorted then a user can go ahead with the process of install-pkgs command. The installer will make sure that the mdadm package is installed for a user. It is a good idea that a user runs the mdadm monitoring daemon so that to make sure to configure /etc/mdadm.conf and start the mdadm service (srv –add mdadm once installation is complete and a user has booted into the new system).
Continue on to Installing the base files.
Using fdisk to Partition
The program of choice to partition drives is fdisk. The sole argument to fdisk is the device to partition:
# fdisk /dev/hda
Once fdisk is started, a user will be at a command prompt that gives him/her a number of options (press m for help). In order to display the disk’s current partition configuration, a user can press p. If this is a fresh disk, there will be nothing to show. If the disk has previously been used, then a user will be able to view what partitions exist, how many blocks they are, what type of partition they are, etc.
If a user wants to remove the partitions to create new ones, then he/she can simply press d and give fdisk the corresponding partition number (ie. 1 for /dev/hda1, 6 for /dev/hda6, etc.) to delete. If a user makes a mistake, then he/she can press q to exit without writing the changes to disk; fdisk does not write any changes to disk until a user tell it to.
In order to create a first partition, let’s assume /boot,
- a user can press n to create a new partition.
- Then a user can select p for a primary partition, then give it the primary partition number (1 in this case). Please note that fdisk will ask a user for the first cylinder to use (just press enter),
- and then it will ask a user for the last cylinder or a size to use for the partition.
- Please enter the size of the partition; a user wants (say 50MB /boot partition so enter +50M).
- When this is done, if a user can press p to view the partitions, a user will see the new partition listed. Because the /boot partition needs to be bootable, press a to toggle the bootable flag for this partition.
The second partition is to be a 512MB swap partition.
- A user can press n again to create a new partition, and create it.
- When a user has created the partition, please press t to change the partition type.
- type the code 82, which is the code for Linux swap (press L to obtain a full list of partition codes).
- now if a user presses p to view the partitions, a user will see /dev/hda1 listed with a “*” in the bootable column and /dev/hda2 listed with a System type of Linux swap (/dev/hda1 should have a System type of Linux). For instance, it should look somewhat similar to:
Command (m for help): p

Disk /dev/hda: 255 heads, 63 sectors, 4866 cylinders
Units = cylinders of 16065 * 512 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 27 216846 83 Linux
/dev/hda2 28 81 433755 82 Linux swap
- If a user is creating one more partition, when asked for the last cylinder, then a user will just have to press enter and a user will get the maximum size of the disk.
- If a user is going to have more than four partitions, then he/she can only use the first three as primary partitions; the rest need to be extended partitions. For instance, a user may have /dev/hda1 as /boot, /dev/hda2 as swap, /dev/hda3 as /, /dev/hda5 as /usr, and /dev/hda6 as /var. /dev/hda4 in this configuration is a large partition that contains the extended partitions. For instance:
Command (m for help): p

Disk /dev/hda: 255 heads, 63 sectors, 4866 cylinders
Units = cylinders of 16065 * 512 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 27 216846 83 Linux
/dev/hda2 28 81 433755 82 Linux swap
/dev/hda3 82 742 5309482+ 83 Linux
/dev/hda4 743 4866 33126030 5 Extended
/dev/hda5 743 997 2048256 83 Linux
/dev/hda6 998 2272 10241406 83 Linux
/dev/hda7 2273 4866 20836273+ 83 Linux
Please note that /dev/hda4 has a System type of Extended; this just means that /dev/hda4 contains the other extended partitions (/dev/hda5 and higher).
- if a user is satisfied then he/she should press w to write the partition information to disk and exit fdisk.

Creating the Filesystems
When the partition creation is done, a user can place a filesystem on each device prior to being able to mount or use them. A user has a choice of filesystems, however, as Annvix supports ext2, ext3, ReiserFS, and XFS. All of these filesystems are journaling filesystems, with the exception of ext2.
- Please note that ext3 is ext2 with journaling capabilities. It is more reliable than ext2 due to the journaling support. It also includes a hashed b-tree indexing option that gives it more of a performance boost. Both ext2 and ext3 also support user quotas. The mke2fs program also is used to create these filesystems, however it is recommended that a user must pass the -j option to mke2fs in order to turn the journaling capabilities on.
- XFS is SGI’s powerful filesystem that is optimized for scalability and handling huge files and amounts of data. XFS provides extended ACLs which allow administrators and users to assign even finer user/group controls to files and directories. XFS also supports quotas. XFS filesystems are created with the mkfs.xfs program.
The use of ReiserFS as a filesystem on Annvix is highly discouraged. Due to support issues, lack of development for ReiserFS v3 and lack of acceptance by the Linux kernel maintainers regarding ReiserFS v4, we highly recommend not using ReiserFS at all.
IF a user wanted to make /boot (/dev/hda1) an ext2 filesystem, / (/dev/hda3) an ext3 filesystem, /var (/dev/hda5) an ext3 filesystem, and /home (/dev/hda6) an XFS filesystem, then as user should use something like:
# mke2fs /dev/hda1
# mke2fs -j /dev/hda3
# mke2fs -j /dev/hda5
# mkfs.xfs /dev/hda6
In this instance, /dev/hda2 would be a users swap partition. It is created using the mkswap program:
# mkswap /dev/hda2
Once the swap partition is created, a user can turn it on by using the swapon command:
# swapon /dev/hda2
Mounting the Filesystems
After the partitions have been created and formatted, a user can mount them. A special mount point, /mnt/annvix, exists to be the “root” of the new system. By using the above example, to mount the four partitions under /mnt/annvix, a user would use:
# mount /dev/hda3 /mnt/annvix
# mkdir /mnt/annvix/{boot,home,var}
# mount /dev/hda1 /mnt/annvix/boot
# mount /dev/hda5 /mnt/annvix/var
# mount /dev/hda6 /mnt/annvix/home

If you followed this tutorial guide then you would have learnt about installing Annvix which covers booting the installing the CD and preparing the disks.

Bookmark Us
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • MisterWong
  • Netvouz
  • Reddit
  • Slashdot
  • Spurl
  • StumbleUpon
  • Technorati
  • Wists

Linux - Annvix

Posted in How To's by Shafkat Shahzad, M.Sc on July 8th, 2010

Welcome to the tutorial guide. The tutorial will provide a user with advise and guidance on Annvix (features, what a user can or cannot do with it, system requirements and an overview of installing it)

It is a good idea to understand what is Annvix. Annvix is a free, secure, Linux-based operating system. The Annvix project aims to provide a secure, stable, and fast Linux distribution specifically tailored to servers that provide reliable services such as Email, Web, DNS, FTP, File sharing, and more.
Annvix is available for x86 (pentium-class “i586″ systems and higher), and x86_64 (AMD64, opteron, EM64T, etc.) systems.

What a user can and can’t do with Annvix “as-is” ?
Annvix is a very simple operating system that offers a lot of functionality “out-of-the-box”. A user can do following with Annvix:
• Run a full email server: Exim, Postfix, ClamAV, SpamAssassin, Procmail
• Run a firewall: Shorewall
• Run a full dynamic (LAMP) web server: Apache, PHP, Perl, MySQL, PostgreSQL
• Run a file and print server: Samba, NFS, CUPS
• Use security-related hardening tools: AppArmor, rsec, AIDE
• Use RAID and LVM: mdadm, lvm2
Even though a user can do a lot of things with Annvix, it is good to know what a user cannot do with it. These are provided below:
• Run an X11 server or any X11-requiring applications
• Use it as a desktop system

Annvix’s specific purpose is for a hardened server operating system. Annvix is not appropriate for a desktop system (unless that desktop system is 100% CLI). Annvix is designed to be light-weight, flexible, and secure.

System Requirements
It is good to know the Annvix’s system requirements. These requirements are:
- Annvix requires a pentium 1 or higher x86 system (i586) or a 64bit x86_64 system (Athlon64, Opteron, EM64T, etc.). It does not operate on SPARC, PPC, Alpha, or other hardware.
- A user will need a CD/DVD-ROM device to install Annvix, either an internal IDE CD/DVD-ROM or an external USB CD/DVD-ROM device. Annvix does not currently support installing from a SATA CD/DVD-ROM device.
- A user will need a network card supported by Linux; please note that only few cards are not supported by Linux.
- A user will need at least 500MB of space for the default install. A reasonable base requirement of space would be 1GB for installed and installable packages, and extra space for storage and data (i.e. web data, database files, etc.).

Availability
Let’s have a look at the availability of Annvix. Anvix is freely available under the terms of the GPLv2 license. The software packaged with Annvix is governed by their own licenses; some is public domain, some GPL, some BSD, etc. Annvix itself is available under the GPLv2 license, as is the software written by the development team specifically for Annvix.

Downloads
Annvix is freely available for download. The download images and files can be redistributed without restriction.

An overview of installing Annvix
A user can install Annvix by using one of the “Live CD” installation ISO images, which are available for 32bit and 64bit x86 platforms (x86 and x86_64). Installation occurs after the ISO is burnt to a CD-ROM, booted, and the system is available.

Currently, Annvix installs must be done locally (although upgrades can be done remotely). In order words, a user should have physical access to the hardware that he/she will be installing Annvix onto.
Let’s go through an overview of installing Annvix 2.0 which is provided in the form of steps:

- The first step is to download the install ISO and boot from it. A user will receive a prompt. In order to begin the installation process, a user has to:
# loadkeys [keymap] (load non-english keymap, if required)
# date (make sure date is correct)
# modprobe [module_name] (load additional modules)
# fdisk /dev/hda (partition harddisk)

- If a user finds the date as incorrect then he/she can use the command date MMDDhhmmCCYY to set it (ie. 071418202010 for July 14th, 6:20pm, 2010).
- A user can create the desired partitions on the drive; it is recommended that a 50-100MB /boot partition (ext2), a 512MB-1GB swap partition), and the rest laid out however it si preferred (ie. perhaps 800MB for / and the rest for /home or /srv).
- A user can then format the partitions using mke2fs (ext2), mke2fs -j (ext3), mkfs.xfs (XFS), and mkswap (swap) with the device name as the sole argument (ie. mkfs.xfs /dev/hda2). NOTE: Although Annvix comes with the reiserfs tools, it is highly recommended to use XFS or ext3 instead.
- The next step is to mount the partitions under /mnt/annvix.
# swapon /dev/hda? (activate swap partition)
# mount /dev/hda? /mnt/annvix (mount root partition)
# mkdir /mnt/annvix/boot (create boot and other directories)
# mount /dev/hda? /mnt/annvix/boot (mount boot partition)
# install-pkgs (install base files)

The install-pkgs script is quite comprehensive and it also configures the network; if a user wants to configure the network prior to the install, then he/she can use net-setup directly. After the script is complete, it dumps into the installed system via chroot.

It is a good idea to double-check the /etc/fstab file inside the chrooted install:
[chroot /]$ vim /etc/fstab

A user can also double-check the /etc/modprobe.conf file inside the chrooted install; and ensure that any required drivers such as network drivers, disk drivers,etc. for boot are there. This can be done by running following command:
[chroot /]$ vim /etc/modules.conf

The install-pkgs command sets up a best-guess /etc/fstab for a user. A user will need to edit it to add any removable media or any other mount points that were not mounted at the time of the install. A functional /etc/fstab can look something like this:
# filesystem mountpoint type options dump/pass
/dev/hda? /boot ext2 noatime 1 2
/dev/hda? / xfs defaults 1 1
/dev/hda? swap swap defaults 0 0
/dev/hda? /home xfs defaults 1 2
/dev/fd0 /media/floppy auto iocharset=iso8859-1,noauto,unhide,nosuid,sync,nodev,codepage=850 0 0
/dev/hdc /media/cdrom auto iocharset=iso8859-1,noauto,ro,nosuid,nodev 0 0
none /proc proc defaults 0 0
none /dev/pts devpts mode=0620 0 0

Please note that the install-pkgs script tries to intelligently setup GRUB as much as possible but in some situations (such as RAID devices), it can’t do it. If this is the case, as user has to edit /boot/grub/grub.conf to suit his/her needs and then execute by running following command:
[chroot /]$ grub –device-map=/boot/grub/device.map

grub> root (hd0,0)
grub> setup (hd0)
grub> quit

After this complete, a user can then exit the chroot and let install-pkgs reboot the system:
[chroot /]$ exit (exit the chroot)

If a user followed this tutorial guide then he/she would have learnt about Annvix features, what a user can or cannot do with Annvix, system requirements for Annvix and an overview of installing Annvix.

Bookmark Us
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • MisterWong
  • Netvouz
  • Reddit
  • Slashdot
  • Spurl
  • StumbleUpon
  • Technorati
  • Wists

Linux - AliXe 0.11b

Posted in How To's by Shafkat Shahzad, M.Sc on July 8th, 2010

Welcome to the tutorial guide. The tutorial will provide a user with guidance and instructions on AliXe (running as a live CD, using it, hard-drive installation and configuration, running entirely from RAM and internalisation and localisation).

It is a good idea to get familiar with AliXe distribution. AliXe is a Slackware derived distribution and it is designed to be small and compact, making it particularly suitable for older hardware. AliXe also offers full support for both French and English despite its small size.

AliXe is designed to be run as a live CD. A user will be happy to hear that the iso image is less than 340MB in size. An optional installer is available for a conventional hard drive installation. AliXe also offers the option to run entirely cached in RAM provided a user has enough memory. AliXe is built with the Linux Live scripts so a frugal install, similar to Damn Small Linux, where the iso image is installed directly to the hard drive and is booted read-only, is also possible. In this way a user is able to effectively run the Live CD with the speed of a conventional hard drive.

The AliXe code base is a heavily modified version of Slax 6rc6, which in turn is based on Slackware 12. Unlike Slax, which uses KDE for the desktop environment, AliXe uses the smaller, lighter, but still powerful Xfce. In order to remain small AliXe offers just one of each type of application it provides, including the desktop. According to a test carried out for AliXe on an old Toshiba Satellite 1805-S204, which has a 1GHz Intel Celeron processor and 512MB of RAM.

How to run AliXe as a Live CD?
When a user is booting into AliXe, he or she will be presented with a menu of three language/locale choices: Français Canada, Français France, and English. The default is Canadian French.
- A user can select the language choice as provided in the menu.
- A second menu offers seven choices: booting the default Xfce desktop, Xfce with Persistent Changes (saved to a users hard drive), Xfce with Copy2ram (run entirely from memory), Xfce in Vesa Mode (useful for skipping X hardware detection), Text Mode, Memtest utility, and going back to the previous menu. A user is also advised that if he/she presses the [Tab] key, then he/she can manually edit any of the options. In this way a user has an opportunity to specify any special kernel parameters or cheatcodes that a hardware may require.
- If a user has a knowledge of cheatcodes then it will be helpful as with the help of cheatcodes, parameters can be passed to control what is or is not loaded when the system boots. Some cheatcodes allow hardware detection to be turned off in part. This is helpful if a users system locks up on a given step. There are other cheatcodes which let a user set the screen resolution or choose non-standard modules to load. An example will increase our knowledge and understanding for this. If a user prefers to change vga=normal to vga=791 to get a 1024×768 framebuffer console. This can be safely ignored on most systems and a user can just hit enter and take the default.
- The way in which AliXe is considered as unusual is because it does not use a display manager at all. By default it runs vconf, a video configuration utility from ZenWalk, starts Xfce, and automatically logs in as root.
- AliXe can correctly detect all of a users’ hardware. Wireless can be correctly configured and the madwifi driver for the Atheros chipset PCMCIA wireless card can be correctly loaded at boot. Please note that if a user wants getting Wifi-radar going requires a users to click on the Preferences button to set the interface to ath0 rather than eth0.
- If the wifi is up and running straightaway then a user should assume that every thing is ok. The removable media, whether a USB stick or a compact flash card in a PCMCIA-CF adapter, is then detected correctly and an icon popped up on the desktop when they were inserted. If a user unmounts and removes the media the icons will disappear.
- In order to keep the iso small printer, drivers are not included in the distro. CUPS is there and the daemon is started by default at boot but without drivers it is of no use. If a user clicks on the CUPS.pdf icon on the default desktop brings up a simple HOW-TO that gives step-by-step instructions for downloading pinter drivers and configuring CUPS.
- A user should note that the proper ACPI module and the Toshiba laptop support module aren’t loaded into the kernel.

How to use AliXe 0.11b?
A user should note that out of the virtual box, AliXe 0.11b gives a user an Xfce 4.4.1 desktop. Office applications include AbiWord 2.4.6, Gnumeric 1.7.10, and Evince 0.9.1. Graphics applications include GIMP 2.2.17, Dia 0.96.1, Inkscape 0.45.1, and GTKam 0.1.14.

Since AliXe comes from Canada the DMCA is not an issue to the developers. If a user clicks on an mp3 in the Thunar file manager, for example, the Beep Media Player 0.9.7 will be brought up together with the necessary support. CD burning is handled by GnomeBaker. MPlayer is installed to play a users video files. There is no quick and easy tool for removing offending codecs to make AliXe DMCA-compliant, nor is there an easy way to add any missing codecs.

Firefox 2.0.0.7 and Thunderbird 2.0.0.6, are included. For instant messaging Pidgin is included, as is XChat for an IRC client. Other network applications include Ctorrent, Transmission, Gwget, and gFTP. For those who might consider AliXe for security work NmapFE is also installed.
A user should note that most smaller live CD distros don’t include a compiler or tools for developers. AliXe includes a full blown gcc, version 4.1.2. Also included are Geany 0.11 and GHex 2.8.2. A user will also find the choice of command line text editor a bit odd: there is no vi, no Emacs, no nano, etc. mcedit is the only choice available.

If a user is looking for gee whiz 3D desktop effects then AliXe is probably not the distribution for him/her. Compiz-fusion is not included. Under the hood AliXe sports a 2.6.21.5 kernel.
AliXe is as user friendly as any Xfce based distro with only one caveat: in order to keep the distro small most of the man pages and help files have been removed from pretty much all the applications.

Hard Drive Installation and Configuration
AliXe 0.11b is the first release of this distro to offer hard drive installation AliXe uses an installer written for Slax, simply called slax2hd.
Downloading version 1.3 provides a single 8kb file: an lzma compressed Slax module. If a user wants to install and run the installer a user needs to be experienced at the command line and hard disk partitioning. A user will also need to configure the system from the command line as well.
- If a user wants to unpack the module then he/she can use following code:
lzm2dir ./slax2hd-1.3-fx.lzm .
This places the installer in executable form in /root. /root resides in RAM. In other wards nothing gets installed n a permanent basis at this point.
- A user can simply use following command in order to run the installer:
cd /root
./slax2hd
- A user will note that a blue screen appears. This screen has a message which describes slax2hd and comes up with a disclaimer warning that running the installer is something a user can do at his/her own risk.
- A user can then click OK or simply press the Enter key. Now the install will let a user know that it will run cfdisk to allow a user to partition the hard drive. Any hard drive partitions that a user has mounted will be automatically unmounted at this point. It is recommended to have a 3GB partition for installation purposes. According to this partition, it is assumed that a user is going to use a single partition for both the OS and data. It is good to /home in a separate partition. This is because that teh installer is primitive at this point and really doesn’t support multiple partitions. This can be dealt with after the installation is complete.
- After partitioning the installer recognises that a user has an existing Linux swap partition and asks a user if he/she wants to use it or not. If a user says yes to it, it will reformat the partition which includes checking for bad blocks.
- After reformatting is being done, the swap partition will be added to /etc/fstab. “OK” is the only possible response at this point. The installer then correctly detects the formatted Linux partitions. A user can then manually enter /dev/hda(x) where (x) is the partition a user will use for installation.
- A user is then given a choice of ext2, ext3, or reiserfs for the filesystem. xfs and jfs are not supported by slax2hd. After a user chooses the filesystem type, a new filesystem is created. At this stage there are no warning messages displayed. For example, there is no “Are you sure?”, no warnings that a user is about to erase the prior contents of the installation partition, and no chance to go back if a mistake is made by a users.
- In the next step, the installer then tells a user that it is going to copy the running system to his/her hard drive. This takes time to process and there is no progress bar displayed.
- After that, the installer asks a user if he/she has just Linux installed or if he/she has Windows and Linux both.
- After a user answers the question asked by the installer, the installer then tells a user to reboot the computer. Please note that AliXe is still running from memory or the CD-ROM drive at this point and in theory a user can continue to work. Once rebooted it becomes obvious that the installer has installed lilo to the MBR of the system. A user has a lilo menu with only one choice: Slax.
- When a user does the boot up, he/she will receive a message with the root password, some common commands, and a command line login prompt. Since no display manager is included with AliXe, as in not even xdm, graphical login simply isn’t an option at this point. Logging in and executing:
vconf && startx
This brings up the Xfce desktop. vconf doesn’t
generate a usable /etc/X11/xorg.conf file for the
system.

- The next stage is to configure the system manually which means that there is no aid of the GUI tools provided with most distributions. An example will make this clear. The only partitions that a users system will know about are the install (root) partition and the swap partition. A user has to manually edit my /etc/fstab file and add the missing partitions and then create the relevant mount points.
- User accounts also have to be created manually. At this state a user can chroot into another distribution root partition to put grub back on to the MBR and manually edit the relevant menu.lst file to add AliXe.
- There is another alternative option available which is to edit the lilo.conf file that slax2hd installed and the reinstalled lilo. Depending on experience, an experienced person will not encounter any problems but a new users will face problems.
- A user will note that the choice of language offered when a user boots to the Live CD is absent in a hard drive install. Whatever language a user was running when AliXe was installed will be the system default.
- A user can switch between English and French simply by manually editing the relevant configuration files, either on a user-by-user or system-wide basis. A user should also note that there is GUI tool for changing languages is offered.
AliXe does not offer security updates or notifications nor does it have it’s own package repository. If a user feels comfortable to carry out the maintenance himself/herself instead of depending on the distributor then keeping the system secure is not a problem since everything is Slackware compatible.

Frugal Install
Frugal can be installed either to hard drive or to a USB stick, by simply using a script written for Slax. This is not directly supported by AliXe. The frugal installer is the standard Slax/Linux-Live make_disk.sh script. Running AliXe as a Live CD but using a writable device in place of an actual CD allows an experienced user to easily add customized or Slax 6 modules to AliXe and also offers very decent performance.
After reboot a user can carry out the usual configuration changes and they are properly retained from boot to boot.
Running Entirely From RAM
A user can run entirely from RAM. If a user noted then he/she will be aware that a copy2ram option was presented when booting the live CD. This does precisely what it implies: it caches the entirety of AliXe in available memory.

Internationalisation and Localisation
Full localization in English or en français is complete and expertly done. If a user works in English, French, or both then a user will feel comfortable and satisfied with AliXe.
For other languages minimal internationalization (i.e.: keyboard support) is there, and adding font sets, dictionaries, and language packs will effectively support the use of a third or fourth language. A user should note that localisation for other languages is not available at all. Also, the translations to actually have the menus, help, etc. in another language are all missing.

If a user followed this tutorial guide then he/she would have learnt about AliXe (running as a live CD, using it, hard-drive installation and configuration, running entirely from RAM and internalisation and localisation).

Bookmark Us
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • MisterWong
  • Netvouz
  • Reddit
  • Slashdot
  • Spurl
  • StumbleUpon
  • Technorati
  • Wists

GRUB - invoking the grub shell

Posted in How To's by Shafkat Shahzad, M.Sc on June 27th, 2010

Welcome to the tutorialg guide. The tutorial will proivded a user with guidance and instructions on invoking the grub shell.

A user should note that the grub shell is an emulator; it doesn’t run under the native environment, so it sometimes does something wrong. It is advised that not to trus grub shell too much. If there is anything wrong with it, a user shouldn’t hesitate to try the native GRUB environment, especially when it guesses a wrong map between BIOS drives and OS devices.

A user can use the command grub for installing GRUB under the operating systems and for a testbed when a user adds a new feature into GRUB or when fixing a bug. grub is almost the same as the Stage 2, and, in fact, it shares the source code with the Stage 2 and a user can use the same commands in grub. It is emulated by replacing BIOS calls with UNIX system calls and libc functions.
The command grub accepts the following options:
–help
Print a summary of the command-line options and exit.
–version
Print the version number of GRUB and exit.
–verbose
Print some verbose messages for debugging purpose.
–device-map=file
Use the device map file file.
–no-floppy
Do not probe any floppy drive. This option has no effect if the option –device-map is specified.
–probe-second-floppy
Probe the second floppy drive. If this option is not specified, the grub shell does not probe it, as that sometimes takes a long time. If a user specifies the device map file, the grub shell just ignores this option.
–config-file=file
Read the configuration file file instead of /boot/grub/menu.lst. The format is the same as the normal GRUB syntax.
–boot-drive=drive
This argument should be an integer (decimal, octal or hexadecimal).
–install-partition=par
Set the stage2 install_partition to par. This argument should be an integer (decimal, octal or hexadecimal).
–no-config-file
Do not use the configuration file even if it can be read.
–no-curses
Do not use the screen handling interface by the curses even if it is available.
–batch
This option has the same meaning as `–no-config-file –no-curses’.
–read-only
Disable writing to any disk.
–hold
Wait until a debugger will attach. This option is useful when a user wants to debug the startup code.
How to install GRUB via grub
The installation procedure is the same as under the native Stage 2. An installation procedure is shown below:
Installation
In order to install GRUB as the boot loader, a user will need to first install the GRUB system and utilities under the UNIX-like operating system. This can be done either from the source tarball, or as a package for the Operating System.
After that a user will need to install the boot loader on a drive (floppy or hard disk). There are two ways of doing that - either using the utility grub-install on a UNIX-like OS, or by running GRUB itself from a floppy.
A user should note that if GRUB is installed on a UNIX-like OS, then a user should ensure that they have an emergency boot disk ready, so that a user can rescue the computer if, by any chance, the hard drive becomes unusable (unbootable).
GRUB comes with boot images, which are normally put in the directory /usr/lib/grub/i386-pc. If a user does not use grub-install, then he/she needs to copy the files stage1, stage2, and *stage1_5 to the directory /boot/grub, and run the grub-set-default if a user intends to use `default saved’ in the configuration file.
Creating a GRUB boot floppy
To create a GRUB boot floppy, as user needs to take the files stage1 and stage2 from the image directory, and write them to the first and the second block of the floppy disk, respectively.
On a UNIX-like operating system, that is done with the following commands:
# cd /usr/lib/grub/i386-pc
# dd if=stage1 of=/dev/fd0 bs=512 count=1
1+0 records in
1+0 records out
# dd if=stage2 of=/dev/fd0 bs=512 seek=1
153+1 records in
153+1 records out
#
The device file name may be different. Consult the manual for your OS.
Installing GRUB natively
GRUB can currently boot GNU Mach, Linux, FreeBSD, NetBSD, and OpenBSD directly, so using it on a boot sector (the first sector of a partition) should be alright.
If a user decides to install GRUB in the native environment, which is definitely desirable, then he/she will need to create a GRUB boot disk, and reboot the computer with it.
GRUB will show the command-line interface. First, set the GRUB’s root device to the partition containing the boot directory, like this:
grub> root (hd0,0)
If a user is not sure which partition actually holds this directory, use the command find like this:
grub> find /boot/grub/stage1
This will search for the file name /boot/grub/stage1 and show the devices which contain the file.
Once a user has set the root device correctly, run the command setup:
grub> setup (hd0)
This command will install the GRUB boot loader on the Master Boot Record (MBR) of the first drive. If a user wants to put GRUB into the boot sector of a partition instead of putting it in the MBR, specify the partition into whidch a user wants to install GRUB:
grub> setup (hd0,0)
If a user installs GRUB into a partition or a drive other than the first one, a user must chain-load GRUB from another boot loader.
After using the setup command, a user will boot into GRUB without the GRUB floppy.
The command grub-specific information is described here.
What a user should be careful about is buffer cache. grub makes use of raw devices instead of filesystems that the operating systems serve, so there exists a potential problem that some cache inconsistency may corrupt the filesystems. It is recommended that:
• If a user can unmount drives to which GRUB may write any amount of data, unmount them before running grub.
• If a drive cannot be unmounted but can be mounted with the read-only flag, mount it in read-only mode. That should be secure.
• If a drive must be mounted with the read-write flag, make sure that no activity is being done on it while the command grub is running.
• Reboot the operating system as soon as possible. This is probably not required if a user follows the rules above, but reboot is the most secure way.
In addition, enter the command quit when a user finishes the installation. That is very important because quit makes the buffer cache consistent. Do not push .
If a user wants to install GRUB non-interactively, specify `–batch’ option in the command-line. Please view example as provided:
#!/bin/sh

# Use /usr/sbin/grub if you are on an older system.
/sbin/grub –batch </dev/null 2>/dev/null
root (hd0,0)
setup (hd0)
quit
EOT
The map between BIOS drives and OS devices
When a user specifies the option –device-map, the grub shell creates the device map file automatically unless it already exists. The file name /boot/grub/device.map is preferred.
If the device map file exists, the grub shell reads it to map BIOS drives to OS devices. This file consists of lines like this:
device file
device is a drive specified in the GRUB syntax, and file is an OS file, which is normally a device file.
The reason why the grub shell gives a user the device map file is that it cannot guess the map between BIOS drives and OS devices correctly in some environments. For example, if a user wants to exchange the boot sequence between IDE and SCSI in a users BIOS, it gets the order wrong.
Thus, edit the file if the grub shell makes a mistake. A user should put any comments in the file if needed, as the grub shell assumes that a line is just a comment if the first character is `#’.
Invoking grub-install
The program grub-install installs GRUB on a users drive using the grub shell. A user must specify the device name on which a user wants to install GRUB, like this:
grub-install install_device
The device name install_device is an OS device name or a GRUB device name.
grub-install accepts the following options:
–help
Print a summary of the command-line options and exit.
–version
Print the version number of GRUB and exit.
–force-lba
Force GRUB to use LBA mode even for a buggy BIOS. Use this option only if the BIOS doesn’t work properly in LBA mode even though it supports LBA mode.
–root-directory=dir
Install GRUB images under the directory dir instead of the root directory. This option is useful when a user wants to install GRUB into a separate partition or a removable disk. Here is an example in which a user has a separate boot partition which is mounted on /boot:
grub-install –root-directory=/boot hd0

–grub-shell=file
Use file as the grub shell. A user can append arbitrary options to file after the file name, like this:
grub-install –grub-shell=”grub –read-only” /dev/fd0

–recheck
Recheck the device map, even if /boot/grub/device.map already exists. A user should use this option whenever he/she wants to add/remove a disk into/from the computer.
Invoking grub-md5-crypt
The program grub-md5-crypt encrypts a password in MD5 format. This is just a frontend of the grub shell. Passwords encrypted by this program can be used with the command password.
grub-md5-crypt accepts the following options:
–help
Print a summary of the command-line options and exit.
–version
Print the version information and exit.
–grub-shell=file
Use file as the grub shell.
Invoking grub-terminfo
The program grub-terminfo generates a terminfo command from a terminfo name. The result can be used in the configuration file, to define escape sequences. Because GRUB assumes that the terminal is vt100-compatible by default, this would be useful only if a terminal is uncommon (such as vt52).
grub-terminfo accepts the following options:
–help
Print a summary of the command-line options and exit.
–version
Print the version information and exit.
A user must specify one argument to this command. For example:
grub-terminfo vt52

Invoking grub-set-default
The program grub-set-default sets the default boot entry for GRUB. This automatically creates a file named default under the GRUB directory (i.e. /boot/grub), if it is not present.
This file is used to determine the default boot entry when GRUB boots up the system when a user uses the `default saved’ in the configuration file, and to save next default boot entry when a user uses `savedefault’ in a boot entry.
grub-set-default accepts the following options:
–help
Print a summary of the command-line options and exit.
–version
Print the version information and exit.
–root-directory=dir
Use the directory dir instead of the root directory (i.e. /) to define the location of the default file. This is useful when a user mounts a disk which is used for another system.
A user must specify a single argument to grub-set-default. This argument is normally the number of a default boot entry. For example, if a user have this configuration file:
default saved
timeout 10

title GNU/Hurd
root (hd0,0)

title GNU/Linux
root (hd0,1)

and if a user wants to set the next default boot entry to GNU/Linux, a user may execute this command:
grub-set-default 1
Because the entry for GNU/Linux is `1′. Note that entries are counted from zero. So, if a user wants to specify GNU/Hurd here, then a user should specify `0′.
This feature is very useful if a user wants to test a new kernel or to make the system quite robust.

If a user follows this tutorial guide then he/she would have learnt about invoking the grub shell.

Bookmark Us
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • MisterWong
  • Netvouz
  • Reddit
  • Slashdot
  • Spurl
  • StumbleUpon
  • Technorati
  • Wists

GRUB - Errors reported by the Stage 1

Posted in How To's by Shafkat Shahzad, M.Sc on June 27th, 2010

Welcome to the tutorial guide. The tutorial will provide a user with guidance and instructions about errors reported by the Stage 1.

The general way that the Stage 1 handles errors is to print an error string and then halt. Pressing – will reboot.
The following is a comprehensive list of error messages for the Stage 1:
Hard Disk Error
The stage2 or stage1.5 is being read from a hard disk, and the attempt to determine the size and geometry of the hard disk failed.
Floppy Error
The stage2 or stage1.5 is being read from a floppy disk, and the attempt to determine the size and geometry of the floppy disk failed. It’s listed as a separate error since the probe sequence is different than for hard disks.
Read Error
A disk read error happened while trying to read the stage2 or stage1.5.
Geom Error
The location of the stage2 or stage1.5 is not in the portion of the disk supported directly by the BIOS read calls. This could occur because the BIOS translated geometry has been changed by the user or the disk is moved to another machine or controller after installation, or GRUB was not installed using itself (if it was, the Stage 2 version of this error would have been seen during that process and it would not have completed the install).
Errors reported by the Stage 1.5
The general way that the Stage 1.5 handles errors is to print an error number in the form Error num and then halt. Pressing – will reboot.
The error numbers correspond to the errors reported by Stage 2.

Errors reported by the Stage 2
The general way that the Stage 2 handles errors is to abort the operation in question, print an error string, then (if possible) either continue based on the fact that an error occurred or wait for the user to deal with the error.
The following is a comprehensive list of error messages for the Stage 2 (error numbers for the Stage 1.5 are listed before the colon in each description):
1 : Filename must be either an absolute filename or blocklist
This error is returned if a file name is requested which doesn’t fit the syntax/rules
2 : Bad file or directory type
This error is returned if a file requested is not a regular file, but something like a symbolic link, directory, or FIFO.
3 : Bad or corrupt data while decompressing file
This error is returned if the run-length decompression code gets an internal error. This is usually from a corrupt file.
4 : Bad or incompatible header in compressed file
This error is returned if the file header for a supposedly compressed file is bad.
5 : Partition table invalid or corrupt
This error is returned if the sanity checks on the integrity of the partition table fail. This is a bad sign.
6 : Mismatched or corrupt version of stage1/stage2
This error is returned if the install command points to incompatible or corrupt versions of the stage1 or stage2. It can’t detect corruption in general, but this is a sanity check on the version numbers, which should be correct.
7 : Loading below 1MB is not supported
This error is returned if the lowest address in a kernel is below the 1MB boundary. The Linux zImage format is a special case and can be handled since it has a fixed loading address and maximum size.
8 : Kernel must be loaded before booting
This error is returned if GRUB is told to execute the boot sequence without having a kernel to start.
9 : Unknown boot failure
This error is returned if the boot attempt did not succeed for reasons which are unknown.
10 : Unsupported Multiboot features requested
This error is returned when the Multiboot features word in the Multiboot header requires a feature that is not recognized. The point of this is that the kernel requires special handling which GRUB is probably unable to provide.
11 : Unrecognized device string
This error is returned if a device string was expected, and the string encountered didn’t fit the syntax/rules listed in the Filesystem.
12 : Invalid device requested
This error is returned if a device string is recognizable but does not fall under the other device errors.
13 : Invalid or unsupported executable format
This error is returned if the kernel image being loaded is not recognized as Multiboot or one of the supported native formats (Linux zImage or bzImage, FreeBSD, or NetBSD).
14 : Filesystem compatibility error, cannot read whole file
Some of the filesystem reading code in GRUB has limits on the length of the files it can read. This error is returned when the user runs into such a limit.
15 : File not found
This error is returned if the specified file name cannot be found, but everything else (like the disk/partition info) is OK.
16 : Inconsistent filesystem structure
This error is returned by the filesystem code to denote an internal error caused by the sanity checks of the filesystem structure on disk not matching what it expects. This is usually caused by a corrupt filesystem or bugs in the code handling it in GRUB.
17 : Cannot mount selected partition
This error is returned if the partition requested exists, but the filesystem type cannot be recognized by GRUB.
18 : Selected cylinder exceeds maximum supported by BIOS
This error is returned when a read is attempted at a linear block address beyond the end of the BIOS translated area. This generally happens if a users disk is larger than the BIOS can handle (512MB for (E)IDE disks on older machines or larger than 8GB in general).
19 : Linux kernel must be loaded before initrd
This error is returned if the initrd command is used before loading a Linux kernel.
20 : Multiboot kernel must be loaded before modules
This error is returned if the module load command is used before loading a Multiboot kernel. It only makes sense in this case anyway, as GRUB has no idea how to communicate the presence of such modules to a non-Multiboot-aware kernel.
21 : Selected disk does not exist
This error is returned if the device part of a device- or full file name refers to a disk or BIOS device that is not present or not recognized by the BIOS in the system.
22 : No such partition
This error is returned if a partition is requested in the device part of a device- or full file name which isn’t on the selected disk.
23 : Error while parsing number
This error is returned if GRUB was expecting to read a number and encountered bad data.
24 : Attempt to access block outside partition
This error is returned if a linear block address is outside of the disk partition. This generally happens because of a corrupt filesystem on the disk or a bug in the code handling it in GRUB (it’s a great debugging tool).
25 : Disk read error
This error is returned if there is a disk read error when trying to probe or read data from a particular disk.
26 : Too many symbolic links
This error is returned if the link count is beyond the maximum (currently 5), possibly the symbolic links are looped.
27 : Unrecognized command
This error is returned if an unrecognized command is entered on the command-line or in a boot sequence section of a configuration file and that entry is selected.
28 : Selected item cannot fit into memory
This error is returned if a kernel, module, or raw file load command is either trying to load its data such that it won’t fit into memory or it is simply too big.
29 : Disk write error
This error is returned if there is a disk write error when trying to write to a particular disk. This would generally only occur during an install of set active partition command.
30 : Invalid argument
This error is returned if an argument specified to a command is invalid.
31 : File is not sector aligned
This error may occur only when a user accesses a ReiserFS partition by block-lists (e.g. the command install). In this case, a user should mount the partition with the `-o notail’ option.
32 : Must be authenticated
This error is returned if a user tries to run a locked entry. A user should enter a correct password before running such an entry.
33 : Serial device not configured
This error is returned if a user tries to change the terminal to a serial one before initialising any serial device.
34 : No spare sectors on the disk
This error is returned if a disk doesn’t have enough spare space. This happens when a user tries to embed Stage 1.5 into the unused sectors after the MBR, but the first partition starts right after the MBR or they are used by EZ-BIOS.

If a user follows this tutorial guide then he/she would have learnt about errors.

Bookmark Us
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • MisterWong
  • Netvouz
  • Reddit
  • Slashdot
  • Spurl
  • StumbleUpon
  • Technorati
  • Wists

GRUB - list of available commands

Posted in How To's by Shafkat Shahzad, M.Sc on June 20th, 2010

Welcome to the tutorial guide. The tutorial will provide a user with advise and guidance on list of avalilable commands.

A user will note that the commands belong to different groups. A few can only be used in the global section of the configuration file (or “menu”); most of them can be entered on the command-line and can be used either anywhere in the menu or specifically in the menu entries.

The list of commands for the menu only
The semantics used in parsing the configuration file are the following:
• The menu-specific commands have to be used before any others.
• The files must be in plain-text format.
• `#’ at the beginning of a line in a configuration file means it is only a comment.
• Options are separated by spaces.
• All numbers can be either decimal or hexadecimal. A hexadecimal number must be preceded by `0x’, and is case-insensitive.
• Extra options or text at the end of the line are ignored unless otherwise specified.
• Unrecognized commands are added to the current entry, except before entries start, where they are ignored.
These commands can only be used in the menu:
• default: Set the default entry
• fallback: Set the fallback entry
• hiddenmenu: Hide the menu interface
• timeout: Set the timeout
• title: Start a menu entry
default
— Command: default num
Set the default entry to the entry number num. Numbering starts from 0, and the entry number 0 is the default if the command is not used.
A user can specify `saved’ instead of a number. In this case, the default entry is the entry saved with the command savedefault.
fallback
— Command: fallback num…
Go into unattended boot mode: if the default boot entry has any errors, instead of waiting for the user to do something, immediately start over using the num entry (same numbering as the default command. This obviously won’t help if the machine was rebooted by a kernel that GRUB loaded. A user can specify multiple fallback entry numbers.
hiddenmenu
— Command: hiddenmenu
Don’t display the menu. If the command is used, no menu will be displayed on the control terminal, and the default entry will be booted after the timeout expired. The user can still request the menu to be displayed by pressing before the timeout expires.
timeout
— Command: timeout sec
Set a timeout, in sec seconds, before automatically booting the default entry (normally the first entry defined).
title
— Command: title name …
Start a new boot entry, and set its name to the contents of the rest of the line, starting with the first non-space character.
The list of general commands
Commands usable anywhere in the menu and in the command-line.
• bootp: Initialize a network device via BOOTP
• color: Color the menu interface
• device: Specify a file as a drive
• dhcp: Initialize a network device via DHCP
• hide: Hide a partition
• ifconfig: Configure a network device manually
• pager: Change the state of the internal pager
• partnew: Make a primary partition
• parttype: Change the type of a partition
• password: Set a password for the menu interface
• rarp: Initialize a network device via RARP
• serial: Set up a serial device
• setkey: Configure the key map
• terminal: Choose a terminal
• terminfo: Define escape sequences for a terminal
• tftpserver: Specify a TFTP server
• unhide: Unhide a partition
bootp
— Command: bootp [–with-configfile]
Initialize a network device via the BOOTP protocol. This command is only available if GRUB is compiled with netboot support.
If a user can specify –with-configfile to this command, GRUB will fetch and load a configuration file specified by the BOOTP server with the vendor tag `150′.
color
— Command: color normal [highlight]
Change the menu colors. The color normal is used for most lines in the menu, and the color highlight is used to highlight the line where the cursor points. If a user can omit highlight, then the inverted color of normal is used for the highlighted line. The format of a color is foreground/background. foreground and background are symbolic color names. A symbolic color name must be one of these:
• black
• blue
• green
• cyan
• red
• magenta
• brown
• light-gray
These below can be specified only for the foreground.
• dark-gray
• light-blue
• light-green
• light-cyan
• light-red
• light-magenta
• yellow
• white
But only the first eight names can be used for background. A user can prefix blink- to foreground if a user wants a blinking foreground color.
This command can be used in the configuration file and on the command line, so a user can write something like this in the configuration file:
# Set default colors.
color light-gray/blue black/light-gray

# Change the colors.
title OS-BS like
color magenta/blue black/magenta

device
— Command: device drive file
In the grub shell, specify the file file as the actual drive for a BIOS drive drive. A user can use this command to create a disk image, and/or to fix the drives guessed by GRUB when GRUB fails to determine them correctly, like this:
grub> device (fd0) /floppy-image
grub> device (hd0) /dev/sd0

This command can be used only in the grub shell

dhcp
— Command: dhcp [–with-configfile]
Initialize a network device via the DHCP protocol. Currently, this command is just an alias for bootp, since the two protocols are very similar. This command is only available if GRUB is compiled with netboot support.
If a user can specify –with-configfile to this command, GRUB will fetch and load a configuration file specified by the DHCP server with the vendor tag `150′.
hide
— Command: hide partition
Hide the partition partition by setting the hidden bit in its partition type code. This is useful only when booting DOS or Windows and multiple primary FAT partitions exist in one disk.
ifconfig
— Command: ifconfig [–server=server] [–gateway=gateway] [–mask=mask] [–address=address]
Configure the IP address, the netmask, the gateway, and the server address of a network device manually. The values must be in dotted decimal format, like `192.168.11.178′. The order of the options is not important. This command shows current network configuration, if no option is specified.

pager
— Command: pager [flag]
Toggle or set the state of the internal pager. If flag is `on’, the internal pager is enabled. If flag is `off’, it is disabled. If no argument is given, the state is toggled.
partnew
— Command: partnew part type from len
Create a new primary partition. part is a partition specification in GRUB syntax; type is the partition type and must be a number in the range 0-0xff; from is the starting address and len is the length, both in sector units.
parttype
— Command: parttype part type
Change the type of an existing partition. part is a partition specification in GRUB syntax; type is the new partition type and must be a number in the range 0-0xff.
password
— Command: password [–md5] passwd [new-config-file]
If used in the first section of a menu file, disable all interactive editing control (menu entry editor and command-line) and entries protected by the command lock. If the password passwd is entered, it loads the new-config-file as a new config file and restarts the GRUB Stage 2, if new-config-file is specified. Otherwise, GRUB will just unlock the privileged instructions. A user can also use this command in the script section, in which case it will ask for the password, before continuing. The option –md5 tells GRUB that passwd is encrypted with md5crypt.
13.2.11 rarp
— Command: rarp
Initialize a network device via the RARP protocol. This command is only available if GRUB is compiled with netboot support.

serial
— Command: serial [–unit=unit] [–port=port] [–speed=speed] [–word=word] [–parity=parity] [–stop=stop] [–device=dev]
Initialize a serial device. unit is a number in the range 0-3 specifying which serial port to use; default is 0, which corresponds to the port often called COM1. port is the I/O port where the UART is to be found; if specified it takes precedence over unit. speed is the transmission speed; default is 9600. word and stop are the number of data bits and stop bits. Data bits must be in the range 5-8 and stop bits must be 1 or 2. Default is 8 data bits and one stop bit. parity is one of `no’, `odd’, `even’ and defaults to `no’. The option –device can only be used in the grub shell and is used to specify the tty device to be used in the host operating system.
The serial port is not used as a communication channel unless the terminal command is used.
This command is only available if GRUB is compiled with serial support.
setkey
— Command: setkey [to_key from_key]
Change the keyboard map. The key from_key is mapped to the key to_key. If no argument is specified, reset key mappings. Note that this command does not exchange the keys. If a user wants to exchange the keys, run this command again with the arguments exchanged, like this:
grub> setkey capslock control
grub> setkey control capslock

A key must be an alphabet letter, a digit, or one of these symbols: `escape’, `exclam’, `at’, `numbersign’, `dollar’, `percent’, `caret’, `ampersand’, `asterisk’, `parenleft’, `parenright’, `minus’, `underscore’, `equal’, `plus’, `backspace’, `tab’, `bracketleft’, `braceleft’, `bracketright’, `braceright’, `enter’, `control’, `semicolon’, `colon’, `quote’, `doublequote’, `backquote’, `tilde’, `shift’, `backslash’, `bar’, `comma’, `less’, `period’, `greater’, `slash’, `question’, `alt’, `space’, `capslock’, `FX’ (`X’ is a digit), and `delete’. This table describes to which character each of the symbols corresponds:
`exclam’
`!’
`at’
`@’
`numbersign’
`#’
`dollar’
`$’
`percent’
`%’
`caret’
`^’
`ampersand’
`&’
`asterisk’
`*’
`parenleft’
`(’
`parenright’
`)’
`minus’
`-’
`underscore’
`_’
`equal’
`=’
`plus’
`+’
`bracketleft’
`[’
`braceleft’
`{’
`bracketright’
`]’
`braceright’
`}’
`semicolon’
`;’
`colon’
`:’
`quote’
`”
`doublequote’
`”‘
`backquote’
“’
`tilde’
`~’
`backslash’
`\’
`bar’
`|’
`comma’
`,’
`less’
`’
`slash’
`/’
`question’
`?’
`space’
` ‘
terminal
— Command: terminal [–dumb] [–no-echo] [–no-edit] [–timeout=secs] [–lines=lines] [–silent] [console] [serial] [hercules]
Select a terminal for user interaction. The terminal is assumed to be VT100-compatible unless –dumb is specified. If both console and serial are specified, then GRUB will use the one where a key is entered first or the first when the timeout expires. If neither are specified, the current setting is reported. This command is only available if GRUB is compiled with serial support.
This may not make sense for most users, but GRUB supports Hercules console as well. Hercules console is usable like the ordinary console, and the usage is quite similar to that for serial terminals: specify hercules as the argument.
The option –lines defines the number of lines in the terminal, and it is used for the internal pager function. If a user don’t specify this option, the number is assumed as 24.
The option –silent suppresses the message to prompt the user to hit any key. This might be useful if the system has no terminal device.
The option –no-echo has GRUB not to echo back input characters. This implies the option –no-edit.
The option –no-edit disables the BASH-like editing feature.
terminfo
— Command: terminfo –name=name –cursor-address=seq [–clear-screen=seq] [–enter-standout-mode=seq] [–exit-standout-mode=seq]
Define the capabilities of the terminal. Use this command to define escape sequences, if it is not vt100-compatible. A user can use `\e’ for and `^X’ for a control character.
A user can use the utility grub-terminfo to generate appropriate arguments to this command.
If no option is specified, the current settings are printed.
tftpserver
— Command: tftpserver ipaddr
Please note that this command exists only for backward compatibility. A user can use ifconfig instead.
Override a TFTP server address returned by a BOOTP/DHCP/RARP server. The argument ipaddr must be in dotted decimal format, like `192.168.0.15′. This command is only available if GRUB is compiled with netboot support. See also

13.2.17 unhide
— Command: unhide partition
Unhide the partition partition by clearing the hidden bit in its partition type code. This is useful only when booting DOS or Windows and multiple primary partitions exist on one disk.
The list of command-line and menu entry commands
These commands are usable in the command-line and in menu entries. If a user forgets a command, a user can run the command help.
• blocklist: Get the block list notation of a file
• boot: Start up your operating system
• cat: Show the contents of a file
• chainloader: Chain-load another boot loader
• cmp: Compare two files
• configfile: Load a configuration file
• debug: Toggle the debug flag
• displayapm: Display APM information
• displaymem: Display memory configuration
• embed: Embed Stage 1.5
• find: Find a file
• fstest: Test a filesystem
• geometry: Manipulate the geometry of a drive
• halt: Shut down your computer
• help: Show help messages
• impsprobe: Probe SMP
• initrd: Load an initrd
• install: Install GRUB
• ioprobe: Probe I/O ports used for a drive
• kernel: Load a kernel
• lock: Lock a menu entry
• makeactive: Make a partition active
• map: Map a drive to another
• md5crypt: Encrypt a password in MD5 format
• module: Load a module
• modulenounzip: Load a module without decompression
• pause: Wait for a key press
• quit: Exit from the grub shell
• reboot: Reboot your computer
• read: Read data from memory
• root: Set GRUB’s root device
• rootnoverify: Set GRUB’s root device without mounting
• savedefault: Save current entry as the default entry
• setup: Set up GRUB’s installation automatically
• testload: Load a file for testing a filesystem
• testvbe: Test VESA BIOS EXTENSION
• uppermem: Set the upper memory size
• vbeprobe: Probe VESA BIOS EXTENSION

blocklist
— Command: blocklist file
Print the block list notation of the file file.
boot
— Command: boot
Boot the OS or chain-loader which has been loaded. Only necessary if running the fully interactive command-line (it is implicit at the end of a menu entry).
cat
— Command: cat file
Display the contents of the file file. This command may be useful to remind a user of the OS’s root partition:
grub> cat /etc/fstab
chainloader
— Command: chainloader [–force] file
Load file as a chain-loader. Like any other file loaded by the filesystem code, it can use the blocklist notation to grab the first sector of the current partition with `+1′. If a user can specify the option –force, then load file forcibly, whether it has a correct signature or not. This is required when a user wants to load a defective boot loader, such as SCO UnixWare 7.1
cmp
— Command: cmp file1 file2
Compare the file file1 with the file file2. If they differ in size, print the sizes like this:
Differ in size: 0×1234 [foo], 0×4321 [bar]

If the sizes are equal but the bytes at an offset differ, then print the bytes like this:
Differ at the offset 777: 0xbe [foo], 0xef [bar]

If they are completely identical, nothing will be printed.
configfile
— Command: configfile file
Load file as a configuration file.
debug
— Command: debug
Toggle debug mode (by default it is off). When debug mode is on, some extra messages are printed to show disk activity. This global debug flag is mainly useful for GRUB developers when testing new code.
displayapm
— Command: displayapm
Display APM BIOS information.
displaymem
— Command: displaymem
Display what GRUB thinks the system address space map of the machine is, including all regions of physical RAM installed. GRUB’s upper/lower memory display uses the standard BIOS interface for the available memory in the first megabyte, or lower memory, and a synthesized number from various BIOS interfaces of the memory starting at 1MB and going up to the first chipset hole for upper memory (the standard PC upper memory interface is limited to reporting a maximum of 64MB).
embed
— Command: embed stage1_5 device
Embed the Stage 1.5 stage1_5 in the sectors after the MBR if device is a drive, or in the boot loader area if device is a FFS partition or a ReiserFS partition.9 Print the number of sectors which stage1_5 occupies, if successful.
Usually, a user doesn’t need to run this command directly.

find
— Command: find filename
Search for the file name filename in all mountable partitions and print the list of the devices which contain the file. The file name filename should be an absolute file name like /boot/grub/stage1.
fstest
— Command: fstest
Toggle filesystem test mode. Filesystem test mode, when turned on, prints out data corresponding to all the device reads and what values are being sent to the low-level routines. The format is `’ for high-level reads inside a partition, and `[disk-offset-sector]’ for low-level sector requests from the disk. Filesystem test mode is turned off by any use of the install (see install) or testload (see testload) commands.
geometry
— Command: geometry drive [cylinder head sector [total_sector]]
Print the information for the drive drive. In the grub shell, a user can set the geometry of the drive arbitrarily. The number of cylinders, the number of heads, the number of sectors and the number of total sectors are set to CYLINDER, HEAD, SECTOR and TOTAL_SECTOR, respectively. If a user omits TOTAL_SECTOR, then it will be calculated based on the C/H/S values automatically.

halt
— Command: halt –no-apm
The command halts the computer. If the –no-apm option is specified, no APM BIOS call is performed. Otherwise, the computer is shut down using APM.
help
— Command: help –all [pattern …]
Display helpful information about builtin commands. If a user does not specify pattern, this command shows short descriptions of most of available commands. If a user specifies the option –all to this command, short descriptions of rarely used commands are displayed as well.
If a user specifies any patterns, it displays longer information about each of the commands which match those patterns.

impsprobe
— Command: impsprobe
Probe the Intel Multiprocessor Specification 1.1 or 1.4 configuration table and boot the various CPUs which are found into a tight loop. This command can be used only in the Stage 2, but not in the grub shell.
initrd
— Command: initrd file …
Load an initial ramdisk for a Linux format boot image and set the appropriate parameters in the Linux setup area in memory.

install
— Command: install [–force-lba] [–stage2=os_stage2_file] stage1_file [d] dest_dev stage2_file [addr] [p] [config_file] [real_config_file]
This command is fairly complex, and a user should not use this command unless a user is familiar with GRUB. Use setup instead.
In short, it will perform a full install presuming the Stage 2 or Stage 1.5 is in its final install location.
In slightly more detail, it will load stage1_file, validate that it is a GRUB Stage 1 of the right version number, install in it a blocklist for loading stage2_file as a Stage 2. If the option d is present, the Stage 1 will always look for the actual disk stage2_file was installed on, rather than using the booting drive. The Stage 2 will be loaded at address addr, which must be `0×8000′ for a true Stage 2, and `0×2000′ for a Stage 1.5. If addr is not present, GRUB will determine the address automatically. It then writes the completed Stage 1 to the first block of the device dest_dev. If the options p or config_file are present, then it reads the first block of stage2, modifies it with the values of the partition stage2_file was found on (for p) or places the string config_file into the area telling the stage2 where to look for a configuration file at boot time. Likewise, if real_config_file is present and stage2_file is a Stage 1.5, then the Stage 2 config_file is patched with the configuration file name real_config_file. This command preserves the DOS BPB (and for hard disks, the partition table) of the sector the Stage 1 is to be installed into.
ioprobe
— Command: ioprobe drive
Probe I/O ports used for the drive drive. This command will list the I/O ports on the screen. For technical information.
kernel
— Command: kernel [–type=type] [–no-mem-option] file …
Attempt to load the primary boot image (Multiboot a.out or ELF, Linux zImage or bzImage, FreeBSD a.out, NetBSD a.out, etc.) from file. The rest of the line is passed verbatim as the kernel command-line. Any modules must be reloaded after using this command.
This command also accepts the option –type so that a user can specify the kernel type of file explicitly. The argument type must be one of these: `netbsd’, `freebsd’, `openbsd’, `linux’, `biglinux’, and `multiboot’. However, a user needs to specify it only if a user wants to load a NetBSD ELF kernel, because GRUB can automatically determine a kernel type in the other cases, quite safely.
The option –no-mem-option is effective only for Linux. If the option is specified, GRUB doesn’t pass the option mem= to the kernel. This option is implied for Linux kernels 2.4.18 and newer.
lock
— Command: lock
Prevent normal users from executing arbitrary menu entries. A user must use the command password if a user really wants this command to be useful.
This command is used in a menu, as shown in this example:
title This entry is too dangerous to be executed by normal users
lock
root (hd0,a)
kernel /no-security-os

makeactive
— Command: makeactive
Set the active partition on the root disk to GRUB’s root device. This command is limited to primary PC partitions on a hard disk.
map
— Command: map to_drive from_drive
Map the drive from_drive to the drive to_drive. This is necessary when a user chain-load some operating systems, such as DOS, if such an OS resides at a non-first drive. Here is an example:
grub> map (hd0) (hd1)
grub> map (hd1) (hd0)

md5crypt
— Command: md5crypt
Prompt to enter a password, and encrypt it in MD5 format. The encrypted password can be used with the command password

module
— Command: module file …
Load a boot module file for a Multiboot format boot image (no interpretation of the file contents are made, so the user of this command must know what the kernel in question expects). The rest of the line is passed as the module command-line, like the kernel command. A user must load a Multiboot kernel image before loading any module.
modulenounzip
— Command: modulenounzip file …

pause
— Command: pause message …
Print the message, then wait until a key is pressed. Note that placing (ASCII code 7) in the message will cause the speaker to emit the standard beep sound, which is useful when prompting the user to change floppies.
quit
— Command: quit
Exit from the grub shell grub. This command can be used only in the grub shell.
reboot
— Command: reboot
Reboot the computer.
read
— Command: read addr
Read a 32-bit value from memory at address addr and display it in hex format.
root
— Command: root device [hdbias]
Set the current root device to the device device, then attempt to mount it to get the partition size (for passing the partition descriptor in ES:ESI, used by some chain-loaded boot loaders), the BSD drive-type (for booting BSD kernels using their native boot format), and correctly determine the PC partition where a BSD sub-partition is located. The optional hdbias parameter is a number to tell a BSD kernel how many BIOS drive numbers are on controllers before the current one. For example, if there is an IDE disk and a SCSI disk, and a users FreeBSD root partition is on the SCSI disk, then use a `1′ for hdbias.
rootnoverify
— Command: rootnoverify device [hdbias]
Similar to root, but don’t attempt to mount the partition. This is useful for when an OS is outside of the area of the disk that GRUB can read, but setting the correct root device is still desired. Note that the items mentioned in root above which derived from attempting the mount will not work correctly.
savedefault
— Command: savedefault num
Save the current menu entry or num if specified as a default entry. Here is an example:
default saved
timeout 10

title GNU/Linux
root (hd0,0)
kernel /boot/vmlinuz root=/dev/sda1 vga=ext
initrd /boot/initrd
savedefault

title FreeBSD
root (hd0,a)
kernel /boot/loader
savedefault

With this configuration, GRUB will choose the entry booted previously as the default entry.
A user can specify `fallback’ instead of a number. Then, next fallback entry is saved. Next fallback entry is chosen from fallback entries. Normally, this will be the first entry in fallback ones.
setup
— Command: setup [–force-lba] [–stage2=os_stage2_file] [–prefix=dir] install_device [image_device]
Set up the installation of GRUB automatically. This command uses the more flexible command install in the backend and installs GRUB into the device install_device. If image_device is specified, then find the GRUB images in the device image_device, otherwise use the current root device, which can be set by the command root. If install_device is a hard disk, then embed a Stage 1.5 in the disk if possible.
The option –prefix specifies the directory under which GRUB images are put. If it is not specified, GRUB automatically searches them in /boot/grub and /grub.
The options –force-lba and –stage2 are just passed to install if specified.
testload
— Command: testload file
Read the entire contents of file in several different ways and compare them, to test the filesystem code. The output is somewhat cryptic, but if no errors are reported and the final `i=X, filepos=Y’ reading has X and Y equal, then it is definitely consistent, and very likely works correctly subject to a consistent offset error. If this test succeeds, then a good next step is to try loading a kernel.
testvbe
— Command: testvbe mode
Test the VESA BIOS EXTENSION mode mode. This command will switch user video card to the graphics mode, and show an endless animation. Hit any key to return.
uppermem
— Command: uppermem kbytes
Force GRUB to assume that only kbytes kilobytes of upper memory are installed. Any system address range maps are discarded.
Caution: This should be used with great caution, and should only be necessary on some old machines. GRUB’s BIOS probe can pick up all RAM on all new machines the author has ever heard of. It can also be used for debugging purposes to lie to an OS.
vbeprobe
— Command: vbeprobe [mode]
Probe VESA BIOS EXTENSION information. If the mode mode is specified, show only the information about mode. Otherwise, this command lists up available VBE modes on the screen.

If user followed the tutorial guide then he/she would have learnt about list of available commands.

Bookmark Us
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • MisterWong
  • Netvouz
  • Reddit
  • Slashdot
  • Spurl
  • StumbleUpon
  • Technorati
  • Wists

GRUB’s user interface

Posted in How To's by Shafkat Shahzad, M.Sc on June 20th, 2010

Welcome to the tutorial guide. The guide will proivde a user with guidance and instructions on users interface.

A user will note that GRUB has both a simple menu interface for choosing preset entries from a configuration file, and a highly flexible command-line for performing any desired combination of boot commands. GRUB looks for its configuration file as soon as it is loaded. If one is found, then the full menu interface is activated using whatever entries were found in the file. If a user chooses the command-line menu option, or if the configuration file was not found, then GRUB drops to the command-line interface.

The flexible command-line interface
The command-line interface provides a prompt and after it an editable text area much like a command-line in Unix or DOS. Each command is immediately executed after it is entered. A user will note that the commands are a subset of those available in the configuration file, used with exactly the same syntax.

Cursor movement and editing of the text on the line can be done via a subset of the functions available in the Bash shell:

Move forward one character.

Move back one character.

Move to the start of the line.

Move the the end of the line.


Delete the character underneath the cursor.

Delete the character to the left of the cursor.

Kill the text from the current cursor position to the end of the line.

Kill backward from the cursor to the beginning of the line.

Yank the killed text back into the buffer at the cursor.

Move up through the history list.

Move down through the history list.
When typing commands interactively, if the cursor is within or before the first word in the command-line, pressing the key (or ) will display a listing of the available commands, and if the cursor is after the first word, the will provide a completion listing of disks, partitions, and file names depending on the context. Note that to obtain a list of drives, one must open a parenthesis, as root (.
Please note that a user cannot use the completion functionality in the TFTP filesystem. This is because TFTP doesn’t support file name listing for the security.

The simple menu interface
The menu interface is quite easy to use. Its commands are both reasonably intuitive.
Basically, the menu interface provides a list of boot entries to the user to choose from. Use the arrow keys to select the entry of choice, then press to run it. An optional timeout is available to boot the default entry (the first one if not set), which is aborted by pressing any key.
Commands are available to enter a bare command-line by pressing (which operates exactly like the non-config-file version of GRUB, but allows one to return to the menu if desired by pressing ) or to edit any of the boot entries by pressing .
If a user wants to protect the menu interface with a password, all a user can do is choose an entry by pressing , or press

to enter the password.
Editing a menu entry
The menu entry editor looks much like the main menu interface, but the lines in the menu are individual commands in the selected entry instead of entry names.
If an is pressed in the editor, it aborts all the changes made to the configuration entry and returns to the main menu interface.
When a particular line is selected, the editor places the user in a special version of the GRUB command-line to edit that line. When the user hits , GRUB replaces the line in question in the boot entry with the changes (unless it was aborted via , in which case the changes are thrown away).
If a user wants to add a new line to the menu entry, press if adding a line after the current line or press if before the current line.
To delete a line, hit the key . Although GRUB unfortunately does not support undo, a user can do almost the same thing by just returning to the main menu.
The hidden menu interface
When the terminal is dumb or a user has requested GRUB to hide the menu interface explicitly with the command hiddenmenu, GRUB doesn’t show the menu interface and automatically boots the default entry, unless interrupted by pressing .
When a user interrupts the timeout and the terminal is dumb, GRUB falls back to the command-line interface.

If a user followed the tutorial guide then he/she would have learnt about GRUB’s user interface.

Bookmark Us
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • MisterWong
  • Netvouz
  • Reddit
  • Slashdot
  • Spurl
  • StumbleUpon
  • Technorati
  • Wists

GRUB - filesystem syntax and semantics

Posted in How To's by Shafkat Shahzad, M.Sc on June 20th, 2010

Welcome to the tutorial guide. The tutorial will provide a user with guidance and instructions on file system syntax and semantics. As GRUB uses a special syntax for specifying disk drives which can be accessed by BIOS. Because of BIOS limitations, GRUB cannot distinguish between IDE, ESDI, SCSI, or others.
A user should know which BIOS device is equivalent to which OS device. Normally, that will be clear if a user sees the files in a device or use the command find

- How to specify devices
The device syntax is like this:
(device[,part-num][,bsd-subpart-letter])
`[]’ means the parameter is optional. device should be either `fd’ or `hd’ followed by a digit, like `fd0′. But if a user can also set device to a hexadecimal or a decimal number which is a BIOS drive number, so the following are equivalent:
(hd0)
(0×80)
(128)
part-num represents the partition number of device, starting from zero for primary partitions and from four for extended partitions, and bsd-subpart-letter represents the BSD disklabel subpartition, such as `a’ or `e’.
A shortcut for specifying BSD subpartitions is (device,bsd-subpart-letter), in this case, GRUB searches for the first PC partition containing a BSD disklabel, then finds the subpartition bsd-subpart-letter. Here is an example:
(hd0,a)
The syntax `(hd0)’ represents using the entire disk (or the MBR when installing GRUB), while the syntax `(hd0,0)’ represents using the first partition of the disk (or the boot sector of the partition when installing GRUB).
If a user has enabled the network support, the special drive, `(nd)’, is also available. Before using the network drive, a user must initialise the network. See Network, for more information.
If a user boots GRUB from a CD-ROM, `(cd)’ is available.

- How to specify files
There are two ways to specify files, by absolute file name and by block list.
An absolute file name resembles a Unix absolute file name, using `/’ for the directory separator (not `\’ as in DOS). One example is `(hd0,0)/boot/grub/menu.lst’. This means the file /boot/grub/menu.lst in the first partition of the first hard disk. If a user omits the device name in an absolute file name, GRUB uses GRUB’s root device implicitly. So if a user sets the root device to, say, `(hd1,0)’ by the command root (see root), then /boot/kernel is the same as (hd1,0)/boot/kernel.

- How to specify block lists
A block list is used for specifying a file that doesn’t appear in the filesystem, like a chainloader. The syntax is [offset]+length[,[offset]+length]…. Here is an example:
0+100,200+1,300+300
This represents that GRUB should read blocks 0 through 99, block 200, and blocks 300 through 599. If a user omits an offset, then GRUB assumes the offset is zero.
Like the file name syntax, if a blocklist does not contain a device name, then GRUB uses GRUB’s root device. So (hd0,1)+1 is the same as +1 when the root device is `(hd0,1)’.

If you followed the tutorial guide then you would have learnt about filesystem syntax and semantics.

Bookmark Us
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • MisterWong
  • Netvouz
  • Reddit
  • Slashdot
  • Spurl
  • StumbleUpon
  • Technorati
  • Wists

GRUB image files

Posted in How To's by Shafkat Shahzad, M.Sc on June 12th, 2010

Welcome to the tutorial guide. The tutorial will provide a user with advise and guidance on GRUB image files. Please note that it consists of several images: two essential stages, optional stages called Stage 1.5, one image for bootable CD-ROM, and two network boot images.

stage1
This is an essential image used for booting up GRUB. Usually, this is embedded in an MBR or the boot sector of a partition. Because a PC boot sector is 512 bytes, the size of this image is exactly 512 bytes.
All stage1 must do is to load Stage 2 or Stage 1.5 from a local disk. Because of the size restriction, stage1 encodes the location of Stage 2 (or Stage 1.5) in a block list format, so it never understand any filesystem structure.

stage2
This is the core image of GRUB. It does everything but booting up itself. Usually, this is put in a filesystem, but that is not required.
e2fs_stage1_5
fat_stage1_5
ffs_stage1_5
jfs_stage1_5
minix_stage1_5
reiserfs_stage1_5
vstafs_stage1_5
xfs_stage1_5

These are called Stage 1.5, because they serve as a bridge between stage1 and stage2, that is to say, Stage 1.5 is loaded by Stage 1 and Stage 1.5 loads Stage 2. The difference between stage1 and *_stage1_5 is that the former doesn’t understand any filesystem while the latter understands one filesystem (e.g. e2fs_stage1_5 understands ext2fs). A user can now move the Stage 2 image to another location safely, even after GRUB has been installed.
As the stage 2 cannot generally be embedded in a fixed area as the size is so large, so Stage 1.5 can be installed into the area right after an MBR, or the boot loader area of a ReiserFS or a FFS.
stage2_eltorito

This is a boot image for CD-ROMs using the no emulation mode in El Torito specification. This is identical to Stage 2, except that this boots up without Stage 1 and sets up a special drive `(cd)’.

nbgrub
This is a network boot image for the Network Image Proposal used by some network boot loaders, such as Etherboot. This is mostly the same as Stage 2, but it also sets up a network and loads a configuration file from the network.

pxegrub
This is another network boot image for the Preboot Execution Environment used by several Netboot ROMs. This is identical to nbgrub, except for the format.

If a user followed this tutorial guide then he/she will learn about GRUB image files.

Bookmark Us
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • MisterWong
  • Netvouz
  • Reddit
  • Slashdot
  • Spurl
  • StumbleUpon
  • Technorati
  • Wists

GRUB – improving security of GRUB

Posted in How To's by Shafkat Shahzad, M.Sc on June 12th, 2010

Welcome to the tutorial guide. The tutorial will provide a user with guidance and instructions on how to improve security of GRUB.

As a user has got an opportunity provided by GRUB to modify its configuration and run arbitrary commands at run-time. An example will explaint this. If a user can read /etc/passwd in the command-line interface by the command cat, then it is necessary to disable all the interactive operations.
GRUB provides a password feature, so that only administrators can start the interactive operations. Please note that interactive operations include editing menu entries and entering the command-line interface. If a user wants to use this feature then he/she will need to run the command password in his/her configuration file. This is as displayed below:
password –md5 PASSWORD
If this is specified, GRUB will disallow interactive control, until a user presses the key

and enter a correct password. The option –md5 tells GRUB that `PASSWORD’ is in MD5 format. If it is omitted, GRUB assumes the `PASSWORD’ is in clear text.
A user can encrypt his/her password with the command md5crypt. For example, a user can run the grub shell and enter his/her password:
grub> md5crypt
Password: ***
Encrypted: $1$U$JK7xFegdxWH6VuppCUSIb.
After that a user can then cut and paste the encrypted password to the configuration file.
A user can also specify an optional argument to password. An example is profvied below:
password PASSWORD /boot/grub/menu-admin.lst
A user should now see that GRUB will load /boot/grub/menu-admin.lst as a configuration file when a user enters the valid password.

There is another issue which should be taken into account. If any user can choose any menu entry and wants to permit only administrators to run some of the menu entries, such as an entry for booting an insecure OS like DOS.

GRUB provides the command lock. This command always fails until as user enters the valid password. A user can use it as provided below:
title Boot DOS
lock
rootnoverify (hd0,1)
makeactive
chainload +1

A user should insert lock right after title, because any user can execute commands in an entry until GRUB encounters lock.

A user can also use the command password instead of lock. As the boot process will ask for the password and stop if it was entered incorrectly. Since the password takes its own PASSWORD argument this is useful if a user wants different passwords for different entries.
If you followed this tutorial guide then he/she would have learnt about how to improve security of GRUB.

Bookmark Us
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • MisterWong
  • Netvouz
  • Reddit
  • Slashdot
  • Spurl
  • StumbleUpon
  • Technorati
  • Wists

« Previous entries · Next entries »