• No results found

LPI Certification

N/A
N/A
Protected

Academic year: 2021

Share "LPI Certification"

Copied!
216
0
0

Loading.... (view fulltext now)

Full text

(1)

LPI Linux Certification/Print Version

LPI Linux Certification

Current, editable version of this book is available in Wikibooks, collection of open-content textbooks at URL:

http://en.wikibooks.org/wiki/LPI_Linux_Certification

LPI Linux Certification

This book covers the Linux Professional Institute™ family of certifications. There are three levels of LPI™ certification:

• Level 1: Junior Level Linux Professional. • Level 2: Advanced Level Linux Professional. • Level 3: Senior Level Linux Professional.

To obtain a certification, a candidate is required to pass exams and, for Level 2 and Level 3, to hold a lower-level certification from the LPI™. All LPIC candidates are encouraged to browse the documentation at the LPI™ website. The resources there will familiarize the candidate with many things that are outside the scope of this book (e.g. exam cost, testing centers, other training resources) you are also encouraged to register with the LPI™ so that you can access the candidate area.

The Detailed Objectives listed within each of the modules in this book have been reproduced from the LPI™ website with kind Permission. We are however, to make it clear that the Linux Professional Institute™ does not endorse the work contained within this book in any way whatsoever.

Audience

This book is written specifically for the LPIC candidate. It is based as indeed is the exam around a community driven documentation project known as "The Linux Documentation Project". Each module in the book however, is organized around a particular subject. It is hence feasible for the casual reader to pick one particular module and study the material, with a view to gain a better understanding. However, many of the modules and in particular the Advanced modules will assume a certain skill level. It is also feasible for a new Linux user to come here with a view to learn Linux. However, although such readers are very welcome, they may be better served by studying the following material, Linux Guide. The modules on the LPI Linux certification are heavily slanted towards up and coming sysadmins.

About this book

This book is organized so that each and every module can be accessed via the front page, this will be useful for readers who just wish to study or quickly gain information about one aspect of the exam syllabus. For exam candidates we have created an exam page which also has a table of contents that covers only the modules required for you to study for the various levels of the LPI™ . It is the hope of the contributors that the exam candidates will use the exam pages and their accompanying discussion pages to leave advice, tips and gotchas etc for other exam candidates.

The Module pages will contain detailed objectives followed by an overview which in turn will be followed by section headings covering the module's syllabus. At the beginning of each section will be a list of prequisite reading (hopefully all nicely formated). It is advisable to read them, although the linked articles may not be required knowledge to pass the exam. However, they should relate to the individual sections they are contained within.

(2)

Lastly, we are obviously looking for Authors, We encourage all positive edits even if it is just to correct a simple spelling mistake or fix a link; in short,

"Every addition is very welcome."

Table of Contents

Junior Level Linux Professional - Exam Page

Hardware & Architecture

• Configure Fundamental BIOS Settings • Configure Modem & Sound Cards • Setup Non IDE Devices

• Setup Different PC Expansion Cards • Configure Communication Devices • Configure USB Devices

Linux Installation & Package Management • Design Hard Disk Layout

• Install A Boot Manager

• Make & Install Programs From Source • Manage Shared Libraries

• Use Debian Package Management • Use RPM and YUM package management GNU & UNIX Commands

• Work On The Command Line • Process Text Streams Using Filters • Perform Basic File Management • Use Streams, Pipes & Redirects • Create, Monitor & Kill Processes • Modify Process Execution Priorities

• Search Text Files Using Regular Expressions • Perform Basic File Editing Operations Using Vi

Devices, Linux Filesystems, Filesystem Hierarchy Standard • Create Partitions & Filesystems

• Maintaining The Integrity Of Filesystems • Control Mounting & Unmounting Filesystems • Managing Disk Quota

• Use File Permissions To Control Access To Files • Manage File Ownership

• Create & Change Hard & Symbolic Links

• Find System Files & Place Files In The Correct Location The X Window System

• Install & Configure X11 • Setup A Display Manager

• Install & Customise A Window Manager Environment Kernel

• Kernel Runtime Management & Query

(3)

Boot, Initialisation, Shutdown & Runlevels • Boot the System

• Change Runlevels And Shutdown Or Reboot System Printing

• Manage Printers & Print Queues • Print Files

• Install & Configure Local & Remote Printers Documentation

• Use & Manage Local System Documentation • Find Linux Documentation On The Internet • Notify Users On System-Related Issues Shells, Scripting, Programming & Compiling • Customise & Use The Shell Environment • Customise Or Write Simple Shell Scripts Administrative Tasks

• Manage Users & Group Accounts & Related System Files • Tune The User Environment & System Environment Variables

• Configure & Use System Log Files To Meet Administrative & Security Needs • Automate System Administrative Tasks By Scheduling Jobs To Run In The Future • Maintain An Effective Data Backup Strategy

• Maintain System Time Networking Fundamentals • Fundamentals Of TCP/IP

• TCP/IP Configuration & Troubleshooting • Configure Linux As A PPP Client Networking Services

• Configure & Manage xinetd, inetd & Related Services

• Operate & Perform Basic Configuration Of Mail Transfer Agent (MTA) • Properly Manage The NFS & SAMBA Daemons

• Setup & Configure Basic DNS Services • Setup Secure Shell (OpenSSH)

Security

• Perform Security Administration Tasks • Setup Host Security

(4)

Advanced Level Linux Professional

Linux Kernel (201)

• Kernel Components (201.1) • Compiling A Kernel (201.2) • Patching A Kernel (201.3)

• Customise, build and install a custom kernel and kernel modules (201.4) • Manage/Query kernel and kernel modules at runtime (201.5)

System Startup (202)

• Customising System Startup & Boot Processes (202.1) • System Recovery (202.2)

Filesystems And Devices (203)

• Operating The Linux File System (203.1) • Maintaining A Linux File System (203.2)

• Creating & Configuring File System Options (203.3) • udev Device Management (203.4)

Advanced Storage Device Administration (204) • Configuring RAID (204.1)

• Adjusting Storage Device Access (204.2) • Logical Volume Manager (204.3) • Adding New Hardware

• Software & Kernel Configuration • Configuring PCMCIA Devices Networking Configuration (205)

• Basic Networking Configuration (205.1)

• Advanced Network Configuration & Troubleshooting (205.2) • Troubleshooting Network Issues (205.3)

• Notify Users On System-Related Issues (205.4) System Maintenance (206)

• Make And Install Programs From Source (206.1) • Backup Operations (206.2)

• System Logging • Packaging Software DNS (207)

• Basic DNS Server Configuration (207.1) • Create & Maintain DNS Zones (207.2) • Securing A DNS Server (207.3) Web Services (208)

• Implementing A Web Server (208.1) • Maintaining A Web Server (208.2) • Implementing A Proxy Server (208.3) File Sharing (209)

• Samba Server Configuration (209.1) • NFS Server Configuration (209.2)

(5)

Network Client Management (210) • DHCP Configuration (210.1) • PAM Authentication (210.2) • LDAP Client Usage (210.3) • NIS Configuration

E-Mail Services (211)

• Using E-Mail Servers (211.1)

• Managing Local E-Mail Delivery (211.2) • Managing Remote E-Mail Delivery (211.3) • Configuring Mailing Lists

• Managing Mail Traffic • Serving News System Security (212) • Configuring A Router (212.1) • Securing FTP Servers (212.2) • Secure Shell (SSH) (212.3) • TCP Wrapper (212.4) • Security Tasks (212.5) Troubleshooting (213)

• Identifying Boot Stages And Troubleshooting Bootloaders (213.1) • General Troubleshooting (213.2)

• Troubleshooting System Resources (213.3)

• Troubleshooting Environment Configurations (213.4) • Creating Recovery Disks

