Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Keeping Your Gentoo Box Up to Date? (the easy way)
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
eno2001
Tux's lil' helper
Tux's lil' helper


Joined: 20 Oct 2006
Posts: 136

PostPosted: Thu Feb 07, 2008 4:59 pm    Post subject: Keeping Your Gentoo Box Up to Date? (the easy way) Reply with quote

I'm trying to find a way to keep my Gentoo boxes at home up to date without needing to do a whole lot of baby sitting. It's been my experience that if I get a box to a "perfect" state and it does all I want, I'm fine. Fine, that is, until there's something new I want and I find out that I have a ton of updates to do. Even missing a month's worth of updates can mean days of emerging, revdep-rebuilds, unmerging blocked/deprecated packages, etc... The other fallout is that sometimes things that worked fine suddenly stop working at all because of changes in the way things are done. So here's what I've been doing to try and keep on top of updates. Any Portage "gods" can let me know if I'm doing this all wrong. Here goes:

1. Make sure you set up a local Portage sync server. This is really "easy as pie". Just make sure you have this in /etc/rsyncd.conf:

Code:
# Simple example for enabling your own local rsync server
[gentoo-portage]
   path = /usr/portage
   comment = Gentoo Portage tree
   exclude = /distfiles /packages


I believe that should be in there by default by might be commented out. If not, add it. If it is there but is commented, uncomment it. Then make sure that the rsyncd daemon is added to your default runlevel:

Code:
rc-update add rsyncd default


Make sure that this server gets it's Portage updates at an interval you feel comfortable with. I prefer every 24 hours, so this is what I have in root's crontab to get updates at 1:00AM every day. Just run 'crontab -e' and add that line below:

Code:
00 1 * * *     /usr/bin/emerge --sync


2. Set all of your Gentoo boxes to use that local portage sync server by adding this line to your /etc/make.conf file:

Code:
SYNC="rsync://your.sync.ip.address.here/gentoo-portage"

A real example where the server is 192.168.1.2:

SYNC="rsync://192.168.1.2/gentoo-portage"


3. Make sure your Gentoo boxes do a sync at an interval you feel comfortable with that is after the last sync that your sync server did. In my case since my sync server updates at 1:00AM daily, I set my other boxes in a staggered fashion to do updates at 2:00AM, 3:00AM, etc... per box. Examples:

Code:
On Gentoo box 1, updates are set for 2:00AM in root's crontab:
00 2 * * *     /usr/bin/emerge --sync

On Gentoo box 2, updates are set for 3:00AM in root's crontab:
00 3 * * *     /usr/bin/emerge --sync

And so on...


4. Once we know that we have all of our boxes syncing properly at a reasonable interval, it's time to try and make the update world process somewhat automatic. I use a very simple script I wrote called 'autoportage' to do this. It depends on GNU screen being installed and still needs some conditional checking and logging set up. So it's a very early "work in progress". Hehe... at two lines of scripting:

Code:
#!/bin/bash

screen -R Portage -X quit
screen -d -m -S Portage emerge -uavDN world


What the script does is kill any screen sessions named "Portage" that were left from the previous day's update attempt, then start a new detached screen session named "Portage" to run the 'emerge -uavDN world' command. I have this script set to run at a reasonable time in root's crontab after the portage update on the box. On Gentoo box 1, my 'autoportage' script runs at 3:00AM, an hour after the 2:00AM sync:

Code:
00 03 * * *     /usr/local/bin/autoportage


That's where I am so far and it's allowed me to keep six Gentoo boxes at home up to date in a reasonable way. What I plan to do next is write another script that I can run from one central location to try and serially connect to each Gentoo box and just accept or decline the updates. My plan for that script is to have a config file that will list all of the Gentoo boxes to connect to as well as possible options beyond accept/decline. Warning... I'm NOT a programmer. And my logic here may be fuzzy. There may be better ways to keep Gentoo boxes up to date that I'm unaware of. Mainly I'm posting this here NOT as a "HOWTO" but as a way to get a conversation started on the best way to keep Gentoo boxes up to date with minimal hassle. Now... off to try and figure out why my latest updates on my AMD64 Gentoo media center wiped out the left channel of audio for all ALSA apps... :)
Back to top
View user's profile Send private message
martin20450
Tux's lil' helper
Tux's lil' helper


Joined: 30 Sep 2005
Posts: 91

PostPosted: Thu Feb 07, 2008 5:24 pm    Post subject: Reply with quote

Why not use NFS for sharing your portage tree?

http://gentoo-wiki.com/HOWTO_Using_a_shared_portage_via_NFS
Back to top
View user's profile Send private message
defenderBG
l33t
l33t


Joined: 20 Jun 2006
Posts: 817

PostPosted: Thu Feb 07, 2008 5:42 pm    Post subject: Reply with quote

when i read the postname i though it was a way to keep not the portage tree uptodate but the system (portage tree + newest installs).
I doubt there is any real reason to sync if you are not going to install... it would be better to sync when you really need to do some update. if you update as much as me (once every 2-3-4 months) that this will save a lot of bandwidth.

Making a cron tab which syncs and emerges the changes is thought to be a bad idea... so be warned in putting emerge -auvDN world...
Back to top
View user's profile Send private message
eno2001
Tux's lil' helper
Tux's lil' helper


Joined: 20 Oct 2006
Posts: 136

PostPosted: Thu Feb 07, 2008 6:04 pm    Post subject: Reply with quote

