With EdgeOS 1.6 for the EdgeRouter line, Ubiquiti upgraded the Debian distribution from squeeze to wheezy. Along with a more modern 3.10 kernel this gets us a newer version of Ruby too, 1.9.1. During upgrades the system is blown away so I lost my Chef client. I had problems re-bootstrapping my routers until I finally realized that /etc/apt/sources.list still pointed at squeeze repos. I asked Ubiquiti about this and they say it’s intentional that you have to update sources.list to fetch from the new repo.
How to fail
Stepping back in time before I figured this out, this is what transpired.
When I would try to build gems things went sideways; the running system was wheezy but it was trying to install packages from the squeeze distribution. As such there were a lot of version conflicts and packages just refused to install. For the record, these are the sort of errors I was running into with a repo mismatch (mainly around libc6 and libc6-dev when trying to install ruby):
root@gw2:/home/ubnt# apt-get install ruby ruby-dev git ruby1.8-dev ... The following packages have unmet dependencies: ruby1.8-dev : Depends: libc6-dev but it is not going to be installed E: Unable to correct problems, you have held broken packages. root@gw2:/home/ubnt#
Trying to install libc6-dev fails:
root@gw2:/home/ubnt# apt-get install libc6-dev The following packages have unmet dependencies: libc6-dev : Depends: libc6 (= 2.11.3-4) but 2.13-38+deb7u6 is to be installed Depends: libc-dev-bin (= 2.11.3-4) but it is not going to be installed Recommends: gcc but it is not going to be installed or c-compiler E: Unable to correct problems, you have held broken packages. root@gw2:/home/ubnt#
You can pretend the problem doesn’t exist and ignore the problem by installing ruby 1.8 without the -dev package, but this will blow up on you later when you try to build gems such as ohai:
root@gw2:/tmp/rubygems-2.4.1# gem install ohai --no-rdoc --no-ri --verbose ... /usr/lib/ruby/gems/1.8/gems/ffi-1.9.6/spec/ffi/variadic_spec.rb /usr/lib/ruby/gems/1.8/gems/ffi-1.9.6/spec/spec.opts Building native extensions. This could take a while... /usr/bin/ruby1.8 -r ./siteconf20141213-14984-bl1gm-0.rb extconf.rb extconf.rb:4:in `require': no such file to load -- mkmf (LoadError) from extconf.rb:4 ERROR: Error installing ohai: ERROR: Failed to build gem native extension. Building has failed. See above output for more information on the failure. extconf failed, exit code 1 Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/ffi-1.9.6 for inspection. Results logged to /usr/lib/ruby/gems/1.8/extensions/mips-linux/1.8/ffi-1.9.6/gem_make.out root@gw2:/tmp/rubygems-2.4.1#
Aaaaand this fails because mkmf (Ruby MakeMakefile module) is provided by the ruby-dev package we couldn’t install earlier.
root@gw1:/home/ubnt# dpkg-query -L ruby1.9.1-dev | grep mkmf /usr/lib/ruby/1.9.1/mkmf.rb root@gw1:/home/ubnt#
So the lesson here is to make sure you’re fetching package from the correct repo. If you’ve found yourself in this situation, you’ll want to back things out and install the correct versions. First thing you want to do is dpkg --purge ruby1.8 libruby1.8 remove ruby 1.8. Then fix your apt sources and start all over again.
Chef/Ruby version caveat
One thing worth mentioning here is that you won’t be able to run the latest hotness, Chef client 12. The wheezy distro only has ruby 1.9.1, and Chef 12 requires ruby 2.0. The best I’ve been able to install from rubygems is Ohai v7.4.0 and Chef client 11.16.4.
gem install ohai --no-rdoc --no-ri --verbose -v 7.4.0 gem install chef --no-rdoc --no-ri --verbose -v 11.16.4