Table of Contents
Here, I describe basic tips to configure and manage systems, mostly from the console.
screen(1) is a very useful tool for people to access remote sites via unreliable or intermittent connections since it support interrupted network connections.
Table 9.1. List of programs to support interrupted network connections
package | popcon | size | description |
---|---|---|---|
screen
|
http://qa.debian.org/popcon.php?package=screen | 952 | terminal multiplexer with VT100/ANSI terminal emulation |
screen(1) not only allows one terminal window to work with multiple processes, but also allows remote shell process to survive interrupted connections. Here is a typical use scenario of screen(1).
You login to a remote machine.
You start screen
on a single console.
You execute multiple programs in screen
windows created with ^A c
("Control-A" followed by "c").
You switch among the multiple screen
windows by ^A n
("Control-A" followed by "n").
Suddenly you need to leave your terminal, but you don't want to lose your active work by keeping the connection.
You may detach the screen
session by any methods.
Brutally unplug your network connection
Type ^A d
("Control-A" followed by "d") and manually logging out from the remote connection
Type ^A DD
("Control-A" followed by "DD") to have screen
detach and log you out
You log in again to the same remote machine (even from a different terminal).
You start screen
as "screen -r
".
screen
magically reattaches all previous screen
windows with all actively running programs.
Tip | |
---|---|
You can save connection fees with |
In a screen
session, all keyboard inputs are sent to your current window except for the command keystroke. All screen
command keystrokes are entered by typing ^A
("Control-A") plus a single key [plus any parameters]. Here are important ones to remember.
Table 9.2. List of key bindings for screen
key binding | meaning |
---|---|
^A ?
|
show a help screen (display key bindings) |
^A c
|
create a new window and switch to it |
^A n
|
go to next window |
^A p
|
go to previous window |
^A 0
|
go to window number 0 |
^A 1
|
go to window number 1 |
^A w
|
show a list of windows |
^A a
|
send a Ctrl-A to current window as keyboard input |
^A h
|
write a hardcopy of current window to file |
^A H
|
begin/end logging current window to file |
^A ^X
|
lock the terminal (password protected) |
^A d
|
detach screen session from the terminal |
^A DD
|
detach screen session and log out |
See screen(1) for details.
Many programs record their activities under the "/var/log/
" directory.
The kernel log daemon: klogd(8)
The system log daemon: rsyslogd(8)
See Section 3.5.9, “The system message” and Section 3.5.10, “The kernel message”.
Here are notable log analyzers ("~Gsecurity::log-analyzer
" in aptitude(8)).
Table 9.3. List of system log analyzers
Note | |
---|---|
CRM114 provides language infrastructure to write fuzzy filters with the TRE regex library. Its popular use is spam mail filter but it can be used as log analyzer. |
The simple use of script(1) (see Section 1.4.9, “Recording the shell activities”) to record shell activity produces a file with control characters. This can be avoided by using col(1) as the following.
$ script Script started, file is typescript
Do whatever … and press Ctrl-D
to exit script
.
$ col -bx <typescript >cleanedfile $ vim cleanedfile
If you don't have script
(for example, during the boot process in the initramfs), you can use following instead.
$ sh -i 2>&1 | tee typescript
Tip | |
---|---|
Some |
Tip | |
---|---|
You may use screen(1) with " |
Tip | |
---|---|
You may use emacs(1) with " |
Although pager tools such as more(1) and less(1) (see Section 1.4.5, “The pager”) and custom tools for highlighting and formatting (see Section 11.1.8, “Highlighting and formatting plain text data”) can display text data nicely, general purpose editors (see Section 1.4.6, “The text editor”) are most versatile and customizable.
Tip | |
---|---|
For vim(1) and its pager mode alias view(1), " |
The default display format of time and date by the "ls -l
" command depends on the locale (see Section 1.2.6, “Timestamps” for value). The "$LANG
" variable is referred first and it can be overridden by the "$LC_TIME
" variable.
The actual default display format for each locale depends on the version of the standard C library (the libc6
package) used. I.e., different releases of Debian had different defaults.
If you really wish to customize this display format of time and date beyond the locale, you should set the time style value by the "--time-style
" argument or by the "$TIME_STYLE
" value (see ls(1), date(1), "info coreutils 'ls invocation'
").
Table 9.4. Display examples of time and date for the "ls -l
" command for lenny
time style value | locale | display of time and date |
---|---|---|
iso
|
any |
01-19 00:15
|
long-iso
|
any |
2009-01-19 00:15
|
full-iso
|
any |
2009-01-19 00:15:16.000000000 +0900
|
locale
|
C
|
Jan 19 00:15
|
locale
|
en_US.UTF-8
|
2009-01-19 00:15
|
locale
|
es_ES.UTF-8
|
ene 19 00:15
|
+%d.%m.%y %H:%M
|
any |
19.01.09 00:15
|
+%d.%b.%y %H:%M
|
C or en_US.UTF-8
|
19.Jan.09 00:15
|
+%d.%b.%y %H:%M
|
es_ES.UTF-8
|
19.ene.09 00:15
|
Tip | |
---|---|
You can eliminate typing long option on commandline using command alias, e.g. " |
Tip | |
---|---|
ISO 8601 is followed for these iso-formats. |
Shell echo to most modern terminals can be colorized using ANSI escape code (see "/usr/share/doc/xterm/ctlseqs.txt.gz
").
For example, try the following
$ RED=$(printf "\x1b[31m") $ NORMAL=$(printf "\x1b[0m") $ REVERSE=$(printf "\x1b[7m") $ echo "${RED}RED-TEXT${NORMAL} ${REVERSE}REVERSE-TEXT${NORMAL}"
Colorized commands are handy for inspecting their output in the interactive environment. I include the following in my "~/.bashrc
".
if [ "$TERM" != "dumb" ]; then eval "`dircolors -b`" alias ls='ls --color=always' alias ll='ls --color=always -l' alias la='ls --color=always -A' alias less='less -R' alias ls='ls --color=always' alias grep='grep --color=always' alias egrep='egrep --color=always' alias fgrep='fgrep --color=always' alias zgrep='zgrep --color=always' else alias ll='ls -l' alias la='ls -A' fi
The use of alias limits color effects to the interactive command usage. It has advantage over exporting environment variable "export GREP_OPTIONS='--color=auto'
" since color can be seen under pager programs such as less(1). If you wish to suppress color when piping to other programs, use "--color=auto
" instead in the above example for "~/.bashrc
".
Tip | |
---|---|
You can turn off these colorizing aliases in the interactive environment by invoking shell with " |
You can record the editor activities for complex repeats.
For Vim, as follows.
"qa
": start recording typed characters into named register "a
".
… editor activities
"q
": end recording typed characters.
"@a
": execute the contents of register "a
".
For Emacs, as follows.
"C-x (
": start defining a keyboard macro.
… editor activities
"C-x )
": end defining a keyboard macro.
"C-x e
": execute a keyboard macro.
There are few ways to record the graphic image of an X application, including an xterm
display.
Table 9.5. List of graphic image manipulation tools
package | popcon | size | command |
---|---|---|---|
xbase-clients
|
http://qa.debian.org/popcon.php?package=xbase-clients | 61 | xwd(1) |
gimp
|
http://qa.debian.org/popcon.php?package=gimp | 15168 | GUI menu |
imagemagick
|
http://qa.debian.org/popcon.php?package=imagemagick | 207 | import(1) |
scrot
|
http://qa.debian.org/popcon.php?package=scrot | 80 | scrot(1) |
There are specialized tools to record changes in configuration files with help of DVCS system.
Table 9.6. List of packages to record configuration history in VCS
package | popcon | size | description |
---|---|---|---|
etckeeper
|
http://qa.debian.org/popcon.php?package=etckeeper | 242 | store configuration files and their metadata with Git (default), Mercurial, or Bazaar (new) |
changetrack
|
http://qa.debian.org/popcon.php?package=changetrack | 148 | store configuration files with RCS (old) |
I recommend to use the etckeeper
package with git(1) which put entire "/etc
" under VCS control. Its installation guide and tutorial are found in "/usr/share/doc/etckeeper/README.gz
".
Essentially, running "sudo etckeeper init
" initializes the git repository for "/etc
" just like the process explained in Section 10.9.5, “Git for recording configuration history” but with special hook scripts for more thorough setups.
As you change your configuration, you can use git(1) normally to record them. It automatically records changes nicely every time you run package management commands, too.
Tip | |
---|---|
You can browse the change history of " |
Booting your system with Linux live CDs or debian-installer CDs in rescue mode make it easy for you to reconfigure data storage on your boot device. See also Section 10.3, “The binary data”.
The disk space usage can be evaluated by programs provided by the mount
, coreutils
, and xdu
packages:
mount(8) reports all mounted filesystems (= disks).
df(1) reports the disk space usage for the file system.
du(1) reports the disk space usage for the directory tree.
Tip | |
---|---|
You can feed the output of du(8) to xdu(1x) to produce its graphical and interactive presentation with " |
For disk partition configuration, although fdisk(8) has been considered standard, parted(8) deserves some attention. "Disk partitioning data", "partition table", "partition map", and "disk label" are all synonyms.
Most PCs use the classic Master Boot Record (MBR) scheme to hold disk partitioning data in the first sector, i.e., LBA sector 0 (512 bytes).
Note | |
---|---|
Some new PCs with Extensible Firmware Interface (EFI), including Intel-based Macs, use GUID Partition Table (GPT) scheme to hold disk partitioning data not in the first sector. |
Although fdisk(8) has been standard for the disk partitioning tool, parted(8) is replacing it.
Table 9.7. List of disk partition management packages
package | popcon | size | GPT | description |
---|---|---|---|---|
util-linux
|
http://qa.debian.org/popcon.php?package=util-linux | 1593 | Not supported | miscellaneous system utilities including fdisk(8) and cfdisk(8) |
parted
|
http://qa.debian.org/popcon.php?package=parted | 262 | Supported | GNU Parted disk partition resizing program |
gparted
|
http://qa.debian.org/popcon.php?package=gparted | 5074 | Supported |
GNOME partition editor based on libparted
|
gnu-fdisk
|
http://qa.debian.org/popcon.php?package=gnu-fdisk | 215 | Supported | GNU replacements of console fdisk(8), cfdisk(8), etc. |
gdisk
|
http://qa.debian.org/popcon.php?package=gdisk | 636 | Supported | partition editor for the GPT disk |
gptsync
|
http://qa.debian.org/popcon.php?package=gptsync | 72 | Supported | synchronize classic MBR partition table with the GPT one |
kpartx
|
http://qa.debian.org/popcon.php?package=kpartx | 104 | Supported | program to create device mappings for partitions |
Caution | |
---|---|
Although parted(8) claims to create and to resize filesystem too, it is safer to do such things using best maintained specialized tools such as mkfs(8) (mkfs.msdos(8), mkfs.ext2(8), mkfs.ext3(8), …) and resize2fs(8). |
Note | |
---|---|
In order to switch between GPT and MBR, you need to erase first few blocks of disk contents directly (see Section 10.3.6, “Clearing file contents”) and use " |
Although reconfiguration of your partition or activation order of removable storage media may yield different names for partitions, you can access them consistently. This is also helpful if you have multiple disks and your BIOS doesn't give them consistent device names.
mount(8) with "-U
" option can mount a block device using UUID, instead of using its file name such as "/dev/sda3
".
"/etc/fstab
" (see fstab(5)) can use UUID.
Boot loaders (Section 3.3, “Stage 2: the boot loader”) may use UUID too.
Tip | |
---|---|
You can probe UUID of a block special device with blkid(8). |
Tip | |
---|---|
Device nodes of devices such as removable storage media can be made static by using udev rules, if needed. See Section 3.5.11, “The udev system”. |
For ext3 filesystem, the e2fsprogs
package provides the following.
The mkfs(8) and fsck(8) commands are provided by the e2fsprogs
package as front-ends to various filesystem dependent programs (mkfs.fstype
and fsck.fstype
). For ext3 filesystem, they are mkfs.ext3(8) and fsck.ext3(8) (they are hardlinked to mke2fs(8) and e2fsck(8)).
Similar commands are available for each filesystem supported by Linux.
Table 9.8. List of filesystem management packages
Tip | |
---|---|
Ext4 filesystem is the default filesystem for the Linux system and strongly recommended to use it unless you have some specific reasons not to. |
Tip | |
---|---|
Btrfs filesystem is available in Linux kernel 3.2 (Debian |
Warning | |
---|---|
You should not use the Btrfs filesystem for your critical data yet before it aquires the live kernel space fsck(8) feature and the boot loader support. |
Tip | |
---|---|
Some tools allow access to filesystem without Linux kernel support (see Section 10.3.2, “Manipulating files without mounting disk”). |
The mkfs(8) command creates the filesystem on a Linux system. The fsck(8) command provides the filesystem integrity check and repair on a Linux system.
Caution | |
---|---|
It is generally not safe to run |
Tip | |
---|---|
Check files in " |
Tip | |
---|---|
Use " |
Performance and characteristics of a filesystem can be optimized by mount options used on it (see fstab(5) and mount(8)). Notable ones are the following.
"defaults
" option implies default options: "rw,suid,dev,exec,auto,nouser,async
". (general)
"noatime
" or "relatime
" option is very effective for speeding up the read access. (general)
"user
" option allows an ordinary user to mount the filesystem. This option implies "noexec,nosuid,nodev
" option combination. (general, used for CD and floppy)
"noexec,nodev,nosuid
" option combination is used to enhance security. (general)
"noauto
" option limits mounting by explicit operation only. (general)
"data=journal
" option for ext3fs can enhance data integrity against power failure with some loss of write speed.
Tip | |
---|---|
You need to provide kernel boot parameter (see Section 3.3, “Stage 2: the boot loader”), e.g. " |
Characteristics of a filesystem can be optimized via its superblock using the tune2fs(8) command.
Execution of "sudo tune2fs -l /dev/hda1
" displays the contents of the filesystem superblock on "/dev/hda1
".
Execution of "sudo tune2fs -c 50 /dev/hda1
" changes frequency of filesystem checks (fsck
execution during boot-up) to every 50 boots on "/dev/hda1
".
Execution of "sudo tune2fs -j /dev/hda1
" adds journaling capability to the filesystem, i.e. filesystem conversion from ext2 to ext3 on "/dev/hda1
". (Do this on the unmounted filesystem.)
Execution of "sudo tune2fs -O extents,uninit_bg,dir_index /dev/hda1 && fsck -pf /dev/hda1
" converts it from ext3 to ext4 on "/dev/hda1
". (Do this on the unmounted filesystem.)
Warning | |
---|---|
Filesystem conversion for the boot device to the ext4 filesystem should be avoided until GRUB boot loader supports the ext4 filesystem well and installed Linux Kernel version is newer than 2.6.30. |
Warning | |
---|---|
Please check your hardware and read manpage of hdparam(8) before playing with hard disk configuration because this may be quite dangerous for the data integrity. |
You can test disk access speed of a hard disk, e.g. "/dev/hda
", by "hdparm -tT /dev/hda
". For some hard disk connected with (E)IDE, you can speed it up with "hdparm -q -c3 -d1 -u1 -m16 /dev/hda
" by enabling the "(E)IDE 32-bit I/O support", enabling the "using_dma flag", setting "interrupt-unmask flag", and setting the "multiple 16 sector I/O" (dangerous!).
You can test write cache feature of a hard disk, e.g. "/dev/sda
", by "hdparm -W /dev/sda
". You can disable its write cache feature with "hdparm -W 0 /dev/sda
".
You may be able to read badly pressed CDROMs on modern high speed CD-ROM drive by slowing it down with "setcd -x 2
".
Performance and disk wear of the solid state drive (SSD) can be optimized as follows.
Use the latest Linux kernel. (>= 3.2)
Reduce disk writes for read disk accesses.
Set "noatime
" or "relatime
" mount option in /etc/fstab
.
Enable the TRIM command.
Enable the SSD optimized disk space allocation scheme.
Set "ssd
" mount option in /etc/fstab
for the Btrfs.
Make system flush data to the disk every 10 minutes for laptop PCs.
Set "commit=600
" mount option in /etc/fstab
. See fstab(5).
Set pm-utils to use laptop-mode even under AC operation. See Debian BTS #659260.
Warning | |
---|---|
Changing flushing interval from normal 5 seconds to 10 minutes makes your data venerable to the power failure. |
You can monitor and log your hard disk which is compliant to SMART with the smartd(8) daemon.
Install the smartmontools
package.
Identify your hard disk drives by listing them with df(1).
Let's assume a hard disk drive to be monitored as "/dev/hda
".
Check the output of "smartctl -a /dev/hda
" to see if SMART feature is actually enabled.
If not, enable it by "smartctl -s on -a /dev/hda
".
Enable smartd(8) daemon to run by the following.
uncomment "start_smartd=yes
" in the "/etc/default/smartmontools
" file.
restart the smartd(8) daemon by "sudo /etc/init.d/smartmontools restart
".
Tip | |
---|---|
The smartd(8) daemon can be customized with the |
For partitions created on Logical Volume Manager (LVM) (Linux feature) at install time, they can be resized easily by concatenating extents onto them or truncating extents from them over multiple storage devices without major system reconfiguration.
Caution | |
---|---|
Deployment of the current LVM system may degrade guarantee against filesystem corruption offered by journaled filesystems such as ext3fs unless their system performance is sacrificed by disabling write cache of hard disk. |
If you have an empty partition (e.g., "/dev/sdx
"), you can format it with mkfs.ext3(1) and mount(8) it to a directory where you need more space. (You need to copy original data contents.)
$ sudo mv work-dir old-dir $ sudo mkfs.ext3 /dev/sdx $ sudo mount -t ext3 /dev/sdx work-dir $ sudo cp -a old-dir/* work-dir $ sudo rm -rf old-dir
Tip | |
---|---|
You may alternatively mount an empty disk image file (see Section 10.2.5, “Making the empty disk image file”) as a loop device (see Section 10.2.3, “Mounting the disk image file”). The actual disk usage grows with the actual data stored. |
If you have an empty directory (e.g., "/path/to/emp-dir
") on another partition with usable space, you can mount(8) it with "--bind
" option to a directory (e.g., "work-dir
") where you need more space.
$ sudo mount --bind /path/to/emp-dir work-dir
Tip | |
---|---|
This is a deprecated method. Use Section 9.3.13, “Expansion of usable storage space by bind-mounting another directory” instead, if possible. |
If you have an empty directory (e.g., "/path/to/emp-dir
") in another partition with usable space, you can create a symlink to the directory with ln(8).
$ sudo mv work-dir old-dir $ sudo mkdir -p /path/to/emp-dir $ sudo ln -sf /path/to/emp-dir work-dir $ sudo cp -a old-dir/* work-dir $ sudo rm -rf old-dir
Warning | |
---|---|
Do not use "symlink to a directory" for directories managed by the system such as " |
Caution | |
---|---|
Some software may not function well with "symlink to a directory". |
If you have usable space in another partition (e.g., "/path/to/
"), you can create a directory in it and stack that on to a directory where you need space with aufs.
$ sudo mv work-dir old-dir $ sudo mkdir work-dir $ sudo mkdir -p /path/to/emp-dir $ sudo mount -t aufs -o br:/path/to/emp-dir:old-dir none work-dir
Caution | |
---|---|
Use of aufs for long term data storage is not good idea since it is under development and its design change may introduce issues. |
With physical access to your PC, anyone can easily gain root privilege and access all the files on your PC (see Section 4.7.4, “Securing the root password”). This means that login password system can not secure your private and sensitive data against possible theft of your PC. You must deploy data encryption technology to do it. Although GNU privacy guard (see Section 10.4, “Data security infrastructure”) can encrypt files, it takes some user efforts.
dm-crypt and eCryptfs facilitates automatic data encryption natively via Linux kernel modules with minimal user efforts.
Table 9.9. List of data encryption utilities
package | popcon | size | description |
---|---|---|---|
cryptsetup
|
http://qa.debian.org/popcon.php?package=cryptsetup | 648 | utilities for encrypted block device (dm-crypt / LUKS) |
cryptmount
|
http://qa.debian.org/popcon.php?package=cryptmount | 341 | utilities for encrypted block device (dm-crypt / LUKS) with focus on mount/unmount by normal users |
ecryptfs-utils
|
http://qa.debian.org/popcon.php?package=ecryptfs-utils | 368 | utilities for encrypted stacked filesystem (eCryptfs) |
Dm-crypt is a cryptographic filesystem using device-mapper. Device-mapper maps one block device to another.
eCryptfs is another cryptographic filesystem using stacked filesystem. Stacked filesystem stacks itself on top of an existing directory of a mounted filesystem.
Caution | |
---|---|
Data encryption costs CPU time etc. Please weigh its benefits and costs. |
Note | |
---|---|
Entire Debian system can be installed on a encrypted disk by the debian-installer (lenny or newer) using dm-crypt/LUKS and initramfs. |
Tip | |
---|---|
See Section 10.4, “Data security infrastructure” for user space encryption utility: GNU Privacy Guard. |
You can encrypt contents of removable mass devices, e.g. USB memory stick on "/dev/sdx
", using dm-crypt/LUKS. You simply formatting it as the following.
# badblocks -c 1024 -s -w -t random -v /dev/sdx # fdisk /dev/sdx ... "n" "p" "1" "return" "return" "w" # cryptsetup luksFormat /dev/sdx1 ... # cryptsetup luksOpen /dev/sdx1 sdx1 ... # ls -l /dev/mapper/ total 0 crw-rw---- 1 root root 10, 60 2008-10-04 18:44 control brw-rw---- 1 root disk 254, 0 2008-10-04 23:55 sdx1 # mkfs.vfat /dev/mapper/sdx1 ... # cryptsetup luksClose sdx1
Then, it can be mounted just like normal one on to "/media/<disk_label>
", except for asking password (see Section 10.1.10, “Removable storage device”) under modern desktop environment, such as GNOME using gnome-mount(1). The difference is that every data written to it is encrypted. You may alternatively format media in different file format, e.g., ext3 with "mkfs.ext3 /dev/sdx1
".
Note | |
---|---|
If you are really paranoid for the security of data, you may need to overwrite multiple times in the above example. This operation is very time consuming though. |
Let's assume that your original "/etc/fstab
" contains the following.
/dev/sda7 swap sw 0 0
You can enable encrypted swap partition using dm-crypt by as the following.
# aptitude install cryptsetup # swapoff -a # echo "cswap /dev/sda7 /dev/urandom swap" >> /etc/crypttab # perl -i -p -e "s/\/dev\/sda7/\/dev\/mapper\/cswap/" /etc/fstab # /etc/init.d/cryptdisks restart ... # swapon -a
You can encrypt files written under "~/Private/
" automatically using eCryptfs and the ecryptfs-utils
package.
Run ecryptfs-setup-private(1) and set up "~/Private/
" by following prompts.
Activate "~/Private/
" by running ecryptfs-mount-private(1).
Move sensitive data files to "~/Private/
" and make symlinks as needed.
Candidates: "~/.fetchmailrc
", "~/.ssh/identity
", "~/.ssh/id_rsa
", "~/.ssh/id_dsa
" and other files with "go-rwx
"
Move sensitive data directories to a subdirectory in "~/Private/
" and make symlinks as needed.
Candidates: "~/.gnupg
" and other directories with "go-rwx
"
Create symlink from "~/Desktop/Private/
" to "~/Private/
" for easier desktop operations.
Deactivate "~/Private/
" by running ecryptfs-umount-private(1).
Activate "~/Private/
" by issuing "ecryptfs-mount-private
" as you need encrypted data.
If you use your login password for wrapping encryption keys, you can automate mounting eCryptfs via PAM (Pluggable Authentication Modules).
Insert the following line just before "pam_permit.so
" in "/etc/pam.d/common-auth
".
auth required pam_ecryptfs.so unwrap
Insert the following line just at the last line in "/etc/pam.d/common-session
".
session optional pam_ecryptfs.so unwrap
Insert the following line at first active line in "/etc/pam.d/common-password
".
password required pam_ecryptfs.so
This is quite convenient.
Warning | |
---|---|
Configuration errors of PAM may lock you out of your own system. See Chapter 4, Authentication. |
Caution | |
---|---|
If you use your login password for wrapping encryption keys, your encrypted data are as secure as your user login password (see Section 4.3, “Good password”). Unless you are careful to set up a strong password, your data is at risk when someone runs password cracking software after stealing your laptop (see Section 4.7.4, “Securing the root password”). |
Program activities can be monitored and controlled using specialized tools.
Table 9.10. List of tools for monitoring and controlling program activities
package | popcon | size | description |
---|---|---|---|
coreutils
|
http://qa.debian.org/popcon.php?package=coreutils | 14088 | nice(1): run a program with modified scheduling priority |
bsdutils
|
http://qa.debian.org/popcon.php?package=bsdutils | 187 | renice(1): modify the scheduling priority of a running process |
procps
|
http://qa.debian.org/popcon.php?package=procps | 593 |
"/proc " filesystem utilities: ps(1), top(1), kill(1), watch(1), …
|
psmisc
|
http://qa.debian.org/popcon.php?package=psmisc | 602 |
"/proc " filesystem utilities: killall(1), fuser(1), peekfd(1), pstree(1)
|
time
|
http://qa.debian.org/popcon.php?package=time | 152 | time(1): run a program to report system resource usages with respect to time |
sysstat
|
http://qa.debian.org/popcon.php?package=sysstat | 962 | sar(1), iostat(1), mpstat(1), …: system performance tools for Linux |
isag
|
http://qa.debian.org/popcon.php?package=isag | 126 | Interactive System Activity Grapher for sysstat |
lsof
|
http://qa.debian.org/popcon.php?package=lsof | 420 |
lsof(8): list open files by a running process using "-p " option
|
strace
|
http://qa.debian.org/popcon.php?package=strace | 404 | strace(1): trace system calls and signals |
ltrace
|
http://qa.debian.org/popcon.php?package=ltrace | 188 | ltrace(1): trace library calls |
xtrace
|
http://qa.debian.org/popcon.php?package=xtrace | 336 | xtrace(1): trace communication between X11 client and server |
powertop
|
http://qa.debian.org/popcon.php?package=powertop | 380 | powertop(1): information about system power use on Intel-based laptops |
cron
|
http://qa.debian.org/popcon.php?package=cron | 195 | run processes according to a schedule in background from cron(8) daemon |
anacron
|
http://qa.debian.org/popcon.php?package=anacron | 159 | cron-like command scheduler for systems that don't run 24 hours a day |
at
|
http://qa.debian.org/popcon.php?package=at | 140 | at(1) or batch(1): run a job at a specified time or below certain load level |
Tip | |
---|---|
The |
Display time used by the process invoked by the command.
# time some_command >/dev/null real 0m0.035s # time on wall clock (elapsed real time) user 0m0.000s # time in user mode sys 0m0.020s # time in kernel mode
A nice value is used to control the scheduling priority for the process.
Table 9.11. List of nice values for the scheduling priority
nice value | scheduling priority |
---|---|
19 | lowest priority process (nice) |
0 | very high priority process for user |
-20 | very high priority process for root (not-nice) |
# nice -19 top # very nice # nice --20 wodim -v -eject speed=2 dev=0,0 disk.img # very fast
Sometimes an extreme nice value does more harm than good to the system. Use this command carefully.
The ps(1) command on the Debian support both BSD and SystemV features and helps to identify the process activity statically.
Table 9.12. List of ps command styles
style | typical command | feature |
---|---|---|
BSD |
ps aux
|
display %CPU %MEM |
System V |
ps -efH
|
display PPID |
For the zombie (defunct) children process, you can kill them by the parent process ID identified in the "PPID
" field.
The pstree(1) command display a tree of processes.
top(1) on the Debian has rich features and helps to identify what process is acting funny dynamically.
Table 9.13. List of commands for top
command key | description of response |
---|---|
h or ?
|
show help |
f
|
set/reset display field |
o
|
reorder display field |
F
|
set sort key field |
k
|
kill a process |
r
|
renice a process |
q
|
quit the top command
|
You can list all files opened by a process with a process ID (PID), e.g. 1, by the following.
$ sudo lsof -p 1
PID=1 is usually init
program.
You can trace program activity with strace(1), ltrace(1), or xtrace(1) for system calls and signals, library calls, or communication between X11 client and server.
You can trace system calls of the ls
command as the following.
$ sudo strace ls
You can also identify processes using files by fuser(1), e.g. for "/var/log/mail.log
" by the following.
$ sudo fuser -v /var/log/mail.log USER PID ACCESS COMMAND /var/log/mail.log: root 2946 F.... rsyslogd
You see that file "/var/log/mail.log
" is open for writing by the rsyslogd(8) command.
You can also identify processes using sockets by fuser(1), e.g. for "smtp/tcp
" by the following.
$ sudo fuser -v smtp/tcp USER PID ACCESS COMMAND smtp/tcp: Debian-exim 3379 F.... exim4
Now you know your system runs exim4(8) to handle TCP connections to SMTP port (25).
watch(1) executes a program repeatedly with a constant interval while showing its output in fullscreen.
$ watch w
This displays who is logged on to the system updated every 2 seconds.
There are several ways to repeat a command looping over files matching some condition, e.g. matching glob pattern "*.ext
".
Shell for-loop method (see Section 12.1.4, “Shell loops”):
for x in *.ext; do if [ -f "$x"]; then command "$x" ; fi; done
find(1) and xargs(1) combination:
find . -type f -maxdepth 1 -name '*.ext' -print0 | xargs -0 -n 1 command
find(1) with "-exec
" option with a command:
find . -type f -maxdepth 1 -name '*.ext' -exec command '{}' \;
find(1) with "-exec
" option with a short shell script:
find . -type f -maxdepth 1 -name '*.ext' -exec sh -c "command '{}' && echo 'successful'" \;
The above examples are written to ensure proper handling of funny file names such as ones containing spaces. See Section 10.1.5, “Idioms for the selection of files” for more advance uses of find(1).
You can set up to start a process from graphical user interface (GUI).
Under GNOME desktop environment, a program can be started with proper argument by double-clicking the launcher icon, by drag-and-drop of a file icon to the launcher icon, or by "Open with …" menu via right clicking a file icon. KDE can do the equivalent, too.
Here is an example under GNOME to create a launcher icon for mc(1) started in gnome-terminal(1).
Create an executable program "mc-term
" by the following.
# cat >/usr/local/bin/mc-term <<EOF #!/bin/sh gnome-terminal -e "mc \$1" EOF # chmod 755 /usr/local/bin/mc-term
Create a desktop launcher as the following.
Right click desktop space to select "Create Launcher …
".
Set "Type" to "Application
".
Set "Name" to "mc
".
Set "Command" to "mc-term %f
".
Click "OK".
Create an open-with association as as the following.
Right click folder to select "Open with Other Application …
".
Click open "Use a custom command" dialog and enter "mc-term %f
".
Click "Open".
Tip | |
---|---|
Launcher is a file at " |
Some programs start another program automatically. Here are check points for customizing this process.
Application configuration menu:
GNOME desktop: "System" → "Preferences" → "Preferred Application"
KDE desktop: "K" → "Control Center" → "KDE Components" → "Component Chooser"
Iceweasle browser: "Edit" → "Preferences" → "Applications"
mc(1): "/etc/mc/mc.ext
"
Environment variables such as "$BROWSER
", "$EDITOR
", "$VISUAL
", and "$PAGER
" (see eviron(7))
The update-alternatives(8) system for programs such as "editor
", "view
", "x-www-browser
", "gnome-www-browser
", and "www-browser
" (see Section 1.4.7, “Setting a default text editor”)
the "~/.mailcap
" and "/etc/mailcap
" file contents which associate MIME type with program (see mailcap(5))
The "~/.mime.types
" and "/etc/mime.types
" file contents which associate file name extension with MIME type (see run-mailcap(1))
Tip | |
---|---|
update-mime(8) updates the " |
Tip | |
---|---|
The |
Tip | |
---|---|
In order to run a console application such as |
# cat /usr/local/bin/mutt-term <<EOF #!/bin/sh gnome-terminal -e "mutt \$@" EOF chmod 755 /usr/local/bin/mutt-term
Use kill(1) to kill (or send a signal to) a process by the process ID.
Use killall(1) or pkill(1) to do the same by the process command name and other attributes.
Table 9.14. List of frequently used signals for kill command
signal value | signal name | function |
---|---|---|
1 | HUP | restart daemon |
15 | TERM | normal kill |
9 | KILL | kill hard |
Run the at(1) command to schedule a one-time job by the following.
$ echo 'command -args'| at 3:40 monday
Use cron(8) to schedule tasks regularly. See crontab(1) and crontab(5).
You can schedule to run processes as a normal user, e.g. foo
by creating a crontab(5) file as "/var/spool/cron/crontabs/foo
" with "crontab -e
" command.
Here is an example of a crontab(5) file.
# use /bin/sh to run commands, no matter what /etc/passwd says SHELL=/bin/sh # mail any output to paul, no matter whose crontab this is MAILTO=paul # Min Hour DayOfMonth Month DayOfWeek command (Day... are OR'ed) # run at 00:05, every day 5 0 * * * $HOME/bin/daily.job >> $HOME/tmp/out 2>&1 # run at 14:15 on the first of every month -- output mailed to paul 15 14 1 * * $HOME/bin/monthly # run at 22:00 on weekdays(1-5), annoy Joe. % for newline, last % for cc: 0 22 * * 1-5 mail -s "It's 10pm" joe%Joe,%%Where are your kids?%.%% 23 */2 1 2 * echo "run 23 minutes after 0am, 2am, 4am ..., on Feb 1" 5 4 * * sun echo "run at 04:05 every Sunday" # run at 03:40 on the first Monday of each month 40 3 1-7 * * [ "$(date +%a)" == "Mon" ] && command -args
Tip | |
---|---|
For the system not running continuously, install the |
Tip | |
---|---|
For scheduled system maintenance scripts, you can run them periodically from root account by placing such scripts in " |
Insurance against system malfunction is provided by the kernel compile option "Magic SysRq key" (SAK key) which is now the default for the Debian kernel. Pressing Alt-SysRq followed by one of the following keys does the magic of rescuing control of the system.
Table 9.15. List of SAK command keys
key following Alt-SysRq | description of action |
---|---|
r
|
restore the keyboard from raw mode after X crashes |
0
|
change the console loglevel to 0 to reduce error messages |
k
|
kill all processes on the current virtual console |
e
|
send a SIGTERM to all processes, except for init(8) |
i
|
send a SIGKILL to all processes, except for init(8) |
s
|
sync all mounted filesystems |
u
|
remount all mounted filesystems read-only (umount) |
b
|
reboot the system without syncing or unmounting |
The combination of "Alt-SysRq s", "Alt-SysRq u", and "Alt-SysRq r" is good for getting out of really bad situations.
See "/usr/share/doc/linux-doc-2.6.*/Documentation/sysrq.txt.gz
".
Caution | |
---|---|
The Alt-SysRq feature may be considered a security risk by allowing users access to root-privileged functions. Placing " |
Tip | |
---|---|
From SSH terminal etc., you can use the Alt-SysRq feature by writing to the " |
You can check who is on the system by the following.
who(1) shows who is logged on.
w(1) shows who is logged on and what they are doing.
last(1) shows listing of last logged in user.
lastb(1) shows listing of last bad logged in users.
Tip | |
---|---|
" |
You can send message to everyone who is logged on to the system with wall(1) by the following.
$ echo "We are shutting down in 1 hour" | wall
For the PCI-like devices (AGP, PCI-Express, CardBus, ExpressCard, etc.), lspci(8) (probably with "-nn
" option) is a good start for the hardware identification
Alternatively, you can identify the hardware by reading contents of "/proc/bus/pci/devices
" or browsing directory tree under "/sys/bus/pci
" (see Section 1.2.12, “procfs and sysfs”).
Table 9.16. List of hardware identification tools
package | popcon | size | description |
---|---|---|---|
pciutils
|
http://qa.debian.org/popcon.php?package=pciutils | 921 | Linux PCI Utilities: lspci(8) |
usbutils
|
http://qa.debian.org/popcon.php?package=usbutils | 630 | Linux USB utilities: lsusb(8) |
pcmciautils
|
http://qa.debian.org/popcon.php?package=pcmciautils | 115 | PCMCIA utilities for Linux 2.6: pccardctl(8) |
scsitools
|
http://qa.debian.org/popcon.php?package=scsitools | 316 | collection of tools for SCSI hardware management: lsscsi(8) |
pnputils
|
http://qa.debian.org/popcon.php?package=pnputils | 108 | Plug and Play BIOS utilities: lspnp(8) |
procinfo
|
http://qa.debian.org/popcon.php?package=procinfo | 164 |
system information obtained from "/proc ": lsdev(8)
|
lshw
|
http://qa.debian.org/popcon.php?package=lshw | 712 | information about hardware configuration: lshw(1) |
discover
|
http://qa.debian.org/popcon.php?package=discover | 66 | hardware identification system: discover(8) |
Although most of the hardware configuration on modern GUI desktop systems such as GNOME and KDE can be managed through accompanying GUI configuration tools, it is a good idea to know some basics methods to configure them.
Table 9.17. List of hardware configuration tools
Here, ACPI is a newer framework for the power management system than APM.
Tip | |
---|---|
CPU frequency scaling on modern system is governed by kernel modules such as |
The following sets system and hardware time to MM/DD hh:mm, CCYY.
# date MMDDhhmmCCYY # hwclock --utc --systohc # hwclock --show
Times are normally displayed in the local time on the Debian system but the hardware and system time usually use UT(GMT).
If the hardware (BIOS) time is set to UT, change the setting to "UTC=yes
" in the "/etc/default/rcS
".
If you wish to update system time via network, consider to use the NTP service with the packages such as ntp
, ntpdate
, and chrony
.
See the following.
The ntp-doc
package
Tip | |
---|---|
ntptrace(8) in the |
There are several components to configure character console and ncurses(3) system features.
The "/etc/terminfo/*/*
" file (terminfo(5))
The "$TERM
" environment variable (term(7))
setterm(1), stty(1), tic(1), and toe(1)
If the terminfo
entry for xterm
doesn't work with a non-Debian xterm
, change your terminal type, "$TERM
", from "xterm
" to one of the feature-limited versions such as "xterm-r6
" when you log in to a Debian system remotely. See "/usr/share/doc/libncurses5/FAQ
" for more. "dumb
" is the lowest common denominator for "$TERM
".
Device drivers for sound cards for current Linux 2.6 are provided by Advanced Linux Sound Architecture (ALSA). ALSA provides emulation mode for previous Open Sound System (OSS) for compatibility.
Run "dpkg-reconfigure linux-sound-base
" to select the sound system to use ALSA via blacklisting of kernel modules. Unless you have very new sound hardware, udev infrastructure should configure your sound system.
Tip | |
---|---|
Use " |
Tip | |
---|---|
If you can not get sound, your speaker may be connected to a muted output. Modern sound system has many outputs. alsamixer(1) in the |
Application softwares may be configured not only to access sound devices directly but also to access them via some standardized sound server system.
Table 9.18. List of sound packages
There is usually a common sound engine for each popular desktop environment. Each sound engine used by the application can choose to connect to different sound servers.
For disabling the screen saver, use following commands.
Table 9.19. List of commands for disabling the screen saver
environment | command |
---|---|
The Linux console |
setterm -powersave off
|
The X Window (turning off screensaver) |
xset s off
|
The X Window (disabling dpms) |
xset -dpms
|
The X Window (GUI configuration of screen saver) |
xscreensaver-command -prefs
|
One can always unplug the PC speaker to disable beep sounds. Removing pcspkr
kernel module does this for you.
The following prevents the readline(3) program used by bash(1) to beep when encountering "\a
" (ASCII=7).
$ echo "set bell-style none">> ~/.inputrc
The kernel boot message in the "/var/log/dmesg
" contains the total exact size of available memory.
free(1) and top(1) display information on memory resources on the running system.
# grep '\] Memory' /var/log/dmesg [ 0.004000] Memory: 990528k/1016784k available (1975k kernel code, 25868k reserved, 931k data, 296k init) $ free -k total used free shared buffers cached Mem: 997184 976928 20256 0 129592 171932 -/+ buffers/cache: 675404 321780 Swap: 4545576 4 4545572
Tip | |
---|---|
Do not worry about the large size of " |
For my MacBook with 1GB=1048576k DRAM (video system steals some of this), I see the following.
Table 9.20. List of memory sizes reported
report | size |
---|---|
Total size in dmesg | 1016784k = 1GB - 31792k |
Free in dmesg | 990528k |
Total under shell | 997184k |
Free under shell | 20256k (but effectively 321780k) |
Poor system maintenance may expose your system to external exploitation.
For system security and integrity check, you should start with the following.
The debsums
package, See debsums(1) and Section 2.5.2, “Top level "Release" file and authenticity”.
The chkrootkit
package, See chkrootkit(1).
The clamav
package family, See clamscan(1) and freahclam(1).
Table 9.21. List of tools for system security and integrity check
Here is a simple script to check for typical world writable incorrect file permissions.
# find / -perm 777 -a \! -type s -a \! -type l -a \! \( -type d -a -perm 1777 \)
Caution | |
---|---|
Since the |
Debian distributes modularized Linux kernel as packages for supported architectures.
There are few notable features on Linux kernel 2.6 compared to 2.4.
Devices are created by the udev system (see Section 3.5.11, “The udev system”).
Read/write accesses to IDE CD/DVD devices do not use the ide-scsi
module.
Network packet filtering functions use iptable
kernel modules.
Many Linux features are configurable via kernel parameters as follows.
Kernel parameters initialized by the bootloader (see Section 3.3, “Stage 2: the boot loader”)
Kernel parameters changed by sysctl(8) at runtime for ones accessible via sysfs (see Section 1.2.12, “procfs and sysfs”)
Module parameters set by arguments of modprobe(8) when a module is activated (see Section 10.2.3, “Mounting the disk image file”)
See "kernel-parameters.txt(.gz)
" and other related documents in the Linux kernel documentation ("/usr/share/doc/linux-doc-2.6.*/Documentation/filesystems/*
") provided by the linux-doc-2.6.*
package.
Most normal programs don't need kernel headers and in fact may break if you use them directly for compiling. They should be compiled against the headers in "/usr/include/linux
" and "/usr/include/asm
" provided by the libc6-dev
package (created from the glibc
source package) on the Debian system.
Note | |
---|---|
For compiling some kernel-specific programs such as the kernel modules from the external source and the automounter daemon ( |
Debian has its own method of compiling the kernel and related modules.
Table 9.22. List of key packages to be installed for the kernel recompilation on the Debian system
package | popcon | size | description |
---|---|---|---|
build-essential
|
http://qa.debian.org/popcon.php?package=build-essential | 48 |
essential packages for building Debian packages: make , gcc , …
|
bzip2
|
http://qa.debian.org/popcon.php?package=bzip2 | 86 | compress and decompress utilities for bz2 files |
libncurses5-dev
|
http://qa.debian.org/popcon.php?package=libncurses5-dev | 1007 | developer's libraries and docs for ncurses |
git
|
http://qa.debian.org/popcon.php?package=git | 13073 | git: distributed revision control system used by the Linux kernel |
fakeroot
|
http://qa.debian.org/popcon.php?package=fakeroot | 316 | provide fakeroot environment for building package as non-root |
initramfs-tools
|
http://qa.debian.org/popcon.php?package=initramfs-tools | 321 | tool to build an initramfs (Debian specific) |
dkms
|
http://qa.debian.org/popcon.php?package=dkms | 338 | dynamic kernel module support (DKMS) (generic) |
devscripts
|
http://qa.debian.org/popcon.php?package=devscripts | 1506 | helper scripts for a Debian Package maintainer (Debian specific) |
If you use initrd
in Section 3.3, “Stage 2: the boot loader”, make sure to read the related information in initramfs-tools(8), update-initramfs(8), mkinitramfs(8) and initramfs.conf(5).
Warning | |
---|---|
Do not put symlinks to the directories in the source tree (e.g. " |
Note | |
---|---|
When compiling the latest Linux kernel on the Debian |
Note | |
---|---|
The dynamic kernel module support (DKMS) is a new distribution independent framework designed to allow individual kernel modules to be upgraded without changing the whole kernel. This will be endorsed for the maintenance of out-of-tree modules for |
For building custom kernel binary packages from the upstream kernel source, you should use the "deb-pkg
" target provided by it.
$ sudo apt-get build-dep linux-2.6 $ cd /usr/src $ wget http://www.kernel.org/pub/linux/kernel/v3.2/linux-<version>.tar.bz2 $ tar -xjvf linux-<version>.tar.bz2 $ cd linux-<version> $ cp /boot/config-<version> .config $ make menuconfig ... $ make deb-pkg
Tip | |
---|---|
The linux-source-<version> package provides the Linux kernel source with Debian patches as " |
For building specific binary packages from the Debian kernel source package, you should use the "binary-arch_<architecture><featureset><flavour>
" targets in "debian/rules.gen
".
$ sudo apt-get build-dep linux-2.6 $ apt-get source linux-2.6 $ cd linux-2.6-* $ fakeroot make -f debian/rules.gen binary-arch_i386_none_686
See further information:
Debian Wiki: KernelFAQ
Debian Wiki: DebianKernel
Debian Linux Kernel Handbook: http://kernel-handbook.alioth.debian.org
Although most of hardware drivers are available as free software and as a part of the Debian system, you may need to load some non-free external drivers to support some hardwares, such as Winmodem, on your system.
Tip | |
---|---|
Check available firmware packages with " |
Tip | |
---|---|
The NDISwrapper can use Windows XP network drivers natively on Linux. Check " |
Check pertinent resources.
Use of virtualized system enables us to run multiple instances of system simultaneously on a single hardware.
There are several system virtualization and emulation related packages in Debian beyond simple chroot. Some packages also help you to setup such system.
Table 9.23. List of virtualization tools
See Wikipedia article Comparison of platform virtual machines for detail comparison of different platform virtualization solutions.
Note | |
---|---|
Some functionalities described here are only available in |
Note | |
---|---|
Default Debian kernels support KVM since |
Typical work flow for virtualization involves several steps.
Create an empty filesystem (a file tree or a disk image).
The file tree can be created by "mkdir -p /path/to/chroot
".
The raw disk image file can be created with dd(1) (see Section 10.2.1, “Making the disk image file” and Section 10.2.5, “Making the empty disk image file”).
qemu-img(1) can be used to create and convert disk image files supported by QEMU.
The raw and VMDK file format can be used as common format among virtualization tools.
Mount the disk image with mount(8) to the filesystem (optional).
For the raw disk image file, mount it as loop device or device mapper devices (see Section 10.2.3, “Mounting the disk image file”).
For disk images supported by QEMU, mount them as network block device (see Section 9.8.3, “Mounting the virtual disk image file”).
Populate the target filesystem with required system data.
Use programs such as debootstrap
and cdebootstrap
help this process (see Section 9.8.4, “Chroot system”).
Use installers of OSs under the full system emulation.
Run a program under a virtualized environment.
chroot provides basic virtualized environment enough to compile programs, run console applications, and run daemons in it.
QEMU provides cross-platform CPU emulation.
QEMU with KVM provides full system emulation by the hardware-assisted virtualization.
VirtualBox provides full system emulation on i386 and amd64 with or without the hardware-assisted virtualization.
For the raw disk image file, see Section 10.2, “The disk image”.
For other virtual disk image files, you can use qemu-nbd(8) to export them using network block device protocol and mount them using the nbd
kernel module.
qemu-nbd(8) supports disk formats supported by QEMU: QEMU supports following disk formats: raw, qcow2, qcow, vmdk, vdi, bochs, cow (user-mode Linux copy-on-write), parallels, dmg, cloop, vpc, vvfat (virtual VFAT), and host_device.
The network block device can support partitions in the same way as the loop device (see Section 10.2.3, “Mounting the disk image file”). You can mount the first partition of "disk.img
" as follows.
# modprobe nbd max_part=16 # qemu-nbd -v -c /dev/nbd0 disk.img ... # mkdir /mnt/part1 # mount /dev/nbd0p1 /mnt/part1
Tip | |
---|---|
You may export only the first partition of " |
chroot(8) offers most basic way to run different instances of the GNU/Linux environment on a single system simultaneously without rebooting.
Caution | |
---|---|
Examples below assumes both parent system and chroot system share the same CPU architecture. |
You can learn how to setup and use chroot(8) by running pbuilder(8) program under script(1) as follows.
$ sudo mkdir /sid-root $ sudo pbuilder --create --no-targz --debug --buildplace /sid-root
You see how debootstrap(8) or cdebootstrap(1) populate system data for sid
environment under "/sid-root
".
Tip | |
---|---|
These debootstrap(8) or cdebootstrap(1) are used to install Debian by the Debian Installer. These can also be used to install Debian to a system without using a Debian install disk, but instead from another GNU/Linux distribution. |
$ sudo pbuilder --login --no-targz --debug --buildplace /sid-root
You see how a system shell running under sid
environment is created as the following.
Copy local configuration ("/etc/hosts
", "/etc/hostname
", "/etc/resolv.conf
")
Mount "/proc
" filesystem
Mount "/dev/pts
" filesystem
Create "/usr/sbin/policy-rc.d
" which always exits with 101
Run "chroot /sid-root bin/bash -c 'exec -a -bash bin/bash'
"
Note | |
---|---|
Some programs under chroot may require access to more files from the parent system to function than |
Note | |
---|---|
The " |
Tip | |
---|---|
The original purpose of the specialized chroot package, |
Tip | |
---|---|
Similar |
I recommend you to use QEMU or VirtualBox on a Debian stable
system to run multiple desktop systems safely using virtualization. These enable you to run desktop applications of Debian unstable
and testing
without usual risks associated with them.
Since pure QEMU is very slow, it is recommended to accelerate it with KVM when the host system support it.
The virtual disk image "virtdisk.qcow2
" containing Debian system for QEMU can be created using debian-installer: Small CDs as follows.
$ wget http://cdimage.debian.org/debian-cd/5.0.3/amd64/iso-cd/debian-503-amd64-netinst.iso $ qemu-img create -f qcow2 virtdisk.qcow2 5G $ qemu -hda virtdisk.qcow2 -cdrom debian-503-amd64-netinst.iso -boot d -m 256 ...
See more tips at Debian wiki: QEMU.
VirtualBox comes with Qt GUI tools and quite intuitive. Its GUI and command line tools are explained in VirtualBox User Manual and VirtualBox User Manual (PDF).
Tip | |
---|---|
Running other GNU/Linux distributions such as Ubuntu and Fedra under virtualization is a great way to learn configuration tips. Other proprietary OSs may be run nicely under this GNU/Linux virtualization, too. |