<?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>tail -f ZS64.log &#187; freebsd</title>
	<atom:link href="http://blog.zs64.net/topics/freebsd/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.zs64.net</link>
	<description>Random Ramblings</description>
	<lastBuildDate>Sat, 18 Jun 2011 17:16:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Getting sshd to start as early as possible</title>
		<link>http://blog.zs64.net/2011/06/getting-sshd-to-start-as-early-as-possible/</link>
		<comments>http://blog.zs64.net/2011/06/getting-sshd-to-start-as-early-as-possible/#comments</comments>
		<pubDate>Sat, 18 Jun 2011 17:16:01 +0000</pubDate>
		<dc:creator>stb</dc:creator>
				<category><![CDATA[freebsd]]></category>
		<category><![CDATA[administration]]></category>
		<category><![CDATA[boot]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://blog.zs64.net/?p=309</guid>
		<description><![CDATA[In FreeBSD, sshd by default gets started quite late in the boot process, about the same time a console will show the login prompt. There’s quite a few services that can make trouble and hang before that. Annoyingly, you can’t fix a stuck system via ssh, since it’s not started yet. But as it turns [...]]]></description>
			<content:encoded><![CDATA[<p>In FreeBSD, sshd by default gets started quite late in the boot process, about the same time a console will show the login prompt. There’s quite a few services that can make trouble and hang before that. Annoyingly, you can’t fix a stuck system via ssh, since it’s not started yet. But as it turns out, sshd can be started quite a bit earlier than FreeBSD does by default.</p>
<p>The rcorder keywords in /etc/rc.d/sshd normally look like this:</p>
<pre># PROVIDE: sshd
# REQUIRE: LOGIN cleanvar
# KEYWORD: shutdown
</pre>
<p>Change the rcorder keywords like so:</p>
<pre># PROVIDE: sshd
# REQUIRE: NETWORKING cleanvar
# BEFORE: mountcritremote
# KEYWORD: shutdown</pre>
<p>&nbsp;</p>
<p>Now sshd will be started right after the network has been configured.</p>
<p>Note that starting sshd before certain parts of the system are ready might give you temporary or permanent errors. For example, starting sshd before the user home directories are mounted might cause problems with logins. However, if your machine has all critical filesystems on local disks, making these changes should not pose any problems, and will allow you to log in while the rc scripts are still running, giving you the opportunity to fix any misbehaving services.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.zs64.net/2011/06/getting-sshd-to-start-as-early-as-possible/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Running bash as root&#8217;s shell only when it&#8217;s not broken</title>
		<link>http://blog.zs64.net/2011/06/running-bash-as-roots-shell-only-when-its-not-broken/</link>
		<comments>http://blog.zs64.net/2011/06/running-bash-as-roots-shell-only-when-its-not-broken/#comments</comments>
		<pubDate>Sat, 18 Jun 2011 16:35:18 +0000</pubDate>
		<dc:creator>stb</dc:creator>
				<category><![CDATA[freebsd]]></category>
		<category><![CDATA[administration]]></category>
		<category><![CDATA[ash]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[root]]></category>
		<category><![CDATA[scripting]]></category>

		<guid isPermaLink="false">http://blog.zs64.net/?p=304</guid>
		<description><![CDATA[I like bash, mostly for its interactive features over FreeBSD’s standard Bourne-compatible shell, ash. Setting bash as the default shell for the root user however has a big downside: if you ever break bash or any of the libraries it depends on, you can&#8217;t log in as root anymore to fix it. I’ve tried quite [...]]]></description>
			<content:encoded><![CDATA[<p>I like bash, mostly for its interactive features over FreeBSD’s standard Bourne-compatible shell, ash.</p>
<p>Setting bash as the default shell for the root user however has a big downside: if you ever break bash or any of the libraries it depends on, you can&#8217;t log in as root anymore to fix it. I’ve tried quite a few ways to work around this, and I think I’ve finally figured out a good solution: leave the root shell as /bin/sh, and add this snippet at the end of /root/.profile:</p>
<pre>[ -z "$BASH" ] &amp;&amp; /usr/local/bin/bash -c 'true' &amp;&amp; exec /usr/local/bin/bash</pre>
<p>This will start bash, but only if the shell sourcing .profile isn&#8217;t bash, and bash can actually successfully be executed.</p>
<p>In FreeBSD 9, ash has apparently grown command name completion. Together with the editing functions (already available in FreeBSD 7), this might allow me to switch to ash as the default shell.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.zs64.net/2011/06/running-bash-as-roots-shell-only-when-its-not-broken/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FreeBSD, CUPS and iPad printing</title>
		<link>http://blog.zs64.net/2011/05/freebsd-cups-and-ipad-printing/</link>
		<comments>http://blog.zs64.net/2011/05/freebsd-cups-and-ipad-printing/#comments</comments>
		<pubDate>Thu, 19 May 2011 21:48:08 +0000</pubDate>
		<dc:creator>stb</dc:creator>
				<category><![CDATA[freebsd]]></category>
		<category><![CDATA[avahi]]></category>
		<category><![CDATA[clp 315]]></category>
		<category><![CDATA[cups]]></category>
		<category><![CDATA[ipad]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[printer]]></category>
		<category><![CDATA[printing]]></category>
		<category><![CDATA[samsung]]></category>

		<guid isPermaLink="false">http://blog.zs64.net/?p=300</guid>
		<description><![CDATA[For the longest time, I couldn’t get CUPS configured on my FreeBSD server successfully. Between CUPS access rules, foomatic drivers and avahi announcements, I had terrible trouble making heads or tails of the nondescript error messages I was getting. Spurned on by the arrival of an iPad, I finally sat down and worked through configuring [...]]]></description>
			<content:encoded><![CDATA[<p>For the longest time, I couldn’t get CUPS configured on my FreeBSD server successfully. Between CUPS access rules, foomatic drivers and avahi announcements, I had terrible trouble making heads or tails of the nondescript error messages I was getting.</p>
<p>Spurned on by the arrival of an iPad, I finally sat down and worked through configuring CUPS and avahi. So I don&#8217;t have to go through all the fiddling again, here&#8217;s <a title="FreeBSD, CUPS and iPad printing" href="http://wiki.zs64.net/FreeBSD,_CUPS_and_iPad_printing">a recipe of what I did</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.zs64.net/2011/05/freebsd-cups-and-ipad-printing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TEMPer USB Thermometer</title>
		<link>http://blog.zs64.net/2010/01/temper-usb-thermometer/</link>
		<comments>http://blog.zs64.net/2010/01/temper-usb-thermometer/#comments</comments>
		<pubDate>Fri, 01 Jan 2010 20:45:35 +0000</pubDate>
		<dc:creator>stb</dc:creator>
				<category><![CDATA[freebsd]]></category>
		<category><![CDATA[hardware]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[iic]]></category>
		<category><![CDATA[lm75]]></category>
		<category><![CDATA[source code]]></category>
		<category><![CDATA[usb]]></category>

		<guid isPermaLink="false">http://blog.zs64.net/?p=220</guid>
		<description><![CDATA[Measuring temperature in a PC should be easy: after all, most mainboards have extensive monitoring capabilities for temperature and voltage levels built-in. Unfortunately, very few of these facilities are documented properly, and software support is lacking. Instead of trying to navigate the maze that is lm-sensors (which isn&#8217;t even available for FreeBSD), I decided to [...]]]></description>
			<content:encoded><![CDATA[<p>Measuring temperature in a PC should be easy: after all, most mainboards have extensive monitoring capabilities for temperature and voltage levels built-in. Unfortunately, very few of these facilities are documented properly, and software support is lacking. Instead of trying to navigate the maze that is <a href="http://www.lm-sensors.org/">lm-sensors</a> (which isn&#8217;t even available for FreeBSD), I decided to look for some USB-based solution.</p>
<p>There&#8217;s a reasonably cheap chinese USB thermometer called TEMPer. I got mine from Brando for 12 Euros. It&#8217;s a USB-to-serial chip from WinChipHead. It&#8217;s DTR, RTS, and CTS lines are used to connect a <a href="http://www.national.com/ds/LM/LM75.pdf">LM75</a> I²C temperature sensor. To talk to the LM75, you need some <a href="http://en.wikipedia.org/wiki/Bit-banging">bit-banging</a> driver.</p>
<p>I&#8217;ve put together a <a href="http://wiki.zs64.net/TEMPer_USB_Thermometer">command line utility for the TEMPer</a> that can program the built-in thermostat (TEMPer has a LED connected to that output) and print out temperature measurement data. It does it&#8217;s job, and might serve as an example on how to do I²C over a simple interface.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.zs64.net/2010/01/temper-usb-thermometer/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Patch to vmmouse to make it work in FreeBSD</title>
		<link>http://blog.zs64.net/2009/08/patch-to-vmmouse-to-make-it-work-in-freebsd/</link>
		<comments>http://blog.zs64.net/2009/08/patch-to-vmmouse-to-make-it-work-in-freebsd/#comments</comments>
		<pubDate>Thu, 20 Aug 2009 08:37:41 +0000</pubDate>
		<dc:creator>stb</dc:creator>
				<category><![CDATA[freebsd]]></category>
		<category><![CDATA[vmmouse]]></category>
		<category><![CDATA[xorg]]></category>

		<guid isPermaLink="false">http://blog.zs64.net/?p=168</guid>
		<description><![CDATA[Here&#8217;s a patch to the vmmouse port that activates the driver unconditionally. This makes the VMware mouse driver work in the default configuration in FreeBSD (7 and 8). When xorg moved to use hal by default, the vmmouse driver needed to be registered with hal. This would work fine, except for the the current port [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s <a href="http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/137731">a patch to the vmmouse</a> port that activates the driver unconditionally. This makes the <a href="http://www.freebsd.org/ports/x11-drivers.html#xf86-input-vmmouse-12.6.3_2">VMware mouse driver</a> work in the default configuration in FreeBSD (7 and 8).</p>
<p>When xorg moved to use <a href="http://www.freedesktop.org/wiki/Software/hal">hal</a> by default, the vmmouse driver needed to be registered with hal. This would work fine, except for the the current port version of hal (hal-0.5.11_25) not supporting a command line option that the probe script for vmmouse needs, and the matching code that determines whether to probe for VMware never matching on FreeBSD.</p>
<p>The patch unconditionally activates the vmmouse driver. This should be fine even when not running in VMware, as vmmouse should be compatible with the default xorg mouse driver.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.zs64.net/2009/08/patch-to-vmmouse-to-make-it-work-in-freebsd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FreeBSD ppp(8): work around invalid remote address</title>
		<link>http://blog.zs64.net/2009/08/freebsd-ppp8-work-around-invalid-remote-address/</link>
		<comments>http://blog.zs64.net/2009/08/freebsd-ppp8-work-around-invalid-remote-address/#comments</comments>
		<pubDate>Sat, 15 Aug 2009 16:51:56 +0000</pubDate>
		<dc:creator>stb</dc:creator>
				<category><![CDATA[freebsd]]></category>
		<category><![CDATA[ppp]]></category>
		<category><![CDATA[umts]]></category>
		<category><![CDATA[usb]]></category>

		<guid isPermaLink="false">http://blog.zs64.net/?p=159</guid>
		<description><![CDATA[How to fix a ppp problem when trying to establish a connection via a Huawei E169 UMTS USB stick.]]></description>
			<content:encoded><![CDATA[<p>When connecting via a Huawai E169 UTMS USB stick through O2 Germany&#8217;s network, the data stick or the network suggests a PPP IPCP remote address of 0.0.0.0. FreeBSD refuses to ifconfig the tun interface with this endpoint address.</p>
<p>Fortunately, <a href="http://www.FreeBSD.org/cgi/man.cgi?query=ppp&#038;apropos=0&#038;sektion=0&#038;manpath=FreeBSD+8-current&#038;format=html">ppp(8)</a> offers a configuration parameter to influence the IP addresses negotiated with the peer (ifaddr), and suggesting a different address will make the configuration work.</p>
<p>If you get this log output from ppp, you need to configure address selection:</p>
<blockquote>
<pre>IPCP: deflink: RecvConfigAck(4) state = Req-Sent
IPCP:  IPADDR[6] 10.68.235.57
IPCP:  PRIDNS[6] 193.189.244.197
IPCP:  SECDNS[6] 193.189.244.205
IPCP: deflink: State change Req-Sent --&gt; Ack-Rcvd
IPCP: deflink: RecvConfigReq(47) state = Ack-Rcvd
IPCP:   [EMPTY]
IPCP: deflink: SendConfigAck(47) state = Ack-Rcvd
IPCP:   [EMPTY]
IPCP: deflink: State change Ack-Rcvd --&gt; Opened
IPCP: deflink: LayerUp.
IPCP: myaddr 10.68.235.57 hisaddr = 0.0.0.0
Warning: iface add: ioctl(SIOCAIFADDR, 10.68.235.57 -&gt; 0.0.0.0): Destination address required
Error: ipcp_InterfaceUp: unable to set ip address</pre>
</blockquote>
<p>Here&#8217;s my complete ppp.conf, with the ifaddr line included:</p>
<blockquote>
<pre>u3g:
	set device /dev/cuaU0.0
	set speed 115200
	<strong>set ifaddr 10.0.0.1/0 10.0.0.2/0 255.255.255.0</strong>
	set authname internet
	set authkey  internet
	set log local phase ipcp
	set dial "ABORT BUSY TIMEOUT 2 \
		\"\" \
		AT OK-AT-OK \
		AT+CFUN=1 OK-AT-OK \
		AT+CMEE=2 OK-AT-OK \
		AT+CSQ OK \
		AT+CGDCONT=1,\\\"IP\\\",\\\"internet\\\" OK \
		AT+CGACT? OK-AT-OK \
		AT+CGATT? OK \
		AT+CGCLASS? OK \
		AT+COPS? OK \
		ATD*99***1# CONNECT"
	set crtscts on
	nat enable yes
	add default HISADDR
	disable dns</pre>
</blockquote>
<p>This applies to both 7-stable and 8-stable (with both the old and the new USB stacks). I&#8217;ve used <a href="http://www.FreeBSD.org/cgi/man.cgi?query=u3g&#038;apropos=0&#038;sektion=0&#038;manpath=FreeBSD+8-current&#038;format=html">u3g(4)</a> on both occasions. The original ppp.conf for 3G modems is based off <a href="http://people.freebsd.org/~n_hibma/pppconfig.html">this one from Nick Hibma</a>.</p>
<p>This is how it looks like when using ifaddr:</p>
<blockquote>
<pre>IPCP:  PRIDNS[6] 10.11.12.13
IPCP:  SECDNS[6] 10.11.12.14
IPCP:  PRINBNS[6] 10.11.12.13
IPCP: MS NBNS req 130 - NAK??
IPCP:  SECNBNS[6] 10.11.12.14
IPCP: MS NBNS req 132 - NAK??
IPCP: deflink: SendConfigReq(2) state = Req-Sent
IPCP:  IPADDR[6] 10.0.0.1
IPCP:  COMPPROTO[6] 16 VJ slots with slot compression
IPCP: deflink: RecvConfigReq(50) state = Req-Sent
IPCP:   [EMPTY]
IPCP: deflink: SendConfigNak(50) state = Req-Sent
IPCP:  IPADDR[6] 10.0.0.2
IPCP: deflink: RecvConfigRej(2) state = Req-Sent
IPCP:  COMPPROTO[6] 16 VJ slots with slot compression
IPCP: deflink: SendConfigReq(3) state = Req-Sent
IPCP:  IPADDR[6] 10.0.0.1
IPCP: deflink: RecvConfigNak(3) state = Req-Sent
IPCP:  IPADDR[6] 10.42.237.110
IPCP:  IPADDR[6] changing address: 10.0.0.1  --&gt; 10.42.237.110
IPCP: deflink: SendConfigReq(4) state = Req-Sent
IPCP:  IPADDR[6] 10.42.237.110
IPCP: deflink: RecvConfigAck(4) state = Req-Sent
IPCP:  IPADDR[6] 10.42.237.110
IPCP: deflink: State change Req-Sent --&gt; Ack-Rcvd
IPCP: deflink: RecvConfigReq(51) state = Ack-Rcvd
IPCP:   [EMPTY]
IPCP: deflink: SendConfigAck(51) state = Ack-Rcvd
IPCP:   [EMPTY]
IPCP: deflink: State change Ack-Rcvd --&gt; Opened
IPCP: deflink: LayerUp.
IPCP: myaddr 10.42.237.110 hisaddr = 10.0.0.2
PPP ON freebsd-current&gt;</pre>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://blog.zs64.net/2009/08/freebsd-ppp8-work-around-invalid-remote-address/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