• Identifying Boot Stages • Troubleshooting Bootloaders

External links

• LPI Website [1]

• The Linux Documentation Project [2]

• LPI Linux certification information and study resources [3]

• LPI Study Guides from IBM - Highly regarded by the Linux Community [4]

• The Linux Tutorial [5]

Junior Level Linux Profesional

Welcome! If you are here, then you are considering or have decided to take the Junior Level Linux Professional Exam. This page and its accompanying discussion page are specifically for you, and will explain your overall objectives for each exam (there are two exams you must complete before being certified). It is a good idea to come back here and perform a sanity check on your understanding against the overall objectives presented here. All that remains is for the authors and contributors of this book to wish you good luck.

Please note DO NOT contribute actual exam questions you may have been presented with in the past ANYWHERE in this book.

(6)

LPI 101 Exam Objectives

Each objective is assigned a weighting value. The weights range roughly from 1 to 10 and indicate the relative importance of each objective. Objectives with higher weights will be covered in the exam with more questions.

LPI 101 Exam Table of Contents

Topic 101: System Architecture

• 101.1 Determine And Configure Hardware Settings • 101.2 Boot the System

• 101.3 Change Runlevels And Shutdown Or Reboot System

Topic 102: Linux Installation and Package Management

• 102.1 Design Hard Disk Layout • 102.2 Install A Boot Manager • 102.3 Manage Shared Libraries

• 102.4 Use Debian Package Management • 102.5 Use RPM and YUM package management

Topic 103: GNU and Unix Commands

• 103.1 Work On The Command Line • 103.2 Process Text Streams Using Filters • 103.3 Perform Basic File Management • 103.4 Use Streams, Pipes And Redirects • 103.5 Create, Monitor And Kill Processes • 103.6 Modify Process Execution Priorities

• 103.7 Search Text Files Using Regular Expressions • 103.8 Perform Basic File Editing Operations Using Vi

Topic 104: Devices, Linux Filesystems, Filesystem Hierarchy Standard

• 104.1 Create Partitions And Filesystems • 104.2 Maintaining The Integrity Of Filesystems

• 104.3 Control Mounting And Unmounting Of Filesystems • 104.4 Managing Disk Quota

• 104.5 Manage File Permissions And Ownership • 104.6 Create And Change Hard And Symbolic Links

(7)

LPI 102 Exam Objectives

Each objective is assigned a weighting value. The weights range roughly from 1 to 10 and indicate the relative importance of each objective. Objectives with higher weights will be covered in the exam with more questions.

LPI 102 Table of Contents

Topic 105: Shells, Scripting and Data Management

• 105.1 Customize And Use The Shell Environment • 105.2 Customize Or Write Simple Scripts

• 105.3 SQL Data Management

Topic 106: User Interfaces and Desktops

• 106.1 Install And Configure X11 • 106.2 Setup A Display Manager • 106.3 Accessibility

Topic 107: Administrative Tasks

• 107.1 Manage User And Group Accounts And Related System Files • 107.2 Automate System Administration Tasks By Scheduling Jobs • 107.3 Localisation And Internationalisation

Topic 108: Essential System Services

• 108.1 Maintain System Time • 108.2 System Logging

• 108.3 Mail Transfer Agent (MTA) Basics • 108.4 Manage Printers And Printing

Topic 109: Networking Fundamentals

• 109.1 Fundamentals Of Internet Protocols • 109.2 Basic Network Configuration • 109.3 Basic Network Troubleshooting • 109.4 Configure Client Side DNS

Topic 110: Security

• 110.1 Perform Security Administration Tasks • 110.2 Setup Host Security

• 110.3 Securing Data With Encryption

Sections below are refer to old exam version and are being made obsolete

See page discussion for more details.

LPI 101 Exam Objectives

• Hardware & Architecture

(8)

• Candidates should have a clear understanding of the concept of a BIOS [6] and what role it performs, from the initial computer power-on to the services it provides to the Linux kernel. Furthermore, candidates should be able to identify all the options presented to them in a standard BIOS interface and further be able to gather basic information about the system from the BIOS (Menu navigation). Candidates should also be able to navigate a BIOS and make changes that will enable or disable peripherals, and compare the information provided to them from the BIOS with the information provided from the kernel. Candidates should also be able to determine compatible modems, configure those modems for outbound dial up and set specific port speeds from the command line. Candidates should have an understanding of the term SCSI [7] (Small Computer System Interface) and how SCSI devices work (this includes the terms termination & SCSI ID). Candidates should also have an understanding of the terms Coldplug [8] and Hotplug [9] and be able to determine via BIOS and kernel methods the resources used for any given device that is attached. Candidates should be able to identify a Sound Card [10], and be able to determine if the kernel recognizes the sound card, as well as determine if the device has an issue/conflict pertaining to IRQ [11], DMA [12], or I/O [13]. Candidates should also be able to understand USB [14] devices and demonstrate a knowledge of the USB layer architecture. • Linux Installation & Package Management

• Candidates should be able to design a disk [15] layout that takes into account your system requirements and its purpose. Candidates should also be able to setup various boot locations such as a floppy [16] or cdrom [17], install a bootloader and interact with that bootloader. Further, the candidate should be able to install, remove and query programs from both the RPM [18] and DPKG [19] commands. Using both RPM and DPKG distributions, candidates should be able to obtain package versions, installed package content, installation status and find any files or libraries that may or may not be installed on the system. Candidates should also be able to install programs from source via the make [20] program, which generally includes the use of the tar [21], gzip [22], and bz2 [23] compression utilities. Finally candidates should be able to identify shared libraries, load them and identify where the shared libraries should be located.

• GNU & Unix Commands

• Candidates should be able to understand the shell [24] environment and how to change its behavior by modifying the .profile file, which is located in home directories. Candidates should also be able to send text files and output streams through utility filters to modify the output. Candidates will be expected to know how to move, copy, delete, find, create files and directories, and use recursion to delete and create both files and directories. Candidates should understand the use of redirects [25], pipes [26] and sending your output to stdout

[27] (Standard Output) and to a file. Candidates should be able to list, create and kill processes as well as understand the "&" option and what it does. The candidate should also be able to monitor processes in real time, and be able to modify the priority of any given process. Candidates should be able to create simple regular expressions and use regular expression tools to search through filesystems or file content. Lastly, candidates should know the basic commands for vi [28].

• Devices, Linux Filesystems, Filesystem Hierarchy Standard

• Candidates should be able to set-up partitions and create filesystems, namely ext2 [29], ext3 [30], reiserfs [31], vfat [32] and xfs [33]. Candidates will know the tools that help maintain those filesystems and keep them in good working order, and use those tools to perform simple filesystem repairs. Candidates will be able to mount and unmount filesystems manually and configure the system to mount them automatically during the boot process. Candidates will be able to implement a disk quota solution for your users. The candidate will understand file permissions and what tools to use to modify those permissions, as well as the concept of file ownership and how to modify file ownership attributes. The candidate will be introduced to both hard [34] & symbolic [35] linking, why it is used, and the usage of the ln command. Finally the candidate will understand the FHS [36] standard and be able to determine where files should be located in FHS-based distributions. • The X Window System

(9)

• Candidates should be able to install and configure an X Server [37], install fonts and configure an X font server, and determine if your hardware is suitable for an X server. Candidates will be introduced to the display managers gdm [38] kdm [39] and xdm [40], and will be able to configure any of these three display managers. Candidates will then be introduced to the Window Manager Environment and GUI [41]. Lastly the candidate will be introduced to the usage of the DISPLAY environment variable, as well as the various files used for customization.

LPI 101 Table of Contents

Hardware & Architecture

• Configure Fundamental BIOS Settings • Configure Modem & Sound Cards • Setup Non IDE Devices

