← Back to team overview

vmbuilder team mailing list archive

apparent conflict between --existing-chroot and --addpkg

 

(first-time poster to this list, fairly new to vmbuilder)

There appears to be a conflict between options --existing-chroot and --addpkg (and possibly others).  If I use --existing-chroot, it appears that all --addpkg options are ignored.  This is with the kvm hypervisor and ubuntu distribution.  It appears the behavior stems from this code around line 216 in cli.py:

   198              if self.options.existing_chroot:
   199                  distro.set_chroot_dir(self.options.existing_chroot)
   200                  distro.call_hooks('preflight_check')
   201              else:
...
   215                  distro.set_chroot_dir(chroot_dir)
   216                  distro.build_chroot()
   217
   218              if self.options.only_chroot:

If --existing-chroot is specified, no part of distro.build_chroot() is executed.

The discovery stems from a use case that needs to ensure that uids installed by packages (mysql, mongodb, graphite, landscape, etc.) are identical between all builds forever.  In order to do this, I had tried to create an initial chroot with vmbuilder, manually copy in /etc/passwd and friends from a baseline build, then use vmbuilder with --existing-chroot to add the packages and build the final image files.  Alternative implementations that do not require two separate vmbuilder runs could be considered.

Back to the above code, it would seem the solution to the --addpkg option being ignored would be to execute at least part of distro.build_chroot() in the branch that is executed when --existing-chroot is supplied.  Is there documentation on the distro.build_chroot() method and its pieces?

Thanks,

Robert Riches