<?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>erdelynet.com &#187; OpenBSD</title>
	<atom:link href="http://erdelynet.com/category/tech/openbsd/feed/" rel="self" type="application/rss+xml" />
	<link>http://erdelynet.com</link>
	<description>Mike Erdely's website (still faster than Scott's blog)</description>
	<lastBuildDate>Tue, 01 Jun 2010 04:24:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Detecting My Wifi Network</title>
		<link>http://erdelynet.com/tech/openbsd/detecting-my-wifi-network/</link>
		<comments>http://erdelynet.com/tech/openbsd/detecting-my-wifi-network/#comments</comments>
		<pubDate>Tue, 31 Mar 2009 22:13:57 +0000</pubDate>
		<dc:creator>merdely</dc:creator>
				<category><![CDATA[OpenBSD]]></category>

		<guid isPermaLink="false">http://erdelynet.com/?p=297</guid>
		<description><![CDATA[On my laptop, I generally don&#8217;t have /etc/hostname.* files. Since I don&#8217;t know where I&#8217;m going to be, I don&#8217;t know which interface I&#8217;m going to be using. So, I&#8217;ll manually run `sudo dhclient em0` or `sudo ifconfig ral0 nwid foo &#38;&#38; sudo dhclient ral0`. But, I&#8217;m often using my home wireless network. So, I [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.openbsd.org/orders.html"><img src="http://www.openbsd.org/art/puffy/puflogv200X130.gif" alt="OpenBSD" width="200" height="130" border="0" align="right" /></a>On my laptop, I generally don&#8217;t have /etc/hostname.* files.  Since I don&#8217;t know where I&#8217;m going to be, I don&#8217;t know which interface I&#8217;m going to be using.  So, I&#8217;ll manually run <tt>`sudo dhclient em0`</tt> or <tt>`sudo ifconfig ral0 nwid foo &amp;&amp; sudo dhclient ral0`</tt>.  But, I&#8217;m often using my home wireless network.</p>
<p>So, I added a little bit of magic to my /etc/rc.local:</p>
<p><span id="more-297"></span></p>
<blockquote>
<pre>## wifi
if [ "$1" = "" -o "$1" = "wifi" ]; then
  ifconfig ral0 up

  ## Reset ral0
  ifconfig ral0 -bssid -chan media autoselect nwid "" -nwkey -wpa -wpapsk

  ## If at home or at Dad's
  if [ `ifconfig ral0 scan | grep -c "00:0f:66:18:62:e0"` -gt 0 ]; then
    /sbin/ifconfig ral0 nwid MySsid wpa wpapsk `/sbin/wpa-psk MySsid MyKey` &gt; /dev/null 2&gt;&amp;1
    /sbin/dhclient ral0 &gt; /dev/null 2&gt;&amp;1
    echo -n ' wifi'
  else
    ifconfig ral0 down
  fi
fi</pre>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://erdelynet.com/tech/openbsd/detecting-my-wifi-network/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Using foo2zjs with OpenBSD lpd</title>
		<link>http://erdelynet.com/tech/openbsd/using-foo2zjs-with-openbsd-lpd/</link>
		<comments>http://erdelynet.com/tech/openbsd/using-foo2zjs-with-openbsd-lpd/#comments</comments>
		<pubDate>Sun, 15 Mar 2009 19:11:54 +0000</pubDate>
		<dc:creator>merdely</dc:creator>
				<category><![CDATA[OpenBSD]]></category>

		<guid isPermaLink="false">http://erdelynet.com/?p=282</guid>
		<description><![CDATA[Getting OpenBSD to print to my HP Color LaserJet 2600n with CUPS was easy. pkg_add cups gtk+2-cups foo2zjs, run cupsd, connect to http://localhost:631/ and add the printer. But, I wanted to take away my need for CUPS and not have to deal with the stupid &#34;Firefox 3 can only print once to CUPS&#34; bug. So, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://h10010.www1.hp.com/wwpc/us/en/sm/WF05a/18972-236251-236268-15077-f51-446153.html"><img src="/images/hp2600n.jpg" alt="HP Color LJ 2006n" width="170" height="190" border="0" align="right" /></a>Getting OpenBSD to print to my HP Color LaserJet 2600n with CUPS was easy.  <code>pkg_add cups gtk+2-cups foo2zjs</code>, run cupsd, connect to http://localhost:631/ and add the printer.  But, I wanted to take away my need for CUPS and not have to deal with the stupid &quot;Firefox 3 can only print once to CUPS&quot; bug.</p>
<p>So, I took the time this afternoon to make foo2zjs work through the OpenBSD stock lpd and foomatic-rip.<br />
<span id="more-282"></span><br />
In short, I copied and gunzipped the PPD file from /usr/local/share/foo2zjs/db/source/PPD into /etc/foomatic as the name of my printer.  I then updated my /etc/printcap and started lpd.</p>
<p>My /etc/printcap:</p>
<blockquote>
<pre>lp|2600n|HP Color LaserJet 2600n:\
        :lp=9100@ganymede.home.erdelynet.com:\
        :af=/etc/foomatic/2600n.ppd:\
        :if=/usr/local/bin/foomatic-rip:\
        :sd=/var/spool/output:\
        :lf=/var/log/lpd-errs:\
        :sh:</pre>
</blockquote>
<p>I added <code>lpd_flags=&quot;-s&quot;</code> to my /etc/rc.conf.local.</p>
<p>I ran the following commands to copy the PPD file:</p>
<blockquote>
<pre>$ cd /etc/foomatic
$ sudo cp /usr/local/share/foo2zjs/db/source/PPD/HP-Color_LaserJet_2600n.ppd.gz 2600n.ppd.gz
$ sudo gunzip 2600n.ppd.gz</pre>
</blockquote>
<p>Thanks to Darrin Chandler&#8217;s <a href="http://stilyagin.com/darrin/blog/2007/05/16/2200/">Printing on OpenBSD II</a> page for some guidance.</p>
]]></content:encoded>
			<wfw:commentRss>http://erdelynet.com/tech/openbsd/using-foo2zjs-with-openbsd-lpd/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Building Ports on a &#8220;Production&#8221; System</title>
		<link>http://erdelynet.com/tech/openbsd/building-ports-on-a-production-system/</link>
		<comments>http://erdelynet.com/tech/openbsd/building-ports-on-a-production-system/#comments</comments>
		<pubDate>Tue, 14 Oct 2008 16:41:56 +0000</pubDate>
		<dc:creator>merdely</dc:creator>
				<category><![CDATA[OpenBSD]]></category>

		<guid isPermaLink="false">http://erdelynet.com/?p=258</guid>
		<description><![CDATA[I am limited to one OpenBSD/amd64 box in my environment. And, unfortunately, it is my &#8220;production&#8221; server (at home). So that I could build and test ports on my &#8220;production&#8221; server without installing millions of dependencies and polluting my environment, I set up a SSH-based chroot environment to build the ports. My server has a [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.openbsd.org/"><img src="/images/puf150X129.gif" width="150" height="129" border="0" alt="Puffy" align="right" /></a>I am limited to one OpenBSD/amd64 box in my environment.  And, unfortunately, it is my &#8220;production&#8221; server (at home).</p>
<p>So that I could build and test ports on my &#8220;production&#8221; server without installing millions of dependencies and polluting my environment, I set up a SSH-based chroot environment to build the ports.<br />
<span id="more-258"></span><br />
My server has a lot of disk space for my use (1.5 TB).  I have it configured to use ~1.2 TB of the available space, leaving ~300 GB available to be partitioned.  I created a new 100 GB /home/chroot partition.  I have the partition mounted with &#8220;<tt>rw,softdep</tt>&#8221; so that I can store and use devices and suid binaries.</p>
<p>I created a &#8220;/home/chroot/ports-amd64&#8243; directory and unpacked all of the amd64 snapshot install sets (matching what is installed on the system) to that directory.  Then, I changed to /home/chroot/ports-amd64/dev and ran &#8220;<tt>sudo ./MAKEDEV all</tt>&#8221; to create devices for the chroot.</p>
<p>Then I created a new user for the chroot.  I went with too long of a username, portsamd64, but it&#8217;s clear what the purpose is.  Then, I copied the following files from /etc to /home/chroot/ports-amd64/etc:</p>
<blockquote>
<pre>cd /etc
cp group hostname.* master.passwd <a href="http://erdelynet.com/downloads/mk.conf">mk.conf</a> \
 motd mygate myname passwd <a href="http://erdelynet.com/downloads/profile">profile</a> <a href="http://erdelynet.com/downloads/profile.local">profile.local</a> \
 pwd.db resolv.conf <a href="http://erdelynet.com/downloads/sh_aliases">sh_aliases</a> spwd.db sudoers \
 /home/chroot/ports-amd64/etc/
</pre>
</blockquote>
<p>I then ran &#8220;<tt>sudo ln -sf /usr/share/zoneinfo/EST5EDT /home/chroot/ports-amd64/etc/localtime</tt>&#8221; so the chroot has the same time as the &#8220;host&#8221; system.  In my /etc/profile.local, I have the ability to override the system hostname in the PS1 prompt, so I edited the profile.local file to have &#8220;<tt>export HOSTNAME=amd64jail</tt>&#8220;.  That way, I can easily distinguish between shells in the chroot and shells directly to the host.  Then, I edited /home/chroot/ports-amd64/etc/group and added the <tt>portsamd64</tt> user to the wheel group.  This way, <tt>portsamd64</tt> can use sudo within the chroot but not outside of it.</p>
<p>Then, I set up /etc/ssh/sshd_config with the following configuration:</p>
<blockquote>
<pre>Match User portsamd64
        ChrootDirectory /home/chroot/ports-amd64</pre>
</blockquote>
<p>and restarted sshd.</p>
<p>Now I was able to ssh to my chroot as portsamd64.  When logged in, I see the other processes that are running on the system, but cannot affect the parent of the chroot&#8217;s filesystem.  I created /var/run/dev.db by running &#8220;<tt>sudo dev_mkdb</tt>&#8221; and I created /var/run/ld.so.hints by running &#8220;<tt>sudo ldconfig /usr/lib /usr/local/lib /usr/X11R6/lib</tt>&#8220;.  So, I just checked out the ports tree and built some ports.</p>
<p>I&#8217;m sure there are potential security problems with this configuration.  I am not using this for security, but for convenience.</p>
]]></content:encoded>
			<wfw:commentRss>http://erdelynet.com/tech/openbsd/building-ports-on-a-production-system/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>2nd Install, 1 Disk</title>
		<link>http://erdelynet.com/tech/openbsd/2nd-install-1-disk/</link>
		<comments>http://erdelynet.com/tech/openbsd/2nd-install-1-disk/#comments</comments>
		<pubDate>Thu, 09 Oct 2008 05:28:41 +0000</pubDate>
		<dc:creator>merdely</dc:creator>
				<category><![CDATA[OpenBSD]]></category>

		<guid isPermaLink="false">http://erdelynet.com/?p=256</guid>
		<description><![CDATA[Here is the problem I&#8217;m trying to solve: I have an Intel Mac Mini that I&#8217;d like to dual boot multiple versions of OpenBSD. I need to be able to boot into another instance of OpenBSD remotely and without a serial port, I had to come up with a way to choose which OS I [...]]]></description>
			<content:encoded><![CDATA[<p>Here is the problem I&#8217;m trying to solve:  I have an Intel Mac Mini that I&#8217;d like to dual boot multiple versions of OpenBSD.  I need to be able to boot into another instance of OpenBSD remotely and without a serial port, I had to come up with a way to choose which OS I want to boot to.</p>
<p>I installed OpenBSD 4.4-current normally on wd0a (wd0b = swap, wd0d = /tmp, wd0e = /var, wd0f = /usr and wd0g = /home).</p>
<p>Here is how I set the machine up with OpenBSD 4.3 installed on wd0h.<br />
<span id="more-256"></span><br />
While booted to OpenBSD 4.4-current (on wd0a), I created and formatted /dev/wd0h and copied OpenBSD 4.3&#8242;s bsd.rd to it.  Then I rebooted.  At the <b>boot&gt;</b> prompt, I typed <tt>hd0h:/bsd.rd</tt>.  Then, I went through the installation as I normally would.  I set partition mount points up as I normally would (d = /tmp, e = none, f = none, g = none, h = none, i = /var, j = /usr).  Note that I am using the same /tmp.  I also want to use the same /home, but I don&#8217;t want /home formatted, so I will add it to wd0h:/etc/fstab later.  Also note that I typed &#8216;none&#8217; for wd0h. Then, when I&#8217;m told that &#8220;<b>The next step *DESTROYS* all existing data on these partitions!</b>&#8220;, I typed <tt>![enter]</tt> to escape to a shell and ran the following commands:</p>
<blockquote>
<pre>sed -e 's/wd0a/wd0h/' /tmp/filesystems > /tmp/fs.mwe
cp /tmp/fs.mwe /tmp/filesystems
exit</pre>
</blockquote>
<p>This tells the OpenBSD installer that my / filesystem is wd0h instead of wd0a.  At this point, I typed <tt>yes</tt> and wd0h and my other new partitions were formatted.  Then, I watched the install proceed normally.  The bootloader was overwritten.  If that&#8217;s a problem, it&#8217;s easily fixed by booting back into -current (or whatever&#8217;s on wd0a) and running <tt>/usr/mdec/installboot -v /boot /usr/mdec/biosboot wd0</tt>.</p>
<p>To change which installation is going to boot, mount /dev/wd0a, if necessary, and edit wd0a:/etc/boot.conf:</p>
<blockquote>
<pre>set device wd0h</pre>
</blockquote>
<p>Whenever I want to boot back into wd0a, I remount /dev/wd0a, edit my boot.conf and reboot.</p>
]]></content:encoded>
			<wfw:commentRss>http://erdelynet.com/tech/openbsd/2nd-install-1-disk/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Use a USB Flash drive to Install OpenBSD</title>
		<link>http://erdelynet.com/tech/openbsd/use-a-usb-flash-drive-to-install-openbsd/</link>
		<comments>http://erdelynet.com/tech/openbsd/use-a-usb-flash-drive-to-install-openbsd/#comments</comments>
		<pubDate>Sat, 30 Aug 2008 19:31:43 +0000</pubDate>
		<dc:creator>merdely</dc:creator>
				<category><![CDATA[OpenBSD]]></category>

		<guid isPermaLink="false">http://erdelynet.com/?p=250</guid>
		<description><![CDATA[Mark Peoples has a very nice write-up for using a USB Flash drive to Install OpenBSD. It uses the first 8 MB of the flash drive for an OpenBSD partition and then the rest to use for storing files (Fat32) that can be accessed by many operating systems. I highly recommend reading it. After following [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.azbsd.org/~marco/openbsd/flashkeyinstaller/"><img src="/images/puf150X129.gif" width="150" height="129" border="0" alt="Puffy" align="right" /></a>Mark Peoples has a very nice <a href="http://www.azbsd.org/~marco/openbsd/flashkeyinstaller/">write-up</a> for using a USB Flash drive to Install OpenBSD.  It uses the first 8 MB of the flash drive for an OpenBSD partition and then the rest to use for storing files (Fat32) that can be accessed by many operating systems.  I highly recommend reading it.</p>
<p>After following Mark&#8217;s directions, stick the flash drive on a machine you&#8217;d like to install/upgrade OpenBSD on and boot to a USB drive.  It should feel just like the process of using a CD or bsd.rd directly.</p>
<p>Updating the flash drive is easy as well: mount sd0a and download a new bsd.rd (as &#8220;bsd&#8221;) to it.</p>
]]></content:encoded>
			<wfw:commentRss>http://erdelynet.com/tech/openbsd/use-a-usb-flash-drive-to-install-openbsd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Print in Firefox 3</title>
		<link>http://erdelynet.com/tech/openbsd/print-in-firefox-3/</link>
		<comments>http://erdelynet.com/tech/openbsd/print-in-firefox-3/#comments</comments>
		<pubDate>Thu, 07 Aug 2008 18:52:10 +0000</pubDate>
		<dc:creator>merdely</dc:creator>
				<category><![CDATA[OpenBSD]]></category>

		<guid isPermaLink="false">http://erdelynet.com/?p=246</guid>
		<description><![CDATA[After upgrading to Firefox 3 on my OpenBSD 4.4-beta box, I noticed that I could not print anymore. I&#8217;m using the stock lpd(8) to print. When I brought up the print dialog box, it only showed &#8220;Print to File&#8221; option. After quite a bit of googling, I found my solution. A post to Mozilla&#8217;s bug [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.mozilla.com/"><img src="/images/firefox.png" alt="firefox" align="right" width="105" height="102" border="0" /></a>After upgrading to Firefox 3 on my OpenBSD 4.4-beta box, I noticed that I could not print anymore.  I&#8217;m using the stock <a href="http://www.openbsd.org/cgi-bin/man.cgi?query=lpd&#038;sektion=8">lpd(8)</a> to print.  When I brought up the print dialog box, it only showed &#8220;Print to File&#8221; option.</p>
<p>After quite a bit of <a href="http://www.google.com/">googling</a>, I found my solution.<br />
<span id="more-246"></span><br />
A post to Mozilla&#8217;s <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=430818#c9">bug tracker</a> explained that this is a problem with GTK, not Firefox.  To restore the ability to print, I had to create a new ~/.gtkrc-2.0 file and add this line:</p>
<blockquote>
<pre>gtk-print-backends = "file,lpr,cups"</pre>
</blockquote>
<p>Now I can print again.  Yay!</p>
]]></content:encoded>
			<wfw:commentRss>http://erdelynet.com/tech/openbsd/print-in-firefox-3/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Errata: 005_pcb for 4.3</title>
		<link>http://erdelynet.com/tech/openbsd/errata-005_pcb/</link>
		<comments>http://erdelynet.com/tech/openbsd/errata-005_pcb/#comments</comments>
		<pubDate>Wed, 30 Jul 2008 18:10:54 +0000</pubDate>
		<dc:creator>merdely</dc:creator>
				<category><![CDATA[OpenBSD]]></category>

		<guid isPermaLink="false">http://erdelynet.com/?p=245</guid>
		<description><![CDATA[The OpenBSD team has released a new errata for 4.2 (014_pcb) and 4.3 (005_pcb) to fix a reliability issue with ipv6. From the 4.3 errata page: Some kinds of IPv6 usage would leak kernel memory (in particular, this path was exercised by the named(8) patch for port randomization). Since INET6 is enabled by default, this [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.openbsd.org/errata43.html"><img src="/images/puf150X129.gif" width="150" height="129" border="0" alt="Puffy" align="right" /></a>The OpenBSD team has released a new errata for 4.2 (014_pcb) and 4.3 (005_pcb)  to fix a reliability issue with ipv6.</p>
<p>From the <a href="http://www.openbsd.org/errata43.html">4.3 errata page</a>:</p>
<blockquote><p>Some kinds of IPv6 usage would leak kernel memory (in particular, this path was exercised by the <a href="http://www.openbsd.org/cgi-bin/man.cgi?query=named&#038;sektion=8">named(8)</a> patch for port randomization). Since INET6 is enabled by default, this condition affects all systems.</p></blockquote>
<p>I have made <a href="/binpatch/">binpatches</a> for 4.2 and 4.3 for i386, amd64 and sparc64.</p>
]]></content:encoded>
			<wfw:commentRss>http://erdelynet.com/tech/openbsd/errata-005_pcb/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Errata: 004_bind for 4.3</title>
		<link>http://erdelynet.com/tech/openbsd/errata-004_bind-for-43/</link>
		<comments>http://erdelynet.com/tech/openbsd/errata-004_bind-for-43/#comments</comments>
		<pubDate>Thu, 24 Jul 2008 20:20:47 +0000</pubDate>
		<dc:creator>merdely</dc:creator>
				<category><![CDATA[OpenBSD]]></category>

		<guid isPermaLink="false">http://erdelynet.com/?p=243</guid>
		<description><![CDATA[The OpenBSD team has released a new errata for 4.2 (013_bind) and 4.3 (004_bind) to fix a security issue with bind (the name server in OpenBSD). From the 4.3 errata page: A vulnerability has been found with BIND. An attacker could use this vulnerability to poison the cache of a recursive resolving name server. (CVE-2008-1447) [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.openbsd.org/errata43.html"><img src="/images/puf150X129.gif" width="150" height="129" border="0" alt="Puffy" align="right" /></a>The OpenBSD team has released a new errata for 4.2 (013_bind) and 4.3 (004_bind)  to fix a security issue with bind (the name server in OpenBSD).</p>
<p>From the <a href="http://www.openbsd.org/errata43.html">4.3 errata page</a>:</p>
<blockquote><p>A vulnerability has been found with BIND. An attacker could use this vulnerability to poison the cache of a recursive resolving name server. (<a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2008-1447">CVE-2008-1447</a>)</p></blockquote>
<p>I have made <a href="/binpatch/">binpatches</a> for 4.2 and 4.3 for i386, amd64 and sparc64.</p>
]]></content:encoded>
			<wfw:commentRss>http://erdelynet.com/tech/openbsd/errata-004_bind-for-43/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>xdm Trick</title>
		<link>http://erdelynet.com/tech/openbsd/xdm-trick/</link>
		<comments>http://erdelynet.com/tech/openbsd/xdm-trick/#comments</comments>
		<pubDate>Wed, 16 Jul 2008 17:45:29 +0000</pubDate>
		<dc:creator>merdely</dc:creator>
				<category><![CDATA[OpenBSD]]></category>

		<guid isPermaLink="false">http://erdelynet.com/?p=242</guid>
		<description><![CDATA[Here&#8217;s another quick tip I&#8217;ve started using. Actually, I don&#8217;t normally run X with xdm and right now I can&#8217;t remember why I am on one of my boxes. But I am. If you put xdm_flags="" in your /etc/rc.conf.local, xdm will start automatically during the boot process. This is probably what you want nine times [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.openbsd.org/"><img src="/images/puf150X129.gif" width="150" height="129" border="0" alt="Puffy" align="right" /></a>Here&#8217;s another quick tip I&#8217;ve started using.  Actually, I don&#8217;t normally run X with xdm and right now I can&#8217;t remember why I am on one of my boxes.  But I am.</p>
<p>If you put <tt>xdm_flags=""</tt> in your /etc/rc.conf.local, xdm will start automatically during the boot process.  This is probably what you want nine times out of ten.  But, that tenth time, it&#8217;s annoying when X starts and you didn&#8217;t want it to.<br />
<span id="more-242"></span><br />
I put the following in my /etc/rc.local instead of putting <tt>xdm_flags=""</tt> in my /etc/rc.conf.local:</p>
<blockquote>
<pre>echo "Press any key within 10 seconds to bypass xdm..."
old_tty=`stty -g`
stty -echo -icanon min 0 time 100
_KEY=$(dd count=1 bs=1 2>/dev/null)
stty "${old_tty}"

if [ "${_KEY}" = "" ]; then
 &nbsp; echo "starting xdm..."
 &nbsp; /usr/X11R6/bin/xdm
else
 &nbsp; echo Bypassing xdm
fi</pre>
</blockquote>
<p>The first <tt>stty</tt> command waits 10 seconds for you to press any key.  The value of that key is stored in ${_KEY}.  If you pressed a key (${_KEY} != &#8220;&#8221;), rc.local does not start xdm and boots to a normal non-X login prompt.  If you do <b>not</b> press a key, xdm starts and you&#8217;re greeted with the xdm login screen.</p>
<p>I hope that helps someone.</p>
]]></content:encoded>
			<wfw:commentRss>http://erdelynet.com/tech/openbsd/xdm-trick/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>rc.local trick</title>
		<link>http://erdelynet.com/tech/openbsd/rclocal-trick/</link>
		<comments>http://erdelynet.com/tech/openbsd/rclocal-trick/#comments</comments>
		<pubDate>Fri, 11 Jul 2008 17:24:40 +0000</pubDate>
		<dc:creator>merdely</dc:creator>
				<category><![CDATA[OpenBSD]]></category>

		<guid isPermaLink="false">http://erdelynet.com/?p=241</guid>
		<description><![CDATA[This is really just a quick tip for (re-)starting daemons. Many converts from other operating systems complain about OpenBSD&#8217;s lack of an rc.d or init.d structure to quickly re-start/stop daemons. Admittedly, it was a slight annoyance when I switched years ago. But, I&#8217;ve gotten used to either looking up a daemon&#8217;s PID and killing it [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.openbsd.org/"><img src="/images/puf150X129.gif" width="150" height="129" border="0" alt="Puffy" align="right" /></a>This is really just a quick tip for (re-)starting daemons.  Many converts from other operating systems complain about OpenBSD&#8217;s lack of an rc.d or init.d structure to quickly re-start/stop daemons.  Admittedly, it was a slight annoyance when I switched years ago.  But, I&#8217;ve gotten used to either looking up a daemon&#8217;s PID and killing it or using <a href="http://www.openbsd.org/cgi-bin/man.cgi?query=pkill&#038;sektion=1">pkill(1)</a>.  Then looking at /etc/rc.local to find the commands (and possibly /etc/rc.conf* for variables) to re-start the daemon.<br />
<span id="more-241"></span><br />
Lately, I&#8217;ve started adding something like this in my /etc/rc.local:</p>
<blockquote><p>
## OpenLDAP Server<br />
if [ "$1" = "" -o "$1" = "openldap" ]; then<br />
slapd_flags=&#8221;-u _openldap&#8221;<br />
if [ "$slapd_flags" != "NO" -a -x /usr/local/libexec/slapd ]; then<br />
 &nbsp; &nbsp; &nbsp; install -d -o _openldap /var/run/openldap<br />
 &nbsp; &nbsp; &nbsp; /usr/local/libexec/slapd $slapd_flags<br />
 &nbsp; &nbsp; &nbsp; echo -n &#8216; slapd&#8217;<br />
fi<br />
fi
</p></blockquote>
<p>That way, I can stop OpenLDAP by running `<tt>sudo pkill slapd</tt>` and restart it with `<tt>sudo sh /etc/rc.local openldap</tt>`.  The boot process is not affected because $1 == &#8220;&#8221; so, all daemons in my rc.local are started.</p>
]]></content:encoded>
			<wfw:commentRss>http://erdelynet.com/tech/openbsd/rclocal-trick/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