• Setup Different PC Expansion Cards • Configure Communication Devices • Configure USB Devices

Linux Installation & Package Management • Design Hard Disk Layout

• Install A Boot Manager

• Make & Install Programs From Source • Manage Shared Libraries

• Use Debian Package Management • Use RPM and YUM package management GNU & Unix Commands

• Work On The Command Line • Process Text Streams Using Filters • Perform Basic File Management • Use Streams, Pipes & Redirects • Create, Monitor & Kill Processes • Modify Process Execution Priorities

• Search Text Files Using Regular Expressions • Perform Basic File Editing Operations Using Vi

Devices, Linux Filesystems, Filesystem Hierarchy Standard • Create Partitions & Filesystems

• Maintaining The Integrity Of Filesystems • Control Mounting & Unmounting Filesystems • Managing Disk Quota

• Use File Permissions To Control Access To Files • Manage File Ownership

• Create & Change Hard & Symbolic Links

(10)

The X Window System • Install & Configure X11 • Setup A Display Manager

• Install & Customise A Window Manager Environment

LPI 102 Exam Objectives

The LPI 102 exam tests basic capabilities in the following areas: • Kernel

• Candidates should be able to build, install, configure, manage and query a Linux kernel [42]. This includes using the command line to get information about the running kernel as well as any kernel modules. The candidate should also be able to understand how to manually load and unload modules and to further understand when those commands are safe to perform. The candidate should be able to determine what parameters you can pass to any given module and how to load those modules with a name other than the file name that represents the module. The candidate should understand at a basic level the difference between monolithic and modular kernels with regards kernel module management.

• Boot, Initialization, Shutdown & Runlevels

• Candidates should be able to boot the system level by level, This starts with passing commands to the bootloader that will define kernel location and pass parameters to the kernel in order to solve problems with the boot process. The candidate will know how to locate and gather information from log files pertaining to the boot process. The candidate will understand the runlevel [43] process and be able to set the default runlevel, as well as shutdown and restart the system from the command prompt this will include being able to terminate individual processes. The candidate will understand how to alert connected users that a major event is about to occur.

• Candidates should be able to install/configure printers, print files, and manage printers both local and remote. • Candidates should be able to find and use man pages, internet documentation.

• Candidates should be able to customize the shell environment, write and administrate simple shell scripts. • Candidates should be able to Administrate users, groups, basic security, implement backups, and the use of cron

[44].

• Candidates should be able to understand/configure/troubleshoot the TCP/IP stack, as well as configure a PPP [45]

client.

• Candidates should be able to manage NFS [46] and Samba [47] daemons, administrate MTA's [48] and the Apache webserver, configure DNS [49] and SSH [50].

• Candidates should be able to implement user level security, basic host security, and perform basic security administration tasks.

(11)

LPI 102 Table of Contents

Kernel

• Kernel Runtime Management & Query

• Reconfigure, Build & Install A Custom Kernel & Kernel Modules Boot, Initialization, Shutdown & Runlevels

• Boot The System

• Change Runlevels & Shutdown Or Reboot System Printing

• Manage Printers & Print Queues • Print Files

• Install & Configure Local & Remote Printers Documentation

• Use & Manage Local System Documentation • Find Linux Documentation On The Internet • Notify Users On System-Related Issues Shells, Scripting, Programming, & Compiling • Customise & Use The Shell Environment • Customise Or Write Simple Shell Scripts Administrative Tasks

• Manage Users & Group Accounts & Related System Files • Tune The User Environment & System Environment Variables

• Configure & Use System Log Files To Meet Administrative & Security Needs • Automate System Administrative Tasks By Scheduling Jobs To Run In The Future • Maintain An Effective Data Backup Strategy

• Maintain System Time Networking Fundamentals • Fundamentals Of TCP/IP

• TCP/IP Configuration & Troubleshooting • Configure Linux As A PPP Client Networking Services

• Configure & Manage xinetd, inetd & Related Services

• Operate & Perform Basic Configuration Of Mail Transfer Agent (MTA) • Operate & Perform Basic Configuration Of Apache

• Properly Manage The NFS & SAMBA Daemons • Setup & Configure Basic DNS Services

(12)

Security

• Perform Security Administration Tasks • Setup Host Security

• Setup User Level Security

External links

• A good guide to LPI 101 - PDF [51]

• A good guide to LPI 102 - PDF [52]

• The Linux Tutorial [5]

Hardware & Architecture

Configure Fundamental BIOS Settings

Detailed Objective

Weight: 1 Description

Candidates should be able to configure fundamental system hardware by making the correct settings in the system BIOS [6] in x86 [53] based hardware.

• Key knowledge area(s):

• Enable and disable integrated peripherals.

• Configure systems with or without external peripherals such as keyboards.

• Correctly set IRQ [11],DMA [12] and I/O [54] addresses for all BIOS administrated ports and settings for error handling.

• The following is a partial list of the used files, terms and utilities: • /proc/ioports

• /proc/interrupts • /proc/dma • /proc/pci

BIOS

BIOS Tips & Tricks

Familiarize yourself with BIOS settings in equipment that you support.

Know your beeps: You may

not have access to the internet when things go wrong.

Change control: Always

make sure you can reverse any change you make in a BIOS.

(13)

BIOS updates: Keep

informed.

Don't roll them out as soon as they hit the mirrors. Wait a couple of months then check manufacturer forums for problems with the update. Once you are happy, update one system, monitor it and then

roll out to the rest of your systems. Document the change, BIOS updates are normally a nightmare to reverse.

Be aware of the F1 key to continue, particularly when rebooting remote servers.

Lights Out Management [55] if it is available, utilize it. Think long and hard about implementing BIOS security. Can the same level of security be implemented elsewhere? Normally it can. Understand the limitations of BIOS date and time. Can system date and time be better maintained by other means?

Introduction

The BIOS (Basic Input / Output System) can be thought of as a suite of small programs that operate between the operating system and the hardware on any given computer. It provides a number of services that enable the computer to boot any given operating system. The BIOS can also provide or present other services to the operating system depending on the operating system and / or the type of hardware installed. It is also wise to note that a modern-day computer may have multiple BIOS chips interfacing the various different hardware components that combine to build the whole computer. These include Disk Array Controllers [56], Graphic Cards [57], Sound Cards [58], and

possibly a few others. Firstly lets look at the services the BIOS provides regardless of which operating system is installed: these being the POST [59] (Power On Self Test), Hardware Management, Security and Date & Time.

Intel and other manufacturers have developed another standard called EFI [60] (Extensible Firmware Interface),

which performs a similar function to BIOS, but does the job in a different manner. EFI is far more flexible and powerful than BIOS, but it has not enjoyed as much commercial success. Exploration of EFI is beyond the scope of this document for now.

(14)

POST - Power On Self Test

• The POST process involves a small diagnostic program that checks system hardware such as RAM or

motherboard components. If a particular piece of hardware is present, a basic test is performed to check for faults. More advanced tests such as a long memory test may be performed, but normally these features need to be manually enabled in the BIOS.

• If the POST process finds errors it will usually sound beeps on the motherboard speaker and / or show some visual message via LEDs on the motherboard and / or messages on the screen. This is known as an "Irregular POST Condition".

