lxc-attach on boot fails
Closed this issue ยท 6 comments
marmistrz commented
Using Arch Linux. Typed
$ vagrant init fgrehm/trusty64-lxc
$ vagrant up
Bringing machine 'default' up with 'lxc' provider...
==> default: Box 'fgrehm/trusty64-lxc' could not be found. Attempting to find and install...
default: Box Provider: lxc
default: Box Version: >= 0
==> default: Loading metadata for box 'fgrehm/trusty64-lxc'
default: URL: https://atlas.hashicorp.com/fgrehm/trusty64-lxc
==> default: Adding box 'fgrehm/trusty64-lxc' (v1.2.0) for provider: lxc
default: Downloading: https://atlas.hashicorp.com/fgrehm/boxes/trusty64-lxc/versions/1.2.0/providers/lxc.box
==> default: Successfully added box 'fgrehm/trusty64-lxc' (v1.2.0) for 'lxc'!
==> default: Importing base box 'fgrehm/trusty64-lxc'...
==> default: Checking if box 'fgrehm/trusty64-lxc' is up to date...
==> default: Setting up mount entries for shared folders...
default: /vagrant => /home/marcin/lxc
==> default: Starting container...
==> default: Waiting for machine to boot. This may take a few minutes...
There was an error executing ["sudo", "/usr/bin/env", "lxc-attach", "--name", "lxc_default_1478245384274_15966", "--namespaces", "NETWORK|MOUNT", "--", "/sbin/ip", "-4", "addr", "show", "scope", "global", "eth0"]
For more information on the failure, enable detailed logging by setting
the environment variable VAGRANT_LOG to DEBUG.
marmistrz commented
From the DEBUG-enabled log:
INFO subprocess: Starting process: ["/usr/bin/sudo", "/usr/bin/env", "lxc-attach", "--name", "lxc_default_1478245824671_5278", "--namespaces", "NETWORK|MOUNT", "--", "/sbin/ip", "-4", "addr", "show", "scope", "global", "eth0"]
INFO subprocess: Command not in installer, restoring original environment...
DEBUG subprocess: Selecting on IO
DEBUG subprocess: stderr: Device "eth0" does not exist.
DEBUG subprocess: Waiting for process to exit. Remaining to timeout: 32000
DEBUG subprocess: Exit status: 1
INFO retryable: Retryable exception raised: #<Vagrant::LXC::Errors::ExecuteError: There was an error executing ["sudo", "/usr/bin/env", "lxc-attach", "--name", "lxc_default_1478245824671_5278", "--namespaces", "NETWORK|MOUNT", "--", "/sbin/ip", "-4", "addr", "show", "scope", "global", "eth0"]
Indeed, eth0
does not exist on my machine, my ethernet iface is named enpXsY
zamentur commented
I reproduce this bug with a debian jessie host and a guest debian/stretch64 (9.1) guest.
The issues is there are no eth0 inside the guest (because stretch use the new interfaces names)
zamentur commented
I have removed eth0 from this line, but it's not a clean fix
anlutro commented
I'm seeing the same error, but on a Debian Stretch host with a Ubuntu 16.04 container. The network is named eth0 on the host, but the are only loopback devices on the container:
$ sudo lxc-attach --name <container-name> -- ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
Deleted user commented
Does the issue persist with v1.3.1? We use lxc-info
now to fetch IP address instead of lxc-attach
.
Deleted user commented
In fact, this is a duplicate to #308