<?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>Aaron Toponce &#187; Debian</title>
	<atom:link href="http://pthree.org/category/debian/feed/" rel="self" type="application/rss+xml" />
	<link>http://pthree.org</link>
	<description>Linux.  GNU.  Freedom.</description>
	<lastBuildDate>Sun, 06 May 2012 14:41:18 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4-beta2-20489</generator>
		<item>
		<title>Install ZFS on Debian GNU/Linux</title>
		<link>http://pthree.org/2012/04/17/install-zfs-on-debian-gnulinux/</link>
		<comments>http://pthree.org/2012/04/17/install-zfs-on-debian-gnulinux/#comments</comments>
		<pubDate>Tue, 17 Apr 2012 20:10:40 +0000</pubDate>
		<dc:creator>Aaron Toponce</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://pthree.org/?p=2357</guid>
		<description><![CDATA[UPDATE (May 06, 2012): I apologize for mentioning it supports encryption. Pool version 28 is the latest source that the Free Software community has. Encryption was not added until pool version 30. So, encryption is not supported natively with the ZFS on Linux project. However, you can use LUKS containers underneath, or you can use [...]]]></description>
			<content:encoded><![CDATA[<p><strong>UPDATE (May 06, 2012)</strong>: I apologize for mentioning it supports encryption. Pool version 28 is the latest source that the Free Software community has. Encryption was not added until pool version 30. So, encryption is not supported natively with the ZFS on Linux project. However, you can use LUKS containers underneath, or you can use Ecryptfs for the entire filesystem, which would still give you all the checksum, scrubbing and data integrity benefits of ZFS. Until Oracle gets their act together, and releases the current sources of ZFS, crypto is not implemented.</p>
<p>Quick post on installing ZFS as a kernel module, not FUSE, on Debian GNU/Linux. The documents already exist for getting this going, I&#8217;m just hoping to spread this to a larger audience, in case you are unaware that it exists.</p>
<p>First, the <a href="https://www.llnl.gov/">Lawrence Livermore National Laboratory</a> has been working on porting the native Solaris ZFS source to the Linux kernel as a kernel module. So long as the project remains under contract by the Department of Defense in the United States, I&#8217;m confident there will be continuous updates. You can track the progress of that porting at <a href="http://zfsonlinux.org">http://zfsonlinux.org</a>.</p>
<p>Now, download the SPL and ZFS sources. I&#8217;m running the latest RC, which seems to be quite stable:</p>
<pre>$ mkdir ~/src/{spl,zfs}
$ cd ~/src/spl
$ wget http://github.com/downloads/zfsonlinux/spl/spl-0.6.0-rc8.tar.gz
$ cd ~/src/zfs
$ wget http://github.com/downloads/zfsonlinux/zfs/zfs-0.6.0-rc8.tar.gz</pre>
<p>At this point, you will need to install the dependencies for SPL, then go ahead and compile and make the necessary .deb files:</p>
<pre>$ sudo aptitude install build-essential gawk alien fakeroot linux-headers-$(uname -r)
$ cd ~/src/spl
$ tar -xf spl-0.6.0-rc8.tar.gz
$ cd spl-0.6.0-rc8
$ ./configure
$ make deb
$ sudo dpkg -i *.deb</pre>
<p>Now do the same for ZFS:</p>
<pre>$ sudo aptitude install zlib1g-dev uuid-dev libblkid-dev libselinux-dev parted lsscsi
$ cd ~/src/zfs
$ tar -xf zfs-0.6.0-rc8.tar.gz
$ cd zfs-0.6.0-rc8
$ ./configure
$ make deb
$ sudo dpkg -i *.deb</pre>
<p>If you&#8217;re running Ubuntu, which I know most of you are, you can install the packages from the Launchpad PPA <a href="https://launchpad.net/~zfs-native">https://launchpad.net/~zfs-native</a>.</p>
<p><strong>A word of note:</strong> the manpages get installed to /share/man/. I found this troubling. You can modify your $MANPATH variable to include /share/man/man8/, or by creating symlinks, which is the approach I took:</p>
<pre># cd /usr/share/man/man8/
# ln -s /share/man/man8/zdb.8 zdb.8
# ln -s /share/man/man8/zfs.8 zfs.8
# ln -s /share/man/man8/zpool.8 zpool.8</pre>
<p>Now, make your zpool, and start playing:</p>
<pre>$ sudo zpool create test raidz sdd sde sdf sdg sdh sdi</pre>
<p>It is stable enough to run a ZFS root filesystem on a GNU/Linux installation for your workstation as something to play around with. It is copy-on-write, supports compression, deduplication, file atomicity, off-disk caching, <del datetime="2012-05-06T14:32:22+00:00">encryption,</del> and much more. At this point, unfortunately, I&#8217;m convinced that ZFS as a Linux kernel module will become &#8220;stable&#8221; long before Btrfs will be stable in the mainline kernel. Either way, it doesn&#8217;t matter to me. Both are Free Software, and both provide the long needed features we&#8217;ve needed with today&#8217;s storage needs. Competition is healthy, and I love having choice. Right now, that choice might just be ZFS.</p>
]]></content:encoded>
			<wfw:commentRss>http://pthree.org/2012/04/17/install-zfs-on-debian-gnulinux/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Setup Network Interfaces in Debian</title>
		<link>http://pthree.org/2012/02/26/setup-network-interfaces-in-debian/</link>
		<comments>http://pthree.org/2012/02/26/setup-network-interfaces-in-debian/#comments</comments>
		<pubDate>Mon, 27 Feb 2012 02:57:23 +0000</pubDate>
		<dc:creator>Aaron Toponce</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://pthree.org/?p=2321</guid>
		<description><![CDATA[If you&#8217;re not using NetworkManager or Wicd, or some other similar tool to automatically manage your network interfaces for you, this post is for you. In the Debian world, you have a single file that manages your network interfaces. It can manage VLANs, bonded interfaces, virtual interfaces and more. You can establish rules on what [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re not using NetworkManager or Wicd, or some other similar tool to automatically manage your network interfaces for you, this post is for you. In the Debian world, you have a single file that manages your network interfaces. It can manage VLANs, bonded interfaces, virtual interfaces and more. You can establish rules on what the interface should do before brought online, what it can do while online, and what it can do after online. These same rules could be applied for taking the interface down as well. Let&#8217;s look at some of these.</p>
<p>First, let&#8217;s look at the basic setup for getting an interface online with DHCP. The file we&#8217;ll be looking at this entire time is the /etc/network/interfaces file:</p>
<pre>auto eth0
allow-hotplug eth0
iface eth0 inet dhcp</pre>
<p>The first line tells the kernel to bring the &#8220;eth0&#8243; interface up when the system boots. The second line tells the kernel to start the interface if a &#8220;hotplug&#8221; event is triggered. The third line defines the configuration of the &#8220;eth0&#8243; interface. In this case, it should use IPv4, and should request an IP address from a DHCP server. A static configuration could look like this:</p>
<pre>auto eth0
allow-hotplug eth0
iface eth0 inet static
    address 10.19.84.2
    network 10.19.84.0
    gateway 10.19.84.1
    netmask 255.255.255.0</pre>
<p>The first two lines remain the same. In the third line, we have decided to use static addressing, rather than dynamic. Then, we followed through by configuring the interface. It&#8217;s important to note that the indentation is not required. I only indented it for my benefit.</p>
<p>What about bonding? Simple enough. Suppose you have 2 NICs, one on the motherboard, and other in a PCI slot, and you want to ensure high availability, should the PCI card die. Then you could do something like this:</p>
<pre>auto eth0
iface eth0 inet manual
    post-up ifconfig $IFACE up
    pre-down ifconfig $IFACE down

auto eth1
iface eth1 inet manual
    post-up ifconfig $IFACE up
    pre-down ifconfig $IFACE down

auto bond0
iface bond0 inet static
    bond-slaves eth0 eth1
    # LACP configuration
    bond_mode 802.3ad
    bond_miimon 100
    bond_lcap_rate faste
    bond_xmit_hash_policy layer2+3
    address 10.19.84.2
    network 10.19.84.0
    gateway 10.19.84.1
    netmask 255.255.255.0</pre>
<p>Technically, I don&#8217;t need to tell the kernel to bring up interfaces eth0 and eth1, if I tell the kernel to bring up bond0, and slave the eth0 and eth1 interfaces. But, this configuration illustrates some points. First, there are the pre-up, up, post-up, pre-down, down, and post-down commands that you can use in your network interfaces(5) file. Each does something to the interface at different times during the configuration. Also notice I&#8217;m using the $IFACE variable. There are others that exist, that allow you to create scripts for your interfaces. See <a href="http://www.debian.org/doc/manuals/debian-reference/ch05.en.html#_scripting_with_the_ifupdown_system">http://www.debian.org/doc/manuals/debian-reference/ch05.en.html#_scripting_with_the_ifupdown_system</a> for more information.</p>
<p>On the bonded interface, I&#8217;m putting in two slaves, then setting some bonding configuration that I want, such as using 802.3ad mode. Of course, the interface is static, so I provided the necessary information.</p>
<p>What if we wanted to add our bonded interface to a VLAN? Simple. Just append a dot &#8220;.&#8221; and the VLAN number you want the interface in. Like so:</p>
<pre>auto bond0
iface bond0 inet manual
    bond-slaves eth0 eth1
    # LACP configuration
    bond_mode 802.3ad
    bond_miimon 100
    bond_lcap_rate faste
    bond_xmit_hash_policy layer2+3

auto bond0.42
iface bond0.42 inet static
    address 10.19.84.2
    network 10.19.84.0
    gateway 10.19.84.1
    netmask 255.255.255.0
    # necessary due to a bonding bug in vlan tools
    vlan-raw-device bond0</pre>
<p>Bring the interface up, the verify that the kernel has assigned it to the right VLAN:</p>
<pre>$ sudo cat /proc/net/vlan/config
VLAN Dev name    | VLAN ID
Name-Type: VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD
bond0.42        | 42  | bond0</pre>
<p>Notice that I specified &#8220;vlan-raw-device bond0&#8243;. This is due to a bonding bug in the VLAN tools, where merely specifying which VLAN the interface should be in by its name is not enough. You must also tell the kernel the bonded interface that the VLAN interface should be in.</p>
<p>How about bridged devices:</p>
<pre>auto bond0
iface bond0 inet manual
    bond-slaves eth0 eth1
    # LACP configuration
    bond_mode 802.3ad
    bond_miimon 100
    bond_lcap_rate faste
    bond_xmit_hash_policy layer2+3

auto bond0.42
iface bond0.42 inet manual
    post-up ifconfig $IFACE up
    pre-down ifconfig $IFACE down
    # necessary due to a bonding bug in vlan tools
    vlan-raw-device bond0

auto br42
iface br42 inet static
    bridge_ports bond0.42
    address 10.19.84.1
    netmask 255.255.255.0
    network 10.19.84.0
    gateway 10.19.84.1</pre>
<p>The only new thing here is the &#8220;bridge_ports&#8221; command. In this case, our bridged device is bridging our bond0.42 interface, which is in VLAN 42. Imagine having a KVM or Xen hypervisor that has a guest that needs to be in several VLANs. How would you setup all those bridges? Simple. Just create a VLAN interface for each VLAN, then create a bridge for each bonded interface in that VLAN.</p>
<p>Lastly, what about virtual IPs? I&#8217;ve heard that you can assign multiple IP addresses to a single NIC. How do you set that up? Simple. Just add a colon &#8220;:&#8221; the append a unique number. For example, say I have only one NIC, but wish to have 2 IP addresses, each in different networks:</p>
<pre>auto eth0
iface eth0 inet static
    address 10.19.84.2
    netmask 255.255.255.0
    network 10.19.84.0
    gateway 10.19.84.1

auto eth0:1
iface eth0:1 inet static
    address 10.13.37.2
    netmask 255.255.255.0
    network 10.13.37.0</pre>
<p>It&#8217;s important to note that you generally only need one default gateway to get out. Your kernel will route packets accordingly. If you must specify multiple gateways, then you must manually make edits to the kernel&#8217;s routing table, if everything isn&#8217;t setup correctly.</p>
<p>Of course, we could combine everything we learned here. See if you can make out what each interface is doing:</p>
<pre>auto eth0
iface eth0 inet manual
    pre-up ifconfig $IFACE up
    post-down ifconfig $IFACE down

auto eth1
iface eth1 inet manual
    pre-up ifcanfig $IFACE up
    post-down ifconfig $IFACe down

auto bond0
iface bond0 inet manual
    bond-slaves eth0 eth1 eth2 eth3
    # LACP configuration
    bond_mode 802.3ad
    bond_miimon 100
    bond_lacp_rate faste
    bond_xmit_hash_policy layer2+3

auto bond0.42
iface bond0.42 inet static
    address 10.19.84.2
    netmask 255.255.255.0
    netwark 10.19.84.0
    gateway 10.19.84.1
    # necessary due to a bonding up in vlan tools
    vlan-raw-device bond0

auto bond0.42:1
iface bond0.42:1 inet manual
    pre-up ifconfig $IFACE up
    post-down ifconfig $IFACE down
    # necessary due to a bonding bug in vlan tools
    vlan-raw-device bond0

auto br42
iface br42 inet static
    bridge_ports bond0.42:1
    address 10.13.37.2
    netmask 255.255.255.0
    network 10.13.37.0</pre>
<p>Lastly, MTU. There is a lot of misinformation out there about frame size. In my professional experience, setting the MTU to 9000 bytes does not result in improved performance. Not noticeably at least. But it does have an effect on the CPU. Setting a larger frame size can result in much lower CPU usage, both on the switch, and in your box. However, some protocols, such as UDP, might break with a 9k MTU. So, use appropriately. At any event, here is how I generally set my MTU when dealing with multiple interfaces:</p>
<pre>auto eth0
iface eth0 inet manual
    pre-up ifconfig $IFACE up
    post-down ifconfig $IFACE down
    mtu 9000

auto eth1
iface eth1 inet manual
    pre-up ifcanfig $IFACE up
    post-down ifconfig $IFACe down
    mtu 9000

auto bond0
iface bond0 inet manual
    bond-slaves eth0 eth1
    # LACP configuration
    bond_mode 802.3ad
    bond_miimon 100
    bond_lacp_rate faste
    bond_xmit_hash_policy layer2+3
    mtu 9000

auto bond0.42
iface bond0.42 inet static
    address 10.19.84.2
    netmask 255.255.255.0
    network 10.19.84.0
    gateway 10.19.84.1
    mtu 9000
    # necessary due to a bug in vlan tools
    vlan-raw-device bond0

auto bond0.43
iface bond0.43 inet static
    address 10.13.37.2
    netmask 255.255.255.0
    network 10.13.37.0
    mtu 1500
    # necessary due to a bug in vlan tools
    vlan-raw-device bond0</pre>
<p>Note that I set the MTU to 9000 on all interfaces except for bond0.43, which is 1500. This is perfectly acceptable. In all reality, setting the MTU to 1500 on bond0.43 is just capping what bond0 can really do. But, it is important to set the MTU on each interface, otherwise the frame size of 1500 bytes will get set, and you&#8217;ll end up chopping up your packets anyway. You must also set the MTU to 9000 on the switch ports as well, and any other server and interfaces that you want jumbo frames on.</p>
]]></content:encoded>
			<wfw:commentRss>http://pthree.org/2012/02/26/setup-network-interfaces-in-debian/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Salt Packaged For Debian/Ubuntu</title>
		<link>http://pthree.org/2011/09/29/salt-packaged-for-debianubuntu/</link>
		<comments>http://pthree.org/2011/09/29/salt-packaged-for-debianubuntu/#comments</comments>
		<pubDate>Thu, 29 Sep 2011 15:04:33 +0000</pubDate>
		<dc:creator>Aaron Toponce</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://pthree.org/?p=2073</guid>
		<description><![CDATA[I created a Debian package for Salt, doing my best to adhere to the Debian Policy. You can find it at http://mentors.debian.net/package/salt. If you&#8217;re not familiar with Salt, head over to http://saltstack.org and check it out. From the author&#8217;s website: Salt is a powerful remote execution manager that can be used to administer servers in [...]]]></description>
			<content:encoded><![CDATA[<p>I created a Debian package for Salt, doing my best to adhere to the <a href="http://www.debian.org/doc/debian-policy/">Debian Policy</a>. You can find it at <a href="http://mentors.debian.net/package/salt">http://mentors.debian.net/package/salt</a>. If you&#8217;re not familiar with Salt, head over to <a href="http://saltstack.org">http://saltstack.org</a> and check it out. From the author&#8217;s website:</p>
<blockquote><p>Salt is a powerful remote execution manager that can be used to administer servers in a fast and efficient way.</p>
<p>Salt allows commands to be executed across large groups of servers. This means systems can be easily managed, but data can also be easily gathered. Quick introspection into running systems becomes a reality.</p>
<p>Remote execution is usually used to set up a certain state on a remote system. Salt addresses this problem as well, the salt state system uses salt state files to define the state a server needs to be in.</p>
<p>Between the remote execution system, and state management Salt addresses the backbone of cloud and data center management.</p></blockquote>
<p>Think Puppet on steroids. And done correctly.</p>
<p>At any event, yes, I&#8217;m looking for a Debian Developer to sponsor me getting it into Debian proper. If you are an Ubuntu Developer, and could help sponsor me getting it into Ubuntu as well, that would be awesome!</p>
]]></content:encoded>
			<wfw:commentRss>http://pthree.org/2011/09/29/salt-packaged-for-debianubuntu/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How To Properly Create And Burn CD/DVD ISO Images From The Command Line</title>
		<link>http://pthree.org/2011/09/26/how-to-properly-create-and-burn-cddvd-iso-images-from-the-command-line/</link>
		<comments>http://pthree.org/2011/09/26/how-to-properly-create-and-burn-cddvd-iso-images-from-the-command-line/#comments</comments>
		<pubDate>Tue, 27 Sep 2011 02:59:31 +0000</pubDate>
		<dc:creator>Aaron Toponce</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://pthree.org/?p=2067</guid>
		<description><![CDATA[Too often, I see the recommendation on forums, IRC, and elsewhere across the internet to use improper tools for creating ISO images. For example, consider the following two commands, both of which are not the correct way to build a CD/DVD image: $ dd if=/dev/scd0 of=cdimage.iso # NO! Or worse yet: $ cat /dev/scd0 > [...]]]></description>
			<content:encoded><![CDATA[<p>Too often, I see the recommendation on forums, IRC, and elsewhere across the internet to use improper tools for creating ISO images. For example, consider the following two commands, both of which are not the correct way to build a CD/DVD image:</p>
<pre>$ dd if=/dev/scd0 of=cdimage.iso # NO!</pre>
<p>Or worse yet:</p>
<pre>$ cat /dev/scd0 > cdimage.iso # NO!</pre>
<p>As you are probably thinking, the problem with the two commands above, is that they provide no error checking while building the image. So, in order to make sure you have all the bits, you need to use another tool, such as using the MD5 hashing algorithm:</p>
<pre>$ md5sum /dev/scd0 cdimage.iso
d642d524dd2187834a418710001bbf82  /dev/cdrom
d642d524dd2187834a418710001bbf82  cdimage.iso</pre>
<p>Thankfully, the hashes above match. But, what if they didn&#8217;t? Then, you get to redo your dd(1) command (or, shudder, cat(1)) from above, and then rerun md5sum(1) to make sure you got all the bits. Doesn&#8217;t sound like much fun to me. Thankfully, there is a better way, one which handles the checksum while doing the copy.</p>
<p>You want to use readom(1) (&#8220;read optical media&#8221;) from the wodim(1) (&#8220;write optical disk media&#8221;) package. Consider the following command:</p>
<pre>$ readom dev=/dev/scd0 f=cdimage.iso # YES!</pre>
<p>If readom(1) fails to get the bits during the copy, it will let you know that it&#8217;s struggling. If it got all the bits, you know you have them all, because of the error checking during the copy. Sure will save you a lot of time running manual hashes when finished.</p>
<p>Now, what about burning a copy of the ISO image? Surely you use dd(1), yes? Something like:</p>
<pre>$ dd if=cdimage.iso of=/dev/scd0 # NO!</pre>
<p>NO! Instead, use wodim(1) directly:</p>
<pre>$ wodim -v -eject cdimage.iso # YES!</pre>
<p>For the same reasons that you want to use readom(1) for creating ISO images from CD/DVD, you want to use wodim(1) for burning ISO images to CD/DVD. What happens if after using dd(1) to create your CD/DVD, the md5sum(1) hash doesn&#8217;t line up with the image? You didn&#8217;t get all the bits, and created a coaster. Use wodim(1) and should it succeed, you can rest assured that you have all the bits.</p>
<p>So, remember, readom(1) and wodim(1) are the tools you want when creating and/or burning ISO images from the command line. Any other tool, and you&#8217;re likely doing it wrong.</p>
]]></content:encoded>
			<wfw:commentRss>http://pthree.org/2011/09/26/how-to-properly-create-and-burn-cddvd-iso-images-from-the-command-line/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Avoid Using which(1)</title>
		<link>http://pthree.org/2011/09/26/avoid-using-which1/</link>
		<comments>http://pthree.org/2011/09/26/avoid-using-which1/#comments</comments>
		<pubDate>Mon, 26 Sep 2011 11:30:40 +0000</pubDate>
		<dc:creator>Aaron Toponce</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://pthree.org/?p=2054</guid>
		<description><![CDATA[This post comes from BashFAQ/081 on Greg&#8217;s Wiki. He argues why you should not be using which(1) to determine if a command is in your $PATH at the end of the page. I&#8217;ll put that argument at the front: The command which(1) (which is often a csh script, although sometimes a compiled binary) is not [...]]]></description>
			<content:encoded><![CDATA[<p>This post comes from <a href="http://mywiki.wooledge.org/BashFAQ/081">BashFAQ/081</a> on Greg&#8217;s Wiki. He argues why you <strong>should not</strong> be using which(1) to determine if a command is in your $PATH at the end of the page. I&#8217;ll put that argument at the front:</p>
<blockquote><p>The command which(1) (which is often a csh script, although sometimes a compiled binary) is <strong>not reliable</strong> for this purpose. which(1) may not set a useful exit code, and it may not even write errors to stderr. Therefore, in order to have a prayer of successfully using it, one must parse its output (wherever that output may be written).</p>
<p>Note that which(1)&#8217;s output when a command is not found is not consistent across platforms. On HP-UX 10.20, for example, it prints &#8220;no qwerty in /path /path /path &#8230;&#8221;; on OpenBSD 4.1, it prints &#8220;qwerty: Command not found.&#8221;; on Debian (3.1 through 5.0 at least) and SuSE, it prints nothing at all; on Red Hat 5.2, it prints &#8220;which: no qwerty in (/path:/path:&#8230;)&#8221;; on Red Hat 6.2, it writes the same message, but on standard error instead of standard output; and on Gentoo, it writes something on stderr.</p></blockquote>
<p>(Quotation and manpage reference additions mine). So, if which(1) is bad news, then what is the &#8220;proper&#8221; way to determine if a command is in your $PATH? Well POSIX has an answer, and not surprisingly, the command to use is &#8220;command&#8221;:</p>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;"># POSIX</span><br />
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">command</span> <span style="color: #660033;">-v</span> qwerty <span style="color: #000000; font-weight: bold;">&gt;/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null; <span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> qwerty exists<br />
<span style="color: #000000; font-weight: bold;">else</span><br />
&nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> qwerty does not exist<br />
<span style="color: #000000; font-weight: bold;">fi</span></div></td></tr></tbody></table></div>
<p>The &#8220;command&#8221; built-in also returns true for shell built-ins. If you absolutely must check only PATH, the only POSIX way is to iterate over it:</p>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;"># POSIX</span><br />
IsInPath <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #7a0874; font-weight: bold;">&#40;</span><br />
&nbsp; <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$#</span> <span style="color: #660033;">-eq</span> <span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;$1&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #7a0874; font-weight: bold;">return</span> <span style="color: #000000;">2</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">set</span> <span style="color: #660033;">-f</span>; <span style="color: #007800;">IFS</span>=:<br />
&nbsp; <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #c20cb9; font-weight: bold;">dir</span> <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #007800;">$PATH</span>; <span style="color: #000000; font-weight: bold;">do</span><br />
&nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-z</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$dir</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #007800;">dir</span>=. <span style="color: #666666; font-style: italic;"># Legacy behaviour</span><br />
&nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-x</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$dir</span>/$1&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #7a0874; font-weight: bold;">return</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">done</span><br />
&nbsp; <span style="color: #7a0874; font-weight: bold;">return</span> <span style="color: #000000;">1</span><br />
<span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">if</span> IsInPath qwerty; <span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> qwerty exists<br />
<span style="color: #000000; font-weight: bold;">else</span><br />
&nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> qwerty does not exist<br />
<span style="color: #000000; font-weight: bold;">fi</span></div></td></tr></tbody></table></div>
<p>There are also Bash built-ins that can be used, should you have Bash installed on your system:</p>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;"># Bash using the 'hash' built-in</span><br />
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">hash</span> qwerty <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null; <span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> qwerty exists<br />
<span style="color: #000000; font-weight: bold;">else</span><br />
&nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> qwerty does not exist<br />
<span style="color: #000000; font-weight: bold;">fi</span></div></td></tr></tbody></table></div>
<p>Or:</p>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;"># Bash using the 'type' built-in</span><br />
<span style="color: #666666; font-style: italic;"># type -P forces a PATH search, skipping builtins and so on</span><br />
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">type</span> <span style="color: #660033;">-P</span> qwerty <span style="color: #000000; font-weight: bold;">&gt;/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null; <span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> qwerty exists<br />
<span style="color: #000000; font-weight: bold;">else</span><br />
&nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> qwerty does not exist<br />
<span style="color: #000000; font-weight: bold;">fi</span></div></td></tr></tbody></table></div>
<p>If you prefer the ZSH (my addition not present in the wiki), as I do, then you can look in the $commands associative array:</p>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;"># ZSH using the $commands associative array</span><br />
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$commands</span><span style="color: #7a0874; font-weight: bold;">&#91;</span>qwerty<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&gt;/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> qwerty exists<br />
<span style="color: #000000; font-weight: bold;">else</span><br />
&nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> qwerty does not exist<br />
<span style="color: #000000; font-weight: bold;">fi</span></div></td></tr></tbody></table></div>
<p>I like that at the end of the FAQ, he gives a shell script for using which(1) should it be absolutely necessary. Not only do you have to test for exit code, but you also have to test for common strings in the output, seeing as though which(1) doesn&#8217;t always use exit codes properly:</p>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;"># Bourne. &nbsp;Last resort -- using which(1)</span><br />
<span style="color: #007800;">tmpval</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #007800;">LC_ALL</span>=C <span style="color: #c20cb9; font-weight: bold;">which</span> qwerty <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">1</span><span style="color: #000000; font-weight: bold;">`</span><br />
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">test</span> <span style="color: #007800;">$rc</span> <span style="color: #660033;">-ne</span> <span style="color: #000000;">0</span>; <span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; <span style="color: #666666; font-style: italic;"># FOR NOW, we'll assume that if this machine's which(1) sets a nonzero</span><br />
&nbsp; <span style="color: #666666; font-style: italic;"># exit status, that it actually failed. &nbsp;I've yet to see any case where</span><br />
&nbsp; <span style="color: #666666; font-style: italic;"># which(1) sets an erroneous failure -- just erroneous &quot;successes&quot;.</span><br />
&nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;qwerty is not installed. &nbsp;Please install it.&quot;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">else</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># which returned 0, but that doesn't mean it succeeded. &nbsp;Look for known error strings.</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">case</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$tmpval</span>&quot;</span> <span style="color: #000000; font-weight: bold;">in</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">*</span>no\ <span style="color: #000000; font-weight: bold;">*</span>\ <span style="color: #000000; font-weight: bold;">in</span>\ <span style="color: #000000; font-weight: bold;">*|*</span>not\ found<span style="color: #000000; font-weight: bold;">*|</span><span style="color: #ff0000;">''</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;qwerty is not installed. &nbsp;Please install it.&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">;;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Congratulations -- it seems you have qwerty (in <span style="color: #007800;">$tmpval</span>).&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">;;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">esac</span><br />
<span style="color: #000000; font-weight: bold;">fi</span></div></td></tr></tbody></table></div>
<p><strong>CONCLUSION:</strong><br />
You have many options to find whether or not a command exists in your $PATH, some POSIX, some proper built-ins. Regardless, you should be able to build platform-independent scripts using the proper tools, and using which(1) is not the right tool for the job. Hopefully, this has convinced you of that.</p>
]]></content:encoded>
			<wfw:commentRss>http://pthree.org/2011/09/26/avoid-using-which1/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Alphabet Book</title>
		<link>http://pthree.org/2011/09/18/alphabet-book/</link>
		<comments>http://pthree.org/2011/09/18/alphabet-book/#comments</comments>
		<pubDate>Mon, 19 Sep 2011 00:32:26 +0000</pubDate>
		<dc:creator>Aaron Toponce</dc:creator>
				<category><![CDATA[Debian]]></category>

		<guid isPermaLink="false">http://pthree.org/2011/09/18/alphabet-book/</guid>
		<description><![CDATA[Our family has been tasked with drawing a picture for each letter of the alphabet in an alphabet book for my soon-to-be-born niece. The letter &#8216;d&#8217; was available, so it was obvious to me what should be drawn. I know when she starts flipping through the pages of the book, she will love this page [...]]]></description>
			<content:encoded><![CDATA[<p><img style="display:block;margin-right:auto;margin-left:auto;" alt="image" src="http://pthree.org/wp-content/uploads/2011/09/wpid-IMAG0217.jpg" /></p>
<p>Our family has been tasked with drawing a picture for each letter of the alphabet in an alphabet book for my soon-to-be-born niece. The letter &#8216;d&#8217; was available, so it was obvious to me what should be drawn. I know when she starts flipping through the pages of the book, she will love this page the best.</p>
]]></content:encoded>
			<wfw:commentRss>http://pthree.org/2011/09/18/alphabet-book/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Why Unix Is Superior</title>
		<link>http://pthree.org/2011/03/27/why-unix-is-superior/</link>
		<comments>http://pthree.org/2011/03/27/why-unix-is-superior/#comments</comments>
		<pubDate>Mon, 28 Mar 2011 04:34:20 +0000</pubDate>
		<dc:creator>Aaron Toponce</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://pthree.org/?p=1834</guid>
		<description><![CDATA[Quick post, outlining what I think makes the Unix family of operating systems superior, including &#8220;unix-like&#8221; operating systems such as GNU/Linux, BSD, and others. Of course, the list isn&#8217;t exhaustive- it&#8217;s just something I threw together in 10 minutes. The motivation of the post was a discussion in ##unix on Freenode. The command line interface. [...]]]></description>
			<content:encoded><![CDATA[<p>Quick post, outlining what I think makes the Unix family of operating systems superior, including &#8220;unix-like&#8221; operating systems such as GNU/Linux, BSD, and others. Of course, the list isn&#8217;t exhaustive- it&#8217;s just something I threw together in 10 minutes. The motivation of the post was a discussion in 	<a href="irc://irc.freenode.net/##unix">##unix on Freenode</a>.</p>
<ol>
<li>The command line interface.</li>
<li>Various shells, including their script syntax.</li>
<li>Builtin programming language support for many languages.</li>
<li>Common Unix utilities, such as grep, rsync, ssh, lsof, and others.</li>
<li>All the supported filesystems (ZFS, Ext4, Reiser, UFS, etc.).</li>
<li>Overall rock-solid stability and reliability.</li>
<li>Lack of viruses, trojans, and other malware.</li>
<li>Tremendous networking capabilities (PPoE, TCP/IP, etc.).</li>
<li>Bulletproof firewall software.</li>
<li>Overall builtin security in general (MACs, PAM, etc.).</li>
<li>Quality user/group management.</li>
<li>System resource usage.</li>
<li>Both vertical and horizontal scaling.</li>
<li>Portability.</li>
<li>Plain text configuration files.</li>
<li>Open source kernel and user-space software.</li>
<li>Based on standards (POSIX, FHS, LSB, etc.).</li>
<li>Vast selection of software choices (various text editors, MUAs, etc.)</li>
<li>Simplicity in software design- do one thing, and do it well.</li>
<li>Mind-blowing hardware support.</li>
<li>Support for hundreds of languages and locales out of the box.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://pthree.org/2011/03/27/why-unix-is-superior/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Various Ways To Shred A Drive</title>
		<link>http://pthree.org/2011/03/09/various-ways-to-shred-a-drive/</link>
		<comments>http://pthree.org/2011/03/09/various-ways-to-shred-a-drive/#comments</comments>
		<pubDate>Thu, 10 Mar 2011 05:00:21 +0000</pubDate>
		<dc:creator>Aaron Toponce</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://pthree.org/?p=1793</guid>
		<description><![CDATA[I&#8217;ve been tasked at work with shredding drives. Not physically, mind you, but digitally. Usually, I grab a copy of the latest version of Knoppix, boot up, pull up a terminal, and grab GNU Shred. Something like: shred -n 3 -v /dev/sda It works well enough. However, it doesn&#8217;t display a real useful progress meter, [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been tasked at work with shredding drives. Not physically, mind you, but digitally. Usually, I grab a copy of the latest version of Knoppix, boot up, pull up a terminal, and grab GNU Shred. Something like:</p>
<pre>shred -n 3 -v /dev/sda</pre>
<p>It works well enough. However, it doesn&#8217;t display a real useful progress meter, other than how far it&#8217;s done in the wipe, thus leaving it up to you to figure out the speed, while filling up your back scroll in the process. There must be a better way.</p>
<p>I used to &#8220;<a href="http://pthree.org/2008/08/17/digital-graffiti/">leave my mark</a>&#8221; (much like a dog marks a fire hydrant), however, this is quite slow. There are other methods, such as using /dev/urandom, but the entropy from urandom relies on SHA1. While fast, it&#8217;s not the speed demon that is AES or other algorithms. There&#8217;s /dev/zero, but how do I get random bits from zeros? And more importantly, does it push the drive to it&#8217;s bandwidth threshold? Of course, I&#8217;ve heard about DBAN, but I&#8217;ve had issues with it booting on certain hardware. Lastly, I would like to have a good progress meter as the data goes down on the drive.</p>
<p>Here&#8217;s a solution that a friend of mine in an IRC channel suggested:</p>
<pre>openssl enc -aes128 -k "foo" &lt; /dev/zero | pv -trb &gt; /dev/sda</pre>
<p>The great thing with this command is two fold:</p>
<ol>
<li>It&#8217;s fast. It pushes the drive to as fast as it can write data.</li>
<li>It provides a convenient progress meter with &#8220;pv&#8221;</li>
</ol>
<p>Again, I&#8217;m shredding drives with pseudorandom data. I&#8217;m not too concerned about the security of the bits going down on the platter. Per corporate regulation, I need to do 3 passes, and I&#8217;m confident that the bits coming out of the pipe from OpenSSL using AES-128 will be sufficient. So, for doing 3 passes, I can script it easily enough:</p>
<pre>for I in 1 2 3; do
    openssl enc -aes128 -k "$I" &lt; /dev/zero | pv -trb &gt; /dev/sda
done</pre>
<p>That works. 1 drive down, 24 to go&#8230;</p>
<p>If you have various ways you shred your drive, let me know, and I&#8217;ll post it below.</p>
]]></content:encoded>
			<wfw:commentRss>http://pthree.org/2011/03/09/various-ways-to-shred-a-drive/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Cloning Debian System Packages</title>
		<link>http://pthree.org/2010/08/19/cloning-debian-system-packages/</link>
		<comments>http://pthree.org/2010/08/19/cloning-debian-system-packages/#comments</comments>
		<pubDate>Thu, 19 Aug 2010 09:43:55 +0000</pubDate>
		<dc:creator>Aaron Toponce</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://pthree.org/?p=1444</guid>
		<description><![CDATA[Just over the past couple of weeks, I have done a few Debian GNU/Linux installations for various people, including myself. I am a minimalist. I like to have installed on my system only exactly what I specify. However, I&#8217;m also a realist, and know that Debian has likely chosen sane defaults in the installer when [...]]]></description>
			<content:encoded><![CDATA[<p>Just over the past couple of weeks, I have done a few Debian GNU/Linux installations for various people, including myself. I am a minimalist. I like to have installed on my system only exactly what I specify. However, I&#8217;m also a realist, and know that Debian has likely chosen sane defaults in the installer when choosing whether or not to install the Desktop or Laptop selections. For servers, I do only a base install, then install OpenSSH, and whatever else is necessary for the server.</p>
<p>So, when installing on a desktop or laptop, I&#8217;m slightly annoyed by the default package sets that are installed. I understand why they&#8217;re chosen, and I&#8217;m definitely not arguing with the decisions made, however, some of the packages just aren&#8217;t for me. So, on my wiki, I&#8217;ve been documenting what should be installed and removed on every Debian GNU/Linux installation I make. As soon as the install finishes, I&#8217;ll login to the system, pull up my wiki, and copy and paste the following commands as root (trying to keep the horizontal scrolling in your browser to a minimum):</p>
<pre># aptitude install abiword apt-file checkconfig chromium-browser clusterssh deborphan flashplugin-nonfree git-core \
gmrun gnumeric htop network-manager openbox openssh-server python-docutils rst2pdf screen tango-icon-theme \
vim vim-gnome xfce4 xfce4-icon-theme xfce4-terminal xscreensaver-data-extra zsh zsh-doc</pre>
<pre># aptitude purge dasher gnome-accessibility gnome-accessibility-themes gnome-mag gnome-orca gok nano \
openoffice.org{,-base,-base-core,-calc,-common,-core,-draw,-emailmerge,-evolution,-filter-binfilter,-filter-mobiledev} \
openoffice.org{-gcj,-gnome,-gtk,-help-en-us,-impress,-java-common,-math,-officebean,-style-galaxy,-style-tango,-thesaurus-en-us,-writer} \
xserver-xorg-input-{all,synaptics,wacom} xserver-xorg-video-{all,apm,ark,ati,chips,cirrus,fbdev,i128,i740,intel,mach64,mga,neomagic} \
xserver-xorg-video-{noveau,nv,openchrome,r128,radeon,radeonhd,rendition,s3,s3virge,savage,siliconmotion,sis,sisusb,tdfx,trident,tseng,v4l,voodoo}</pre>
<p>First, I will identify which xserver-xorg-video driver I&#8217;ll need for the hardware I&#8217;m installing to, and remove that from the purge, even though the VESA driver always works just fine for me, as I&#8217;m certainly no gamer, and it&#8217;s never let me down in my desire to power any video card at any resolution and frequency I&#8217;ve encountered. I&#8217;ll also leave the Synaptics driver in place when installing to a laptop.</p>
<p>Second, I realize that this isn&#8217;t for everybody. Most people won&#8217;t care about having OpenOffice.org or the GNOME accessibility packages installed. I don&#8217;t need them, they free up hard drive space for me, and when running updates, downloads are much faster. So, this works for me.</p>
<p>Lastly, I have a hard time deciding between using GNOME and Openbox for my default desktop. I like the GDM for logging in, and I like the power management features that GNOME brings to the table. However, I like the minimalist approach to Openbox, and its configuration capabilities. I login to both from time-to-time, just in case you noticed that I&#8217;m installing Openbox, but also removing GNOME packages that would only come from a default GNOME install.</p>
<p>I&#8217;ve gotten tired of executing this on every install, and wondered if there was something more I could do. So, <a href="http://identi.ca/notice/46660961">I mentioned my frustration on Identi.ca</a>, not really looking for a reply, but <a href="http://identi.ca/notice/46667461">one came through</a> at any event (<a href="http://identi.ca/conversation/46304157#notice-46660961">thread here</a>). The reply was to use DPKG to get a list of the software that is installed when I&#8217;m finished with my install and purge, then use that list during the next install.</p>
<p>So, how to do this? Well, after you have your system installed the way you want, with all the packages installed and purged to suit your needs, run the following command:</p>
<pre>$ dpkg --get-selections \* > packages.txt</pre>
<p>You now have a text file with all the packages that are installed on your system. So, when doing a fresh Debian install at a later date, it&#8217;s trivial to get these packages installed, so I don&#8217;t have to do the install and purge copy/paste that I was doing before. After installing only the base, and nothing more, login to the system, copy the packages.txt file you created via SCP or some other method to the filesystem, and run the following commands (as root):</p>
<pre># apt-get update
# dpkg --set-selections < packages.txt
# apt-get -u dselect-upgrade</pre>
<p>You now have your system installed with exactly the packages you want installed, and nothing more. Not only that, but the latest version as well. No need to update after you login (Windows, you could learn something here).</p>
<p>To me, this is beautiful. This is a simplistic way to clone a Debian system, without using utilities like Norton Ghost or CloneZilla, either though both have their place in administration. I just love the simplicity and elegance of this. To me, this makes administration fun. When I can solve simple problems with core system tools, I'm a happy admin.</p>
<p>Long live Debian.</p>
]]></content:encoded>
			<wfw:commentRss>http://pthree.org/2010/08/19/cloning-debian-system-packages/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Connecting To Serial Null Modems With GNU Screen</title>
		<link>http://pthree.org/2010/03/23/connecting-to-serial-null-modems-with-gnu-screen/</link>
		<comments>http://pthree.org/2010/03/23/connecting-to-serial-null-modems-with-gnu-screen/#comments</comments>
		<pubDate>Wed, 24 Mar 2010 00:32:01 +0000</pubDate>
		<dc:creator>Aaron Toponce</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://pthree.org/?p=1332</guid>
		<description><![CDATA[The motivation for this post, actually, is that I had heard of the BSD-licensed tmux. I&#8217;ve heard it&#8217;s far more configurable than GNU screen and lighter on resources. So, I thought I&#8217;d install it on my Debian machine, and give it a quick test drive. The first thing I wanted to test, was not attaching [...]]]></description>
			<content:encoded><![CDATA[<p>The motivation for this post, actually, is that I had heard of the <a href="http://tmux.sourceforge.net">BSD-licensed tmux</a>. I&#8217;ve heard it&#8217;s far more configurable than <a href="http://gnu.org/software/screen">GNU screen</a> and lighter on resources. So, I thought I&#8217;d install it on my Debian machine, and give it a quick test drive. The first thing I wanted to test, was not attaching and detaching sessions, but using tmux to connect to serial ports as a null modem. I use this feature with GNU screen all the time, as I&#8217;m constantly in the back of Cisco switches, HPUX ports, and other serial connections in our datacenter at work. However, I found out very quickly that tmux doesn&#8217;t support this feature. In fact, <a href="http://tmux.cvs.sourceforge.net/viewvc/*checkout*/tmux/tmux/FAQ">the developers call it &#8220;bloat&#8221;</a> (emphasis mine):</p>
<blockquote><p>There are still a few features screen includes that tmux omits:</p>
<p>- builtin serial and telnet support; <b>this is bloat</b> and is unlikely to be added to tmux;<br />
- wider platform support, for example IRIX and HP-UX, and for odd terminals.</p></blockquote>
<p>That&#8217;s unfortunate. I&#8217;ve found that when developers call a requested feature &#8220;bloat&#8221;, it&#8217;s usually because they don&#8217;t use it themselves. That may be the case here. I don&#8217;t know. However, I do know that GNU screen supports both serial and telnet connections, and it&#8217;s a valued feature for our team.</p>
<p>So, here&#8217;s how you can use GNU screen to act as a terminal emulator to a serial null modem connection. Just start a screen session on the correct serial device:</p>
<pre>$ screen /dev/ttyS0</pre>
<p>If the connection is too slow, and your serial port can handle faster baud rates, then you can set that instead:</p>
<pre>$ screen /dev/ttyS0 115200</pre>
<p>As is common with null modem connections, if you need to send a break, just send <b>C-a B</b>.</p>
<p>That&#8217;s it. Rather straight forward. I know that using minicom or HyperTerminal can sometimes be a pain, so using a more modern terminal, complete with telnet, multiuser, locking and splitting support can make all the difference in the world. So, why tmux won&#8217;t support this is beyond me, but it sure makes life behind the serial connection just a bit more enjoyable, and a valuable system administration tool.</p>
]]></content:encoded>
			<wfw:commentRss>http://pthree.org/2010/03/23/connecting-to-serial-null-modems-with-gnu-screen/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Installing Debian via USB</title>
		<link>http://pthree.org/2010/02/21/installing-debian-via-usb/</link>
		<comments>http://pthree.org/2010/02/21/installing-debian-via-usb/#comments</comments>
		<pubDate>Sun, 21 Feb 2010 15:50:27 +0000</pubDate>
		<dc:creator>Aaron Toponce</dc:creator>
				<category><![CDATA[Debian]]></category>

		<guid isPermaLink="false">http://pthree.org/?p=1314</guid>
		<description><![CDATA[Last night, I wanted to see if I could get Debian Squeeze loaded on my HP Mini 110, so I set out to accomplish the task, and accomplish it I did. As with most netboks, this HP doesn&#8217;t ship with a CDROM. So, the only way to get an operating system on this guy is [...]]]></description>
			<content:encoded><![CDATA[<p>Last night, I wanted to see if I could get Debian Squeeze loaded on my HP Mini 110, so I set out to accomplish the task, and accomplish it I did. As with most netboks, this HP doesn&#8217;t ship with a CDROM. So, the only way to get an operating system on this guy is either with PXE, or USB (actually, I don&#8217;t even know if PXE-booting works). So, I grabbed an unused USB thumb drive, and set to work.</p>
<p>Before beginning any installation, you should be very familiar with your hardware, so you know what sort of drivers you&#8217;ll need for the installation, and if there will be any compatibility issues. Attempting to put Debian on this machine in the past has failed, due to the network driver not shipping with the Lenny kernel. If you have this netbook, the NIC is an Attansic Technology Atheros AR8132/L1c gigabit ethernet adapter. The driver is open source, however, the hardware is so new, that at the time I had purchased the Mini, the driver hadn&#8217;t been included in the mainline kernel. The wireless is a Broadcom BCM4132, which means the firmware is not open source, and as a result, not included with the Debian installer. So, at the time, there was no way to get this netbook online with Debian. However, with the release of the 2.6.29 kernel, the Aetheros driver needed was included, and the development snapshot of the installer now ships that kernel, so we&#8217;re good to go with a network installation, and getting the computer online.</p>
<p>All the other hardware that I&#8217;ve tested, I have tested before with different hardware other than the Mini, and worked out of the box. So, the installation should be rather straightforward, and booting in the new system should be on par with a working system.</p>
<p>So, in order to perform a Debian GNU/Linux installation via USB, you need only a few things. First, you must grab a boot.img.gz file from the development snapshot of the installer for your hardware. Because the HP Mini is x86 32-bit, <a href="http://mirrors.kernel.org/debian/dists/sid/main/installer-i386/current/images/hd-media/">I grabbed mine here</a>. Now, you also need a CD image file (ISO format) which will contain the necessary software and installation procedures for the install. I prefer to do network installs, so <a href="http://mirrors.kernel.org/debian-cd/5.0.4/i386/iso-cd/">I grabbed a netinst ISO here</a>.</p>
<p>The boot.img.gz file will contain a bootable syslinux kernel and initial ramdisk, which means it will have the drivers necessary for your hardware. Of course, I got mine from a development snapshot, so I could get the Atheros NIC driver from the latest kernel, but if you have older hardware, maybe the stable version of the boot.img.gz would work better for you. You just need to get it from any hd-media directory appropriate for your architecture. The ISO on the other hand contains the base software for installing to disk, the partitioner and other parts of the installer necessary for performing the installation. The boot.img.gz just gets you started.</p>
<p>Now that you have both files, you&#8217;ll need a USB thumb drive that is at least 256MB in size, which shouldn&#8217;t be a problem these days. Insert the USB drive into a  computer with a working Linux operating system, and determine the appropriate device assigned to your newly inserted drive. You can get this information a number of ways. Probably the best way, is to run the following command before you insert the USB drive:</p>
<pre># tail -f -n 0 /var/log/messages</pre>
<p>Then, insert the drive. You&#8217;ll see output from the kernel as it discovers the hardware and assigns a device to the drive. For me, my output was this:</p>
<pre>Feb 21 08:22:28 hermes kernel: [46103.644130] usb 1-7: new high speed USB device using ehci_hcd and address 7
Feb 21 08:22:28 hermes kernel: [46103.789569] usb 1-7: New USB device found, idVendor=13fe, idProduct=1e00
Feb 21 08:22:28 hermes kernel: [46103.789586] usb 1-7: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Feb 21 08:22:28 hermes kernel: [46103.789599] usb 1-7: Product: USB DISK 2.0    
Feb 21 08:22:28 hermes kernel: [46103.789609] usb 1-7: Manufacturer:         
Feb 21 08:22:28 hermes kernel: [46103.789618] usb 1-7: SerialNumber: 077904015F40
Feb 21 08:22:28 hermes kernel: [46103.789974] usb 1-7: configuration #1 chosen from 1 choice
Feb 21 08:22:28 hermes kernel: [46103.790939] scsi5 : SCSI emulation for USB Mass Storage devices
Feb 21 08:22:33 hermes kernel: [46108.838495] scsi 5:0:0:0: Direct-Access              USB DISK 2.0     PMAP PQ: 0 ANSI: 0 CCS
Feb 21 08:22:33 hermes kernel: [46109.101380] sd 5:0:0:0: [sdb] 4030464 512-byte logical blocks: (2.06 GB/1.92 GiB)
Feb 21 08:22:33 hermes kernel: [46109.101984] sd 5:0:0:0: [sdb] Write Protect is off
Feb 21 08:22:33 hermes kernel: [46109.107382]  sdb:
Feb 21 08:22:33 hermes kernel: [46109.174851] sd 5:0:0:0: [sdb] Attached SCSI removable disk</pre>
<p>So, in my case, the newly inserted drive is /dev/sdb. So, armed with this information, I can now prepare the USB drive. This next step should be handled with caution. If you type in, whether intentionally or accidentally the wrong device, disasterous consequences may abound. As a friend once told me: &#8220;read twice, type once&#8221;. Think what you&#8217;re doing before you do it. So, at this point, I just need to send the contents of the boot.img.gz file to the new disk. I would not recommend doing it to a partition, but instead doing it to the whole drive. If you inserted your thumb drive, and you noticed in the output that you have a /dev/sdb and /dev/sdb1, then this means you have a partition table outlining a single partition on the drive /dev/sdb. Ignore the partition, work with the drive itself.</p>
<p>Make sure your USB drive is NOT mounted, then type in the following (this next step will remove any existing partitions and data on the drive):</p>
<pre># umount /dev/sdb*
# zcat boot.img.gz > /dev/sdb</pre>
<p>This should only take a couple of seconds to finish. At this point, you&#8217;ll have a FAT16 formatted USB drive with a syslinux install on the drive. You will now need to mount the drive and copy the ISO image to the mount point.</p>
<pre># mount /dev/sdb /mnt
# cp debian-504-i386-netinst.iso /mnt
# sync
# umount /dev/sdb</pre>
<p>At this point, you have a fully prepared USB thumb drive with all the necessary bits in place to perform a USB installation on your netbook, or other hardware. When you boot from the USB stick, you&#8217;ll have the familiar Debian installer interface- automated installation, beginner and expert modes and a rescue environment. Because of this, I would recommend keeping the USB stick close at hand, should you need to troubleshoot your installation any time soon.</p>
<p>When you initialize the installation, the installer will look for an ISO file that contains the Debian software. It will start with /dev/sda, and work it&#8217;s way device-by-device and partition-by-partition in order, until it finds the ISO file. Because my drive is also recognized as /dev/sdb on my netbook, it only take a couple seconds. After it has found the ISO image, you&#8217;re ready to install, just like you would if you had booted off a CD.</p>
<p>That&#8217;s it! Rather straightforward, I think. You only need four times really to complete the job:</p>
<ul>
<li>You computer</li>
<li>A USB disk</li>
<li>A boot.img.gz file</li>
<li>An ISO containing the Debian software</li>
</ul>
<p>Good luck on your USB installs!</p>
]]></content:encoded>
			<wfw:commentRss>http://pthree.org/2010/02/21/installing-debian-via-usb/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Does Debian Deviate From Standards Or Upstream?</title>
		<link>http://pthree.org/2010/01/04/does-debian-deviate-from-standards-or-upstream/</link>
		<comments>http://pthree.org/2010/01/04/does-debian-deviate-from-standards-or-upstream/#comments</comments>
		<pubDate>Mon, 04 Jan 2010 14:06:29 +0000</pubDate>
		<dc:creator>Aaron Toponce</dc:creator>
				<category><![CDATA[Debian]]></category>

		<guid isPermaLink="false">http://pthree.org/?p=1224</guid>
		<description><![CDATA[Recently, I got into a discussion with a friend of mine that I have a great deal of respect for. After having our discussion, my respect for him has grown. The discussion was about whether or not Debian and Ubuntu have deviated from standard practice regarding Paul Vixie&#8217;s cron implementation. The idea is simple. On [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, I got into a discussion with a friend of mine that I have a great deal of respect for. After having our discussion, my respect for him has grown. The discussion was about whether or not Debian and Ubuntu have deviated from standard practice regarding Paul Vixie&#8217;s cron implementation.</p>
<p>The idea is simple. On Fedora and SUSE based operating systems, if /etc/cron.allow AND /etc/cron.deny do not exist on the system, then only the super-user can install cron jobs using the crontab command. However, on Debian and Ubuntu, both files are missing, yet everyone on the system can install a cron job. So, the question was: why does Debian and Ubuntu feel the need to be different from everyone else? Why do they need to deviate from standard practice?</p>
<p>Now, for the record, I don&#8217;t care if Debian deviates&#8230; much. Debian is an operating system. Sometimes, I think those in the Free Software and GNU/Linux world forget that. Operating systems are free to make the changes necessary for their platform as they see fit. Those changes will likely either make users happy and make the operating system popular, like Ubuntu, or they won&#8217;t be good changes, and likely will lose users, like, well, Gentoo (sorry guys, but you have seen better days). I&#8217;m all for changes that are thought out and that bring obvious or non-obvious benefits. For example, Debian Squeeze moving away from System V Init to Upstart.</p>
<p>So, the question remains: Is Debian deviating with Vixie cron from what would be considered &#8220;standard practice&#8221;? Well, to start, I pulled up the crontab(1) man page to see what it says regarding the matter. On Debian, this is what I found:</p>
<blockquote><p>If  the /etc/cron.allow file exists, then you must be listed therein in order to be allowed to use this command.  If the  /etc/cron.allow  file does  not  exist  but the /etc/cron.deny file does exist, then you must not be listed in the /etc/cron.deny file in order to use this  command. If neither of these files exists, then depending on site-dependent configuration parameters, only the super user will be allowed to use  this command,  or  all  users will be able to use this command. For standard Debian systems, all users may use this command.</p></blockquote>
<p>I pulled up the same man page on Fedora, and this is what I found:</p>
<blockquote><p>If the cron.allow file exists, then you must be listed therein in order to be allowed to use this command.  If the  cron.allow  file  does  not exist but the cron.deny file does exist, then you must not be listed in the cron.deny file in order to use this command.  If neither  of  these files  exists, only the super user will be allowed to use this command.</p></blockquote>
<p>Both man pages document exactly what the behavior of crontab is should both /etc/cron.allow and /etc/cron.deny be missing. Further, the crontab(1) man page mentions a site-wide configuration file for this behavior. On Debian, by default, I reached for /etc/default/cron to find this configuration. Nothing in there seemed to lead me to this behavior. Pulling up /etc/sysconfig/crond on Fedora also lacked the information I was looking for. I dug through /etc/pam.d/cron, /etc/crontab, /etc/init/cron, /etc/init.d/cron, /etc/security/access and just about any other possible configuration file that might be related, and came up empty-handed every time.</p>
<p>So, when in doubt, Use the Source Luke. So, I went to the Debian packaging site to grab the cron source. Why there rather than upstream? Because Debian ships the upstream pristine source in one tarball with the Debian-specific patches in another tarball. This way, I can see what is being patched while staring at the source directly. While I was at it, I grabbed the source RPM from Fedora as well. However, I grabbed it from Fedora 8, as it seems Red Hat has forked Vixie cron to &#8220;cronie&#8221; around Fedora 9, and I wanted to compare apples to apples.</p>
<p>Now, before I dug through the source, I found one bit of information that actually started laying to rest my suspicions. Paul Vixie developed cron for BSD 4.3. So, I would imagine that Vixie cron is still running on BSD systems, and that the default, intended behavior from Paul Vixie himself would be present on the BSDs. Curious, I fired up FreeBSD, and read the crontab(1) man page:</p>
<blockquote><p>If the allow file exists, then you must be listed therein in order to be allowed to use this command.  If the allow file does not exist but the deny file does exist, then you must not be listed in the deny file in order to use this command.  If neither of these files exists, then depending on site-dependent configuration parameters, only the super user will be allowed to use this command, or all users will be able to use this command.  The format of these files is one username per line, with no leading or trailing whitespace.  Lines of other formats will be ignored, and so can be used for comments.</p></blockquote>
<p>Interesting. Even FreeBSD says that depending on site-wide configuration parameters, either only the super-user will be able to use crontab or everyone. This is the same wording in the Debian man page. Curious, I looked, and sure enough, both the allow and deny files are missing in /var/cron/, and yet everyone on the system can install cron jobs. This is telling me that Debian is not deviating from upstream, and that Red Hat is. However, I have the source, let&#8217;s see what that says.</p>
<p>First, I cracked open the Fedora patches to see if the patch was obvious. To be honest, I was a bit overwhelmed by the sheer number of patches Fedora was applying. Most were for PAM and SELinux, however. But, there was a patch for the crontab(1) man page, and there was a patch against crontab itself. After a bit of digging and parsing the C files, it seemed clear to me that Red Hat was patching crontab to only allow root to install a cron job if both the allow and deny files are missing. This patch does not exist in Debian, nor could I find it in FreeBSD.</p>
<p>So, it seemed clear. Debian was in fact not changing the default behavior of cron, but it was Red Hat who was doing the changing. Further, despite what the documentation says, I could find no site-wide configuration file to modify this behavior- even referenced in the source code. The only way to make the change was to change the code before compilation (so maybe we should submit a bug on the man page).</p>
<p>Digging deeper, I learned that there are many cron systems available for GNU/Linux. It appears Arch Linux is shipping dcron by default (Dillon&#8217;s cron), Red Hat has forked Vixie cron to cronie, and Debian and Ubuntu both utilize or will utilize Upstart, which will eventually replace cron entirely. It&#8217;s my understanding that launchd on Mac OS X has also replaced cron (although I haven&#8217;t verified).</p>
<p>Generally, when I got into discussions with various people about Debian or Ubuntu changing this, that or the other for whatever reason, nine times out of ten, it has been my experience that Debian is not the one deviating, but it is the one who is doing the accusing that is deviating. This example with cron has only been one. I&#8217;ve had discussions like this many times before. The only real solid example of Debian deviating from standard that I can come up with quickly off the top of my head, is Apache. The /etc/apache2/(sites,modules}-{available,enabled}/ directories are a break from standard. However, I have found that I prefer this configuration to upstream vanilla, as it makes administering specific modules and websites a bit easier to maintain without affecting others. This is a change that is long term beneficial to Debian.</p>
<p>In conclusion, what does this mean? Is Debian better than Fedora/RHEL/CentOS or any other operating system? While I prefer it on my systems, the answer is of course no. But, when breaking from standard practice is called into question, I&#8217;m glad Debian sticks as close to upstream as possible. I understand the need for patches where appropriate, but I would prefer as vanilla as possible so I&#8217;m not a fish out of water when I need to move to another operating system that is deploying the same technology. At least from that point I&#8217;ll be able to see the changes the new system is making. I understand Arch Linux is about as vanilla as you can get, but until they separate the non-free from the free software and GPG sign their packages, I won&#8217;t run it.</p>
<p>Debian it is for me, and I&#8217;m glad they have the philosophies they do.</p>
]]></content:encoded>
			<wfw:commentRss>http://pthree.org/2010/01/04/does-debian-deviate-from-standards-or-upstream/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>Debian &#8211; The Universal Operating System</title>
		<link>http://pthree.org/2009/11/17/debian-the-universal-operating-system/</link>
		<comments>http://pthree.org/2009/11/17/debian-the-universal-operating-system/#comments</comments>
		<pubDate>Wed, 18 Nov 2009 03:10:37 +0000</pubDate>
		<dc:creator>Aaron Toponce</dc:creator>
				<category><![CDATA[Debian]]></category>

		<guid isPermaLink="false">http://pthree.org/?p=1191</guid>
		<description><![CDATA[The other day, I blogged about the Debian Installer, and I stated that I find it to be one of the most flexible and possibly most powerful operating system installers. Well, continuing with a series of posts on Debian, I want to mention how flexible the operating system is by itself, from installing to running. [...]]]></description>
			<content:encoded><![CDATA[<p>The other day, I blogged about the Debian Installer, and I stated that I find it to be one of the most flexible and possibly most powerful operating system installers. Well, continuing with a series of posts on Debian, I want to mention how flexible the operating system is by itself, from installing to running. The claim from the Debian project that it is &#8220;The Universal Operating System&#8221; is spot on, and I hope this post shows you really how universal it truly is.</p>
<p>First off, let me start by saying that Debian isn&#8217;t perfect. No operating system is. However, I find the flexibility of Debian extremely powerful. So powerful, in fact, that Debian can meet the needs of most individuals and situations. While it may not meet the needs of all individuals all the time, I&#8217;m confident that it can either meet the needs of all individuals some of the time, or some of the individuals all the time. Let&#8217;s take a look.</p>
<p><strong>Installation</strong><br />
First, as mentioned in my previous post, the Debian installer is fantastic. I won&#8217;t cover everything here that I already covered in that post, but I will mention a few things. To start, you can download the entire 5-disk DVD set, in addition to a 1-disk DVD update to get you caught up to the latest stable release, and use this set as your software repository, keeping your system completely offline, should you so desire. You could also download 31 CDs, including 5 additional update CDs for the same thing, should you not have a DVD burner at your disposal.</p>
<p>Of course, not everyone is up do downloading 30GB of software, so, should you desire, you could download just the first DVD or CD to do a complete base &#8220;default&#8221; install. This way, you&#8217;ve only downloaded ~5GB if you grabbed the DVD, or ~700MB if you grabbed the CD. Much better than 30GB.</p>
<p>But, Debian doesn&#8217;t stop there. Even 700MB might be too much. So, you can download &#8220;net installers&#8221; which are substantially smaller images. These installers come in two flavors- businesscard and netinst. The businesscard images are designed to be burned on business card CDs, which only hold 50MB total. As a result, these are great to carry in wallets (I do myself) should you be a Debian system administrator. The netinst image is a bit bigger, roughly ~170MB, give or take. The different with these from the business card images is they contain the base software on the ISO, where the business card relies on an external software repository for that.</p>
<p>Aside from ISOs, you can install Debian from a USB drive, PXE or from a local hard disk should you desire. Debian ships expansive documentation covering how to do each of these in detail, so you&#8217;re not left stranded.</p>
<p><strong>Releases</strong><br />
Part of what makes Debian GNU/Linux the universal operating system is the architecture itself. The developers of Debian want to reach as many people as possible with the widest array of hardware and software, while not compromising the philosophies in regards to software itself. As such, the developers of Debian have split the software repositories into 6 repositories:</p>
<ul>
<li><b>oldstable</b>: This is the release that was previously the &#8220;stable&#8221; release. This software is supported for one year by the security team after it has become &#8220;oldstable&#8221;. If a new stable release happens within that year, then this release will become &#8220;oldoldstable&#8221; for the remainder of the year, with the new oldstable receiving a new full year of security updates. This is currently aliased to &#8220;etch&#8221;.</li>
<li><b>stable</b>: This is currently aliased to &#8220;lenny&#8221;. The stable release is the officially supported release by the security team, meaning that security updates and bug fixes are applied in a timely manner.</li>
<li><b>testing</b>: This release becomes the test bed for the next stable release. It has filed against it a number of &#8220;release critical&#8221; bugs. This count must reach as close to zero as humanly possible, while still keeping the idea of a close release at hand before becoming the next stable. Packages enter this release from the &#8220;unstable&#8221; branch only after a stringent testing criteria. The testing criteria is:
<ul>
<li>It must have been in unstable for 10, 5 or 2 days, depending on the urgency of the upload.</li>
<li>It must be compiled and up to date on all architectures it has previously been compiled for in unstable.</li>
<li>It must have fewer release-critical bugs than, or the same number as, the version currently in &#8220;testing&#8221;.</li>
<li>All of its dependencies must either be satisfiable by packages already in &#8220;testing&#8221;, or be satisfiable by the group of packages which are going to be installed at the same time.</li>
<li>The operation of installing the package into &#8220;testing&#8221; must not break any packages currently in &#8220;testing&#8221;.</li>
</ul>
<p>        A package which is said to pass 3 of the above criteria is said to be a &#8220;valid candidate&#8221;. Packages in this release do not get security updates from the security team. This release is currently aliased to &#8220;squeeze&#8221;. This release is also coined a &#8220;rolling release&#8221; as there are no release dates, but updates come in on a near daily basis, fixing bugs and preparing for the next stable release.</li>
<li><b>unstable</b>: As the release name implies, packages here are not guaranteed to be stable. Packages could break other packages in this release, and regularly do. Security updates are not applied to packages in this release, however, due to the nature of the release, most packages here are bleeding edge with the latest versions. This release is permanently aliased to &#8220;sid&#8221;. It is also considered a &#8220;rolling release&#8221; like testing.</li>
<li><b>experimental</b>: This release is not indented for installs. It is solely suited for package building, testing and signing. Packages entering this release have just come through the package queue, and are brand new, usually upstream as well. Quite often, packages here are still in development, usually alpha quality. Packages should not be installed from here, as they can be potentially dangerous to your system, even for experienced users.</li>
<li><b>volatile</b>: The packages in the stable release sometimes get old out outdated, as the time between releases could be great. This not only includes binaries, but configuration files, libraries, databases and other pieces of software. As such, the volatile release is aimed at keeping things, such as configuration files, more up-to-date. For example, spam blacklists for SMTP servers. It is important for administrators to keep on top of their spam, so keeping up-to-date spam definitions is critical. This release supplies these definitions. Generally, binaries are not included in this release. All package dependencies in this release are satisfiable in the stable release.</li>
</ul>
<p><strong>Kernels</strong><br />
Aside from the 6 software releases, of which stable, testing and unstable are named after Toy Story characters from the Disney/Pixar movie, Debian GNU/Linux ships 4 kernels as well. This is part of the reason for the name &#8220;Debian GNU/Linux&#8221; as the name implies that Debian is an operating system that comprises of mostly GNU software with the Linux kernel. However, other kernels and software can be added. As such, the four kernels we have are:</p>
<ul>
<li>Debian GNU/Linux</li>
<li>Debian GNU/kFreeBSD</li>
<li>Debian GNU/Hurd</li>
<li>Debian GNU/NetBSD</li>
</ul>
<p>Debian GNU/kFreeBSD is the furthest developed of the three kernels outside of the Linux kernel mentioned above. Currently, the FreeBSD kernel has landed in the &#8220;testing&#8221; release, meaning it will be fully supported by the security team for the next &#8220;stable&#8221; release, codenamed &#8220;Squeeze&#8221;. Advantages of this bring the ZFS filesystem to the Debian userland, and the PF firewall from OpenBSD. Debian GNU/kFreeBSD will only be supported on two architectures out the gate, namely i386 and amd64. Debian GNU/Hurd and Debian GNU/NetBSD are still under active and heavy development. In fact, the Debian project seems to be doing more for the Hurd kernel than the GNU project itself, as most Hurd developers are also Debian developers.</p>
<p><strong>CPU Architectures</strong><br />
If this isn&#8217;t enough, when the Linux kernel initially released, it only supported Intel 386 back in 1991. Fast forward nearly 20 years later, and the Linux kernel supports a massive array of CPU architectures. The Debian project has strived hard to reach as many of them as they can. As such, under the current stable release, Debian GNU/Linux supports 12 CPU architectures, namely:</p>
<ul>
<li>Alpha</li>
<li>AMD64</li>
<li>ARM</li>
<li>EABI ARM (&#8220;ARMEL&#8221;)</li>
<li>HP PA-RISC</li>
<li>Intel x86</li>
<li>Intel IA-64</li>
<li>MIPS (big endian)</li>
<li>MIPS (little endian (&#8220;MIPSEL&#8221;))</li>
<li>PowerPC</li>
<li>IBM S/390</li>
<li>SPARC</li>
</ul>
<p>There are three additional CPU architectures that are under development, and will probably find their way into a &#8220;stable&#8221; release. They are:</p>
<ul>
<li>Armeb (big endian ARM processors)</li>
<li>Atmel&#8217;s 32-bit RISC</li>
<li>Hitachi SuperH</li>
<li>PowerPC64</li>
<li>Renesas Technology&#8217;s 32-bit RISC</li>
</ul>
<p>Now granted, not all of the software that is available for the Debian operating system is available on every architecture. The Intel processors get the most attention obviously, as they hold the largest market share. But, package support for each architecture is growing, and the heavy hitters in the packages selection are likely already compiled for that architecture, such as Apache, NFS, OpenLDAP, GNOME, etc. NetBSD might be the only other operating system in the world with more hardware support than Debian.</p>
<p><strong>Repositories</strong><br />
Coupled with all this software and hardware that Debian GNU/Linux supports, you can choose your software based on your personal philosophies toward software freedom. The Debain project prides itself in being an operating system that ships Free Software as defined by the GNU project. As such, by default, a Debian operating system will only ship Free Software, leaving the proprietary software out. However, holding true to the universal operating system paradigm, they have made proprietary software available for installation, should you choose to use it. So, they&#8217;ve split out their software repositories as follows:</p>
<ul>
<li><b>main</b>: This repository holds the bulk of software installable from Debian. All software in this repository is deemed Free Software as defined by the Debian Free Software Guidelines (see Appendix). This is the only repository enabled by default on a new Debian GNU/Linux install.</li>
<li><b>contrib</b>: This repository also contains Free Software, however, it might rely on proprietary counterparts, such as images or media codecs. This repository must be added by the user manually after install.</li>
<li><b>non-free</b>: This repository contains only proprietary software, or software licensed such that it does not meet the Deian Free Software Guidelines. This repository must be added by the user manually after install.</li>
</ul>
<p><strong>Locality</strong><br />
Because the Debian project is a community-driven project run entirely by volunteers in many countries across the world, it also strives to provide package translation for as many languages as possible. Unlike Red Hat, who can say they support 19 languages out the box, Debian has provided package translation, mostly in part, for nearly 250 languages! However, most of these translations are works in progress, and are not considered complete. If you speak one of these languages, feel free to join in on translating packages to get Debian closer to complete in this area.</p>
<p><strong>Conclusion</strong><br />
Outlining the vast array of software and hardware that Debian supports, coupled with the flexible installer, and package translation for hundreds of languages, truly makes Debian the universal operating system. Nevermind the fact that Debian also appeals to a large crowd of users. Everyone from complete &#8220;newbs&#8221; to the ultimate hardcore hacker can easily fit within the Debian ecosystem.</p>
]]></content:encoded>
			<wfw:commentRss>http://pthree.org/2009/11/17/debian-the-universal-operating-system/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>The Debian Installer &#8211; The Most Flexible Linux Installer</title>
		<link>http://pthree.org/2009/11/15/the-debian-installer-the-most-flexible-linux-installer/</link>
		<comments>http://pthree.org/2009/11/15/the-debian-installer-the-most-flexible-linux-installer/#comments</comments>
		<pubDate>Sun, 15 Nov 2009 23:53:23 +0000</pubDate>
		<dc:creator>Aaron Toponce</dc:creator>
				<category><![CDATA[Debian]]></category>

		<guid isPermaLink="false">http://pthree.org/?p=1186</guid>
		<description><![CDATA[I was just recently blown away by what I can accomplish with the Debian installer on getting Debian installed on a system. I used to think that the openSUSE installer was the most flexible Linux installer, with Anaconda running a close second, but I think I&#8217;m going to at least put the Debian installer in [...]]]></description>
			<content:encoded><![CDATA[<p>I was just recently blown away by what I can accomplish with the Debian installer on getting Debian installed on a system. I used to think that the openSUSE installer was the most flexible Linux installer, with Anaconda running a close second, but I think I&#8217;m going to at least put the Debian installer in a 2-way tie for first with openSUSE. The only reason I would say that, is because the openSUSE installer uses a hub-and-spoke design to installing the operating system. This means you can pick and choose what you want to install, rather than going through the entire installer itself. Further, the openSUSE installer supports installing from a SMB share on a Windows network, with neither Anaconda nor the Debian installer support (that I can tell).</p>
<p>However, one thing that continues to impress me about the Debian installer is the extreme amount of choices in which to get Debian installed on your system. You can pick any path, ranging from the complete newbie-have-the-installer-choose-everything-for-you to total hacker control over what you want installed, and everything in between. Looking over the installer, here&#8217;s a quick list of what I&#8217;ve come up with, and how to get Debian installed on your system:</p>
<ul>
<li><b>Text vs Graphical</b>- The Debian installer supports both a text mode and a graphical mode for getting the operating system installed. When booting the installer, you are presented with a menu that allows you to choose which method you want to take.</li>
<li><b>Beginner vs Expert</b>- Further, if you want total control over what gets installed on your system, you can choose to take the expert path. This will ask you many more questions on what you want to install and how you want it configured. As a result, the installations takes a bit longer to get through, but if you&#8217;ve done it several times, it&#8217;s no biggie.</li>
<li><b>Local vs Remote</b>- An operating system installer wouldn&#8217;t be complete without the ability to do local as well as remote installations. The Debian installer supports setting up both a VNC server and an OpenSSH server for remotely installing the operating system. It also supports &#8220;bootstrapping&#8221;.</li>
<li><b>Manual vs Automatic</b>- Installing the operating system here and there, one at a time is fine for manual installs. However, if you need many installations to take place, or you want the exact same install to go down on many machines, then you can do an automated install using preseed. There are other ways to do automatic installs, such as Kickstart, Kickseed and FAI.</li>
<li><b>Installation vs Rescue mode</b>- Let&#8217;s not forget that you&#8217;re not installing Debian all the time. The Debian installer supports a rescue mode which will mount any filesystem on your local computer, and give you the ability to troubleshoot why your computer is in the trenches, and how to get it out. Windows, Mac, GNU/Linux, etc. If you can talk to the filesystem, you can rescue the computer.</li>
</ul>
<p>So, now you&#8217;ve booted the installer. You&#8217;ve loaded the kernel and you&#8217;re ready to start an install. Most experienced Debian users will choose to do a network install. This means that you have access to a server acting as a Debian software repository, from which you&#8217;ll pull down the packages. Of course, if you don&#8217;t have access to a software repository, you can download all the CD images or DVD images, and do an install completely disconnected from any network. Once the installer is ready to go, you have a variety of options on getting Debian installed on your system. First, let&#8217;s look at different ways on getting the installer booted:</p>
<ul>
<li><b>PXE</b>- The Debian installer can be loaded through network booting via PXE using TFTP. If you have a TFTP server, and probably DHCP and DNS as well, setup, you can make installs rather painless using this preferred method.</li>
<li><b>CD/DVD</b>- This is probably the most &#8220;tried and true&#8221; method for getting Debian onto your system. Downloading and burning bootable CDs or DVDs are a great way to get Debian installed, even if using optical media is the slowest method of doing so.</li>
<li><b>USB</b>- I personally love this option, as I don&#8217;t have to waste CDs. I can create a bootable USB drive by downloading, uncompressing and copying over a boot.img.gz to the drive. Then, I mount the drive, and copy over an ISO image I want to use for the installer, and use this newly created bootable drive to install Debian.</li>
<li><b>Local Hard Disk</b>- Lastly, you can start the Debian installer by booting from a partition on a local disk to your system. You just grab a Linux kernel and initial RAM disk, as well as an ISO image, copy it to the front of the disk, make some configuration changes, and reboot. This method is completely host operating system independent.</li>
</ul>
<p>Once the installer is up and running, you now have a slew of options on how to get access to the software for the install. This is where I think the openSUSE installer might have the upper hand, as it supports installing from a SMB share on a Windows network. However, your options are far from limited:</p>
<ul>
<li><b>HTTP</b>- Accessing a Debian software repository via HTTP is the preferred method, especially if the repository is local to your network. And setting up an HTTP software repository is rather trivial if you have the software to do an install.</li>
<li><b>FTP</b>- Of course, you can do the same thing with FTP as you can with HTTP. It&#8217;s rather trivial to get software of an FTP repository for the install.</li>
<li><b>NFS</b>- If you have an NFS server, you can export the repository over the network, and do an installation over NFS.</li>
<li><b>CD/DVD</b>- As already mentioned, you can do a complete offline install by using the CDs or DVDs. This is a very slow method for accessing the software packages, but it is rather trivial.</li>
<li><b>ISO</b>- As already mentioned, you can use ISO images for the software source. These can be placed on a CDROM or on an external USB drive. Setting either of these up is slightly different than just burning an image to disk, but it&#8217;s still rather trivial, and doesn&#8217;t take much time. Plus, it&#8217;s fast, and light.</li>
</ul>
<p>Once the installer has booted, the kernel has been loaded, and other configuration parameters setup, the flexibility of the installer doesn&#8217;t stop here. You can install Debian on a RAID array using software RAID. You can setup LVM. You have full encryption support, with even determining the type of encryption you want to support (AES, Twofish, Blowfish, etc) and the key strength. When the drives are setup, with partitions, LVM or RAID, you now have the option to install software. You can choose to just do a &#8220;base install&#8221; which installs only the bare minimum for a bootable operating system. You can install necessary system tools, a desktop environment, with or without laptop support, and so forth. You can choose to have root login or not by using sudo. You have access to two TTYs during the install, from which you can add many users, setup groups, do additional configuration, and so forth before rebooting into your new install.</p>
<p>The options seem to be virtually endless! I was a Red Hat and SUSE trainer for a bit, and I really grew to love the Anaconda an openSUSE installers. They are powerful, flexible installers. However, after learning what was possible with Debian, it seemed clear to me that the Debian installer held the upper hand. Not because I prefer Debian for my default operating system on all my computers, but because of what was immensely possible with it.</p>
<p>If you are a Debian system administrator, either personally or professionally, I would recommend spending some time with the installer to get a feel for what you can do with it. I think you&#8217;ll find that it&#8217;s rather impressive, keeping up very well with the &#8220;enterprise&#8221; solutions that exist out there. Also, spending some time on Google will show you a vast array of documentation on how to use the Debian installer to its fullest. <a href="http://d-i.alioth.debian.org/manual/en.i386/apas02.html">This document might be a good start for you</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://pthree.org/2009/11/15/the-debian-installer-the-most-flexible-linux-installer/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
	</channel>
</rss>

