The gem path changing doesn't really have anything do with updating RubyGems. It has to do with the fact that you have two parallel installations of RubyGems: the one from the Debian package repository which you installed via APT and another one.
The solution is simple: Don't Do That.
The Debian RubyGems has been patched to install its gems in /var/lib/gems
, the RubyGems from RubyGems.Org uses /usr/lib/ruby/gems
if that is writeable, ~/.gem
otherwise.
You should never mix several different installations of RubyGems, and you should particularly not mix Debian-RubyGems and plain RubyGems. Either install RubyGems from Debian and use only that, and only update it with APT or install RubyGems from RubyGems.Org and use only that and only update it via gem update --system
. Note that this transitively also applies to YARV, which contains its own copy of RubyGems. If you use Debian-RubyGems, then you must also use the Debian-packaged versions of YARV, because only the Debian packages of YARV have been patched to remove RubyGems and use the Debian-provided one.
Somehow, you managed to "update" your Debian-RubyGems to a plain one, which isn't really an update but actually more like a separate installation. This shouldn't actually happen, because the Debian-RubyGems has the update functionality removed. This is what my Debian-installed RubyGems prints:
gem update --system
# ERROR: While executing gem ... (RuntimeError)
# gem update --system is disabled on Debian. RubyGems can be updated using the
# official Debian repositories by aptitude or apt-get.
1.3.5 is pretty old, so maybe that error check wasn't in there, although I doubt it. AFAIK that error check was introduced somewhere in the 1.2 timeframe.