Monday, August 17, 2009

Linux Run-Levels Questions

Linux Run-Levels Questions


01. Linux has ______ different run levels ( or operating modes).


Ans : Seven


02. Describe all different run levels in Linux

Ans : Linux has 7 different run levels
* rc0.d - System Halted
* rc1.d - Single User Mode
* rc2.d - Single User Mode with Networking
* rc3.d - Multi-User Mode - boot up in text mode
* rc4.d - Not yet Defined
* rc5.d - Multi-User Mode - boot up in X Windows
* rc6.d - Shutdown & Reboot


03. In Redhat/fedora Linux __________ command updates and queries runlevel information for system services


ans: chkconfig



04. Under which folder the service run settings are kept for run level 3 _

ans : /etc/rc.d/rc3.d


05. All files under /etc/rc.d/rc3.d that start with a capital S are the services that will _____ at this runlevel.


A. Skip
B. Start
C. Share
D. None

Ans : B


06. In Linux, which command will shift one run level to other ?


Ans: init


07. In Linux(Redhat), default runlevel is defined in _____________ file


Ans : /etc/inittab

08. Scripts that define runlevel 5 can be found in ____________


Ans : /etc/rc.d/rc.4 or /etc/rc.d/rc4.d

09. In Debian/ubuntu Linux __________ command installs and remove System-V style init script links.


ans: update-rc.d


Ref :

* http://www.networkclue.com/os/Linux/run-levels.aspx
* http://linux.com/news/enterprise/systems-management/8116-an-introduction-to-services-runlevels-and-rcd-scripts

Saturday, August 15, 2009

LPI 102v part_007

061. You are working on a non graphical shell. What command would you use to configure the kernel using a menu system. Type the command and its argument(s).

Ans : make menuconfig

Explanation : They clearly state that this is a non graphical shell. Thus, you couldn't use the make xconfig utility here. The only way to accomplish configuring the kernel through a menu without the GUI is make menuconfig.


062. Which of the following correctly describe a Monolithic Kernel (choose all that apply ) :

A. it is built into one single binary.
B. it is loaded completely into memory at boot time.
C. it pre-dates micro-kernel architecture by at least ten years.
D. None of the choices

Ans : ABC

Explanation : Have everything they need in that binary. Are loaded completely into memory at boot time. Pre-date micro-kernel architecture by at least ten years.


063. Which of the following correctly describe a micro-kernal architecture (choose all that apply):

A. it has an extremely small core
B. only its small core remains in memory at all times.
C. its device drivers are loaded as-needed
D. None of the choices

Ans : ABC

Explanation : Miro-kernel architectures : Have an extremely small core. Only the small core remains in memory at all times. Device drivers and other additional items are loaded as-needed.


064. Rate this comment : Linux by and large is monolithic.

A. true
B. false

Ans : A

Explanation : Linux by and large is monolithic. However, Linux permits modules, a system whereby certain parts of the kernel may be loaded at runtime. Linux modules are reminiscent of micro-kernel architecture, but linux really remains basically a monolithic architecture.


065. On a debian system which of the following would build a boot disk

A. mkboot /dev/floopy
B. makeboot --device /dev/fd0 2.4.18-12
C. mkboot --device /dev/fd0 2.4.18-12
D. mkboot /boot/vmlinux-2.4.18-12
E. mkbootdisk /boot/vmlinux-2.4.18-12

Ans : D

066. On a Red Hat system, with a single floppy drive and a returned output from the uname command of 2.4.20-12, what exact command string will create a customized boot disk for this system ? Type the full command string to accomplish this.

Ans. mkbootdisk --device /dev/fd0 2.4.20-12

067. On a Debian-based system, what command will create a boot disk on the first floppy if your kernel image is named "vmlinux-2.4.18-4" ? Type the full command string to accomplish this.

Ans : mkboot vmlinux-2.4.18-4
or mkboot /boot/vmlinux-2.4.18-4

068. You want to create a boot floppy using a given image file on your hard disk. What utility would you use to do so ?

Ans : mkbootdisk --device /dev/fd0 `uname -r`

069. To exclude all log messages of a given logging facility, you should use a logging priority of :

Ans : none