• The number (and in some cases the pattern) of the beeps, lights, or messages will aid you in diagnosing the problem; however, different motherboard models (even Mobo's from the same manufacturer) have different implementations of these signals, so it is always wise to have a printed reference manual for each model you support or internet access on another machine for a quick look-up.

Hardware Management

• During the POST process, the BIOS allows you great flexibility to customize certain aspects of the system via settings stored in CMOS [61] (Complementary Metal Oxide Semiconductor) memory. CMOS memory is volatile memory [62], but your motherboard has a backup battery to preserve any customized system configurations that you have made. This battery will eventually die. If you find that your computer is not retaining BIOS settings from one power cycle to another, the usual reason is that you need to replace this battery.

• Useful BIOS settings often edited by users and system administrators may include: • Boot device priority

• Enable / disable motherboard features like integrated video, LAN, or sound • Setting preferred memory addresses or IRQ vectors for PCI (or older) cards

• On older motherboards these configurations were done by positioning certain jumpers [63] or dip switches [64] to the hardware manufacturer's specifications. Modern CMOS menus have replaced nearly all of these devices, with the exception of setting SCSI ID or resetting a BIOS password. There are still some "old school" motherboards in operation, so always keep the possibility of jumpers in mind.

Security

• Most BIOSs allow the user to set a password. The computer will require this password to be input before completing the boot process. Often this BIOS password adds inconvenience without any real security: information on how to get around these passwords is freely available on the internet. If the user forgets this password, the computer will not proceed to load an operating system. It's not hard to see why BIOS Passwords are rarely invoked at the business level.

• Many modern computers have the ability to detect configuration changes such as memory size changes and even if the case has been removed. The BIOS will often report these changes and prompt the user to press a key (usually the F1 key) to continue if this change is acceptable. Users may be required to hit another key to enter the BIOS configuration screens to change parameters depending on the particular BIOS manufacturer.

(15)

Date and Time

• Setting the time and date are options within any modern BIOS. This is a "real-time" clock that runs constantly, powered by the same battery that preserves the CMOS settings. It's not very accurate, even compared to a wrist-watch, but it's better to have this poor clock than to require users to enter the time manually at every reboot. (That's how it was done in the early days of computers.)

• Linux (like other operating systems) maintains its own clock in software by counting interrupts generated by an oscillator circuit in your computer. This clock only functions while the operating system is running.

• The BIOS provides the date and time to the operating system upon booting. After the operating system has gathered this information, the BIOS clock and the Operating System clock continue to run independently. This means that the BIOS clock will soon differ from the operating system clock, even if it is only in milliseconds. • Linux has a command called hwclock which can be used to synchronize the operating system clock with the

BIOS. Once synchronized, they will drift apart again, however. (This is due to the Hardware nature of the BIOS clock and the Software nature of the OS clock.)

• Further on in the course, you will start to look at ntp [65] and how important it is to maintain a consistent "Network Time". Knowing that the BIOS and operating system maintain separate clocks will aid you in setting out a solution.

• The BIOS does not handle time zone or daylight savings time adjustments. These are handled by the operating system. For this reason, some administrators may choose to set their BIOS clocks to UTC [66] rather than the local time.

Disk Drives

Most computers use Hard Disk Drives [15] to hold an operating system and users' data. Some newer computers use Solid State Disk Drives [67] instead. Though the physical devices vary greatly, there is little difference from the standpoint of configuring Linux or other operating systems.

Attachment Interfaces

Firstly let's address the confusion that often comes around from disk drive terminology such as IDE/ATA [68]

(Integrated Drive Electronics / Advanced Technology Attachment) and SATA [69] (Serial Advanced Technology Attachment) and indeed PATA [70] (Parallel Advanced Technology Attachment) which all use the ATA (Advanced Technology Attachment) standard to communicate with the device. The first part of the acronym can be thought of simplistically as a revision. For instance IDE, Fast IDE, EIDE, etc these revisions had changes made to the physical cables or ribbons that connect the disk drives to the computer that enabled certain features. This could be to address more disk space or speed up communications with the device. SATA was like a rewrite, once SATA came into being it was decided that all historical ATA devices that predated SATA, like IDE etc be grouped under the terminology PATA.

SCSI [7] is another popular attachment interface that has undergone several generations of revision over the years: SCSI, SCSI-2, SCSI-3, U160, U320, and SAS. Click on the link at the head of this paragraph for more details, if desired. The SCSI family of attachment interfaces is not hardware-compatible with the ATA family, nor do they use the same software command set, so you cannot mix SCSI drives with ATA controllers or ATA drives with SCSI controllers. Because they use different commands, Linux will enumerate them with different labels. This will be handled in more detail when it becomes important later.

(16)

A Brief History

To get an understanding of modern hard drives, it helps to have some background. The BIOS traditionally uses INT13h [71] as an interface to the hard drive. INT13h, from a historical stand-point, had certain limitations such as: hard drive size, limit, etc. Now on the other side of the interface that being the drive which used the IDE/ATA also had restrictions. We can see these restrictions easily if we lay out a table as below.

Specification Max Cylinders Max heads Max sectors Max Size

IDE/ATA 65,536 16 256 138GB

INT13h 1,024 256 63 528MB

Clearly you can see that because of the limitations of INT13h and IDE/ATA (which we have highlighted) under the above scenario, the largest drive your average computer could handle was 528MB. We call this specification CHS

[72] (Cylinders Heads Sectors). You may recall that to calculate the total size of a hard drive use the following formula:

• Cylinders * Heads * Sectors * 512 = Capacity

To get around this a new specification was implemented called ECHS (Extended Cylinders Heads Sectors) some times also referred to as "Large Mode". This introduced a translation layer between the BIOS and INT13h. The translation layer then allowed a computer to handle disk drives upto 8.4GB in size we can see this with a following modification to the table above which we have set out below and highlighted the relevant row.

Specification Max Cylinders Max heads Max sectors Max Size

IDE/ATA 65,536 16 256 138GB

ECHS 620 128 63 2.5GB

INT13h 1,024 256 63 8.4GB

To see how the translation works, lets take a 2.5GB hard drive with the following specs: Cylinders = 4960, Heads = 16, Sectors = 63. The translation program looks at the number of cylinders and makes a "Best fit" with the INT13h limitation of 1,024 cylinders. The translation program does this by division normally; It divides the number of cylinders by one of the following numbers: 2,4,6,8 and in some cases 16. In our case, 4960 / 8 = 620, which does not break the limitation of INT13h. Now the translation program multiplies the number of heads by 8, so 16 * 8 = 128. In this way, the translation program maintains the INT13h standard and provides a way in which the computer can see the whole disk. We can see this by calculating the disk space at both points previous translation and after. • Native 4660 * 16 * 63 * 512 = 2.5GB

• Translation 620 * 128 * 63 * 512 = 2.5GB

The Table above needs a little more clarification. You will note that the Heads for the ECHS (Translation Layer) = 128, which is incompatible with the IDE/ATA Layer, which specifies a limit of 16. We get away with this, because the translation layer is only concerned with INT13h and not in any way related to the IDE/ATA layer. The next table will show how this model really looks.

(17)

Specification Max Cylinders Max heads Max sectors Max Size

Physical Drive 4,660 16 63 2.5GB

IDE/ATA 65,536 16 256 138GB

INT13h 1,024 256 63 8.4GB

ECHS 620 128 63 2.5GB

Needless to say, Hard Drives got a lot bigger than 8.4GB, so some other way was needed, as the cylinders, heads and sectors were no longer a viable option. This is covered in the next section where we bring you right up to date. LBA

LBA (Logical Block Addressing [73]) is the most common scheme in use today to get past the 528MB limit imposed on an IDE/ATA disk drive. With LBA each block has a unique identification number thats starts at 0 and then 1,2,3,4,5... In order for this mechanism to work it must be supported by the BIOS, the operating system and the IDE drive. The common misconception with LBA is that it is the LBA itself that gets around the 528MB limit when in fact LBA uses translation. When you enable LBA mode in a BIOS you are in effect enabling translation. The translation can be the same as ECHS as discussed above or another algorithm can be used by a 3rd party. It is way beyond this course to look at these algorithms. But the point of 3rd party algorithms should be made. More and more with modern operating systems the BIOS is taking a back seat when "Talking" to the drive, modern operating systems now perform this function with their own interpretation of the ATA specification preferring to bypass the BIOS altogether.

IRQ

There are 16 IRQ's (Interupt ReQuest) channels on x86 architecture, of those only a few are freely available. The table below lists the IRQ's that cannot be used in red and the IRQ's that could be reassigned providing certain hardware does not exist in your system in orange, and those that you are free to assign as you please in white.

IRQ No. Hardware Assignment IRQ No. Hardware Assignment IRQ No. Hardware Assignment IRQ No. Hardware Assignment

0 System timer 4 COM1 8 Real Time Clock 12 PS2 Mouse

1 Keyboard 5 LPT2 / Sound Card 9 Available 13 Floating Point Proc

2 Handles IRQ 8 - 15 6 Floppy Controller 10 Available 14 Primary IDE

3 COM2 7 Parallel Port 11 Available 15 Secondary IDE

In essence IRQ's are used to halt the computer from processing any further information and immediately service the request from the interrupt. That being the device that is assigned to the interrupt. The table above explains what the IRQ architecture looked like under PIC [74] (Programmable Interrupt Controller), however it does hide the issue of priorities. The priorities of the IRQ structure can be seen like this 0-1-2-8-9-10-11-12-13-14-15-3-4-5-6-7. The reason 8-15 have a higher priority is that they hook into IRQ 2, in fact IRQ 2 can be said to be IRQ 9. What we have looked at here is somewhat historical under the above scenario adding new hardware quickly became an art and a pain! However, the advent of PCI [75] and USB [14] enabled a greater range of addresses and also the ability to just plug things in and go.

(18)

DMA

DMA (Direct Memory Access) is a feature of the modern computer to enable devices to bypass the CPU [76] when needing to write or read information to or from another device, the purpose of this is to take the load off the CPU and utilize the DMA controller and RAM [77] to move blocks of data from one area to another. Although the CPU is never completely eliminated in a DMA transfer, its role is purely to initiate the process rather than manage it.

I/O

I/O (Input / Output) refers to moving data among all devices both external and internal within a modern computer system. Some devices can perform both input and output functions, an example of this is a Network Card [78], obviously keyboards [79], mouse [80] etc are examples of input devices and monitor [81], printers [82] are examples of output devices. I know, this is entry-level stuff but bear with me the theory is nearly over.

Putting it all together

When you turn the PC on, BIOS instructions are loaded into RAM from a permanently available ROM [83] chip on the motherboard. These instructions, after performing a POST, may further inform the processor where the operating system is located and how to load it into RAM. In order to allow operating systems and applications to run on a PC, the BIOS provides a standard layer of services that the operating system can use to "talk" to the hardware. In turn, the operating system provides standard services to applications to perform their functions. It is important to understand that not all operating systems use all BIOS services, some use their own instructions to access the hardware. The direct method of accessing the hardware may improve performance.

The BIOS utilizes a number of technologies to perform the services we have addressed above. However, as with all things in the computer industry, technology is moving forward fast. The BIOS performs a crucial role within the system and new technology added to the motherboard will normally require BIOS co-operation so that the OS can utilize the new technology.

By now you should have a good understanding of the BIOS and the role it performs with hardware. In the next section we look at Linux and how it interacts with the BIOS / Hardware. This will hopefully give you a System Administrator's view of these relationships.

Viewing BIOS-related information in Linux

Introduction

From this point onward it becomes necessary to have access to a Linux PC. Although some theory is involved, we shall be interacting with Linux more and more. I advise that you attempt the commands as you come across them, testing your understanding as you go. Do be careful with some of the commands as an incorrect switch, or in some cases running a command from the wrong directory is not healthy. (One famous example is running rm -R * from / as root.) So if you are new to Linux, be careful: don't misuse the root account. Only use it when you have to. I personally advise a separate Linux installation for the course that contains no personal data.

Understand that No author / contributor to this book is in any way responsible for any loss of data or damage to any hardware, however it is caused. Mistakes in typing can happen and this is an open book for anyone to edit regardless of their knowledge.

(19)

/proc

/proc is a pseudo-filesystem which is used as an interface to kernel data structures. Most of it is read-only, but some files allow kernel variables to be changed, particularly in /proc/sys. if you were to list the file system in /proc you would see something like this:

user@host:~$ cd /proc user@host:/proc$ ls 1 4190 5071 5462 5859 6 dma pagetypeinfo 128 4312 5103 5478 5867 6024 driver partitions 1475 44 5162 5547 5868 6553 execdomains sched_debug 1481 45 5164 5563 5871 6583 fb scsi 1508 4589 5205 5574 5879 6593 filesystems self 1524 4590 5224 5579 5880 6685 fs slabinfo 1526 4594 5227 5655 5884 6694 interrupts stat 165 4595 5289 5660 5890 6714 iomem swaps 166 4597 5302 5661 5892 6716 ioports sys 1784 4765 5315 5695 5901 6717 irq sysrq-trigger 1786 4805 5318 5697 5902 6735 kallsyms sysvipc 1787 4878 5328 5698 5903 7 kcore timer_list 2 4932 5336 5816 5905 acpi key-users timer_stats 207 4934 5356 5820 5912 asound kmsg tty

2272 4956 5362 5821 5915 buddyinfo loadavg uptime 2273 4972 5363 5829 5918 bus locks version

2515 4986 5370 5832 5925 cgroups meminfo version_signature 2718 4999 5373 5842 5938 cmdline misc vmcore

3 5 5378 5851 5941 cpuinfo modules vmnet 3181 5021 5416 5854 5970 crypto mounts vmstat 4 5042 5419 5856 5973 devices mtrr zoneinfo 41 5043 5423 5858 5982 diskstats net

The first thing that you will notice is the numbered directories these represent processes running on your system. Each numbered directory, has a common subset of directories that provide information about that process. The number representing the directory is consistent with the process number seen with the ps command. We cover processes in a later section.

The directories and files we are interested in are the following: /proc/acpi * Power Management

/proc/bus/pci * Note on some distributions this may be /proc/pci /proc/cpuinfo * processor information

/proc/devices /proc/dma /proc/interrupts /proc/iomem /proc/ioports /proc/irq /proc/meminfo

(20)

Getting kernel information

/proc is a pseudo-filesystem which is used as an interface to kernel data structures. Most of it is read-only, but some files allow kernel variables to be changed.

Examples of available directories are:

[Number]: Process information running on the system.

cmdline: The complete command line, cwd: The working directory, ... /proc/uptime Since when the system is up and running.

/proc/sys/kernel Kernel information. /proc/sys/net Network information.

/proc/partitions Hard drive partitions information. /proc/scsi SCSI information.

/proc/mount Mounted file system information. /proc/devices List the loaded drivers.

/proc/bus Bus information. /proc/version Linux version.

/proc/acpi

This section needs text.

Getting hard drive Information

In order to get disk information, use hdparm. More information is available at the hdparm man page [84] hdparm [options] [devices]

Common options:

-g: Get the disk geometry.

-C: Display the power mode of the hard drive. active/idle: Normal operation,

Standby: Low power mode, or sleeping: Lowest power mode.

-v: Display all settings, except -i (same as -acdgkmnru for IDE, -gr for SCSI or -adgr for XT). This is also the default behaviour when no flags are specified.

Examples:

hdparm -g /dev/hda /dev/hda:

geometry = 3648/255/63, sectors = 58605120, start = 0 hdparm -C /dev/hda

/dev/hda:

drive state is: active/idle And more... Bold text

(21)

Exercises

1. What is the RAM size of your system? 2. Which devices are sharing an interrupt line?

3. Use the lspci utility with the right option to draw the PCI architecture of your system. • How many PCI buses and bridges are there?

• Are there any PCI/ISA bridges?

4. What is the lspci option to list all the Intel PCI devices?

5. What is the command to set your IDE hard drive to read-only mode? 6. What is the command to turn on/off the hard drive disk cache? 7. What does the setpci utility do?

8. What is the command to write a word in register N of a PCI device? Exercise Results

1. To show the amount of physical RAM available: use free or cat /proc/meminfo | grep MemTotal 2. Which are the devices that are sharing an interrupt line? cat /proc/interrupts | more

3. How many PCI buses and bridges are there? lspci | wc -l 4. Are there any PCI/ISA bridges? lspci | grep 'PCI\|ISA'

5. What is the option with lspci to list all the Intel PCI devices? lspci -d 8086:*

6. What is the command to set you IDE hard drive in read only mode? hdparm -r1 <device>

7. What is the command to turn on/off the disk cache hard drive? hdparm -W1 <device>    hdparm -W0 <device> 8. What does the setpci utility do? setpci is a utility for querying and configuring PCI devices.

9. What would be the command to write a word in register N of a PCI device? setpci -s 12:3.4 N.W=1

Configure Modem & Sound Cards

Detailed Objective

Weight: 1 Description

Candidates should be able to configure modem and sound card settings. • Key knowledge area(s):

• Ensure devices meet compatibility requirements (particularly that the modem is not an unsupported "win-modem").

• Verify that correct resources are used by the cards. • Configure modem for outbound dial-up.

• Set serial port speeds.

• The following is a partial list of the used files, terms and utilities: • /proc/dma • /proc/interrupts • /proc/ioports • /proc/pci • lspci • lsusb

(22)

Modems

A modem is a device that lets you send digital data through a telephone line. The four types of modem are: • External: Connected through the serial port.

• USB: Connected through USB. • Internal: ISA or PCI board. • Built-in: Part of the motherboard.

Most new modems are Plug and Play and you have various ways to deal with it: • The serial driver does it all for you.

• Use the isapnp program.

• Let a PnP BIOS do the configuration.

To display the configuration of an ISA device, use pnpdump. This utility can dump information (IO ports, interrupts, and DMA channels) that the card uses. To configure any ISA devices, use isapnp. For more information check the man page of isapnp.conf file.

Serial ports

An external modem can be configured with setserial [85]. setserial [options] device [parameters]

The available serial ports are: /dev/ttyS0 (COM1), port 0x3f8, irq 4 /dev/ttyS1 (COM2), port 0x2f8, irq 3 /dev/ttyS2 (COM3), port 0x3e8, irq 4 /dev/ttyS3 (COM4), port 0x2e8, irq 3

Common options:

-a: report all available information on a connected device.

Common parameters: -port: Port number. -irq: IRQ number.

-uart: Type of UART permitted (none, 8250, 16450,...).

-autoconfig: Ask the kernel to determine the UART, IRQ number,... -baud_rate: Communication bandwidth. (Maximum: 115200 bytes/sec) Example:

(23)

Dial Out and In

In order to dial out with a modem, you can use the application setserial [85] or minicom [86]. A configuration file can be created with the -s option.

minicom -s

In order to be able to handle users dialing in, the system needs to be able to start a getty process to handle the dial-in session. The configuration must be done in the /etc/inittab file.

D1:45:respawn:/sbin/agetty -mt60 19200,9600 ttyS0 vt100

-m: tells getty to try to extract the bps rate. 19200,9600: bps rate when it receives a BREAK character. t60: timeout of 60 seconds.

ttyS0: Port on which the modem is connected.

vt100: Terminal type used in the TERM env variable. Once /etc/inittab is modified, init needs to re-read it.

telinit -q

Exercises

• Exercises results

Detailed Objective

Weight: 1 Description:

Candidates should be able to configure non-IDE devices as SCSI, SATA, USB drives using the special BIOS as well as the necessary Linux tools.

• Key knowledge area(s):

• Differentiate between the various types of non-IDE devices. • Manipulate BIOS to detect used and available SCSI IDs.

• Set the correct hardware ID for different devices, especially the boot device.

• Configure BIOS settings to control the boot sequence when both non-IDE and IDE devices are present . • The following is a partial list of the used files, terms and utilities:

• SCSI ID • /proc/scsi/ • scsi_info

(24)

SCSI

The SCSI BIOS can be accessed at boot time with some special key sequences (Ctrl+A for most Adaptec Host Bus Adapters, Ctrl+G, Ctrl+M, or other keys for other vendors) and allow you to setup some parameters. Bootable SCSI and more.

In order to get SCSI information, use scsi_info or hdparm [87]. Examples:

scsi_info /dev/sda hdparm -grv /dev/sda

obs: Tested with hdparm v6.1 (debian sarge kernel 2.6.8-3 arch 386)

Exercises

• Exercises results

Setup Different PC Expansion Cards

Detailed Objective

Weight: 3 Description

Candidates should be able to configure various cards for the various expansion slots. • Key knowledge area(s):

• Know the differences between coldplug and hotplug devices. • Determine hardware recources for devices.

• The following is a partial list of the used files, terms and utilities: • The appropriate subdirectories of /proc

• hotplug configuration files, terms and utilities • lspci [88]

• lsusb [89]

Hotplug

With proper support from the operating system, some devices can be added and/or removed without shutting the system down, much like a CD-ROM or floppy disk can be mounted or unmounted. USB was designed to be hot-pluggable, but the operating system must still be prepared to deal with the possibility of devices appearing and disappearing.

Some server motherboards support a hot-pluggable PCI slot standard, intended to reduce downtime by allowing administrators to replace failed components without shutting-down the entire server. A few server vendors even go as far as to allow swapping-out bad RAM while the system is running, but this is very rare and expensive. Both the hardware and the operating system must support hot-plugging components in order for the system to work. (There's a limited amount of repair that can be done on an airplane while flying at 10,000 feet.)

(25)

Coldplug

It is much less confusing to your computer if you shutdown the power before making any changes to hardware you are connecting.

PCI

All PCI cards are normally detected by the BIOS. At boot time the BIOS probes the PCI configuration space and detects all the different devices and bridges. To insure that the BIOS has detected all the PCI devices, use lspci. Check for bridges, special devices, and functions.

All ISA cards are also normally detected with the respected drivers. The utilities that allow you to manually configure any ISA cards are pnpdump, pnpisa and /etc/pnpisa.conf file. The pnpdump program allows you to dump information on all the detected ISA cards. The isapnp works with a configuration file /etc/pnpisa.conf that has the same syntax of the output of pnpdump and it allows you to customize any ISA card settings.

Exercises

• Exercises results

Configure Communication Devices

Detailed Objective

Weight: 1 Description

Candidates should be able to install and configure different internal and external communication devices like modems, ISDN adapters and DSL modems.

• Key knowledge area(s):

• Verification of compatibility requirements (such as the modem is not a "winmodem"). • Correctly set IRQs, DMAs and I/O Ports of the cards to avoid conflicts between devices. • Load and configure suitable device drivers.

• Set serial port speed.

• Setup modem for outbound PPP connections.

• The following is a partial list of the used files, terms and utilities: • /proc/dma

• /proc/interrupts • /proc/ioports • setserial [85]

I/O Ports

To list the I/O ports the system uses, print the /proc/ioports file. $ cat /proc/ioports 0000-001f : dma1 0020-003f : pic1 0040-005f : timer 0060-006f : keyboard 0070-007f : rtc

(26)

00a0-00bf : pic2 00c0-00df : dma2 00f0-00ff : fpu

0170-0177 : PCI device 8086:248a 0170-0177 : ide1

01f0-01f7 : PCI device 8086:248a 01f0-01f7 : ide0

02f8-02ff : serial(auto)

0376-0376 : PCI device 8086:248a 0376-0376 : ide1

0378-037a : parport0 037b-037f : parport0 03c0-03df : vesafb

03f6-03f6 : PCI device 8086:248a 03f6-03f6 : ide0

Interrupts

To list all the interrupts used by all the devices, print the /proc/interrupts file. $ cat /proc/interrupts

CPU0

0: 397517 XT-PIC timer 1: 7544 XT-PIC keyboard 2: 0 XT-PIC cascade

5: 0 XT-PIC usb-uhci, usb-uhci 8: 2 XT-PIC rtc

10: 2024 XT-PIC eth0, usb-uhci, PCI device 104c:ac51, PCI device 104c:ac51, Intel ICH3

12: 19502 XT-PIC PS/2 Mouse 14: 11445 XT-PIC ide0

15: 2770 XT-PIC ide1 NMI: 0

ERR: 0

An optimized system will not have any interrupt lines used by more than one heavily-used device. Remember that every ISR [90] from every device will be executed for each interrupt.

(27)

DMA

To list all the ISA DMA (Direct Memory Access) channels in-use, print out the /proc/dma file. $ cat /proc/dma

4: cascade

PCI

To list all the devices on the pci buses, print out the /proc/pci file. $ cat /proc/pci

PCI devices found:

Bus 0, device 0, function 0:

Class 0600: PCI device 8086:3575 (rev 2).

Prefetchable 32 bit memory at 0xe0000000 [0xefffffff]. Bus 0, device 1, function 0:

Class 0604: PCI device 8086:3576 (rev 2). Master Capable. Latency=96. Min Gnt=12. Bus 0, device 29, function 0:

Class 0c03: PCI device 8086:2482 (rev 1). IRQ 10.

I/O at 0x1800 [0x181f]. Bus 0, device 29, function 1:

Class 0c03: PCI device 8086:2484 (rev 1). IRQ 5.

I/O at 0x1820 [0x183f]. Bus 0, device 29, function 2:

Class 0c03: PCI device 8086:2487 (rev 1). IRQ 5.

I/O at 0x1840 [0x185f]. Bus 0, device 30, function 0:

Class 0604: PCI device 8086:2448 (rev 65). Master Capable. No bursts. Min Gnt=4.

Exercises

• Exercises results

Configure USB Devices

Detailed Objective

Weight: 1 Description

Candidates should be able to activate USB support, use and configure different USB devices. • Key knowledge area(s):

• Identify and load the correct USB driver module.

• Demonstrate knowledge of the USB layer architecture and the modules used in the different layers. • The following is a partial list of the used files, terms and utilities:

(28)

• lspci [88] • xHCI modules • lsusb [89] • /etc/usbmgr/ • usbmodules [91] • /etc/hotplug

• udev [92] configuration files, utilities and documentation

Auto detection of new USB Devices

The program that gets executed when a new hardware is connected is hotplug [93]. hotplug name

Common names are: pci: PCI devices. usb: USB devices.

The /etc/hotplug directory contains the script that must be executed each time a device gets inserted or removed. * /etc/hotplug/pci.agent: To install the appropriate PCI driver.

* /etc/hotplug/usb.agent: To install the appropriate USB driver. The hotplug program is also started at boot time to initialize all the connected devices. /etc/init.d/hotplug

List USB Devices

To verify your devices have been detected, use lsusb [89]. lsusb [options]

Example: $ lsusb -v

Bus 001 Device 004: ID 04a9:3045 Canon Inc. PowerShot S100

Device Descriptor:

bLength 18 bDescriptorType 1 bcdUSB 1.00

bDeviceClass 255 Vendor Specific Class bDeviceSubClass 255 Vendor Specific Subclass bDeviceProtocol 255 Vendor Specific Protocol bMaxPacketSize0 32

idVendor 0x04a9 Canon Inc. idProduct 0x3045 PowerShot S100 ...

(29)

USB Drivers

Every detected USB device will be mounted in the /proc/bus/usb filesystem and can be accessed with the appropriate application.

Each USB device will be viewed through a filename like /proc/bus/usb/001/005 .

To check if the appropriate driver has been loaded for a USB devices, use usbmodules [91]. usbmodules [options]

Examples:

usbmodules –device /proc/bus/usb/001/001 usbcore

usbmodules –device /proc/bus/usb/001/005 –mapfile /etc/hotplug/usb.handman The default modules to be loaded are /lib/modules/<kernel-version>/modules.usbmap.

The mapping is stored in the file /lib/modules/<kernel-version>/modules.usbmap.

All the drivers are stored in the directory /lib/modules/<kernel-version>/kernel/drivers/usb/.

USB Applications

Many applications exist for many different devices. It is sometimes time consuming to make them work. An application that can be used for a digital camera is gphoto2.

Common options:

--debug: See what is the problem when talking to the camera.

--print-usb-usermap: Store the output in /etc/hotplug/usb.usermap in order for the application to support your camera.

-P: Download pictures. Example:

$ gphoto2 --summary

Detected a 'Canon PowerShot S100'. Camera summary :

Camera identification:

Model : Canon PowerShot S100 Owner:

Power status: on battery (power OK)

Flash disk information: Drive D:

31'885'312 bytes total 27'668'480 bytes available

(30)

Exercises

USB:

1. Check if you can detect a digital camera. 2. View the camera device information.

3. Take a picture and download it into a system with gphoto2. 4. Configure your own device (HD, camera, mouse, keyboard,...) • Exercises results

Linux Installation & Package Management

Detailed Objectives

Weight: 2

Description:

Candidates should be able to design a disk partitioning scheme for a Linux system. • Key knowledge area(s):

• Allocate filesystems and swap space to separate partitions or disks. • Tailor the design to the intended use of the system.

• Ensure the /boot partition conforms to the BIOS requirements for booting. • The following is a partial list of the used files, terms and utilities:

• / (root) filesystem • /var filesystem • /home filesystem • swap space • mount points • partitions

Filesystems

A filesystem is simply a way of organizing data in computer-accessible form on the hard disk or other media. Different filesystems have different organizing structures to determine where the data and indexing information will be stored. Some popular filesystems include:

ext2 one of the oldest and most universally supported filesystems on Linux, Unix, and BSD operating systems ext3 an extended version of ext2 which overcomes some limitations and adds journaling

ext4 btrfs

reiserfs an enhanced journaling filesystem written by Hans Reiser and extended by the open source community since his incarceration jfs

xfs fat or

vfat the file allocation table-based filesystem used by MS-DOS and Windows 9x NTFS A more advanced (than fat) filesystem used by Windows NT, 2000, XP and Vista

(31)

Partitions

When doing an installation there is normally a minimum disk configuration of two partitions that needs to be created:

• / (root): directory that contains the Linux distribution.

• Swap space: partition that allows a kernel to run more processes that can normally fit into RAM.

If multiple disks are available it is good practice to also have the /usr and /home directories on different partitions. Each partition will contain a filesystem type and can be mounted on the active system in the filesystem global tree. To print the active mounted filesystems, use mount [95].

$ mount

dev/hda3 on / type reiserfs (rw) proc on /proc type proc (rw)

devpts on /dev/pts type devpts (rw) /dev/hda1 on /boot type ext2 (rw) shmfs on /dev/shm type shm (rw)

usbdevfs on /proc/bus/usb type usbdevfs (rw)

The swap partition doesn't need a file system. It will be accessed in raw mode by the kernel with no filesystem system calls as overhead.

Disk speed issues

Before deciding on your partitioning scheme, you really need to know exactly what sort of applications you will be running.

• Mail Server • Web Server

• Graphical X-Windows based applications • And more

If your system has multiple disks, use the fastest one to store most of your data.

• / Contains most of the system utilities and doesn't get used much. These can be shipped off to the slowest disk. • /var/log contains a lot of logging information. Best on a fast disk.

• /usr is typically on a separate partition anyway and if you have a lot of clients starting lots of X applications, use a fast disk.

Examples of system applications:

For e-mail serving, Sendmail writes to two main locations mail queue, usually /var/spool/mqueue and /var/spool/mail as well as other location. Apache uses several different files, two logs files per site hosted for logging and access to the actual pages. Apache spends quite a bit of time writing to logs files in /var/log (or where configured to do so)

(32)

Virtual memory (Swap)

When you set up a new system, swap should be twice your actual RAM. This is not always sensible in real-world scenarios, however it is a traditional guideline and a conservative answer to give in an exam.

Information on the swap partition can be displayed with swapon. swapon -s # Display the active partition To get information on the usage of virtual memory, use vmstat. $ vmstat -n 1

procs memory swap io system cpu r b w swpd free buff cache si so bi bo in cs us sy id 5 0 1 184 3228 37684 92828 0 0 37 19 124 228 3 0 97 1 0 0 184 3476 37684 92596 0 0 0 0 102 368 0 0 100 2 0 0 184 3476 37684 92596 0 0 0 0 101 328 0 0 100

R:processes waiting for run time. b: processes in uninterruptable sleep. w: processes swapped out.

swpd: virtual memory used (kB). free: Idle memory (kB).

buff: Memory used as buffers (kB). si: Memory swapped in from disk (kB/s). so: Memory swapped to disk (kB/s).

bi: Blocks received from a block device (blocks/s). bo: Blocks sent to a block device (blocks/s).

in: The number of interrupts per second.

cs: The number of context switches per second. us: user time

sy: system time id: idle time

Exercises

• Exercises results

1. Open two terminals: In one terminal display periodically the virtual memory usage. In the second terminal disable the virtual memory and re-enable it. Notify the changes in the first terminal.

2. What is the disk layout of your system and how many disks do you have? 3. How many swap space can you use?

(33)

Detailed Objective

Weight: 2

Description:

Candidates should be able to select, install and configure a boot manager. • Key knowledge area(s):

• Providing alternative boot locations and backup boot options • Install and configure a boot loader such as GRUB.

• Interact with the boot loader.

• The following is a partial list of the used files, terms and utilities: • /boot/grub/menu.lst • grub-install • MBR • superblock • /etc/lilo.conf • lilo

Boot managers

A boot loader is installed in the MBR. When a system starts, it loads what is in the MBR to RAM. Under Linux there are two main boot loaders:

• Lilo: LInux LOader.

• Grub: GRand Unified Boot Loader.

A boot loader allows you to select the image that you would like to boot from. A system can contain multiple images (operating systems).

A boot loader allows you to interactively run commands and pass parameters to the image that you will boot. The initrd is the driver that will be used to build a filesystem on RAM to mount other filesystems and execute programs. GRUB is today's default boot loader for many distributions. When installing Windows with Linux, install Windows first and Linux second, because Windows overwrites the MBR without asking.

LILO vs. GRUB

Both are used to load an image from a disk to RAM. GRUB has the following advantages to LILO: • More pre-OS commands.

• Supports images stored beyond the 1024 BIOS cylinder limitation. • Can access its configuration file through the filesystem.

When using LILO, each time you add a new image or change an image a new LILO needs to be installed in the MBR.

• LILO keeps its boot information in the MBR

• GRUB keeps its boot information in the filesystem (menu.lst). • LILO also has a configuration file /etc/lilo.conf.

To install GRUB on the MBR, use grub-install. The command setup will override the MBR.

To install LILO on the MBR, use lilo. The lilo will use the /etc/lilo.conf file to know what to write into the MBR.

(34)

# LILO global section

boot = /dev/hda # LILO installation target: MBR vga = normal # (normal, extended, or ask)

read-only # Mount the root file systems read-only

# LILO Linux section

image=/boot/vmlinuz # Image to load label=linux # Label to display

root=/dev/hda1 # Root partition for the kernel initrd=/boot/initrd # Ramdisk

# LILO DOS/Windows section other=/dev/hda3

label=windows

# LILO memtest section image=/boot/memtest.bin label=memtest86

Example of menu.lst (GRUB configuration file): # GRUB default values

timeout 10 # Boot the default kernel after 10 seconds default 0 # Default kernel

# Grub for Linux section 0 title GNU/Linux # Title

root (hd0,1) # /dev/hda2 root filesystem # Kernel and parameters to pass to the kernel kernel /boot/vmlinuz root=/dev/hda2 read-only initrd /boot/initrd

boot

# Grub for DOS/Windows section title Winblows root (hd0,2) # /dev/hda3 makeactive chainloader+1

GRUB Resources

* GRUB Manual [96] * GRUB homepage [97] * Grub wiki [98] * Linux+Win+Grub HowTo [99]

* Linux Recovery and Boot Disk Creation with Grub [100]. * Win32 Grub [101]

* Booting with GRUB [102]

* WinGRUB [103]

(35)

* GRUB for DOS [105] - Bridging DOS/Windows to Unix/Linux

Exercises

• Exercises results

1) Install Grub on a floppy disk and try to boot your image manually: mkfs -t ext2 /dev/fd0 mount /dev/fd0 /mnt mkdir -p /mnt/boot/grub cp /boot/grub/stage* /mnt/boot/grub/ cp /boot/grub/e2fs-stage1_5 /mnt/boot/grub/ touch /mnt/boot/grub umount /mnt grub root (fd0) setup (fd0) quit

Now reboot with the floppy and from the prompt select the kernel on the hard disk. root (hd0,1)

kernel /boot/vmlinuz root=/dev/hda2 read-only initrd /boot/initrd

boot

2) Create /boot/grub/menu.lst file and install Grub on your hard drive with the grub utility.

3) Install back lilo. Change the linux label of the default kernel image to SuSE in /etc/lilo.conf and re-install the lilo program in the MBR.

