<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Rolling shells &#187; Debian</title>
	<atom:link href="http://shell.burgas.org/tag/debian/feed/" rel="self" type="application/rss+xml" />
	<link>http://shell.burgas.org</link>
	<description>All the things i find useful for linux and network.</description>
	<lastBuildDate>Thu, 09 Sep 2010 06:18:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>debian and bind9 recursive dns, the easy way</title>
		<link>http://shell.burgas.org/2010/06/debian-and-bind9-recursive-dns-the-easy-way/</link>
		<comments>http://shell.burgas.org/2010/06/debian-and-bind9-recursive-dns-the-easy-way/#comments</comments>
		<pubDate>Sat, 05 Jun 2010 07:14:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Servers]]></category>
		<category><![CDATA[Debian]]></category>

		<guid isPermaLink="false">http://shell.burgas.org/?p=127</guid>
		<description><![CDATA[First of you need to know this is quick and very insecure way to run a dns. I recommend using chroot jail for bind, which i wont cover here. We start with installing packages: apt-get install bind9 bind9-doc dnsutils then edit /etc/bind/named.conf.options to append following lines: allow-recursion { 0.0.0.0/0 ; }; I strongly recommend using [...]]]></description>
			<content:encoded><![CDATA[<p>First of you need to know this is quick and very insecure way to run a dns. I recommend using chroot jail for bind, which i wont cover here.</p>
<p>We start with installing packages:</p>
<p><code>apt-get install bind9 bind9-doc dnsutils</code></p>
<p>then edit /etc/bind/named.conf.options to append following lines: </p>
<p><code>allow-recursion {<br />
    0.0.0.0/0 ;<br />
}; </code></p>
<p>I strongly recommend using real network that you wish dns to be accessible from, that will save you a lot of troubles.</p>
<p>And finally just start/restart bind9 with: </p>
<p><code>/etc/init.d/bind9 restart</code> </p>
]]></content:encoded>
			<wfw:commentRss>http://shell.burgas.org/2010/06/debian-and-bind9-recursive-dns-the-easy-way/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Debian 5.03 ipset</title>
		<link>http://shell.burgas.org/2010/01/debian-5-03-ipset/</link>
		<comments>http://shell.burgas.org/2010/01/debian-5-03-ipset/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 17:53:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Servers]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[iptables]]></category>

		<guid isPermaLink="false">http://shell.burgas.org/?p=122</guid>
		<description><![CDATA[To get ipset and iptables set module working, which means kernel modules as well, you need to install the following : ipset, kernel headers and build essentials, you also need package named netfilter-extensions-source. then run as root module-assistant build netfilter-extensions-source to test it simply run ipset -N servers ipmap --network 192.168.0.0/16]]></description>
			<content:encoded><![CDATA[<p>To get ipset and iptables set module working, which means kernel modules as well, you need to install the following :</p>
<p>ipset, kernel headers and build essentials, you also need package named netfilter-extensions-source.</p>
<p>then run as root
<pre>module-assistant build netfilter-extensions-source
</pre>
<p>to test it simply run
<pre>ipset -N servers ipmap --network 192.168.0.0/16
</pre>
]]></content:encoded>
			<wfw:commentRss>http://shell.burgas.org/2010/01/debian-5-03-ipset/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Howto set default editor for mc in Debian 5.0 Lenny</title>
		<link>http://shell.burgas.org/2009/08/howto-set-default-editor-for-mc-in-debian-5-0-lenny/</link>
		<comments>http://shell.burgas.org/2009/08/howto-set-default-editor-for-mc-in-debian-5-0-lenny/#comments</comments>
		<pubDate>Tue, 18 Aug 2009 15:04:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Desktop]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Servers]]></category>
		<category><![CDATA[Debian]]></category>

		<guid isPermaLink="false">http://shell.burgas.org/?p=101</guid>
		<description><![CDATA[Run: apt-get install vim-nox and then: update-alternatives --config editor and select vim-nox: evil:/tmp/# update-alternatives --config editor There are 4 alternatives which provide `editor'. Selection Alternative ----------------------------------------------- 1 /bin/ed *+ 2 /bin/nano 3 /usr/bin/vim.tiny 4 /usr/bin/vim.nox Press enter to keep the default[*], or type selection number:]]></description>
			<content:encoded><![CDATA[<p>Run:</p>
<pre>
apt-get install vim-nox
</pre>
<p>and then:</p>
<pre>
update-alternatives --config editor
and select vim-nox:
</pre>
<pre>
evil:/tmp/# update-alternatives --config editor

There are 4 alternatives which provide `editor'.

  Selection    Alternative
-----------------------------------------------
          1    /bin/ed
*+        2    /bin/nano
          3    /usr/bin/vim.tiny
          4    /usr/bin/vim.nox

Press enter to keep the default[*], or type selection number: <-- 4
Using '/usr/bin/vim.nox' to provide 'editor'.
evil:/tmp/#
</pre>
<p>Choose the one you like most, voila.<br />
Shoud work on ubuntu and other derivates too.</p>
]]></content:encoded>
			<wfw:commentRss>http://shell.burgas.org/2009/08/howto-set-default-editor-for-mc-in-debian-5-0-lenny/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Access denied for user &#8216;debian-sys-maint&#8217;@&#039;localhost&#8217;</title>
		<link>http://shell.burgas.org/2009/08/access-denied-for-user-debian-sys-maintlocalhost/</link>
		<comments>http://shell.burgas.org/2009/08/access-denied-for-user-debian-sys-maintlocalhost/#comments</comments>
		<pubDate>Tue, 18 Aug 2009 14:44:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Desktop]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Servers]]></category>
		<category><![CDATA[Debian]]></category>

		<guid isPermaLink="false">http://shell.burgas.org/?p=99</guid>
		<description><![CDATA[Debian have their own way for doing things. Here is a quick fix up if mess with the mysql-maintain user. If you end up having error like that one when restarting your mysql server: armed:~# /etc/init.d/mysql restart Stopping MySQL database server: mysqld failed! Starting MySQL database server: mysqld already running. /usr/bin/mysqladmin: connect to server at [...]]]></description>
			<content:encoded><![CDATA[<p>Debian have their own way for doing things. Here is a quick fix up if mess with the mysql-maintain user.</p>
<p>If you end up having error like that one when restarting your mysql server:</p>
<pre>armed:~# /etc/init.d/mysql restart
Stopping MySQL database server: mysqld failed!
Starting MySQL database server: mysqld already running.
/usr/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'debian-sys-maint'@'localhost' (using password: YES)'</pre>
<p>First you need to find out what is the password for your system:</p>
<pre>
armed:~# cat /etc/mysql/debian.cnf | grep pass
password = x4FStDr29DDshTFqsf
</pre>
<p>and than add the user:</p>
<pre>
GRANT ALL PRIVILEGES ON *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY '<your password>' WITH GRANT OPTION;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://shell.burgas.org/2009/08/access-denied-for-user-debian-sys-maintlocalhost/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>linux disk statistics with dstat and disk device names</title>
		<link>http://shell.burgas.org/2009/06/linux-disk-statistics-with-dstat-and-disk-device-names/</link>
		<comments>http://shell.burgas.org/2009/06/linux-disk-statistics-with-dstat-and-disk-device-names/#comments</comments>
		<pubDate>Sun, 21 Jun 2009 16:22:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Desktop]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Servers]]></category>
		<category><![CDATA[Virtualization]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Fedora]]></category>
		<category><![CDATA[Red Hat]]></category>
		<category><![CDATA[USB]]></category>

		<guid isPermaLink="false">http://shell.burgas.org/?p=97</guid>
		<description><![CDATA[Something interesting i spotted on Karansbir&#8217;s blog: Running dstat normally gives you something like this : # dstat --nocolor ----total-cpu-usage---- -dsk/total- -net/total- ---paging-- ---system-- usr sys idl wai hiq siq&#124; read writ&#124; recv send&#124; in out &#124; int csw 3 0 97 0 0 0&#124; 820k 456k&#124; 0 0 &#124; 800B 866B&#124;1054 255 And you [...]]]></description>
			<content:encoded><![CDATA[<p>Something interesting i spotted on Karansbir&#8217;s blog:</p>
<p>Running dstat normally gives you something like this :</p>
<blockquote>
<pre># dstat --nocolor
----total-cpu-usage---- -dsk/total- -net/total- ---paging-- ---system--
usr sys idl wai hiq siq| read  writ| recv  send|  in   out | int   csw
  3   0  97   0   0   0| 820k  456k|   0     0 | 800B  866B|1054   255</pre>
</blockquote>
<p>And you can split the disk metrics up based on devices using something like this :</p>
<blockquote>
<pre># dstat -D sda,sdb,total --nocolor
----total-cpu-usage---- --dsk/sda-- --dsk/sdb-- -dsk/total- -net/total- ---paging-- ---system--
usr sys idl wai hiq siq| read  writ: read  writ: read  writ| recv  send|  in   out | int   csw
  1   1  97   0   0   0| 176k   77k:  30k  162k: 411k  478k|   0     0 |3608B 4005B|1447  1458
 33   2  63   0   1   2|   0     0 :   0   216k:   0   432k|2470k 1611k|   0     0 |2915  6967
 31   2  65   0   1   1|   0     0 :   0     0 :   0     0 |2210k 1338k|   0     0 |2866  6051</pre>
</blockquote>
<p>But you can also get deeper level device names / nodes to measure &#8211; which is required in many cases if you have drivers for storage creating nodes further down the tree than /dev. Eg. I have a setup where there are four mysql instances running, each with its own dedicated storage :</p>
<blockquote>
<pre># mount | grep srv
/dev/cciss/c0d1 on /var/lib/mysql/node1 type ext3 (rw)
/dev/cciss/c0d2 on /var/lib/mysql/node2 type ext3 (rw)
/dev/cciss/c0d3 on /var/lib/mysql/node3 type ext3 (rw)
/dev/cciss/c0d4 on /var/lib/mysql/node4 type ext3 (rw)
/dev/cciss/c0d5 on /srv/wal type ext3 (rw)</pre>
</blockquote>
<p>so in this case, to get dstat reporting working you need to mention just the component level, like this :</p>
<blockquote>
<pre># dstat -D cciss/c0d1,cciss/c0d2,cciss/c0d3 --nocolor
----total-cpu-usage---- dsk/cciss/c dsk/cciss/c dsk/cciss/c -net/total- ---paging-- ---system--
usr sys idl wai hiq siq| read  writ: read  writ: read  writ| recv  send|  in   out | int   csw
  3   0  97   0   0   0| 209k   89k: 201k   86k: 204k   85k|   0     0 | 799B  865B|1055   256
 90   1   8   1   0   0|3196k   68k: 764k    0 : 816k   24k|1067k 1650k|   0     0 |1999   609
 95   1   3   1   0   0|2548k    0 :   0  4084k:2448k 5700k| 660k  791k|   0     0 |1611   571
 96   1   2   1   0   0|2628k    0 : 808k    0 :1620k    0 | 352k  798k|   0     0 |1835  1605</pre>
</blockquote>
<p>And you get the details, for each block device.</p>
]]></content:encoded>
			<wfw:commentRss>http://shell.burgas.org/2009/06/linux-disk-statistics-with-dstat-and-disk-device-names/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Debian 5.0 xen DomU iptables kernel module problem on fresh install</title>
		<link>http://shell.burgas.org/2009/06/debian-50-xen-domu-iptables-kernel-module-problem-on-fresh-install/</link>
		<comments>http://shell.burgas.org/2009/06/debian-50-xen-domu-iptables-kernel-module-problem-on-fresh-install/#comments</comments>
		<pubDate>Wed, 17 Jun 2009 08:38:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Desktop]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Servers]]></category>
		<category><![CDATA[Virtualization]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[Xen]]></category>

		<guid isPermaLink="false">http://shell.burgas.org/?p=95</guid>
		<description><![CDATA[yesterday i run true a weird situation. After installing fresh DomU with xen-image-create via debootstrap, I noticed that its ipbtales is not working giving the following: WARNING: Could not open 'kernel/net/netfilter/x_tables.ko': No such file or directory FATAL: Could not open 'kernel/net/ipv4/netfilter/ip_tables.ko': No such file or directory iptables v1.3.6: can't initialize iptables table `filter': iptables who? [...]]]></description>
			<content:encoded><![CDATA[<p>yesterday i run true a weird situation. After installing fresh DomU with xen-image-create via debootstrap, I noticed that its ipbtales is not working giving the following:</p>
<pre>
WARNING: Could not open 'kernel/net/netfilter/x_tables.ko': No such file or directory
FATAL: Could not open 'kernel/net/ipv4/netfilter/ip_tables.ko': No such file or directory
iptables v1.3.6: can't initialize iptables table `filter': iptables who? (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
</pre>
<p>anyway its very easy to fix and i just decided to share the info, just type a simple command:</p>
<pre>
depmod
</pre>
]]></content:encoded>
			<wfw:commentRss>http://shell.burgas.org/2009/06/debian-50-xen-domu-iptables-kernel-module-problem-on-fresh-install/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>debian xen domU hangs at crond</title>
		<link>http://shell.burgas.org/2009/06/debian-xen-domu-hangs-at-crond/</link>
		<comments>http://shell.burgas.org/2009/06/debian-xen-domu-hangs-at-crond/#comments</comments>
		<pubDate>Mon, 15 Jun 2009 13:15:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Desktop]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Servers]]></category>
		<category><![CDATA[Virtualization]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Xen]]></category>

		<guid isPermaLink="false">http://shell.burgas.org/?p=93</guid>
		<description><![CDATA[If you have problems with xen domU console on Debian 5.0 Lenny, stoping at crond, try to add the following line to your config: extra = 'console=hvc0 xencons=tty']]></description>
			<content:encoded><![CDATA[<p>If you have problems with xen domU console on Debian 5.0 Lenny, stoping at crond, try to add the following line to your config:</p>
<pre>
extra = 'console=hvc0 xencons=tty'
</pre>
]]></content:encoded>
			<wfw:commentRss>http://shell.burgas.org/2009/06/debian-xen-domu-hangs-at-crond/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>sshd problem on debian xen guest PTY allocation request failed on channel 0</title>
		<link>http://shell.burgas.org/2009/05/sshd-problem-on-debian-xenpty-allocation-request-failed-on-channel-0-guest/</link>
		<comments>http://shell.burgas.org/2009/05/sshd-problem-on-debian-xenpty-allocation-request-failed-on-channel-0-guest/#comments</comments>
		<pubDate>Sat, 23 May 2009 10:21:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Desktop]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Servers]]></category>
		<category><![CDATA[Virtualization]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[Xen]]></category>

		<guid isPermaLink="false">http://shell.burgas.org/?p=89</guid>
		<description><![CDATA[How do you fix the issue with a SSH server which freezes after authenticating? $ ssh root@xxx.xxx.xxx.xxx The authenticity of host ‘xx.xx.xxx.xxx (xx.xx.xxx.xxx)’ can’t be established. RSA key fingerprint is replaced for security. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added ‘xx.xx.xxx.xxx’ (RSA) to the list of known hosts. Password: [...]]]></description>
			<content:encoded><![CDATA[<p>How do you fix the issue with a SSH server which freezes after authenticating?</p>
<blockquote><p>$ ssh <span class="mh-plaintext">root@xxx.xxx.xxx.xxx</span><br />
The authenticity of host ‘xx.xx.xxx.xxx (xx.xx.xxx.xxx)’ can’t be established.<br />
RSA key fingerprint is replaced for security.<br />
Are you sure you want to continue connecting (yes/no)? yes<br />
Warning: Permanently added ‘xx.xx.xxx.xxx’ (RSA) to the list of known hosts.<br />
Password:<br />
PTY allocation request failed on channel 0</p></blockquote>
<p>In the above scenario, you can see that I logged in but I’m not able to get into the console.</p>
<p>Once you’re in debug more, you will see lots of messages elaborating the SSH access steps in detail. These messages might point you to the root cause or the stage at which you’re being locked.</p>
<p>In my case, I got freezed after authenticating myself.</p>
<p>Resolution is just to make pts and restart sshd</p>
<pre>
mkdir /dev/pts
mount /dev/pts
/etc/init.d/ssh restart
</pre>
<p>and permanent solution is just instaling udev via: </p>
<pre>
apt-get install udev
</pre>
]]></content:encoded>
			<wfw:commentRss>http://shell.burgas.org/2009/05/sshd-problem-on-debian-xenpty-allocation-request-failed-on-channel-0-guest/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Debian runlevels in details</title>
		<link>http://shell.burgas.org/2009/05/debian-runlevels-in-details/</link>
		<comments>http://shell.burgas.org/2009/05/debian-runlevels-in-details/#comments</comments>
		<pubDate>Sat, 23 May 2009 08:52:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Desktop]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Servers]]></category>
		<category><![CDATA[Virtualization]]></category>
		<category><![CDATA[Debian]]></category>

		<guid isPermaLink="false">http://shell.burgas.org/?p=85</guid>
		<description><![CDATA[Simply put, a &#8216;runlevel&#8217; determines which programs are executed at system startup. Most of your exposure to run levels will deal with system startup. You will become intimately familiar with the exceptions the first time you have to troubleshoot a failed system. Linux run levels are numbered 0 through 6. Run levels stop at six [...]]]></description>
			<content:encoded><![CDATA[<p>Simply put, a &#8216;runlevel&#8217; determines which programs are executed at system startup. Most of your exposure to run levels will deal with system startup. You will become intimately familiar with the exceptions the first time you have to troubleshoot a failed system.</p>
<p>Linux run levels are numbered 0 through 6. Run levels stop at six for practical and historical reasons, but it is entirely possible to have more if desired.</p>
<p>The following table summarises the UserLinux run levels:</p>
<pre> * 0		System Halt
 * 1		Single user
 * 2		Full multi-user mode (Default)
 * 3-5		Same as 2
 * 6		System Reboot</pre>
<p>When run levels are discussed they are referred to as &#8216;moving into&#8217;, or &#8216;going into&#8217; a certain run level. The inference is that you came from somewhere. With the exception of booting up, a system always transitions from one runlevel to another in response to certain conditions.</p>
<p><strong>Special Run Levels</strong></p>
<p>Run level 0 is the system halt condition. Nearly all modern X86 computers will power off automatically when run level 0 is reached. Older X86 computers, and various different architectures will remain powered on and display a message referring to the halt condition.</p>
<p>Run Level 1 is known as &#8216;single user&#8217; mode. A more apt description would be &#8216;rescue&#8217;, or &#8216;trouble-shooting&#8217; mode. In run level 1, no daemons (services) are started. Hopefully single user mode will allow you to fix whatever made the transition to rescue mode necessary.</p>
<p>(You can boot into single user mode typically by using your boot loader, lilo or grub, to add the word &#8216;single&#8217; to the end of the kernel command line).</p>
<p>Run levels 2 through 5 are full multi-user mode and are the same in a default UserLinux (Debian) system. It is a common practise in other Linux distributions to use run level 3 for a text console login and run level 5 for a graphical login.</p>
<p>Run level 6 is used to signal system reboot. This is just like run level 0 except a reboot is issued at the end of the sequence instead of a power off.</p>
<p>In the interests of completeness, there is also a runlevel &#8216;S&#8217; that the system uses on it&#8217;s way to another runlevel. Read the man page for the <tt>init</tt> command (&#8220;<tt>man init</tt>&#8220;) for more information, but you can safely skip this for all practical purposes.</p>
<p><strong>Where Does a Run Level Live?</strong></p>
<p>Like everything else in a Linux system, run levels are defined by files in the filesystem. All the run level files are found in the <tt>/etc</tt> directory according to the following table:</p>
<pre>/etc/rc0.d		Run level 0
/etc/rc1.d		Run level 1
/etc/rc2.d		Run level 2
/etc/rc3.d		Run level 3
/etc/rc4.d		Run level 4
/etc/rc5.d		Run level 5
/etc/rc6.d		Run level 6</pre>
<p>Notice a pattern?  Each defined runlevel should have an <tt>rcX.d</tt> directory where X is the run level number.  The contents of the <tt>rcX.d</tt> directory determines what happens at that run level.</p>
<p><strong>(S)tart files, (K)ill files</strong></p>
<p>Let&#8217;s look at run level 2 since this is where we&#8217;ll spend most of our time.</p>
<p>Here are the contents of a generic rc2.d directory:</p>
<pre>S10sysklogd  S20cupsys   S20mailman  S20usermin  S91apache         S99xdm
S11klogd     S20exim4    S20makedev  S20xfs      S91apache2
S14ppp       S20fam      S20pcmcia   S20xprint   S99gdm
S18portmap   S20hylafax  S20samba    S89atd      S99rmnologin
S20acpid     S20inetd    S20ssh      S89cron     S99stop-bootlogd</pre>
<p>At first glance the files in this directory look kind of intimidating. They should be. The files in the rcX.d directories are formatted for the computer to read, not the user.</p>
<p>Each file is a symbolic link to a script residing in the <tt>/etc/init.d</tt> directory and controls the starting, or stopping of a program, or daemon (service).</p>
<p>This is important enough to say again, each file is a symbolic link to a script and controls the starting, or stopping of a program, or daemon.</p>
<p>In slightly modified man page format, here is how the files are named:</p>
<pre>[K | S] + nn + [string]</pre>
<p>Working backwards, here is how the name parses out. The [string] is a human readable mnemonic for the executable file that is actually symbolically linked to. The &#8216;nn&#8217; is a two digit number from 01-99; lower number programs are executed first. By this method, services that have a dependancy can be certain their precursor has ran. The K and S signify simply Kill, or Start.</p>
<p>When a system moves into a new runlevel, all the files that begin with S will be executed. When a system moves into a new runlevel all the files that begin with K will be executed. Yes, all the files will execute, but with one distinct difference: &#8216;S&#8217; files invoke their program with the &#8216;start&#8217; parameter, the &#8216;K&#8217; files invoke their program with the &#8216;stop&#8217; parameter. The UserLinux (Debian) system optimizes the runlevel change by not starting a daemon that is already running.</p>
<p>The simple elegance of this system is made possible by the alphabet. All the scripts will execute in alphabetical order. &#8216;K&#8217; comes before &#8216;S&#8217;, so programs are stopped before they are started. Forgetting this fact can lead to a lot of chin scratching while manipulating your rcX.d files.</p>
<p>After the first letter comes the integer, again determining execution order. Finally, the mnemonic portion is followed alphabetically to determine execution order.</p>
<p>Let&#8217;s look at some of the programs that are actually executed during a run level change:</p>
<pre>S20exim4 -&gt; ../init.d/exim4
S20fam -&gt; ../init.d/fam
S20hylafax -&gt; ../init.d/hylafax
S20inetd -&gt; ../init.d/inetd
S20mailman -&gt; ../init.d/mailman
S20makedev -&gt; ../init.d/makedev
S20pcmcia -&gt; ../init.d/pcmcia
S20samba -&gt; ../init.d/samba
S20ssh -&gt; ../init.d/ssh</pre>
<p>All of these files have the same precedence as far as the system is concerned. They will be executed in the order listed, i.e. alphabetically.</p>
<p>All of the scripts that run during system start-up actually reside in the <tt>/etc/init.d/</tt> directory, as suggested by the listing. The reasons for this are many, but basically boil down to common sense issues like: saving space, single point for editing, and everyone knowing where to find things.</p>
<p><strong>Transitioning Between Run levels </strong></p>
<p>When you leave a runlevel, nothing happens.  All the action takes place when you enter the new run level.</p>
<p>Look at the following two rcX.d listings:</p>
<p><tt>rc2.d</tt>:</p>
<pre>K01xdm      S18portmap S20fam     S20makedev S20usermin S89cron    S99rmnologin
S10sysklogd S20acpid   S20hylafax S20pcmcia  S20xfs     S91apache  S99stop-bootlogd
S11klogd    S20cupsys  S20inetd   S20samba   S20xprint  S91apache2 S99xdm
S14ppp      S20exim4   S20mailman S20ssh     S89atd     S99gdm</pre>
<p><tt>rc3.d</tt>:</p>
<pre>K01gdm       S20acpid    S20inetd    S20ssh      S89cron           S99xdm
S10sysklogd  S20cupsys   S20mailman  S20usermin  S91apache
S11klogd     S20exim4    S20makedev  S20xfs      S91apache2
S14ppp       S20fam      S20pcmcia   S20xprint   S99rmnologin
S18portmap   S20hylafax  S20samba    S89atd      S99stop-bootlogd</pre>
<p>Look intensely at the two listings while allowing your eyes to unfocus. An image of a gnu will eventually appear. Ok, no it won&#8217;t, but you believed for just a second, didn&#8217;t you?</p>
<p>Look at the first listing, <tt>rc2.d</tt>.  Notice the contradiction between the first program and the last program.  <tt>K01xdm</tt> instructs the system to Kill <tt>xdm</tt> upon entering run level 2; <tt>S99xdm</tt> tells the system to start <tt>xdm</tt>.  Who wins?  Both programs are executed, but the last program to run will prevail.  <tt>S99xdm</tt>, as it appears last in  the alphabetical sequence, will leave <tt>xdm</tt> in a running state.  The change to runlevel 2 was wasted typing.</p>
<p>Now, let&#8217;s look closely at the <tt>rc3.d</tt> listing.  The first thing that will be executed is the stopping of <tt>gdm</tt>, which is the default graphical display manager for UserLinux (Debian).  Note the <tt>S99gdm</tt> file (symlink) has been removed.  The purpose of the change is to move to a runlevel where everything else is still running, <em>except</em> the pretty window manager. This situation is called &#8216;console mode&#8217;. As mentioned previously, many Linux distributions use run level 3 for console mode.</p>
<p><strong>That&#8217;s great, but how do I change run levels?</strong></p>
<p>Before we change run levels it might help to find out which run level is current.  Use the &#8216;<tt>runlevel</tt>&#8216; command to tell you two things: The last run level, and the current run level. Here is the command and the output shown together due to the sparsity of the output:</p>
<pre>ulsoho:/home/user1# runlevel
N 2</pre>
<p>The &#8216;N&#8217; stands for none, meaning there has been no run level change since powering up.</p>
<p>The init system controls run levels, but then again, the init system pretty much controls everything. The init system will be looked at in detail in a future article.</p>
<p>The primary command used to change run levels is &#8216;<tt>telinit</tt>&#8216;.  Get it?  &#8220;Tell Init&#8221; to do something; like this:</p>
<pre>telinit 3</pre>
<p><tt>telinit</tt> takes one argument on the command line. As always, see the man page for full details. Normally the argument will be one of: 0,1,2,3,4,5,6, or the letter &#8216;S&#8217;. As you may have guessed, the numbers correspond to the run level you wish to move to. Using the &#8216;S&#8217;, for single-user, is the same as the number 1, but don&#8217;t do it; the &#8216;S&#8217; runlevel is intended for use by the UserLinux (Debian)system.</p>
<p>A note of caution is warranted here.  You can easily use the <tt>telinit</tt> command to reboot (run level 6), or shutdown (run level 0) the system, but <strong>it is not recommended</strong>. Certain programs need special processing for an orderly shutdown. Bypassing the expected shutdown sequence can have dire effects on your data. Older _Unix_ systems are especially sensitive to shutdown/bootup operations</p>
<p>The preferred method for a serious runlevel change is &#8216;<tt>shutdown</tt>&#8216;.  There are easier mnemonics, but in a running system they all point to the &#8216;<tt>shutdown</tt>&#8216; command.  You can use the &#8216;<tt>halt</tt>&#8216;, or &#8216;<tt>poweroff</tt>&#8216; command to stop a system and the &#8216;<tt>reboot</tt>&#8216; command to restart your system.  In each case they call the &#8216;<tt>shutdown</tt>&#8216; command with different parameters.</p>
<p>In a single system (non-networked, or no locally shared resources) environment, the shutdown choice is pretty much yours. However, in a multi-user production system the rule of thumb is <strong>learn the shutdown command</strong>. The two most basic uses of the &#8216;shutdown&#8217; command are for halting, or rebooting. The important parameter to know for shutdown is WHEN is the action going to occur. Here is the command synopsis from the shutdown man page:</p>
<pre>/sbin/shutdown [-t sec] [-arkhncfFHP] time [warning-message]</pre>
<p>The vast majority of your shutdowns will follow one of these two forms:</p>
<pre>shutdown -h now</pre>
<p>or to reboot instead of halt:</p>
<pre>shutdown -r now</pre>
<p>Intuitively, the arguments mean &#8216;<tt>halt</tt>&#8216; and &#8216;<tt>reboot</tt>&#8216;, respectively.</p>
<p>In a multi-user system like a file server, the most important parameter is &#8216;time&#8217;. The time can be an actual clock time in the form of HH:MM, or a Julian style shutdown X minutes from now, denoted by the +X syntax. Note that the &#8216;+&#8217; is needed. The keyword &#8216;<tt>now</tt>&#8216; is synonymous with &#8216;+0&#8242;.  Here are two examples using the time parameter:</p>
<pre>shutdown -h 16:30
shutdown -r +10</pre>
<p>Another important point to remember: once the shutdown command is issued, a notice is sent to all the users of the system and no further logins are allowed. For example, if you need to bring the system down at midnight, don&#8217;t issue the shutdown command at noon and leave to take a nap. No new users will be able to login for the next 12 hours.</p>
<p>A good admin never takes a system down without warning the user community, but the shutdown notice is only sent after the command is executed! Fortunately, there are two ways around the downtime notification dilemma. The first is the &#8216;motd&#8217;, Message Of The Day. The motd is a useful feature that is often overlooked. Using the motd is easy and you are urged to read the simple man page for details. The second method of notification is the <tt>-k</tt> option.  Using <tt>-k</tt> will send the downtime notice to all the users, but will not actually start the shutdown sequence. There is an important limitation to the shutdown notification: the downtime message is only sent 15 minutes (or less) prior to the actual shutdown.</p>
<p>The warning-message parameter may be useful for&#8230;high maintenance users. I find that the default message is authoritative and simple enough to accomplish the task.</p>
<p><strong>Troubleshooting in Run Levels</strong></p>
<p>Here is a tip contributed by <a rel="nofollow" href="http://www.varlinux.org/vl/html/userinfo.php?uid=1">Nicholas Petreley</a>. Sometimes you may not want all the programs in a run level to execute. In this situation an easy way to disable a program is to rename it with the initial S, or K in lowercase. The system will ignore all programs that do not begin with a capital S, or K.</p>
<hr />This article was originally written as part of a course for UserLinux system administration.  It initially appeared on the <a rel="nofollow" href="http://www.userlinux.com/">UserLinux</a> wiki <a rel="nofollow" href="http://www.userlinux.com/cgi-bin/wiki.pl?Run_Level_Lecture">here</a>.  The wiki version, as a living document, may have more, or less to offer in the way of content.</p>
<p>(UserLinux is a subset of Debian.  Everywhere &#8216;UserLinux&#8217; appears, you can substitute &#8216;Debian&#8217; with equal facility.)</p>
]]></content:encoded>
			<wfw:commentRss>http://shell.burgas.org/2009/05/debian-runlevels-in-details/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Big day for the Debian fans &#8211; Debian GNU/Linux 5.0 Lenny is out now</title>
		<link>http://shell.burgas.org/2009/02/big-day-for-the-debian-fans-debian-gnu-linux-50-lenny-is-out-now/</link>
		<comments>http://shell.burgas.org/2009/02/big-day-for-the-debian-fans-debian-gnu-linux-50-lenny-is-out-now/#comments</comments>
		<pubDate>Mon, 16 Feb 2009 07:42:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Desktop]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Servers]]></category>
		<category><![CDATA[Virtualization]]></category>
		<category><![CDATA[Debian]]></category>

		<guid isPermaLink="false">http://shell.burgas.org/?p=69</guid>
		<description><![CDATA[Big day for the Debian fans - Debian GNU/Linux 5.0 &#8220;Lenny&#8221; has been released: &#8220;The Debian Project is pleased to announce the official release of Debian GNU/Linux version 5.0 (code-named &#8216;Lenny&#8217;) after 22 months of constant development. Debian GNU/Linux is a free operating system which supports a total of twelve processor architectures and includes the KDE, GNOME, [...]]]></description>
			<content:encoded><![CDATA[<p>Big day for the Debian fans - <a href="http://distrowatch.com/debian">Debian</a> GNU/Linux 5.0 &#8220;Lenny&#8221; has been released: &#8220;<span class="Quote">The Debian Project is pleased to announce the official release of Debian GNU/Linux version 5.0 (code-named &#8216;Lenny&#8217;) after 22 months of constant development. Debian GNU/Linux is a free operating system which supports a total of twelve processor architectures and includes the KDE, GNOME, Xfce, and LXDE desktop environments. This release includes numerous updated software packages, such as the K Desktop Environment 3.5.10, an updated version of the GNOME desktop environment 2.22.2, the Xfce 4.4.2 desktop environment, LXDE 0.3.2.1, the GNUstep desktop 7.3, X.Org 7.3, OpenOffice.org 2.4.1, GIMP 2.4.7&#8230;.</span>&#8221; See the <a href="http://www.debian.org/News/2009/20090214">release announcement</a> and <a href="http://www.debian.org/releases/lenny/i386/release-notes/">release notes</a> for a detailed description of the release.</p>
<p>As usual, a wide variety of installation media is available for <a href="http://www.debian.org/CD/">free download</a> from the project&#8217;s <a href="http://www.debian.org/mirror/list">mirror sites</a>. For new installations, the &#8220;netinst&#8221; method of installing the distribution is probably the easiest; get the &#8220;netinst&#8221; images for i386 and x86_64 architectures from here: <a href="http://cdimage.debian.org/debian-cd/5.0.0/i386/iso-cd/debian-500-i386-netinst.iso">debian-500-i386-netinst.iso</a> (150MB, <a href="http://cdimage.debian.org/debian-cd/5.0.0/i386/iso-cd/MD5SUMS">MD5</a>,<a href="http://cdimage.debian.org/debian-cd/5.0.0/i386/bt-cd/debian-500-i386-netinst.iso.torrent">torrent</a>), <a href="http://cdimage.debian.org/debian-cd/5.0.0/amd64/iso-cd/debian-500-amd64-netinst.iso">debian-500-amd64-netinst.iso</a> (131MB, <a href="http://cdimage.debian.org/debian-cd/5.0.0/amd64/iso-cd/MD5SUMS">MD5</a>, <a href="http://cdimage.debian.org/debian-cd/5.0.0/amd64/bt-cd/debian-500-amd64-netinst.iso.torrent">torrent</a>).</p>
]]></content:encoded>
			<wfw:commentRss>http://shell.burgas.org/2009/02/big-day-for-the-debian-fans-debian-gnu-linux-50-lenny-is-out-now/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
