fgrehm/vagrant-lxc

kill: Operation not permitted

thePanz opened this issue · 5 comments

I am getting the following message when booting up a machine:

==> php-7.1: Machine booted and ready!
#<Thread:0x000055bba4492158@/opt/vagrant/embedded/gems/gems/vagrant-2.0.2/lib/vagrant/action/builtin/wait_for_communicator.rb:21 aborting> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
        19: from /opt/vagrant/embedded/gems/gems/vagrant-2.0.2/lib/vagrant/action/builtin/wait_for_communicator.rb:26:in `block in call'
        18: from /opt/vagrant/embedded/gems/gems/vagrant-2.0.2/lib/vagrant/machine.rb:514:in `state'
        17: from /home/ema/.vagrant.d/gems/2.5.0/gems/vagrant-lxc-1.3.1/lib/vagrant-lxc/provider.rb:87:in `state'                                                                                                                                                                             
        16: from /home/ema/.vagrant.d/gems/2.5.0/gems/vagrant-lxc-1.3.1/lib/vagrant-lxc/driver.rb:235:in `state'                                                                                                                                                                              
        15: from /home/ema/.vagrant.d/gems/2.5.0/gems/vagrant-lxc-1.3.1/lib/vagrant-lxc/driver/cli.rb:50:in `state'                                                                                                                                                                           
        14: from /home/ema/.vagrant.d/gems/2.5.0/gems/vagrant-lxc-1.3.1/lib/vagrant-lxc/driver/cli.rb:161:in `run'                                                                                                                                                                            
        13: from /home/ema/.vagrant.d/gems/2.5.0/gems/vagrant-lxc-1.3.1/lib/vagrant-lxc/sudo_wrapper.rb:32:in `run'                                                                                                                                                                           
        12: from /home/ema/.vagrant.d/gems/2.5.0/gems/vagrant-lxc-1.3.1/lib/vagrant-lxc/sudo_wrapper.rb:58:in `execute'                                                                                                                                                                       
        11: from /opt/vagrant/embedded/gems/gems/vagrant-2.0.2/lib/vagrant/util/retryable.rb:17:in `retryable'                                                                                                                                                                                
        10: from /home/ema/.vagrant.d/gems/2.5.0/gems/vagrant-lxc-1.3.1/lib/vagrant-lxc/sudo_wrapper.rb:60:in `block in execute'                                                                                                                                                              
         9: from /home/ema/.vagrant.d/gems/2.5.0/gems/vagrant-lxc-1.3.1/lib/vagrant-lxc/sudo_wrapper.rb:93:in `raw'                                                                                                                                                                           
         8: from /opt/vagrant/embedded/gems/gems/vagrant-2.0.2/lib/vagrant/util/busy.rb:19:in `busy'                                                                                                                                                                                          
         7: from /home/ema/.vagrant.d/gems/2.5.0/gems/vagrant-lxc-1.3.1/lib/vagrant-lxc/sudo_wrapper.rb:94:in `block in raw'                                                                                                                                                                  
         6: from /opt/vagrant/embedded/gems/gems/vagrant-2.0.2/lib/vagrant/util/subprocess.rb:22:in `execute'                                                                                                                                                                                 
         5: from /opt/vagrant/embedded/gems/gems/vagrant-2.0.2/lib/vagrant/util/subprocess.rb:254:in `execute'                                                                                                                                                                                
         4: from /opt/vagrant/embedded/gems/gems/vagrant-2.0.2/lib/vagrant/util/subprocess.rb:254:in `ensure in execute'                                                                                                                                                                      
         3: from /opt/vagrant/embedded/gems/gems/childprocess-0.6.3/lib/childprocess/unix/process.rb:12:in `stop'
         2: from /opt/vagrant/embedded/gems/gems/childprocess-0.6.3/lib/childprocess/unix/process.rb:61:in `send_term'
         1: from /opt/vagrant/embedded/gems/gems/childprocess-0.6.3/lib/childprocess/unix/process.rb:72:in `send_signal'
/opt/vagrant/embedded/gems/gems/childprocess-0.6.3/lib/childprocess/unix/process.rb:72:in `kill': Operation not permitted (Errno::EPERM)

Vagrant: v2.0.2
Vagrantl-lxc: v1.3.1
LXC: v2.0.8

You get that every time? Could you try again with --debug?

ccope commented

The stacktrace is because Vagrant::LXC::Driver::CLI::run calls into Vagrant::LXC::SudoWrapper::raw which calls Vagrant::Util::Subprocess. This function has a timeout, and if it tries to kill the command if it's stuck. All of the lxc commands are run via sudo though, so it doesn't have the privileges to kill it. Vagrant could really use a nice interface like machine.communicate for running commands on the host...

ccope commented

As for @thePanz's issue, either there's a network misconfiguration or the container is failing to start due to some configuration problem. Try running sudo lxc-ls -f to see if your container is running and has an IP address. If there's no IP, start looking at your bridge configuration and dhcp server. If it's not running at all, try starting it by hand, with sudo lxc-start -n containername -l debug -o logfile. If it doesn't start, post the log file and your /var/lib/lxc/containername/config (note: you have to be root before attempting to tab complete that path, /var/lib/lxc is only readable by root)

@ccope @hsoft The issue is quite random, I started the machine (after a reboot) and the error is not displayed anymore.
Can we keep this issue open (or labelled as "to be confirmed") so I can post new insights as soon the issue manifests again?

Hey, sorry for the silence here but this project is looking for maintainers 😅

As per #499, I've added the ignored label and will close this issue. Thanks for the interest in the project and LMK if you want to step up and take ownership of this project on that other issue 👋