070. You are having some trouble with a disk partition and you need to do maintenance on this partition but your users home directories are on it and several are logged in. Which command would disconnect the users and allow you to safely execute maintenance tasks ?

A. telinit 1
B. shutdown -r now
C. killall -9 inetd
D. /bin/netshop --maint
E. /etc/rc.d/init.d/network stop

Ans : E

LPI 102v part_006

051. Which of the following insures that all of the dependencies, such as the include files, are in place?

A. make dep
B. make clean
C. make_dep
D. make_install

Ans : A

Explanation : When the configure script ends, it also tells you to 'make dep' and (possibly) 'clean'. So, do the 'make dep'. This insures that all of the dependencies, such the include files, are in place. It does not take long, unless your computer is fairly slow to begin with. For older versions of the kernel, when finished, you should do a 'make clean'. This removes all of the object files and some other things that an old version leaves behind. in any case, do not forget this step before attempting to recompile a kernel.


052. Incremental upgrades of the kernel are distributed as :

A. patches
B. fixes
C. hotfixes
D. service packs

Ans : A

Explanation : Incremental upgrades of the kernel are distributed as patches.


053. Which of the following removes all of the object files and some other things that an old version leaves behind ?

A. make dep
B. make clean
C. make_deb
D. make_install

Ans : B

Explanation : When the configure script ends, it also tells you to 'make dep' and (possibly) 'clean'. So, do the 'make dep'. This insures that all of the dependencies, such the include files, are in place. It does not take long, unless your computer is fairly slow to begin with. For older versions of the kernel, when finished, you should do a 'make clean'. This remove all of the object files and some other things that an ond version leaves behind. In any case, do not forget this step before attempting to recompile a kernel.

054. What command will compile the Linux kernel and leave a file in arch/i386/boot called bzImage?

A. make bzImage
B. make compile
C. make Image
D. make bzdisk

Ans : A

