Page MenuHomePhabricator

Backport Vagrant 1.7+ from Debian experimental to our Trusty apt repo
Closed, ResolvedPublic

Description

Enable deprecating role::labs_vagrant in favor of role::mediawiki_vagrant_lxc by making a Vagrant 1.7+ deb available for installation on Trusty hosts in Labs. Backporting the latest Debian experimental vagrant package (https://packages.debian.org/experimental/vagrant) to our Ubuntu 14.04 apt repo would do the trick.

See https://gerrit.wikimedia.org/r/#/c/193665/ for intended usage.

Event Timeline

bd808 raised the priority of this task from to Needs Triage.
bd808 updated the task description. (Show Details)
bd808 added projects: Labs-Vagrant, acl*sre-team.
bd808 added subscribers: bd808, dduvall.

I don't know if it would be acceptable, but there are universal deb packages provided by Vagrant directly that could just be put into our apt cache too.

fgiunchedi triaged this task as Medium priority.Apr 2 2015, 9:38 AM
fgiunchedi subscribed.
bd808 added a subscriber: akosiaris.

@akosiaris and/or @fgiunchedi: would either of you be interested in helping me with this? I'd love to move T90892 forward.

Stealing this, it might take me a bit, as I familiarize myself with labs vagrant.

I submitted a patch to fix system gem integration a while. back. I'm not sure if it was applied to the latest package but it would be great to check that.

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=740165#30

So the sid packages are a bit of a mess to backport to trusty, but I have now put in the official vagrant packages on Carbon. They are kind of shit packages, though :(

It's an FPM built package and upstream doesn't care much https://github.com/mitchellh/vagrant-installers/issues/12 so I'm ok with this being used as is for now, rather than backporting to trusty from sid. @akosiaris does that sound ok?

I 've managed to backport 1.7.2+dfsg-4 from sid to trusty instead. I 've deleted the ugly upstream package and replaced it with the backport. For now tentatively resolving this, I suppose we can reopen if we find bugs.

Some ruby error in the backported package:

$ vagrant plugin list
/usr/lib/ruby/vendor_ruby/vagrant/pre-rubygems.rb:19:in `require_relative': /usr/lib/ruby/vendor_ruby/vagrant/bundler.rb:223: syntax error, unexpected tPOW (SyntaxError)
    def internal_install(plugins, update, **extra)
                                            ^
/usr/lib/ruby/vendor_ruby/vagrant/bundler.rb:305: class definition in method body
/usr/lib/ruby/vendor_ruby/vagrant/bundler.rb:322: class definition in method body
/usr/lib/ruby/vendor_ruby/vagrant/bundler.rb:375: syntax error, unexpected keyword_end, expecting $end
        from /usr/lib/ruby/vendor_ruby/vagrant/pre-rubygems.rb:19:in `<main>'
  • vagrant 1.7.2+dfsg-4
  • ruby 1:1.9.3.4
  • libruby1.9.1 1.9.3.484-2ubuntu1.2

The "official" package from https://www.vagrantup.com/downloads.html doesn't throw this error. My guess is that **extra syntax needs/wants a newer version of ruby. The sid version of ruby is 1:2.1.5.1 instead of trusty's 1:1.9.3.4

Trusty has a ruby2.0 package that can be installed and made the default interpreter:

sudo apt-get install ruby2.0 ruby2.0-dev

sudo update-alternatives --install /usr/bin/ruby ruby /usr/bin/ruby1.9.1 100
sudo update-alternatives --install /usr/bin/gem gem /usr/bin/gem1.9.1 100
sudo update-alternatives --install /usr/bin/ruby ruby /usr/bin/ruby2.0 200
sudo update-alternatives --install /usr/bin/gem gem /usr/bin/gem2.0 200

sudo update-alternatives --set ruby /usr/bin/ruby2.0
sudo update-alternatives --set gem /usr/bin/gem2.0

Success!

$ ruby --version
ruby 2.0.0p384 (2014-01-12) [x86_64-linux-gnu]

But...

$ vagrant init
Vagrant experienced a version conflict with some installed plugins!
This usually happens if you recently upgraded Vagrant. As part of the
upgrade process, some existing plugins are no longer compatible with
this version of Vagrant. The recommended way to fix this is to remove
your existing plugins and reinstall them one-by-one. To remove all
plugins:

    rm -r ~/.vagrant.d/plugins.json ~/.vagrant.d/gems

Note if you have an alternate VAGRANT_HOME environmental variable
set, the folders above will be in that directory rather than your
user's home directory.

The error message is shown below:

Could not find gem 'nokogiri (>= 1.6.3.1) ruby', which is required by gem 'vagrant (= 1.7.2) ruby', in any of the sources.

Trusty doesn't provide ruby2.0-* packages for gems. :(

From the depends for vagrant 1.7.2+dfsg-4 we are going to need to backport ruby2.0 versions of these packages (and their possible ruby-* dependencies):

  • ruby-childprocess (>= 0.3.7)
  • ruby-erubis (>= 2.7.0)
  • ruby-i18n (>= 0.6.0)
  • ruby-listen
  • ruby-log4r (>= 1.1.9)
  • ruby-net-scp (>= 1.1.0)
  • ruby-net-sftp
  • ruby-net-ssh (>= 1:2.6.6)
  • ruby-rest-client
  • ruby-nokogiri
  • ruby-rb-inotify

@akosiaris this is starting to look like a long, boring and painful journey.

Just to see what the next hurdle would be I installed the needed gems manually.

sudo apt-get build-dep ruby-nokogiri
sudo apt-get install zlib1g-dev
sudo gem install --no-ri --no-rdoc childprocess erubis i18n listen log4r net-scp net-sftp net-ssh rest-client nokogiri rb-inotify

17 gems installed

Then the baseline test:

$ vagrant init
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.

$ vagrant plugin list
vagrant-lxc (1.1.0, system)

@akosiaris and I talked over difficulty that backporting and continuing to maintain all of the gem packages would be and he grudgingly agreed that we should probably just switch back to the "official" deb from https://www.vagrantup.com/downloads.html.

@yuvipanda imported https://dl.bintray.com/mitchellh/vagrant/vagrant_1.7.3_x86_64.deb into apt for me.

It turns out that the 1.7.3 package includes a few nfs setup bugs that we need fixed. 1.7.4 includes the fixes. We should get it added to apt: https://dl.bintray.com/mitchellh/vagrant/vagrant_1.7.4_x86_64.deb

I just imported 1.7.4 into thirdparty component of trusty-wikimedia apt.wikimedia.org repo. I cleaned up all the previous ones, including vagrant-lxc package. So we ended up going full circle on this one unfortunately. I am gonna tentatively resolve this again, hoping no bugs show up.