Monday, January 14, 2013

Updating Gentoo on the Raspberry Pi

I have Gentoo with a 3.6.11+ kernel running very well on my 512 MB RAM RPi.
I've already posted quite a few times about my progress in getting Gentoo up and running here, another here, yet another here and here too.

In general it runs well but, as Gentoo compiles everything before it installs it, just like FreeBSD, installs are very, very slow because of the small CPU (even though I have mine overclocked to 850 MHz) and the low RAM (even with the "upgraded" 512 MB).
In an attempt to mitigate these negative influences, I'm using 1 GB of swap space on an 8 GB SDHC Class 4 card.
Perhaps I'd get some better performance had I used the same SanDisk Extreme Pro Class 10 8GB card that I use for Raspbian Wheezy but I didn't have a spare one (they're not cheap. I paid €23 for mine which is 60% of what I paid for my RPi).

I also have Gentoo installed on my Desktop with 3GB of RAM and a 1.86 GHz C2D processor. Installs and updates run about 10 times faster on the Desktop.

Today I'm going to write about an educational adventure I had when attempting to upgrade Gentoo on my RPi.

The first step is to run

sudo emerge --sync
which makes sure the repos are up-to-date.
This runs quickly, even on the RPi, in less than 5 minutes.

Next, I issued this command
sudo emerge --update --ask world
However, this gave me an error during the dependency calculation.
* Error: The above package list contains packages which cannot be * installed at the same time on the same system. 
(sys-apps/net-tools-1.60_p20120127084908::gentoo, ebuild scheduled for merge) pulled in by sys-apps/net-tools required by @system 
(sys-apps/openrc-, installed) pulled in by sys-apps/openrc required by (dev-db/mysql-init-scripts-2.0_pre1-r2::gentoo, ebuild scheduled for merge) sys-apps/openrc required by (sys-apps/baselayout-2.1-r1::gentoo, installed) 
where both sys-apps/net-tools and sys-apps/baselayout-2.1-r1 therefore sys-apps/openrc are required by the system. 
Now, in my frantic googling to resolve this problem, I first came across this very similar problem and a seemingly easy solution which just unmerged one of the conflicting packages.
So, I unmerged openrc- even though I knew this package is essential in the boot.
My intention was to update my OS, then re-install openrc.

However, as luck would have it, during the update my overclocked Gentoo froze.
So, a reboot was needed. Oh boy, now what?
Actually, I should mention that the SDCard did actually reboot fully to the Desktop even without openrc.
However, there was no network connection, neither mouse nor keyboard worked and Conky didn't open.

Not for the first time, I was very grateful for the existence of the Gentoo tinderbox site from where I downloaded
and moved it to a usb-key.
Next, I placed the Gentoo SDCard into the card-reader of my trusty EeePC901 and made a few changes to ~/.bash_profile (comment out the startx line) and /etc/inittab : uncomment the line

c1:12345:respawn:/sbin/agetty 38400 tty1 linux
and comment out the following line
c1:12345:respawn:/bin/login -f "your user" tty1 >/dev/tty1 >/dev/tty1 2<&1
(although in retrospect, this was probably unnecessary).
Now, I booted to a TTy, logged in as my user, plugged in the usb-key and copied the openrc----tbz2 file to my home directory.
Next, I moved this file to / (as root) and expanded it with this command
sudo tar xfpj openrc..........tbz2
as explained here.
After, this I was able to boot fully to my Desktop with network, mouse and keyboard all working perfectly.
All of this indicates that what I should have done, rather than deleting the older version of openrc was to emerge openrc to its updated version before trying to update world.

Now, to update everything, instead of issuing the command
sudo emerge --update --ask world
following what I learned in this mailing-list thread, I used this command
sudo emerge -Duv --ask world 
However, a further error resulted as shown here:
 * Error: The above package list contains packages which cannot be * installed at the same time on the same system.
  (sys-fs/udev-171-r9::gentoo, installed) pulled in by    sys-fs/udev required by (www-client/google-chrome-24.0.1312.14_beta167497::gentoo, installed)
  (sys-fs/eudev-0::gentoo, ebuild scheduled for merge) pulled in by    ~sys-fs/eudev-0[gudev,hwdb,introspection,keymap] required by (virtual/udev-171::gentoo, ebuild scheduled for merge)
The solution to this problem was simply to emerge udev using
sudo emerge -v1 udev
and now the command
 sudo emerge -Duv --ask world
ran without any problems whatsoever.

So, would I recommend Gentoo as the OS of choice for the RPi?
Well, it's a very interesting and solid OS which presents multitudinous opportunities to develop a more complete understanding of what's going on 'under the hood' in Linux.

It's big drawback if the time required in installing new software and updating.
For example, the update described above took 5 hours on my Desktop but needed 53 hours, that's more than 2 days, on the overclocked RPi.
Of course, the Tinderbox site provides a huge number of pre-compiled binaries ready for direct installation in Gentoo.
So, this can be used to, at least, partly overcome this drawback.
Of course, choosing this route, will remove many of the learning opportunities I referred to above.



No comments:

Post a Comment