Fix broken portage on RPS running OVH Release 2

It was always going to happen.

With my current web host (OVH) when setting up my server (RPS) I chose to run it using their custom version of gentoo Linux (OVH Release 2).  They offer a number of choices but this seemed like the best pick because it was their release running on their hardware so I figured it would just get the job done.

That was all fine until I went and broke it.  Well, when I say broke it, I didn’t break it exactly so much as stupidly try to update it so that it would be running the latest shiny version of things.

This was out not a sensible plan and the net upshot was that I broke the portage system.  Impressively though gentoo didn’t fall over despite my ineptitude and kept serving up my websites (including this one) without issue.  The only thing was, I had no idea how to put things right!

So, after much tinkering behind the scenes (with gentoo still managing to keep going despite me doing my best to knock lumps out of it and wreck it completely) I managed to get things back on a proper footing, i.e. a working Release 2 running the latest patches from OVH.

Here’s what I did to fix the mess I created which I’m sharing because I thought it might be useful to other people out there who have also “tinkered” with their RPS and struggle, as I did, to read all the technical support that’s mainly found in French on the OVH RPS forums.

Disclaimer: These commands worked for me but they might not work for you so if you decide to use them backup everything on your RPS first because I’m not responsible for any commands you issue to your server!

  1. Firstly SSH into your RPS with root access.  This will land you in the home directory.
  2. Run the command: echo “2.10” > /etc/ovhrelease as this will fool the OVH updater into thinking you’re running an earlier version of Release 2.
  3. Run: eselect profile list
  4. Look at the list and find the number of the profile that matches: default-linux/x86/2007.0/desktop on my RPS it was 4.
  5. Run: eselect profile set <> where <<NUMBER>> is the profile number you looked up at step 5, e.g. for me it was eselect profile set 4
  6. Remove any pre-existing upgrade scripts with: rm -rf patch-2.*.sh to make sure that you get a clean update.
  7. Restore and run the OVH patch-all scripts with: wget ftp://ftp.ovh.net/made-in-ovh/release/patch-all.sh -O patch-all.sh; sh patch-all.sh
  8. Now, that should, ditch the broken portage tree and run every automatic update script since they released 2.10.  I found that this upon reaching patch 2.19 it was necessary to change the profile again.
  9. Run: eselect profile list again
  10. Look at the list and find the number of the profile that matches: default/linux/x86/2008.0/desktop on my RPS it was 9.
  11. Run: eselect profile set <<NUMBER>> where <<NUMBER>> is the profile number you looked up at step 5, e.g. for me it was eselect profile set 9
  12. Run: sh patch-all.sh
  13. This should finish the patches and bring you up to current which at the time of writing is 2.30.

Hopefully this will be of some use to those out there like me who just can’t help tinkering with things!