Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Essentially, I am looking for a fully silent, non-interactive version of

freebsd-update fetch
freebsd-update install


portsnap fetch update
share|improve this question
up vote 5 down vote accepted

Allow freebsd-update to run fetch without stdin attached to a terminal:

sed 's/\[ ! -t 0 \]/false/' /usr/sbin/freebsd-update > /tmp/freebsd-update
chmod +x /tmp/freebsd-update

Allow portsnap to run fetch without stdin attached to a terminal:

sed 's/\[ ! -t 0 \]/false/' /usr/sbin/portsnap > /tmp/portsnap
chmod +x /tmp/portsnap

Credits: veewee

share|improve this answer
Outstanding! I was looking for this to automate an installation! – Vinícius Ferrão Apr 23 '14 at 2:33

Blindly installing updates (even freebsd-update updates) can be a Bad Thing: One option in rc.conf changes, and suddenly your machine has no SSH daemon anymore.

Similarly you probably don't want to blindly install all available port updates via portsnap / portupgrade -a -- you might take a major version number bump and break the universe, or you might just have a port with new configuration options that need to be changed (you can make ports just accept whatever their defaults are, but sometimes that's not what you want).

The best way to do this is to use a configuration management tool like Puppet or radmind to deploy your changes.
Make a machine template based on a box you've successfully upgraded and tested, then deploy that to the rest of your environment. This ensures that you're pushing out a working system configuration, and that you only have to do the manual steps once (on the machine you're templating from).

share|improve this answer
Does freebsd-update overwrite configuration data like rc.conf? But even if so: we want to automatically (nightly) create VM images (OVA, AMI, ..) from scratch. Hence, there is no problem of configs overwritten, since after base install, the system is first updated, and then configured. So how do I run freebsd-update and portsnap unattended? On RH Linux, I just fire yum -y update and voila. How do I do that with FreeBSD? – oberstet May 16 '13 at 18:22
freebsd-update generally doesn't overwrite configuration files, but it will replace stock rc scripts in /etc/rc.d when they're updated. (I believe it checks rc.conf and friends for obvious problems, but I could be wrong. I still build my systems the old fashioned way with make world & mergemaster). – voretaq7 May 16 '13 at 18:26
the short answer to your question though is "You don't blindly install updates." -- it's irresponsible to do so (I can tell you horror stories of production environments destroyed by yum -y update). If the tool asks you a question it's because it really needs you to stop, think, and respond. You can always pipe yes to freebsd-upgrade and run portupgrade --batch if you want to, but IMHO that's a pretty big foot-gun. – voretaq7 May 16 '13 at 18:28
@oberstet that's only for fetch (and it tells you what to do about it in the error message). Also to be blunt I don't think you know the requirements of freebsd-upgrade better than the dude who wrote it (he's been doing this longer than I have, and he's pretty good at this whole "write stuff that doesn't destroy the universe" thing), but if you really think you know better it's just a shell script -- You can copy it and hack to your heart's content to make it behave how you want... – voretaq7 May 16 '13 at 19:02
No it won't destroy a newly installed system. He's worrying you'll blow up your systems and obviously didn't read any of the bits about nightly images. – Florian Heigl Apr 26 '14 at 21:13

On FreeBSD 10.0R and later, set PAGER environment variable on freebsd-update

env PAGER=cat freebsd-update fetch
freebsd-update install

For portsnap(8) on FreeBSD 10.0R and later, default behaviour, namely without --interactive option, is non-interactive.

portsnap fetch update
share|improve this answer

On FreeBSD-10.2 there's a new option to allow this:

freebsd-update install --not-running-from-cron

From the manpage:

        Force freebsd-update fetch to proceed when there is no
        controlling tty.  This is for use by automated scripts and
        orchestration tools.  Please do not run freebsd-update
        fetch from crontab or similar using this flag, see:
        freebsd-update cron
share|improve this answer
Ah, still giving the crazy MORE button. – zsero Dec 11 '15 at 3:41
This should be the accepted answer. – dentarg May 31 at 8:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.