number 2. Then if you type reboot, the system automatically chooses the item you selected
3. Chapter 3 also discusses other types of Linux filesystems, but at the time of this writing, only
Accessing Windows Partitions from Linux
Linux has provided support for FAT and FAT32 (another name for the VFAT filesystem) filesys- tems for quite some time. Support for NTFS filesystems existed for the 2.4.xseries of Linux kernels but has been directly integrated into the 2.6 series of Linux kernels (such as those used on SUSE 9.1 and greater).
Reading NTFS filesystems under the 2.6 kernel works fine, but by default the in-kernel driver will mount them read-only. If you need to write to NTFS partitions, consider using the userspacefilesystem driverntfs-3 g.
To mount a Windows partition under Linux, you use themountcommand discussed in Chapter 3. The following is a sample command to mount a VFAT Windows partition on the Linux directory/mnt/c(which must be created before attempting to mount the drive):
mount -t vfat /dev/hda1 /mnt/c
If you are mounting an NTFS partition and do not need to write to it, you can use a command such as the following to mount it in read-only mode:
mount -t ntfs -o ro /dev/hda1 /mnt/c
In most cases you will not need to mount the Windows partitions on your system manually;
during the installation they will be added to the filesystem table/etc/fstabso that they are available to you at all times.
Accessing Linux Partitions from Windows
Accessing Linux partitions from Windows is slightly trickier than the reverse because Windows does not provide any built-in support for any of the types of partitions used by Linux. However, a number of utilities and drivers are available for Windows systems that enable you to mount and access EXT2 or EXT3 filesystems under Windows. These range from commercial products to public domain and open source utilities:
■ Explore2fs (www.chrysocome.net/explore2fs)EXT2 filesystem access from Windows 9x, NT, 2000, XP, and Me.
■ EXT2 IFS (http://uranus.it.swin.edu.au/ ~ jn/linux/ext2ifs.htm) Installable filesystem driver for EXT2 and EXT3 under Windows NT, 2000, and XP.
■ Ext2fsnt (http://ashedel.chat.ru/ext2fsnt/)EXT2 access from Windows NT.
This driver code has been incorporated in Paragon Software’s Mount Everything utility.
■ Paragon Mount Everything (www.mount-everything.com/)Mounts EXT2 and EXT3 filesystems under Windows 9x, NT, 2000, and XP. Paragon Software Group’s home page is atwww.paragon-gmbh.com.
We highly recommend Explore2fs as an open source solution and Paragon Software Group’s Mount Everything as a commercial solution. Many people have reported success with the other packages listed in the previous list, but we have no direct experience with them.
Troubleshooting Booting
Unfortunately, an important part of system administration is fixing problems, and the authors have all spent many hours fixing configuration problems for customers. This section explores what to do if you have trouble booting your system.
Fixing Boot Problems Using Runlevels
We discussed runlevels earlier in this chapter, and if you have a corrupt system, or a runaway process that is loaded in theinitprocess, one way to fix this is to force the system into a spe- cific runlevel to stop that process from running. This is achieved by passing the runlevel number to the boot loader at boot time. Both LILO and GRUB are capable of passing parameters to the kernel before it is loaded, which is a feature that every Linux user should know how to use.
The kernel is able to take parameters in the same way that a normal application or program can once Linux is loaded. To do this, the kernel must know this information before it is loaded and executed so that it can make changes based on what you need to do. The kernel itself does not deal with what runlevel the system boots up in. This is determined by theinitprocess, as defined in the/etc/inittabfile by default, but it can be overridden from the boot manager.
Any parameter you pass to the kernel that it does not understand will be passed on to the first program that the kernel calls after it has finished initializing. In the case of Linux, this is the
initprocess. If you remember, you change a runlevel by using theinitprocess with the runlevel as a parameter. If you add the runlevel number to the kernel command line before booting, this number is sent to theinitprocess, which therefore boots the system into the specified runlevel.
To pass aninitparameter to LILO, you can specifylinux 1on the LILO prompt to load up the boot profile called Linux.
In GRUB, you do this by selecting the profile you would like to edit and entering the number of the runlevel into which you want to enter at boot-up in the Boot Options field (see Figure 4-5).
FIGURE 4-5
Adding the runlevel to the GRUB boot loader
In both cases, the 1 tellsinitto load up the system in runlevel 1. This, as you may remember, is the runlevel that signifies single-user mode with no network. This is the lowest usable runlevel and is needed only if there is a problem with the system.
If, on the other hand, you know your runlevel configuration is sound, but you want to man- ually stop a certain service from starting up, you can setPROMPT_FOR_CONFIRM = "yes"in /etc/sysconfig/boot.
As shown in Figure 4-6, you will be asked for the root password to log in to the system (this is why you shouldneverforget you root password). Once logged in, you can then turn off processes as we talked about with thechkconfigscript or fix any other problems that the
system has. Once fixed, you can then reboot the system normally. Because specifying a runlevel to GRUB and LILO is a temporary change, you are able to let the system start up normally without having to interrupt the normal operation of LILO or GRUB.
FIGURE 4-6 Logging in to init 1
The SUSE Rescue System
We have talked about fixing system problems by changing the boot runlevel of the system tem- porarily, but what if you encounter a dire problem such as forgetting the root password? This requires another approach because you will need the root password at some point.
SUSE realizes the need to be able to repair a Linux system, which generally requires Linux tools and access to the ailing Linux system using those tools, and so has included a Rescue System on the first CD or DVD in your SUSE installation set. To load the Rescue System, use the optical media, and select Rescue System from the initial boot menu. The kernel from the CD will load, and an initial ramdisk containing a fuller Linux system will be loaded. This Rescue System has built-in support for the types of Linux filesystems discussed in this book, as well as to IDE hard drives. If you are using a SCSI disk, this ramdisk also includes the main modules for loading a SCSI disk.
As an example of using the SUSE Rescue System, let’s imagine that we have forgotten the root password so we need to reset this with the Rescue System.
Some of you might see a large security problem with what we are about to do. If malicious users have physical access to a server, they are quite able to reset the root password of the machine using this method. For this reason, the physical security of a machine is as important as the security of the machine from an operational standpoint. But if you think about it, if someone has physical access to the machine they can do anything. They can install a different operating system, smash the hard disks with a sledgehammer — whatever they want to do.
To reset the root password from the SUSE Rescue System, follow these steps:
1. When the Rescue System has loaded, you are prompted to select the keyboard map that you are using (which defines the type of keyboard that you are using). After the kernel executes, loads the initial ramdisk, and starts various system processes, you are then asked to log in. Just enterrootas the username, and you will be dropped into the Linux system from the initial ramdisk.
2. At this point, you need to identify the partition that contains/etc. This will usually be your/(root) partition. Mount the partition under/mnt. The following example uses /dev/hda3as the root partition:
mount /dev/hda3 /mnt
3. When mounted, you need to edit the file/mnt/etc/shadowto reset the root password.
You can edit this file using any text editor, althoughviis the only screen-oriented text editor that is provided in the SUSE Rescue System. Remember that you mounted your system’s root partition under/mnt; which is why the location of the/etc/shadowfile has changed.
The shadow file is a system file that contains encrypted passwords of the users on the system. The file can be read and written to only by the root superuser.
4. When loaded, you need to find the entry for the root user. Find the encrypted password, which is the second field (fields in the file are separated by a colon). When found, delete the password so that there are just two colons next to each other (::), and save the file.
5. After the file has been edited, change the directory to/(root) and unmount the filesystem by issuing the following:
umount /mnt
6. When unmounted, you can reboot the system by typingrebootand pressing the Enter key, or just pressing the reboot key on the machine. Remember to remove your optical media as the system reboots, or you may accidentally boot from it.
Now if you boot the system into runlevel 1 (type 1 at Boot Options in the initial GRUB boot screen), you will be able to log in without a password (On newer versions of SUSE you will not be able to log in as root at a higher runlevel after doing this.) You will seePress enter for login:. Do so, and you will be logged in as root. Typepasswdto change the password, and then all will be well.
The Rescue System is something every administrator and user should have in his or her arsenal as it can help you fix pretty much any lethal problem you have on a Linux system, regardless of whether it is SUSE-based or not.
This chapter has provided a great deal of information about the Linux boot process and the way in which you can start various services by associating them with Linux runlevels. You learned how to customize the boot process for both Linux-only and dual-boot Windows/Linux systems.
The last section explained various ways to correct boot process configuration problems. All in all, this chapter should have you well on your way to becoming a Linux system administrator (or the administrator of your own home Linux system). The only thing remaining is experience, which you will accumulate as you perform more and more of your daily activities on your SUSE Linux system.
Documentation
IN THIS CHAPTER
Using the SUSE manuals Using man and info pages Using the SUSE Help Center Package documentation Reviewing Linux Documentation Project resources
Finding help online
One fairly widespread misconception about Linux is that it is not well documented. Along with this, many people still have preconceptions about open source software. They believe that proprietary systems come with copious glossy manuals, but that Linux requires you to be a programmer who can read the source code to understand the system.
The truth is much more refreshing and interesting. In our experience, it is usually much easier to find relevant and specific information about Linux and open source software than about proprietary products. The spirit of open source means that there are a variety of sources of ‘‘good’’
information about the software — from official documentation provided by commercial vendors to mailing lists, newsgroup postings, and other ephemeral information.
Finding Help on Your SUSE System
Although this chapter surveys a whole spectrum of information sources about SUSE Linux and associated utilities, we will start with documenta- tion that you can find on your system or in your purchased package of SUSE Linux, including the official SUSE documentation.
The SUSE Manuals
Your copy of openSUSE, SUSE Linux Enterprise Desktop, or SUSE Linux Enterprise Server comes with official documentation that which can be installed to disk and (if you wish) printed.
When installed, the manuals can be found under the directory/usr/share/doc/manual/. The packages containing the English language versions of the manuals for openSUSE are named as follows:
■ opensuse-manual_en
■ opensuse-manual_en-pdf
■ opensuse-gnomeuser_en
■ opensuse-gnomeuser_en-pdf
■ apparmor-admin_en
■ apparmor-admin_en-pdf
Versions for many other languages exist withenreplaced by the relevant code for the language.
These packages provide the same materials in both PDF form and HTML.
If these packages are installed, look in the directory/usr/share/doc/manual/opensuse- manual_en-pdf/. You will find the following books in PDF form:
■ openSUSE Start-Up Guide:More than 250 pages describing installation and an introduction to Linux in 13 chapters.
■ openSUSE KDE Quick Start:12 pages describing common desktop functions with KDE.
■ openSUSE Gnome Quick Start:The equivalent short guide for GNOME users.
■ openSUSE Reference:Over 700 pages in 42 chapters, describing system administration, the main services on Linux, security, and more.
■ openSUSE KDE User Guide:Over 300 pages describing the KDE desktop environment in more detail.
■ The AppArmor Administration Guide:Describing the use of the AppArmor security framework.
■ openSUSE Gnome User Guide:Equivalent to theopenSUSE KDE User Guide, but for the GNOME environment it is installed in a separate subdirectory.
All these documents can be viewed as nicely formatted PDF files and also as HTML (navigate to the appropriate directory and start by viewing theindex.htmlfile in a browser).
The SUSE official manuals have their strengths and weaknesses. They are very well produced and beautifully formatted; and the look and feel of both the PDF and the HTML versions is elegant and easy to read. The main manualopenSUSE Referenceshould be regarded (as its name implies) as a reference book. Its coverage of the system as a whole is remarkably good, and
certain chapters provide good information that is hard to find elsewhere. The installation chapter covers most common problems and includes short sections on setting up Logical Volume Management (LVM) and software RAID (Redundant Array of Inexpensive Disks). The network section includes subsections on Samba, Lightweight Directory Access Protocol (LDAP), and Network Information System (NIS), and a good introduction to setting up the Domain Name System (DNS). All of this information is somewhat pared down, as a whole book could be written on any one of the topics, but the advantage is that there is a good description of setting up these services specifically on SUSE Linux, using the YaST modules.
TheStart-Upbook is a good introduction to installing and using SUSE Linux, aimed mainly at the new desktop user. There is a good general description of YaST and introductions to the main features of both the KDE and GNOME desktops. The chapter entitled ‘‘Getting to Know Linux Software’’ gives a useful comparison between the desktop applications available on Linux and the commonly used Windows equivalents.
Man Pages
Man pages (manis short formanual) are the original form of online Unix documentation.
Traditionally, command-line programs have associatedmanpages that are installed as part of the package that the program belongs to. To access amanpage (for example themanpage of thecp command), typeman cp:
user@bible:~> man cp
Themancommand displays a somewhat terse but usually complete and accurate summary of the options and usage of the command. A large number of commands havemanpages, which pro- vide a quick and easy way of checking on command syntax and usage. Manymanpages include command examples, which can be quite useful. Themanpages are normally stored in directories under/usr/share/manand are normally stored as gzipped files to save space on your system.
manpages are written in a simple markup language known asnroffthat is interpreted by the mancommand to produce nicely formatted output for the screen. You can print a text version of amanpage by using a command such as the following:
user@bible:~> man cp | lpr
You can also create a more nicely formatted printed output by using themancommand’s-t option, which processes themanpage using a formatter (groff— GNU roff) and generates output in the PostScript printer format, as follows:
user@bible:~> man -t cp | lpr
If you want to save the nicely formatted output as a PostScript file so that you can print or dis- play it later (using a program such askghostview,evince, orgv), you can redirect the output of theman -tcommand into a file, as in the following example:
user@bible:~> man -t cp > manpage.ps
To find out more about the use of themancommand, you can, of course, look at itsmanpage:
user@bible:~> man man
To search for amanpage, you can use themancommand with the-k(keyword) option:
user@bible:~> man -k copy
This will list one sentence summaries of manpages that are relevant to the wordcopy. It does this by searching a database ofmanpage summaries known as thewhatisdatabase. You can use this summary to determine whichmanpage you may want to view in full.
Another command that does essentially the same thing is theaproposcommand, which searches the same database of availablemanpages used by theman -kcommand, looking for a specified phrase. An equivalent example of usingaproposis the following:
user@bible:~> apropos copy
Working with man Page Sections
On Linux systems,manpages are divided into ten general sections according to the type of information that they provide. The ones that you are most likely to use frequently are sections 1 (User Commands), 5 (File Formats), and 8 (System Administration).manpages are stored under a single directory hierarchy, the directory/usr/share/manon Linux systems. (Older Linux and other Unix-like systems often store these under the directory/usr/man.) Each section has its own subdirectory — for example,man1,man2,man3, and so on.
Table 5-1 lists themanpages sections and their corresponding types of information.
TABLE 5-1
man Pages Sections
Section Number Type of man Pages
0p Documentation on header files for programmers
1 User commands
1p Developer’s pages for the user commands
2 System calls
3 Subroutines and library functions
3p Documentation on Perl modules
4 Devices, special files, device drivers, and associated file formats
5 File formats