[buildd-tools-devel] Bug#674846: Bug#674846: /etc/resolv.conf should be copied upon every invocaktion, not just session start

Roger Leigh rleigh at codelibre.net
Sat Nov 3 13:43:43 UTC 2012


On Mon, May 28, 2012 at 09:29:46AM +0100, Roger Leigh wrote:
> On Mon, May 28, 2012 at 09:37:59AM +0200, Joachim Breitner wrote:
> > on my laptop, I sometimes have a long running schroot session (several
> > days). It seems that schroot is only copying the current
> > /etc/resolv.conf when I begin the session, or when it is recovered at
> > boot time, but not everytime I enter it. This causes problems when I
> > move locations between uses of the session. It also causes problems when
> > the schroot init script runs before the network is set up, as it will
> > copy an empty /etc/resolv.conf. 
> > 
> > It seems that this could be fixed if always the current /etc/resolv.conf
> > is used.
> 
> We used to have "exec" scripts in addition to "setup" scripts, which
> were run once per command being run, rather than once per session.
> These lived in /etc/schroot/exec.d rather than /etc/schroot/setup.d.
> These were never used for any practical purpose, so they were removed
> some years back.  However, we could certainly add them back to make
> this possible.

The "exec" script facility has been restored in schroot 1.7.0
(current git master, not yet released).  With exec scripts
re-enabled, you just need to change this line in 20copyfiles:

if [ $STAGE = "setup-start" ] || [ $STAGE = "setup-recover" ]; then

to

if [ $STAGE = "setup-start" ] || [ $STAGE = "setup-recover" ] || [ $STAGE = "exec-start" ]; then

and it will be run every time a command is run, copying outdated
files into the chroot.

In fact, any setup script can be modified in this way to
to any per-command setup.


The outstanding question here is whether this should be
enabled by default, since this adds additional work for
every command invocation, which could potentially be
quite expensive.  And it also alters the chroot environment,
which you might want to keep consistent within the
context of a session.

The script isn't specific to resolv.conf; it handles copying
of arbitrary files.  So we could add an extra third argument
to each line in copyfiles:
source dest setup|exec
to indicate when you want a file to be copied.


This is really just an issue of how to configure this in a
way convinient for the admin/user.


Regards,
Roger

-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux    http://people.debian.org/~rleigh/
 `. `'   schroot and sbuild  http://alioth.debian.org/projects/buildd-tools
   `-    GPG Public Key      F33D 281D 470A B443 6756 147C 07B3 C8BC 4083 E800



More information about the Buildd-tools-devel mailing list