Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 628648 - app-emulation/vagrant - Conflicting gem dependencies when installing plugins
Summary: app-emulation/vagrant - Conflicting gem dependencies when installing plugins
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Tomáš Mózes
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-22 20:20 UTC by James Le Cuirot
Modified: 2017-09-11 04:30 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description James Le Cuirot gentoo-dev 2017-08-22 20:20:23 UTC
$ vagrant version
Installed Version: 1.9.7
Latest Version: 1.9.7
 
You're running an up-to-date version of Vagrant!

$ vagrant plugin install vagrant-cachier
Installing the 'vagrant-cachier' plugin. This can take a few minutes...
Bundler, the underlying system Vagrant uses to install plugins,
reported an error. The error is shown below. These errors are usually
caused by misconfigured plugin installations or transient network
issues. The error from Bundler is:

conflicting dependencies net-ssh (= 4.1.0) and net-ssh (= 2.10.0)
  Activated net-ssh-2.10.0
  which does not match conflicting dependency (= 4.1.0)

  Conflicting dependency chains:
    net-ssh (= 2.10.0), 2.10.0 activated

  versus:
    net-ssh (= 4.1.0)

  Gems matching net-ssh (= 4.1.0):
    net-ssh-4.1.0

----

It is important to note that vagrant-cachier does not have any dependencies. That isn't the problem here. I have two versions of net-ssh installed by Portage, 2.10.0 for net-scp, and 4.1.0 for vagrant.

Without bundler's help, it picks up the older version first. How do I know bundler would help? I created a Gemfile.lock using only vagrant's gemspec against gems installed on the system. Installing the plugin by prefixing the above command with "bundle exec" then worked.

I also tried placing "gem 'net-ssh', '=4.1.0'" at the start of vagrant's script but strangely, that didn't help. It seems to forget the gem environment when installing plugins but the bundler environment survives, perhaps thanks to the BUNDLER_GEMFILE environment variable.

I am very familiar with Ruby as I use it every day for work. Despite using Gentoo for years, I am less familiar with how Gentoo packages Ruby gems. Knowing how important bundler is in locking down the gem versions, I do wonder whether this problem is more widespread in other packages. If not then this may be something specific to how vagrant installs plugins. It does have a Vagrant::Bundler class, after all. What's strange is that bundler is not a dependency and you even get the above error without it installed.

----

Portage 2.3.8 (python 2.7.13-final-0, default/linux/amd64/17.0, gcc-7.1.0, glibc-2.24-r1, 4.11.12-01738-g3507a4ecfa36 x86_64)
=================================================================
System uname: Linux-4.11.12-01738-g3507a4ecfa36-x86_64-AMD_Ryzen_5_1600X_Six-Core_Processor-with-gentoo-2.4.1
KiB Mem:    16426660 total,  12323652 free
KiB Swap:    5242876 total,   5242876 free
Head commit of repository gentoo: fe817b619cc3edd62175dd2e3716f93c1405aebe

sh bash 4.4_p12
ld GNU ld (Gentoo 2.28 p1.2) 2.28
distcc 3.2rc1 x86_64-pc-linux-gnu [disabled]
ccache version 3.3.4 [disabled]
app-shells/bash:          4.4_p12::gentoo
dev-java/java-config:     2.2.0-r3::gentoo
dev-lang/perl:            5.24.1-r2::gentoo
dev-lang/python:          2.7.13::gentoo, 3.5.3::gentoo, 3.6.1-r1::gentoo
dev-util/ccache:          3.3.4::gentoo
dev-util/cmake:           3.8.2::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.4.1::gentoo
sys-apps/openrc:          0.27.2::gentoo
sys-apps/sandbox:         2.10-r4::gentoo
sys-devel/autoconf:       2.13::<unknown repository>, 2.69-r3::gentoo
sys-devel/automake:       1.15-r2::gentoo
sys-devel/binutils:       2.28-r2::gentoo
sys-devel/gcc:            6.4.0::gentoo, 7.1.0-r1::gentoo
sys-devel/gcc-config:     1.8-r1::gentoo
sys-devel/libtool:        2.4.6-r4::gentoo
sys-devel/make:           4.2.1-r1::gentoo
sys-kernel/linux-headers: 4.10::gentoo (virtual/os-headers)
sys-libs/glibc:           2.24-r1::gentoo
Repositories:

