Jacob J. Walker's Blog

Scholarly Thoughts, Research, and Journalism for Informal Peer Review

Using additional commands in the early_command (or %pre) portion of an automated Ubuntu or Debian installations

with one comment

Icon image for apt-get and apt-cacheAs I have been working on developing VubuntuBox, I have had to learn a lot more about some of the fundamentals of the Debian installer, and learn “tricks” to get around issues that exist from working in a minimal system that first exists when you start a Ubuntu or Debian installation.

Automated installations of Ubuntu can run commands prior to most of the installation by either using an early_command in a preseed file or putting things in the %pre block of a kickstart file.

But, prior to the installation, there are very few commands available.  And when I wanted to run mkfs to create a ram disk (see an upcoming blog entry about this), I found it wasn’t available.  So in order to use this command, I needed to install mkfs, which is in the package linux-util.

Thankfully, there is a command called udpkg that allows  installation of packages, and many basic debian packages are in the cdrom/pool/main folder.  But udpkg doesn’t seem to have any dependency capabilities that dpkg has.  So I had to determine which packages all need to be installed first, and create the udpkg commands to do that.  And I thought I’d share what I learned with others who might want to install some packages in an Ubuntu or Debian per-installation environment.

To quickly see a recursive list of all the dependencies of a package, install the apt-rdepends utility / package.  When you run apt-rdepends package_name it will show all dependencies for all packages required.  Then you can use apt-cache show package_name to find the Filename of each package.  Of course, this takes some time, thus it is better to make a script to do this for you, and I’m now working on writing a Python script that can do this, and hope to post it here soon.

Update: After working on this for a bit, I have realized that given my time constraints, current knowledge level, and complexity of Debian package dependencies, that I will not be finishing the Python script any time soon (if ever).  So for the time being, to solve my issue of having additional utilities available in the pre-install environment, I’m adding binaries to the distribution CD, and copying them in, as necessary.  Yes, it is a kludge, but it works for now, until I can get a better system developed.


Post Revisions:

Written by Jacob Walker

November 24th, 2014 at 7:54 am

Posted in Descartes' Daemon

One Response to 'Using additional commands in the early_command (or %pre) portion of an automated Ubuntu or Debian installations'

Subscribe to comments with RSS or TrackBack to 'Using additional commands in the early_command (or %pre) portion of an automated Ubuntu or Debian installations'.

  1. […] Also, I should mention, that to do this, you need to have mkfs installed in the %pre environment.  And for right now, I’m “cheating” by just copying in the binary and libraries.  But in the future, I hope to be able to load the appropriate packages, as I talked about in a previous post. […]

Leave a Reply

%d bloggers like this: