<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="/stylesheets/rss.css" type="text/css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>HJK Solutions: Tag ubuntu</title>
    <link>http://blog.hjksolutions.com/articles/tag/ubuntu</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>We Launch Startups</description>
    <item>
      <title>Unattended Package Installation with Debian and Ubuntu</title>
      <description>&lt;p&gt;&lt;a href="http://en.wikipedia.org/wiki/Advanced_Packaging_Tool"&gt;Apt&lt;/a&gt; is a wonderful tool, but it does have its quirks.  One of those is that it likes to ask you interactive questions during package installation.  This makes total sense when a human is doing &lt;code&gt;apt-get install foobar&lt;/code&gt;, but it causes all sorts of consternation when you want to automatically install packages. (You do this all the time with &lt;a href="http://puppet.reductivelabs.com"&gt;Puppet&lt;/a&gt;, which I&amp;#8217;ll talk more about at the end of this post.)&lt;/p&gt;


	&lt;p&gt;The answer to this problem is to pre-seed &lt;a href="http://www.fifi.org/doc/debconf-doc/tutorial.html"&gt;debconf&lt;/a&gt; with the correct answers to it&amp;#8217;s questions.  To do this, first you need to install the package by hand:&lt;/p&gt;


&lt;pre&gt;
    &lt;code&gt;
$ apt-get install libnss-ldap
    &lt;/code&gt;
&lt;/pre&gt;

	&lt;p&gt;You&amp;#8217;ll need to provide answers to the questions it asks, which we&amp;#8217;re going to re-use later as the basis for our seed file.  Next, make sure you have &lt;code&gt;debconf-utils&lt;/code&gt; installed, and grab the answers to your questions:&lt;/p&gt;


&lt;pre&gt;
    &lt;code&gt;
$ apt-get install debconf-utils # Only if you need it
$ debconf-get-selections | grep libnss-ldap
libnss-ldap     libnss-ldap/rootbindpw  password
libnss-ldap     libnss-ldap/bindpw      password
libnss-ldap     libnss-ldap/dblogin     boolean false
# Automatically update libnss-ldap's configuration file?
libnss-ldap     libnss-ldap/override    boolean false
libnss-ldap     shared/ldapns/base-dn   string   dc=example,dc=com
libnss-ldap     libnss-ldap/rootbinddn  string   cn=admin,dc=example,dc=com
libnss-ldap     shared/ldapns/ldap_version      select   3
libnss-ldap     libnss-ldap/binddn      string   cn=proxyuser,dc=example,dc=net
libnss-ldap     shared/ldapns/ldap-server       string   ldapi:///
libnss-ldap     libnss-ldap/nsswitch    note
libnss-ldap     libnss-ldap/confperm    boolean false
libnss-ldap     libnss-ldap/dbrootlogin boolean true
    &lt;/code&gt;
&lt;/pre&gt;

	&lt;p&gt;Take the output of that and stick it in a file, say &lt;code&gt;libnss-ldap.seed&lt;/code&gt;.  You can now use that file to pre-seed a new system with those answers using debconf-set-selections:&lt;/p&gt;


&lt;pre&gt;
    &lt;code&gt;
$ debconf-get-selections | grep libnss-ldap &amp;gt; /tmp/libnss-ldap.seed
$ debconf-set-selections /tmp/libnss-ldap.seed
    &lt;/code&gt;
&lt;/pre&gt;

	&lt;p&gt;Or use ssh to pre-seed a new box:&lt;/p&gt;


&lt;pre&gt;
    &lt;code&gt;
$ cat /tmp/libnss-ldap.seed | ssh somehost debconf-set-selections
    &lt;/code&gt;
&lt;/pre&gt;

	&lt;p&gt;If you are using &lt;a href="http://puppet.reductivelabs.com"&gt;Puppet&lt;/a&gt; (and if you&amp;#8217;re not, you should be) to manage your systems, you can use a recipe like this to automatically install packages that require interaction:&lt;/p&gt;


&lt;pre&gt;
    &lt;code&gt;
define seed_package($ensure = latest) {
  $seedpath = "/var/cache/local/preseeding" 
  file { "$seedpath/$name.seed":
    source =&amp;gt; "puppet://$puppet_server/seeds/$lsbdistcodename/$name.seed",
    mode =&amp;gt; 0600,
    owner =&amp;gt; root,
    group =&amp;gt; root
  }
  package { $name:
    ensure =&amp;gt; $ensure,
    responsefile =&amp;gt; "$seedpath/$name.seed",
    require =&amp;gt; File["$seedpath/$name.seed"],
  }
}

class foobar {
  seed_package { "libnss-ldap":
    ensure =&amp;gt; latest
  }
}
    &lt;/code&gt;
&lt;/pre&gt;

	&lt;p&gt;Some other resources on ways to use pre-seeding to great effect:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;&lt;a href="http://www.debian-administration.org/articles/394"&gt;Automating new Debian installations with preseeding at Debian Administration&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://wiki.debian.org/DebianInstaller/Preseed"&gt;Preseed entry at the Debian Wiki&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;Happy unattended package installation! :)&lt;/p&gt;</description>
      <pubDate>Fri, 27 Jul 2007 10:05:00 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:04ea761d-3f21-4868-b91d-6fc83dedbe47</guid>
      <author>Adam Jacob</author>
      <link>http://blog.hjksolutions.com/articles/2007/07/27/unattended-package-installation-with-debian-and-ubuntu</link>
      <category>solutions</category>
      <category>ubuntu</category>
      <category>debian</category>
      <category>puppet</category>
      <trackback:ping>http://blog.hjksolutions.com/articles/trackback/6</trackback:ping>
    </item>
    <item>
      <title>Using runit with Upstart</title>
      <description>&lt;p&gt;When using &lt;a href="http://smarden.org/runit/"&gt;runit&lt;/a&gt; with &lt;a href="http://upstart.ubuntu.com"&gt;Upstart&lt;/a&gt; in Ubuntu 7.04, you&amp;#8217;re going to run in to a couple of problems.  The first is that the package doesn&amp;#8217;t install cleanly without the presence of &lt;code&gt;/etc/inittab&lt;/code&gt;, which Upstart doesn&amp;#8217;t need.  You can fix that with a simple:&lt;/p&gt;


&lt;pre&gt;
    &lt;code&gt;
$ sudo touch /etc/inittab
    &lt;/code&gt;
&lt;/pre&gt;

	&lt;p&gt;Now, you need to actually add runit to Upstart.  You do this by putting the following in &lt;code&gt;/etc/event.d/runsvdir&lt;/code&gt;:&lt;/p&gt;


&lt;pre&gt;
    &lt;code&gt;
start on runlevel 2
start on runlevel 3
start on runlevel 4
start on runlevel 5
stop on shutdown
respawn
exec /usr/sbin/runsvdir-start
    &lt;/code&gt;
&lt;/pre&gt;

	&lt;p&gt;This will cause &lt;code&gt;runsvdir-start&lt;/code&gt; to run during runlevel 2, 3, 4, and 5, stop when the system is going to be shutdown, and respawn if it goes away.&lt;/p&gt;


	&lt;p&gt;If you are on Ubuntu 6.10, the syntax is a bit different:&lt;/p&gt;


&lt;pre&gt;
&lt;code&gt;
start on runlevel 2
start on runlevel 3
start on runlevel 4
start on runlevel 5
stop on shutdown
respawn /usr/sbin/runsvdir-start
&lt;/code&gt;
&lt;/pre&gt;</description>
      <pubDate>Fri, 20 Jul 2007 15:52:00 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:eb3c5be5-0f6f-46b9-9b68-d36ea1bc10ef</guid>
      <author>Adam Jacob</author>
      <link>http://blog.hjksolutions.com/articles/2007/07/20/using-runit-with-upstart</link>
      <category>solutions</category>
      <category>runit</category>
      <category>upstart</category>
      <category>ubuntu</category>
      <trackback:ping>http://blog.hjksolutions.com/articles/trackback/5</trackback:ping>
    </item>
  </channel>
</rss>
