Skip to content
This repository has been archived by the owner on Nov 24, 2022. It is now read-only.

vagrant-lxc-wrapper doesn't allow 'rm' on Fedora #323

Closed
detached opened this issue Oct 21, 2014 · 9 comments
Closed

vagrant-lxc-wrapper doesn't allow 'rm' on Fedora #323

detached opened this issue Oct 21, 2014 · 9 comments
Milestone

Comments

@detached
Copy link

sudoers rm is /bin/rm on Fedora20

vagrant-lxc-wrapper has only /usr/bin/rm whitelisted

that results in the error:

There was an error executing ["sudo", "/usr/local/bin/vagrant-lxc-wrapper", "rm", "/usr/share/lxc/templates/lxc-vagrant-tmp-lxc_default_1413883001571_41712"]
@fgrehm
Copy link
Owner

fgrehm commented Jan 8, 2015

Weird, we rely on the output of running which rm from the host machine to create that wrapper. What vagrant-lxc version are you using?

@fgrehm fgrehm added bug and removed needs info labels Jan 8, 2015
@fgrehm
Copy link
Owner

fgrehm commented Jan 8, 2015

Oh, I just noticed your #322 (comment), I'll change the plugin to use /usr/bin/which for getting rm path when building the wrapper.

Tagged as a bug

@fgrehm fgrehm modified the milestone: v1.1.0 Jan 8, 2015
@detached detached changed the title vagrant-lxc-wrapper doesn't allow 'rm' on Fedora 20 vagrant-lxc-wrapper doesn't allow 'rm' on Fedora Jan 9, 2015
@kupferk
Copy link

kupferk commented Jan 9, 2015

I also have a similar problem on Fedora 21, but found a workaround. Let me describe what happens.

As a normal user, I run "vagrant lxc sudoers". In this case the sudo_wrapper file gets created and has whitelist entries which begin with "/usr/bin/...". This is consistent with

env | grep PATH
PATH=/home/kaya/bin:/usr/lib64/qt-3.3/bin:/usr/lib64/ccache:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/bin

But then I receive the error "lxc package not installed" when trying to start my box:

vagrant up --provider=lxc
The lxc package does not seem to be installed or is not accessible on the PATH.

When I turn on debugging, I can see that vagrant is actually try to execute /bin/whch instead of /usr/bin/which
And this behaviour is the root cause of my problem. When I execute a command without sudo, I get a different search PATH than with sudo:

env | grep PATH
PATH=/home/kaya/bin:/usr/lib64/qt-3.3/bin:/usr/lib64/ccache:/usr/local/bin:/usr/local/sbin:/usr/bin:
/usr/sbin:/bin:/sbin:/bin

as opposed to

sudo env | grep PATH
PATH=/sbin:/bin:/usr/sbin:/usr/bin

Note that the order of entries is also different!

I could workaround this problem by also using sudo for generating the sudoer wrapper script

sudo vagrant lxc sudoers

This will generate a correct sudo wrapper script.

@fgrehm
Copy link
Owner

fgrehm commented Jan 11, 2015

This is very weird and I'll need to reproduce this locally to help you out.

How are you setting up your Fedora host? Are you using the instructions from https://github.com/fgrehm/vagrant-lxc/wiki/Usage-on-fedora-hosts?

@kupferk
Copy link

kupferk commented Jan 12, 2015

I setup my fedora host using Method 2 from the instructions. Other than that maybe there might be something wrong, because I started using Fedora 16 on my machine and upgraded to Fedora 21 during the last years. So maybe my machine has a slightly different configuration than a fresh install of Fedora 21.

@fgrehm
Copy link
Owner

fgrehm commented Jan 12, 2015

I'll try reproducing this on a clean VBox VM before 1.1.0

@fgrehm fgrehm modified the milestone: v1.1.0 Jan 14, 2015
@kupferk
Copy link

kupferk commented Jan 29, 2015

This seems to work now with 1.1.0. Thanks a lot!

@Ramblurr
Copy link

This issue reared its head again for me on Fedora 21 using 1.1.0 (installed from the new rpm packages).

I outlined it in #350 , but I'll repeat:

On Fedora the root has a different PATH than my user.

As root (when I run sudo vagrant lxc sudoers) /bin is first in the PATH, whereas when I run vagrant as my user /usr/bin is first. This results in a wrapper file that uses an lxc_bin of /bin, but the vagrant user is passing in /usr/bin/ as a path.

@globin globin added this to the post-1.2.0 milestone Sep 8, 2015
@fgrehm fgrehm added the ignored label Nov 17, 2022
@fgrehm
Copy link
Owner

fgrehm commented Nov 17, 2022

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 👋

@fgrehm fgrehm closed this as completed Nov 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants