config.nonet does not exist

Bug #1656985 reported by Michael Nelson on 2017-01-17
28
This bug affects 5 people
Affects Status Importance Assigned to Milestone
Mojo
Medium
Unassigned

Bug Description

I'm seeing "Error calling external process" because mojo attempts to start the container using a non-existent config file:

CalledProcessError: Command '['sudo', 'lxc-start', '-d', '-n', 'mojo-my-project.xenial', '-f', '/var/lib/lxc/mojo-my-project.xenial/config.nonet']' returned non-zero exit status 1

$ sudo lxc-start -d -n mojo-my-project.xenial -f /var/lib/lxc/mojo-my-project.xenial/config.nonet
lxc-start: tools/lxc_start.c: main: 258 Failed to load rcfile

$ ls -al /var/lib/lxc/mojo-my-project.xenial/
total 16
drwxrwxr-x 3 root root 4096 Jan 16 23:32 .
drwxr-xr-x 3 root mojo 4096 Jan 16 23:31 ..
-rw-r--r-- 1 root root 797 Jan 16 23:32 config
drwxr-xr-x 2 root root 4096 Jan 16 23:31 rootfs

I suspect LXCContainer.is_setup should be checking that the required config is written before it decides to return True (so that LXCContainer.setup() is not called - but not 100%). Full traceback at [1]

[1] https://pastebin.canonical.com/176092/ (sorry for the internal link)

Related branches

description: updated
description: updated
Jacek Nykis (jacekn) wrote :

Which version of mojo, Ubuntu and lxc are you running?

Changed in mojo:
status: New → Incomplete
Shawn Wang (shawn111) wrote :

mojo 0.4.1-2

host: xenial, mojo -c lxc

the buildphase force to use nonet config but it wasn't created.

class BuildPhase(ScriptPhase):
    """Execute a build script within a build directory. The build environment
       is restricted to have no access to networks.
       Arguments:
           config Base name for build script file
    """
    name = "build"

    def run(self, project, workspace, stage, auto_secrets=True):
        "Run a build script"
        # XXX: Remove network access during build phase
        super(BuildPhase, self).run(project, workspace, stage,
                                    lxc=True, network=False,
                                    auto_secrets=auto_secrets,
                                    gather_debug_logs=False)

Shawn Wang (shawn111) wrote :

In mojo/contain.py,
for xenial host, it didn't do the setup check just return true.
it skip the container.setup() to create /var/lib/lxc/{}/config.nonet and config.virtnet

class LXCContainer(Container):

    ...

    def is_setup(self):
        if UBUNTU_RELEASES.get(self.series) >= UBUNTU_RELEASES['vivid']:
            return True
        setup_file = self.container_root + "/etc/init/setup-stopped.conf"
        return os.path.exists(setup_file)

James Hebden (jhebden) wrote :

I'm also seeing this.
Ubuntu 16.10
LXD/LXC 2.4.1
Mojo 0.4.1 (from stable PPA)
Juju 2.0.2-yakkety-amd64 (from stable PPA)

Adding "build" to a manifest file, and creating a simple bash script names "build" is enough to trigger this behaviour.
Removing the "build" step in the manifest allows Mojo to continue.

Changed in mojo:
status: Incomplete → New
James Hebden (jhebden) on 2017-02-08
tags: added: canonical-bootstack
Jacek Nykis (jacekn) on 2017-02-20
Changed in mojo:
status: New → Confirmed
importance: Undecided → Medium
Jacek Nykis (jacekn) wrote :

Just to confirm this bug is still present in mojo 0.4.5

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers