What happened to preseed/late_command?

Josef Wolf jw at raven.inka.de
Wed Dec 12 17:37:43 GMT 2007


On Wed, Dec 12, 2007 at 09:58:30AM +0000, Colin Watson wrote:
> On Wed, Dec 12, 2007 at 08:02:52AM +0100, Josef Wolf wrote:
> > In my customized install-cd's, I used to finish the installation via
> > 
> >    d-i preseed/late_command string my commands go here; more commands
> > 
> > This worked in previous releases (last checked was feisty, IIRC). But
> > for some reason, my commands are no longer run in Gutsy.  Have there
> > been significant changes with this?
> 
> Nothing happened; it's still there and supported.

Thanks for the fast response, Colin!

> Could you give a more
> concrete example? Perhaps it's the commands you're running that are
> problematic?

I've created a customized install CD based on gutsy alternate CD.  To
load my preseed file, I changed the append line in isolinux.cfg (I break
the line to improve readability)

   append  debian-installer/locale=de_DE \
           console-setup/variant=Germany \
           console-setup/layout=Germany \
           console-setup/ask_detect=false \
           file=/cdrom/preseed/generic.seed \
           initrd=/install/initrd.gz \
           quiet \
           --

Below is my generic.seed (I stripped comments from preseed values which
are not related to preseed/early_command).  The relevant setting is at
the end of this post.  In the comment, I've added some remarks.  This
preseed file is definitely loaded, since even the crypted password is
set correctly.

   d-i debian-installer/locale string de_DE
   d-i console-setup/layoutcode string de-latin1-nodeadkeys
   d-i     pkgsel/install-language-support boolean true
   d-i netcfg/choose_interface select eth0
   d-i netcfg/wireless_wep string
   d-i mirror/country string enter information manually
   d-i mirror/http/hostname string archive.ubuntu.com
   d-i mirror/http/directory string /ubuntu
   d-i partman-auto/disk string /dev/sda
   d-i clock-setup/utc boolean true
   d-i time/zone string Europe/Berlin
   d-i apt-setup/restricted boolean true
   d-i apt-setup/universe boolean true
   d-i apt-setup/security_host string security.ubuntu.com
   d-i passwd passwd/make-user boolean true
   d-i passwd/user-fullname string Dummy User
   d-i passwd/username string dummy
   d-i passwd/user-password-crypted password DeLeTeD
   d-i grub-installer/only_debian boolean true
   d-i grub-installer/with_other_os boolean true
   tasksel tasksel/first multiselect ubuntu-standard
   d-i finish-install/reboot_in_progress note
   xserver-xorg xserver-xorg/autodetect_monitor boolean true
   xserver-xorg xserver-xorg/config/monitor/lcd boolean true
   xserver-xorg xserver-xorg/config/monitor/selection-method \
          select medium
   
   #### Advanced options
   ### Shell commands
   # d-i preseeding is inherently not secure. Nothing in the installer checks
   # for attempts at buffer overflows or other exploits of the values of a
   # preconfiguration file like this one. Only use preconfiguration files from
   # trusted locations! To drive that home, and because it's generally useful,
   # here's a way to run any shell command you'd like inside the installer,
   # automatically.
   
   # This first command is run as early as possible, just after
   # preseeding is read.
   #d-i preseed/early_command string anna-install some-udeb
   
   # This command is run just before the install finishes, but when there is
   # still a usable /target directory. You can chroot to /target and use it
   # directly, or use the apt-install and in-target commands to easily install
   # packages and run commands in the target system.
   #d-i preseed/late_command string apt-install zsh; in-target chsh -s /bin/zsh
   
   d-i preseed/late_command \
      string cp -a /cdrom/preseed/instfiles /target; \
             chmod -R u=rwX,go= /target/instfiles; \
             cd /target/instfiles/gem/scripts/start; \
             for i in *; do \
               ln -s /instfiles/gem/scripts/start/$i /target/etc/rcS.d; \
             done

Again, to improve readability, I split the line.  While installing,
/cdrom/preseed/instfiles exists and contains the desired scripts.  The
idea is to execute those scripts at the first reboot while /etc/rcS.d
scripts are executed.  But the instfiles directory never ends up in the
/target directory.

After installation, I make "find /var/log -type f | xargs grep late_command"
and the only results I get are the ones in questions.dat/template.dat.



More information about the Ubuntu-installer mailing list