Explanation : After depending and cleaning, you may now 'make bzImage' or 'make bzdisk' (this is the part that takes a long time. ). 'make bzImage' will compile the kernel, and leave a file in arch/i386/boot called 'bzImage' (among other things). This is the new compressed kernel. 'make bzdis' does the same thing, but also places the new bzImage on a floppy disk which you hopefully but in drive ''A:''. 'bzdisk' is fairly handy for Certkiller new kernel; if it bombs (or just' work right), just remove the floppy and boot with your old kernel. It can also be a handy way to boot if you accidentally remove your kernel (or something equvally as dreadful).


055. What command will compile the Linux kernel and leave a file called bzImage in the floppy disk ?

A. make bzImage
B. make compile
C. make Image
D. make bzDisk

Ans : D

Explanation : After depending and cleaning, you may now 'make bzImage' or 'make bzdisk' (this is the part that takes a long time. ). 'make bzImage' will compile the kernel, and leave a file in arch/i386/boot called 'bzImage' (among other things). This is the new compressed kernel. 'make bzdis' does the same thing, but also places the new bzImage on a floppy disk which you hopefully but in drive ''A:''. 'bzdisk' is fairly handy for Certkiller new kernel; if it bombs (or just' work right), just remove the floppy and boot with your old kernel. It can also be a handy way to boot if you accidentally remove your kernel (or something equvally as dreadful).


056. Which of the following command will attempt to configure the kernel from an old configuration file and run through the make config process for you ?

A. make oldconfig
B. make newconfig
C. make clean
D. None of the choices

Ans : A

Explanation : Make oldconfig will attempt to configure the kernel from an old configure file; it will run through make config process for you if you havent ever compiled a kernel befor or don't have an old config file, then you probably should't do this, as you will most likely want to change the default configuration.

057. To produce a compiled kernel with slightly better than standard compressio, type the command with and options and arguments to accomplish just the compilation.

Ans: make bzImage

058. You are using X and wish to build a new kernel. What x tool would you use to build the .config file. Type in just the command, not the switches:

Ans : make xconfig

059. Type in the command to compile a kernel image with normal compression :

Ans : make zImage

060. Which of the following is not a valid make command during a kernel recompile ?

A. make dep
B. make clean
C. make xconfig
D. make modules
E. make gzlilo

Ans : E

LPI 102v part_005

041. The command "make config" requires bash.

A. True
B. false

Ans : A

Explanation : The command 'make config' while in /usr/src/linux starts a configure script which asks you many questions. It requires bash, so verify that bash is /bin/bash, /bin/sh, or $BASH.


042. If you need to view per-user space usage on a filesystem, the _____ command can provide that information if the kernel is build to support it.

Ans : du

043. Rate this advice : In order to use the latest kernel, it is necessary to first upgrade to the newest utilities and libraries.

A. True
B. False

Ans : A

Explanation : In order to use the latest kernel, it is first necessary to upgrade to the newest utilities and libraries.


044. What is the name of the Kernel configuration file ? Type just the filename.

Ans : .config

045. GNU Make determines which pieces of a large program need to be recompiled and issues the commands to recompile them when necessary.

A. true
B. false

Ans : A

Explanation : GNU Make is a program that determines which pieces of a large program need to be recompiled and issues the commands to recompile them, when necessary.


046. What does "make bzImage" do as opposed to "make zImage"?

A. make a bz encrypted kernel
B. makes a kernel with a better compression ratio
C. makes a kernel with build in gzip application
D. nothing

Ans : B

047. You have just recompiled a new kernel and rebooted your system with the new kernel. Unfortunately you are getting "Can't locate module" error message. which of the following is most likely to be the source of the problem ?

A. You copied the modules to the worng directory.
B. YOu did not configure modular support into the kernel.
C. You did not run depmod after installing the modules.
D. You did not install the modules

Ans : B

Explanation : If you get two choose - than take D as second answer.


048. When preparing to compile a new kernel, which of the following commands can be used to create the configuration file ?

A. make config
B. make kernel
C. ./configure
D. make kernelconfig
E. [Kernel Source Path]/Configure

Ans : A


049. If your new kernel does not behave normally after a routine kernel upgrade, chances are that you forgot to _____ before compiling the new kernel.

A. make clean
B. make shot
C. make clear
D. make remove

Ans : A

Explanation : If your new kernel does really weird things after a routine kernel upgrade, chances are you forgot to make clean before compiling the new kernel. Symptoms can be anything from your system outright crashing, strange I/O problems, to crummy performance. Make sure you do a make dep, too.


050. Upgrading a kernel involves which of the following tasks (choose all that apply):

A. configuring the desired modules
B. compiling the kernel and modules
C. installing the kernel image
D. conducting a system reboot

Ans : ABCD

Explanation : Upgrading the kernel involves configuring desired modules, compiling the kernel and modules, and finally installing the kernel image. This is followed by a system reboot (with fingers crossed !) to load the new kernel. All of this is documented in the ''README'' file which comes with each kernel package. Further information can be found in the 'Documentation/'' subdirectory. A particularly helpful file there is ''configure.help'' which contains detailed information on the available kernel compile options and modules.

LPI 102v part_004

031. You wish to install the module fat.o into the kernel. Type in the simplest command to do this, assuming there are no dependencies for this module :


Ans : insmod fat

032. What modprobe option will cause inactive kernel modules to be unloaded ?

A. autoclean
B. incative
C. remove
D. timeout
E. holdoff


Ans : A


033. You are using insmod. You do not want to use the default configuration file /etc/ modules.conf. What environment variable should you modify ?

Ans : MODULECONF

Explanation : The environment variable MODULECONF can also be used to select a different configuration file from the default /etc/modules.conf (or /etc/conf.modules (deprecated)). This environment variable will override all the definitions above.


034. You can find out how much memory the kernel is using by taking the total amount of memory in your machine and subtracting from it the amount of :

A. "total mem" in /proc/meminfo
B. "total mem" in /proc/memused
C. "total mem" in /proc/memcurrent
D. Note of the choices

Ans : A

Explanation : You can find out how much memory the kernel is using by taking the total amount of memory in your machine and subtracting from it the amount of 'total mem' in /proc/meminfo or the output of the command 'free'.

035. What command will load groups fo modules into the kernel as needed ?

Ans : modprobe

036. If the module file name is given without directories or extension, insmod will search for the module in some common default directories. what environment variable can be used to override this ?

Ans : MODPATH

Explanation : If the module file name is given without directories or extension, insmod will search for the module in some common default directories. The environment variable MODPATH can be used to override this default. If a module configuration file such as /etc/modules.conf, it will override the paths defined in MODPATH.


037. Which of the following could be used to load kernel modules for a 2.4.x kernel ?

A. vi/proc/modules
B. rmmod
C. kmod
D. depmod

Ans : C


038. Loadable kernel modules can (choose all that apply ) :

A. Save memory
B. ease configuration
C. include filesystems
D. include ethernet card drivers


Ans : ABCD

Explanation : Loadable kernel modules can save memory and ease configuration. The scope of modules has grown to include filesystems, ethernet card drivers, tape drivers, printer drivers, and more.

039. What command would rebuild the ld.so cache file ?

A. ldd
B. ldconfig
C. ld.so.cache -rebuild
D. ld

Ans : B


40. What file should be edited to make the system aware of newly added library files ?

A. /etc/modules.conf
B. /etc/conf.modules
C. /etc/ld.so.conf
D. /etc/ld.so.cache
E. /etc/LD_LIBRARY_PATH.conf

Ans : C

LPI 102v part_003

021. What option of modprobe spectifies the loading of all matching modules instead of stopping after the first successful loading ?

A. -a
B. -f
C. -c
D. -e


Ans : A

Explanation : -a, --all: Load all matching modules instead of stopping after the first successful loading.


022. What option of modprobe allows you to set 'autoclean' on the loaded modules ?

A. -k
B. -d
C. -c
D. -e

Ans : A

Explanation : -k, --autoclean: Set 'autoclean' on loaded modules. Used by the kernel when it calls on modprobe to satisfy a missing feature (supplied as a module). The -q option is implied by -k. These options will automatically be sen to insmod.


023. Modprobe can be used to load (choose all that apply) :

A. a single module
B. a stack of dependent modules
C. all modules that are marked with a specified tag
D. None of the choices

Ans : A, B, C

Explanation : Modprobe is used to load a single module, a stack of dependent modules, or all modules that are marked with a specified tag.

024. Modprobe will automatically load all base modules needed in the modules stack as described by its dependency file. What file is this ?

A. modules.dep
B. modprobe.deb
c. module.dep
D. modep.dep

Ans : A

Explanation : Modprobe will automatically load all base modules needed in a module stack, as described by the dependency file modules.dep. If the loading of one of these modules files, the whole current stack of modules loaded in the current session will be unloaded automatically.


025. Which utility is used to create or update the modules.dep file ? Type the command only.

Ans : depmod


026. Type in the simplest command to list all loaded modules:

Ans : lsmod


027. You wish to get information on a module called msdos.o. Type in the simplest command that would list all information including author and description for the module:


Ans : modinfo msdos


028. You have a module called msdos.o which has a dependancy on fat.o. What single command will load msdos.o and its dependant fat.o module in one command line ?


Ans : modprobe msdos


029. Type in the simplest command, including any switches, to rebuild the modules.dep file after you have made changes to the modules.conf file :

Ans : depmod -a


030. Type in the command to list your current kernel version, including any switches

Ans : uname -a

Explanation : uname -a or uname -r

LPI 102v part_002

011. Which of the following commands installs a loadable module in the running kernal?

A. insmod
B. depmod
C. modprobe
C. setmod


Ans : A

Explanation: insmod installs of loadable module in the running kernel. It tries to link a module into the running kernel by resolving all symbols from the kernel's exported symbol table.


012. insmod tries to link to module into the running kernel by resolving all symbols obtained from:

A. the kernel's exported symbol table.
B. the kernel's internal pointer base.
c. the user command argument list.
D. note of the choices.

Ans : A

Explanation: insmod installs a loadable module in the running kernel. It tries to link a module into the running kernel by resolving all symbols from the kernel's exported symbol.



013. With insmod, the paths listed in /etc/modules.conf override the paths defined in MODPATH.

A. true
B. false

Ans : A

Explanation: If the module file name is given without directories or extension, insmod will search for the module in some common default directories. The environment variable MODPATH can be used to override this default. If a module configuration file such as /etc/modules.conf exits, it will override the paths defined in MODPATH.


014. Lsmod shows information about :

A. all loaded modules
B. all non-updatable modules
C. All updatable modules
D. all unloaded modules

Ans : A

Explanation: Lsmod shows information about all loaded modules. The format is name, size, use count, list of referring modules. The information displayed is identical to that available from /proc/modules.



015. Lsmod shows infromation in which of the following formats ?

A. name, size, use count, list of referring modules
B. name, use count, list of referring modules, size
C. name, size, list of referring modules, use count
D. none of the choices

Ans : A

Explanation : Lsmod shows information about all loaded modules. The format in name, size, use count, list of referring modules. The information displayed is identical to that available from /proc/modules.


016. The information displayed by lsmod is identical to that available from :

A. /proc/modules
B. /proc/depemod
C. /proc/ls
D. /proc/lsmod

Ans: A

Explanation : Lsmod shows infromation about all loaded modules. The format is name, size, use count, list of referring modules. The information displayed is identical to that available from /proc/modules.


017. What command should you use to unload loadable modules from the running kernel ?

A. rmmod
B. remove -mod
C. delmod
D. unload module

Ans : A

Explanation : rmmod unloads loadable modules from the running kernel. rmmod tries to unload a set of modules from the kernel, with the restriction that they are not in use and that they are not referred to by other modules. If more than one module is named on the command line, the modules will be removed simultansously. This supports unloading of stacked modules.

018. What command option of rmmod specifies that all outputs be sent to syslog?

A. -a
B. -i
C. -s
D. -d

Ans : C

Explanation : Rmmod unloads loadable modules from the running kernel. -s: Outpu everything to syslog(3) instead of the terminal.

019. What utility examines the object file module_file associated with a kernel module and displays any information that it can glean ?

A. modinfo
B. modprobe
C. insmod
D. depmod

Ans : A

Explanation : The modinfo utility examines the object file module_file associated with a kernel module and displays any information that it can glean.

020. What command option of modinfo can display its version number ?

A. -V
B. -i
C. -I
D. -A

Ans: A

Explanation : The modinfo utility examines the object file module_file associated with a kernel module and displays any information that it can glean. -V, --version : Display the version of modinfo.

LPI 102v part_001

001. What command would load the module msdos.o and all its dependancies ?

A. modifo -a msdos
B. lsmod -a msdos
C. modprobe msdos
D. insmod -d msdos

Ans: C

002. What command will unload a kernel module ?

A. rmmod
B. unmod
C. delmod
D. modprobe
E. unloadmod

Ans : A

003. The ______ command will list the currently loaded kernel modules.

Ans : lsmod


004. You wish to remove a module from the kernel called fat. Assume this module has no dependancies. Type in the simplest command to do this :


Ans : rmmod fat


005. You have just added new modules to you system. What command would you execute to rebuild the modules.dep file ?

A. depmod --rebuild
B. update-dependancies
C. depmod -a
D. insmod -dependancies

Ans : C

006. Which of the following correctly describe the relationship between depmod and modprobe ?

A. depmod creates a dependency file for use by modprobe
B. modprobe create a dependency file for use by depmod
C. they have no relationship
D. they can replace each other


Ans : A

Explanation : Depmod creates a "Makefile" -like dependency file, based on the symbols it fineds in the set of modules mentioned on the command line or from the directories specified in the configuration file. This dependency file is late used by modprobe to automatically load the correct module or stack of modules.


007. The normal use of depmod is to include which of the following lines in one of the files in /etc/rc.d so the correct module dependencies will be available after booting the system ?

A. /sbin/depmod -a
B. /sbin/depmod -p
C. /sbin/depmod -r
D. /sbin/depmod -c

Ans: A

Explanation : depmod creates a dependency file for the modules given on the command line. This dependency file can be used by modprobe to automatically load the relevant modules. The normal use of depmod is to include the line /sbin/depmod -a in one of the files in /etc/rc.d so the correct module dependencies will be available after booting the system.


008. What command option of depmod allows you to print a list of all unresolved symbols ?

A. -e
B. -l
C. -i
D. -a

Ans: A

Explanation : depmod creates a dependency file for the modules given on the command line. -e : print a list of all unresolved sysmbols.


009. Which of the following commands loads the module file into the kernel and changes any symbols that are defined on the command line ?

A. insmod
B. depmod
C. modprobe
D. setmod

Ans : A


010. What option of the insmod command can you use to force the loading of module even if problems are encountered?

A. -f
B. -F
C. -u
d. -r

Ans : A