Control: tags -1 +patch Here's a patch to fix this.
>From 1ddf84046d314e8fafec4266d701be17c08b458f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antoine=20Beaupr=C3=A9?= <anar...@debian.org> Date: Thu, 5 Jan 2017 02:23:24 -0500 Subject: [PATCH] install custom packages non-interactively (Closes: #850213) this was happening because some of the prompts were hidden during debootstrap, and would show up during the apt-get install -y run that is triggered after dpkg -i when installing custom packages. --- bin/vmdebootstrap | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/bin/vmdebootstrap b/bin/vmdebootstrap index d9a697d..9f0c7fd 100755 --- a/bin/vmdebootstrap +++ b/bin/vmdebootstrap @@ -467,6 +467,17 @@ class VmDebootstrap(cliapp.Application): # pylint: disable=too-many-public-meth # return to doing swap setup base.make_swap(extent) + def _non_interactive_env(self): + '''set a noninteractive debconf environment''' + env = { + "DEBIAN_FRONTEND": "noninteractive", + "DEBCONF_NONINTERACTIVE_SEEN": "true", + "LC_ALL": "C" + } + # merge with complete environment + env.update(os.environ) + return env + def _bootstrap_packages(self): base = self.handlers[Base.name] uefi = self.handlers[Uefi.name] @@ -483,14 +494,6 @@ class VmDebootstrap(cliapp.Application): # pylint: disable=too-many-public-meth def _debootstrap_second_stage(self, rootdir): base = self.handlers[Base.name] - # set a noninteractive debconf environment for secondstage - env = { - "DEBIAN_FRONTEND": "noninteractive", - "DEBCONF_NONINTERACTIVE_SEEN": "true", - "LC_ALL": "C" - } - # add the mapping to the complete environment. - env.update(os.environ) # First copy the binfmt handler over base.message('Setting up binfmt handler') shutil.copy(self.settings['foreign'], '%s/usr/bin/' % rootdir) @@ -498,7 +501,7 @@ class VmDebootstrap(cliapp.Application): # pylint: disable=too-many-public-meth base.message('Running debootstrap second stage') runcmd(['chroot', rootdir, '/debootstrap/debootstrap', '--second-stage'], - env=env) + env=self._non_interactive_env()) def debootstrap(self, rootdir): base = self.handlers[Base.name] @@ -541,7 +544,8 @@ class VmDebootstrap(cliapp.Application): # pylint: disable=too-many-public-meth logging.debug('stdout:\n%s', out) logging.debug('stderr:\n%s', err) out = runcmd(['chroot', rootdir, - 'apt-get', '-y', '-f', '--no-remove', 'install']) + 'apt-get', '-y', '-f', '--no-remove', 'install'], + env=self._non_interactive_env()) logging.debug('stdout:\n%s', out) shutil.rmtree(tmp) -- 2.11.0
Can also be reviewed or pulled directly from: https://gitlab.com/anarcat/vmdebootstrap/commit/1ddf84046d314e8fafec4266d701be17c08b458f or the git repo at: https://gitlab.com/anarcat/vmdebootstrap/ 850213-non-interactive branch. A. -- If builders built houses the way programmers built programs, The first woodpecker to come along would destroy civilization. - Gerald Weinberg