# How not to upgrade your system with freebsd-update



## Peter Eriksson (Feb 18, 2022)

It kind of royally confuses the system....

1. Have a cron job that runs "freebsd-update cron" every night at 23:10.
2. Run "freebsd-update upgrade -r 12.3-RELEASE" before 23:10
3. Run "freebsd-update install" some time after 23:10
4. Reboot

Ah the fun...

Other fun ways others have tried? 

(I do think it would be nice if "freebsd-update cron" had some way to notice an "upgrade-in-progress" and perhaps skip doing what it does...)


----------



## Geezer (Feb 19, 2022)

It might be better - _much better_ - to do the upgrading by yourself at the console.


----------



## grahamperrin@ (Feb 19, 2022)

Peter Eriksson said:


> How not to upgrade your system with freebsd-update … Other fun ways others have tried?  …



My update/upgrade routine is both (a) not how to upgrade with `freebsd-update`; and (b) more importantly, good for a laugh  (like, an earlier edition included commands such as _go to bed_).


----------



## dave01 (Feb 19, 2022)

grahamperrin said:


> My update/upgrade routine is both (a) not how to upgrade with `freebsd-update`; and (b) more importantly, good for a laugh  (like, an earlier edition included commands such as _go to bed_).


I think the next version should scrape the FreeBSD website for the latest RELEASE and feed that into the upgrade script for extra giggles.  Or switch to CURRENT


----------



## Vull (Feb 19, 2022)

Just do it interactively. It's easy. Read the manual. freebsd-update(8)

Edited to add:

Do your upgrades right after the backup. Always have a good recovery strategy ready to go.

Minor upgrades are pretty routine. Upgrading to the next major point release requires planning and more time.


----------



## Peter Eriksson (Feb 20, 2022)

Vull said:


> Just do it interactively. It's easy. Read the manual. freebsd-update(8)
> 
> Edited to add:
> 
> ...



Yes, well, that was not the point. The reason we've been running "freebsd-update -t root cron" from ... cron is that it just downloads the updates and sends an email to root if there are updates to install. Then you normally do a "freebsd-update install" whenever is convenient.

However... if doing a release-upgrade then this causes the packages that "freebsd-update upgrade -r ...." downloaded to be replaced/mixed up with the ones downloaded by "freebsd-update cron" - if the cron job happens to come inbetween the "upgrade" and "install" commands... 

Anyway, I was looking for other creative ways you've caused upgrades to go wrong - fun for beer-time war-stories


----------



## SirDice (Feb 21, 2022)

Peter Eriksson said:


> Anyway, I was looking for other creative ways you've caused upgrades to go wrong - fun for beer-time war-stories


Deleting the contents of /var/db/freebsd-update/ _before_ completely finishing the upgrade. No, never done that, I deny everything.


----------



## Profighost (Feb 21, 2022)

I am also thinking of doing the updates automatcilly via cron....
But I am not aware of this is a good idea.

(At least for particulary packages some may be set first to "not to be updated or removed" because some packegs I don't want packages updated or autoremoved, waht also could happen (see man pkg)

Instead of let cron doing the commands directly with a waiting period I may suggest to place those freebsd-update commands into tiny shellscripts that cron will execute instead.

You also could include the pkg upate / portsnap fetch commands and let the first script (#freebsd-update fetch - "look and get all updates") write afterwards a small file (timestamp to /tmp  ... something)
Another script started periodically via cronjob checks if this file exists an updated status and if so executes #freebsd-update install ("install the updates").


That may prevent possible collisions if the first job wasn't done (slow/aborted/no internet connection to server) and then starts the next directly afterwards if it's done without errors instead of betting on approximated waiting periods.


----------



## monwarez (Feb 21, 2022)

If you do not want to use `freebsd-update`, just setup pkgbase and update with `pkg` at your own risk (still in beta, some caveat : see the docs)


----------



## grahamperrin@ (Feb 21, 2022)

monwarez said:


> … pkgbase … still in beta, some caveat : see the docs)



Maybe better to think of PkgBase as _alpha_ (in `main`, and so on). If you're aware of something that I'm not, please add to this topic: 









						PkgBase
					

… how to safely update the system (regardless of how far out of date) reliably. …   Let's assume that PkgBase is the way forward.   and so on.  https://lists.freebsd.org/mailman/listinfo/freebsd-pkgbase  In addition to the list, there's sometimes discussion of PkgBase in IRC for FreeBSD...




					forums.freebsd.org


----------

