Notes on how I set up Portage to sync on a daily basis, so that when I am ready to apply updates to Gentoo I can get right to it. The set up described below is specific to my own setup, but should be easily modified to suit the needs of other Gentoo configurations.


In addition to Portage tools included with the Gentoo install, I schedule the sync using Cronie though there are other choices for scheduling. I also use EIX to update the cache after sync completes and provide convenient searching and information on what is installed.

Software Installation

$ sudo emerge -a cronie eix

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R    ] sys-process/cronie-1.5.5-r1
[ebuild   R    ] app-portage/eix-0.34.12

Would you like to merge these packages? [Yes/No]


Portage and EIX

Portage has slowly been transitioning to a modular sync system, and I take advantage of that or my setup.

If directory path /etc/portage/repos.conf does not exist, create it.

$ sudo mkdir /etc/portage/repos.conf

I also copied the default configuration file for the gentoo repository into place incase I wanted to or needed to make changes. It turned out that I made no changes at this time, but am now ready should that ever become necessary. Fell free to skip the copy ste , as not needed for the daily sync to work.

$ sudo cp /usr/share/portage/config/repos.conf /etc/portage/repos.conf/gentoo.conf

After a Portage sync completes, I use EIX to update the cache and index all packages on the system. Below I make use of Portage’s post sync hook to execute an eix-update after every sync.

Create /etc/portage/repo.postsync.d/eix file witt the contents below. Use any text editor you like to create the file. Code below directly borrowed from Gentoo Wiki entry on EIX.

$ sudo vim /etc/portage/repo.postsync.d/eix
#!/usr/bin/env bash
if [[ -e /var/cache/eix/portage.eix ]]; then
    cp -a /var/cache/eix/portage.eix /var/cache/eix/previous.eix;
if [[ -e /var/cache/eix/previous.eix ]]; then

After saving the file make it executable.

$ sudo chmod +x /etc/portage/repo.postsync.d/eix


To actually schedule and run the sync, I create the file /etc/cron.daily/portage-sync with the content below. I don’t care precisely when the sync runs, only that it happens daily. If you want the sysnc to happen at a precise time, then add the command to root’s crontab instead, using sudo crontab -e rather than creating the portage-sync file as I do.

$ sudo vim /etc/cron.daily/portage-sync

The emaint sync -a command will sync all Portage repository which are set to autosync, and is the equivalent of running emerge –sync, and is favored over use of eix-sync.

#! /bin/sh
/usr/sbin/emaint sync -a

After saving the file make it executable.

$ sudo chmod +x etc/cron.daily/portage-sync

Nothing left to do but wait a day and see if it all works. You can check the last time Portage was synced with the following command.

$ cat /var/db/repos/gentoo/metadata/timestamp.chk

And best of all it seems to be working. I waited a day checked the time stamp as above and saw the current date. I ran an emerge -DNuvta @world and had updates to apply that were not needed/available the previous day.