abendbrot
    location: /var/lib/layman/abendbrot
    masters: gentoo
    priority: -1001

gentoo
    location: /usr/portage
    sync-type: git
    sync-uri: git+ssh://git@git.gentoo.org/repo/gentoo.git
    priority: -1000

steam-overlay
    location: /var/lib/layman/steam-overlay
    masters: gentoo
    priority: 50

symphony
    location: /usr/local/portage
    masters: gentoo
    priority: 1001

Installed sets: @esteam, @iplayer
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=bdver4 -mno-fma4 -mno-tbm -mno-xop -mno-lwp -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.6/ext-active/ /etc/php/apache2-php7.1/ext-active/ /etc/php/cgi-php5.6/ext-active/ /etc/php/cgi-php7.1/ext-active/ /etc/php/cli-php5.6/ext-active/ /etc/php/cli-php7.1/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=bdver4 -mno-fma4 -mno-tbm -mno-xop -mno-lwp -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--ask-enter-invalid --quiet-build=n --nospinner"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync multilib-strict network-sandbox news parallel-fetch preserve-libs protect-owned sandbox sfperms sign strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://mirror.bytemark.co.uk/gentoo http://mirror.qubenet.net/mirror/gentoo http://gentoo.osuosl.org"
INSTALL_MASK="/usr/lib64/distcc/bin"
LANG="en_GB.utf8"
LC_ALL="en_GB.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j12"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="S3TC X a52 aac aacplus aacs aalib acpi alaw amd64 amr asf bash-completion berkdb bluray bmp bogofilter branding bzip2 cairo cdda cddb cdio cdparanoia cdr cdrom cdsound cli cracklib crypt css cups curl cxx dbus device-mapper dhcp dri dts dvd dvdnav egl emf enca encode exif fam fat fbcon fdk ffmpeg fftw filter flac fluidsynth fontconfig frei0r ftp fuse gallium gbm gdbm gif gimp git gkrellm glamor gmp gnutls gphoto2 gpm gsm gstreamer gtk gtk3 gtkstyle http hwdb iconv icu id3tag imagemagick ipv6 ithreads j2me jfs joystick jpeg ladspa lame launcher lcms libkms libnotify libsamplerate libsoxr live lvm mad matroska midi mikmod mod modern-top modplug modules mp3 mp4 mpeg multilib ncurses nptl ntfs offensive ogg openal opencl opengl openmax openmp openssl opus osmesa pam pcre pdf pm-utils png policykit pulseaudio qt5 rar readline reiserfs rtc s3tc sasl scanner sdl seccomp session smp sndfile sound speex spell ssl startup-notification steamfonts steamgames_portal steamgames_source_engine svg taglib theora threads thunar tiff timidity truetype udev udisks ulaw unicode upnp upower usb v4l vaapi vdpau vhosts vorbis vpx vulkan wav wayland webgl webp widevine wma wmf x264 x265 xattr xcb xcomposite xft xkb xml xrandr xv xvid xvmc zlib zsh-completion" ABI_X86="64 32" ALSA_CARDS="intel-hda" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 f16c fma3 mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="evdev" KERNEL="linux" L10N="en-GB" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en en_GB" LIRC_DEVICES="devinput" NGINX_MODULES_HTTP="access auth_basic autoindex fastcgi geoip gzip proxy rewrite ssi" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6" POSTGRES_TARGETS="postgres9_5" PYTHON_SINGLE_TARGET="python3_5" PYTHON_TARGETS="python3_6 python3_5 python2_7" QEMU_SOFTMMU_TARGETS="i386 x86_64" QEMU_USER_TARGETS="i386 x86_64 arm" RUBY_TARGETS="ruby23 ruby24" USERLAND="GNU" VIDEO_CARDS="amdgpu radeon radeonsi" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 James Le Cuirot gentoo-dev 2017-08-22 22:12:18 UTC
Hmm maybe using bundler isn't the key. When I try to install vagrant-libvirt using the same method, it fails to build nokogiri 1.6.8.1 because mini_portile2 isn't in the bundle. I should check how Fedora packages vagrant.
Comment 2 Hans de Graaff gentoo-dev Security 2017-08-23 06:20:12 UTC
(In reply to James Le Cuirot from comment #0)

> I am very familiar with Ruby as I use it every day for work. Despite using
> Gentoo for years, I am less familiar with how Gentoo packages Ruby gems.

Basically we use our own eclass to install the files, but the on-disk result should be the same. The exception is that we only install the actual code by default, so we strip things like test and spec directories before install.

Unsuspecting ruby code should not be able to tell the difference, so this seems to point to a vagrant issue.
Comment 3 Tomáš Mózes 2017-08-23 11:50:07 UTC
Please try:
$ VAGRANT_DISABLE_STRICT_DEPENDENCY_ENFORCEMENT=1 vagrant plugin install vagrant-cachier

The strict dep check was added to 1.9.6:
https://github.com/mitchellh/vagrant/pull/8692/files

And bundler dep was removed in 1.9.0:
https://github.com/mitchellh/vagrant/commit/1fb4553d14b235957d89d29f26f1c0decc971831
Comment 4 Tomáš Mózes 2017-08-23 11:51:02 UTC
It seems to fail on this call:
Gem::Dependency.new(spec.name, spec.version)
Comment 5 James Le Cuirot gentoo-dev 2017-08-23 12:45:58 UTC
(In reply to Tomáš Mózes from comment #3)
> Please try:
> $ VAGRANT_DISABLE_STRICT_DEPENDENCY_ENFORCEMENT=1 vagrant plugin install
> vagrant-cachier

That works for me. It still seems like a bug though. Obviously vagrant needs to avoid conflicting dependencies but like I said, vagrant-cachier doesn't have any. I may play with the code later to see exactly what it's doing.
Comment 6 James Le Cuirot gentoo-dev 2017-08-30 21:26:02 UTC
I've had a look. Thanks to Gem::Specification.find_all in the vagrant_internal_specs method, it gets a list of all the gems in the environment. I think Vagrant likes to assume that it is installed into its own isolated gem environment. This is probably why upstream tells you not to install it using your distro. I have still run into problems using their RPM on Fedora though as having GEM_HOME or GEM_PATH set confuses it. These variables are commonly set by rvm and the like. On both Fedora and Gentoo, I have placed this in /usr/local/bin/vagrant.

> #!/bin/sh
> 
> unset RUBY_VERSION GEM_HOME GEM_PATH
> PATH=/usr/local/bin:/usr/bin:/bin
> exec /usr/bin/vagrant "${@}"

It would be handy to prepend this to the vagrant launcher. I guess we should also add VAGRANT_DISABLE_STRICT_DEPENDENCY_ENFORCEMENT=1 too as this check is no use to us in its current form. Maybe it could be improved to only consider vagrant, the existing plugins, and their dependencies instead of every single gem. That way, gems not used by vagrant at all (like net-ssh 2.10.0) would be ignored.
Comment 7 Tomáš Mózes 2017-09-08 05:14:05 UTC
(In reply to James Le Cuirot from comment #6)
> I've had a look. Thanks to Gem::Specification.find_all in the
> vagrant_internal_specs method, it gets a list of all the gems in the
> environment. I think Vagrant likes to assume that it is installed into its
> own isolated gem environment. This is probably why upstream tells you not to
> install it using your distro. I have still run into problems using their RPM
> on Fedora though as having GEM_HOME or GEM_PATH set confuses it. These
> variables are commonly set by rvm and the like. On both Fedora and Gentoo, I
> have placed this in /usr/local/bin/vagrant.
> 
> > #!/bin/sh
> > 
> > unset RUBY_VERSION GEM_HOME GEM_PATH
> > PATH=/usr/local/bin:/usr/bin:/bin
> > exec /usr/bin/vagrant "${@}"
> 
> It would be handy to prepend this to the vagrant launcher. I guess we should
> also add VAGRANT_DISABLE_STRICT_DEPENDENCY_ENFORCEMENT=1 too as this check
> is no use to us in its current form. Maybe it could be improved to only
> consider vagrant, the existing plugins, and their dependencies instead of
> every single gem. That way, gems not used by vagrant at all (like net-ssh
> 2.10.0) would be ignored.

Thanks for digging into this a bit. We already had an issue with RVM in the last and it was solved by patching vagrant itself and unsetting GET_PATH. I've moved this to the vagrant wrapper along with GET_HOME and now set export VAGRANT_DISABLE_STRICT_DEPENDENCY_ENFORCEMENT:
https://github.com/gentoo/gentoo/pull/5657
Comment 8 Tomáš Mózes 2017-09-11 04:30:47 UTC
Should be fixed in 1.9.8,please try.