You are here:

Portage Tree Updated on Gentoo 2017 Image

Portage Tree Updated on Gentoo 2017 Image

As the portage tree on the Gentoo 2017 image may not have been updated recently, running emerge --sync can fail due to the portage package being outdated. To address this, you need to download older snapshots and use them to gradually upgrade portage to a more recent version.

Here are the snapshot downloads that worked for me: 

wget http://dev.gentoo.org/~swift/snapshots/portage-20170920.tar.bz2
wget http://dev.gentoo.org/~swift/snapshots/portage-20180120.tar.bz2
wget http://dev.gentoo.org/~swift/snapshots/portage-20180520.tar.bz2
wget http://dev.gentoo.org/~swift/snapshots/portage-20180720.tar.bz2

These files contain the portage snapshot with dates in the filenames. To update the portage package, extract these snapshots sequentially to the /usr/portage directory.

Begin by backing up the existing /usr/portage directory:

mv /usr/portage/ /usr/portage.latest

After backing up the existing /usr/portage directory, proceed to extract the oldest portage snapshot to /usr/portage.

tar xjpf portage-20170920.tar.bz2 -C /usr

Next, update the portage package after successfully extracting the oldest portage snapshot.

emerge -auv portage

Repeat the steps for each of the other snapshots, updating the portage package sequentially.

mv /usr/portage /usr/portage.20170920.old
tar xjpf portage-20180120.tar.bz2 -C /usr
emerge -auv portage
mv /usr/portage /usr/portage.20180120.old
tar xjpf portage-20180520.tar.bz2 -C /usr
emerge -auv portage
mv /usr/portage /usr/portage.20180520.old
tar xjpf portage-20180720.tar.bz2 -C /usr
emerge -avu portage
mv /usr/portage /usr/portage.20180721.old

Following these steps will position your system to restore the latest snapshot and emerge the latest portage package.

mv /usr/portage.latest /usr/portage
emerge -auv portage

Tidy up by updating the etc files that have been modified during the process.

etc-update

Additionally, confirm that your portage tree is now up to date.

emerge --sync

After completing these steps, you should be able to update your system successfully.

emerge -av system

Note: If you are running Gentoo on a memory-constrained system, it’s advisable to create a swap file and configure it for automatic mounting on boot. Failing to do so may result in compilation failures, especially when compiling GCC.

dd if=/dev/zero of=/mnt/2G.swap bs=1G seek=2 count=0
mkswap /mnt/2G.swap

Configure the /etc/fstab file to ensure automatic mounting on boot.

sudo nano /etc/fstab

Add the following line to the /etc/fstab file:

/mnt/2G.swap none swap sw,loop 0 0

Ensure that the system can locate the fstab entry and successfully mount the swap file.

swapon -a
Was this article helpful?
Dislike 0