Hmmm... perhaps I'm missing something. But I thought that the right way to keep my box always up to date with the latest software was to manually run:

emerge --sync

then

emerge -auvDN world

As often as possible.

I found that a lot of times if I haven't run an 'emerge --sync' then packages I want to install usually complain during the wget about certain files not being there and the emerge fails. The only way to get them to build is to run a sync. But after running the sync, then I find that almost anything I want to install that I didn't have or want to rebuild with new USE flags wants to upgrade a bunch of packages. So... may as well save myself the headache and just update my world at that point. And since that takes a lot longer to do if I don't sync the system for months, I think it's better to do it frequently so it takes less time. But, as I said, there's a lot I don't know about Portage and it could be that I'm doing it all wrong. My main goal is to have the latest and greatest as often as possible and avoid really long emerge sessions if I haven't updated Portage tree or packages in a long time. Is that the wrong approach?

defenderBG wrote:
when i read the postname i though it was a way to keep not the portage tree uptodate but the system (portage tree + newest installs).
I doubt there is any real reason to sync if you are not going to install... it would be better to sync when you really need to do some update. if you update as much as me (once every 2-3-4 months) that this will save a lot of bandwidth.

Making a cron tab which syncs and emerges the changes is thought to be a bad idea... so be warned in putting emerge -auvDN world...
Back to top
View user's profile Send private message
eno2001
Tux's lil' helper
Tux's lil' helper


Joined: 20 Oct 2006
Posts: 136

PostPosted: Thu Feb 07, 2008 6:15 pm    Post subject: Reply with quote

I forgot to respond to your comment about 'emerge -auvDN world' in a script. I thought it was pretty safe since it does nothing until you answer yes/no because of the -a. The only reason I want that automated is that on some of my boxes it can take up to five minutes before that command gives me the full list of what is to be updated and I don't have the time to sit and wait or come back to it.

In the past, I found that if I ran it and then went off to do something else, I'd forget about it and sometimes it would be sitting there for two or three days waiting for me to answer yes or no. By that time, there were already new packages/updates in Portage so the emerge world would be invalid. This way, there's always one waiting for me that has a fresh portage tree, meaning I have the latest and greatest.

However, I do admit that I don't really understand Portage very well so I could be looking at this all wrong. I just want to make sure that when I'm trying to emerge something with a specific set of USE flags and the information I find on the forums here is referring to the newest stuff, that I'm not behind the curve. USE flags seem to change frequently and there are a number of times when I wanted some new functionality and would see a list here in the forums that didn't match my list when running 'emerge -av <package>'. Usually at that point, I'd have to sync and then run the emerge -av again only to find out that five or ten other packages needed to be updated, then a revdep-rebuild, etc... So to try and avoid that, I wanted to keep a fresh tree and a constantly up to date world. Did I misunderstand something in my approach?

Now that you've mentioned that syncing frequently is not necessary. Is it possible that the Portage tree is local and isolated? If so, does that mean that if I don't sync for a long time and want to install something new, or rebuild something with different USE flags I shouldn't have a problem? Finally, is it possible to sync the tree and then somehow pull down every possibly package (regardless as to whether I'll use it or not) to a local repository so that when I build on an out of sync system, it won't have to go to the net to pull down the source tarballs? I simply want to understand the right way to do things.

Thanks for your comments.

defenderBG wrote:
when i read the postname i though it was a way to keep not the portage tree uptodate but the system (portage tree + newest installs).
I doubt there is any real reason to sync if you are not going to install... it would be better to sync when you really need to do some update. if you update as much as me (once every 2-3-4 months) that this will save a lot of bandwidth.

Making a cron tab which syncs and emerges the changes is thought to be a bad idea... so be warned in putting emerge -auvDN world...
Back to top
View user's profile Send private message
OmSai
l33t
l33t


Joined: 30 Sep 2007
Posts: 605
Location: Manchester, CT, USA

PostPosted: Thu Feb 07, 2008 6:53 pm    Post subject: Reply with quote

eno2001 wrote:
But I thought that the right way to keep my box always up to date with the latest software was to manually run:
emerge --sync
then
emerge -auvDN world
As often as possible.

Don't forget revdep-rebuild.

Though for the "best" way with the least breakages, use steveL's emerge script Update.
It automates revdep-rebuild among many other things, and for me has been working brilliantly even for 150+ package mass updates.
_________________
Gentoo is the stick-shift of Linux.
You work it manually, it has somewhat better performance, but it's really for the fun of it.
Back to top
View user's profile Send private message
smitty_one_each
Tux's lil' helper
Tux's lil' helper


Joined: 21 Mar 2004
Posts: 94
Location: Right coast, halfway up

PostPosted: Fri Feb 08, 2008 2:52 am    Post subject: As a paludis-ite Reply with quote

I just put in a 0200 cron job to do paludis -s, followed by paludis -if everything
It's important to keep the tree up to date, and the packages pulled down, but I'll wait until I get there to inspect the whackiness, tweak any use flags, and do etc-update.
_________________
I'm just looking for clues at the scene of the crime.--Walsh
Back to top
View user's profile Send private message
jcat
Veteran
Veteran


Joined: 26 May 2006
Posts: 1337

PostPosted: Fri Feb 08, 2008 11:24 am    Post subject: Reply with quote

eno2001: Apologies for the thread hijack. Just curious, what are you running for your media center?


Cheers,
jcat
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum