# Upgrading ports via (p)ssh (non-interactive)



## frijsdijk (Jul 10, 2012)

I've been searching for a while how to upgrade ports on FreeBSD machines without really having to login to them (non-interactive). For instance, if you have 300 machines that need an update of lang/rub18 (when Ruby is only used for ports-mgmt/portupgrade one could do such a thing without any risc), it would be very easy and fast to use security/pssh for this. Something like this:


```
# pssh -i -t 0 -l admin -h <list of hosts> 'sudo portupgrade -pb --batch lang/ruby18'
```

But even something 'simple' like this:


```
# for i in `cat <list of hosts>` ; do ssh $i 'sudo portupgrade -pb --batch lang/ruby18
```

.. would be nice, if it would work.

The problem however is the fact that sometimes, but not always, somewhere along the line the process on the server seems to stop, and most of the time I'll see the program 'script' running at 100%. The ssh sessions must be terminated, and I have to login on the machine to complete the job.

My questions:

1) anyone know what's going on here?
2) am I doing something wrong, is there another way to do this?


----------



## frijsdijk (Jul 10, 2012)

DutchDaemon: for once I thought I'd done everything right. Now I post in the wrong forum. Will I ever learn?


----------



## wblock@ (Jul 10, 2012)

Step 1: switch to ports-mgmt/portmaster, eliminating the need for Ruby and databases/ruby-bdb.


----------



## SirDice (Jul 11, 2012)

If you want to do binary updates I would suggest pkg_upgrade(1) from sysutils/bsdadminscripts.


----------



## frijsdijk (Jul 11, 2012)

We use portmaster as well, but still portupgrade most of the time. I agree that portmaster is much more elegant. But do you (wblock) think it's ruby related?

@SirDice: I was not referring to binary upgrades, although that is something I'm looking into (as well as pkgng).


----------



## SirDice (Jul 11, 2012)

frijsdijk said:
			
		

> @SirDice: I was not referring to binary upgrades, although that is something I'm looking into (as well as pkgng).


If you do have 300 machines, why are you building stuff from ports on each machine? Why not set up a build server, build things *once* and distribute the resulting packages? Building things from ports 300 times isn't exactly efficient.


----------



## frijsdijk (Jul 11, 2012)

SirDice said:
			
		

> If you do have 300 machines, why are you building stuff from ports on each machine? Why not set up a build server, build things *once* and distribute the resulting packages? Building things from ports 300 times isn't exactly efficient.



I said I was looking into that, didn't I?


----------



## SirDice (Jul 11, 2012)

I only suggested it isn't efficient to build the same port on 300 machines.


----------



## jrm@ (Jul 11, 2012)

+1 for @SirDice's suggestion for a build server.  This works for us.

On our cluster, I nfs mount /usr/local and /usr/compat on the compute nodes from a "software node".  When I update a port on the "software node", the new version is available on all the compute nodes.  This can break down if you're running, for example, 7.x on one some compute nodes and 9.0 on the "software" node.


----------



## frijsdijk (Jul 12, 2012)

SirDice said:
			
		

> I only suggested it isn't efficient to build the same port on 300 machines.



SirDice: what about the fact that these 300 machines are not all the same version of FreeBSD, but 7.4, 8.1, 8.2, 8.3, and 9.0? (even some 32-bit, although 90% is 64-bit). And alot of machine have different compile options for apache/php etc.


----------



## wblock@ (Jul 12, 2012)

frijsdijk said:
			
		

> We use portmaster as well, but still portupgrade most of the time. I agree that portmaster is much more elegant. But do you (wblock) think it's ruby related?



Rebuilding the Ruby interpreter while a Ruby program is running could certainly cause problems.  I remember some problems like that back when I was using portupgrade.  There was enough of a problem that eventually I did not use portupgrade to upgrade portupgrade, Ruby, or databases/ruby-bdb, just manual port rebuilds.


----------



## frijsdijk (Jul 12, 2012)

wblock@ said:
			
		

> Rebuilding the Ruby interpreter while a Ruby program is running could certainly cause problems.  I remember some problems like that back when I was using portupgrade.  There was enough of a problem that eventually I did not use portupgrade to upgrade portupgrade, Ruby, or databases/ruby-bdb, just manual port rebuilds.



Ah, but this was just an example with the portupgrade port. It happens with all sorts of ports.

Meanwhile, I'm looking into tinderbox. It seems pretty sweet!


----------