Detailed Objective

Weight: 5

Description:

Candidates should be able to build and install an executable program from source. This objective includes being able to unpack a file of sources. Candidates should be able to make simple customizations to the Makefile, for example changing paths or adding extra include directories, either in the raw Makefile or using the configure tools.

• Key knowledge area(s):

• Unpack a file of sources using typical compression utilities.

• Make simple customizations to Makefile such as changing paths or adding extra include directories. • Apply parameters to a configure script.

• Know where sources are stored by default.

• Compile a RPM or DPKG software package using sources. • The following is a partial list of the used files, terms and utilities:

• RPM and DPKG commands • /usr/src/

• gunzip • gzip • bzip2

References

Related documents

Responding to a call for more theoretically embedded empirical work inspired by queer theory (Ozturk and Rumens, 2014), this paper problematises the notion of inclusion by suggesting

Customs revenues are increased from 34% of all taxes in 2005 to 37% in 2008 (MOF), these amounts are an important amount and reinforce the role of custom administration as collector

For example, when you smooth the data point with the smallest predictor value, the shape of the weight function is truncated by one half, the leftmost data point

The mean offspring survival on each host was 70.1% (Figure 3). Parasitoid offspring size decreased with the increasing num- ber of eggs on each host. These results suggested

For this study, we extracted all spellings for etymological dental fricatives in the FITS corpus, distinguishing five categories: (1) initial position in content words; (2)

It is also for this reason that that, for the period(s) we are looking at, the term ‘non-literary’ seems to be more suitable and inclusive, enabling our contrib- utors to take

By the year 1475, the first phase of the vernacularization of scientific and medical writing was largely complete, to such an extent that the use of the vernacular became even

 True Virtual Hosting - Allows multiple IP address and/or host names to be served through a single and/or host names to be served through a single Apache server... Virtual Hosting: