<?xml version="1.0" encoding="UTF-8"?>
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">
  <title>HJK Solutions: Tag ubuntu</title>
  <subtitle type="html">We Launch Startups</subtitle>
  <id>tag:blog.hjksolutions.com,2005:Typo</id>
  <generator uri="http://www.typosphere.org" version="4.0">Typo</generator>
  <link href="http://blog.hjksolutions.com/xml/atom/tag/feed.xml" rel="self" type="application/atom+xml"/>
  <link href="http://blog.hjksolutions.com/articles/tag/ubuntu" rel="alternate" type="text/html"/>
  <updated>2007-07-27T14:14:23-04:00</updated>
  <entry>
    <author>
      <name>Adam Jacob</name>
    </author>
    <id>urn:uuid:04ea761d-3f21-4868-b91d-6fc83dedbe47</id>
    <published>2007-07-27T10:05:00-04:00</published>
    <updated>2007-07-27T14:14:23-04:00</updated>
    <title type="html">Unattended Package Installation with Debian and Ubuntu</title>
    <link href="http://blog.hjksolutions.com/articles/2007/07/27/unattended-package-installation-with-debian-and-ubuntu" rel="alternate" type="text/html"/>
    <category term="solutions" scheme="http://blog.hjksolutions.com/articles/category/solutions" label="solutions"/>
    <category term="ubuntu" scheme="http://blog.hjksolutions.com/articles/tag/ubuntu"/>
    <category term="debian" scheme="http://blog.hjksolutions.com/articles/tag/debian"/>
    <category term="puppet" scheme="http://blog.hjksolutions.com/articles/tag/puppet"/>
    <summary type="html">&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;</summary>
    <content type="html">&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;</content>
  </entry>
  <entry>
    <author>
      <name>Adam Jacob</name>
    </author>
    <id>urn:uuid:eb3c5be5-0f6f-46b9-9b68-d36ea1bc10ef</id>
    <published>2007-07-20T15:52:00-04:00</published>
    <updated>2007-07-20T15:58:15-04:00</updated>
    <title type="html">Using runit with Upstart</title>
    <link href="http://blog.hjksolutions.com/articles/2007/07/20/using-runit-with-upstart" rel="alternate" type="text/html"/>
    <category term="solutions" scheme="http://blog.hjksolutions.com/articles/category/solutions" label="solutions"/>
    <category term="runit" scheme="http://blog.hjksolutions.com/articles/tag/runit"/>
    <category term="upstart" scheme="http://blog.hjksolutions.com/articles/tag/upstart"/>
    <category term="ubuntu" scheme="http://blog.hjksolutions.com/articles/tag/ubuntu"/>
    <summary type="html">&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;</summary>
    <content type="html">&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;</content>
  </entry>
</feed>

