# freebsd update upgrade sucks



## covacat (Dec 11, 2022)

takes longer than reinstalling and probably longer than building from source
12.3 to 12.4 you need to restart sshd after the last install command or get locked out if you log out
creates (by default) both snapshot / and backup files in /var/db/freebsd-update/files which is wasteful 
no geolocated servers
some stuff can be improved by fiddling with config file but still....


----------



## zirias@ (Dec 11, 2022)

covacat said:


> takes longer than reinstalling and probably longer than building from source


I doubt that. Although I never did an _upgrade_ (only using this tool to update my ports testing jails, and they are reinstalled on a new minor) myself, I can tell you as soon as the changes require rebuilding base llvm, building takes considerable time 



covacat said:


> 12.3 to 12.4 you need to restart sshd after the last install command or get locked out if you log out


I really like that no FreeBSD tool would ever _automatically_ restart a service! But this should be documented of course. Is it? 



covacat said:


> creates (by default) both snapshot / and backup files in /var/db/freebsd-update/files which is wasteful


Write a PR? I agree, one of them is enough. The IMHO sane approach would be to create a boot environment (snapshot) by default _if_ they are available, otherwise the classic backup files.


----------



## mer (Dec 11, 2022)

I'm going to touch the time factor because it's been a long time since I've rebuilt everything from source, but the snapshot (isn't this really a new BE, not just a snapshot?)/backup files point is interesting.
Why the files in /var/db?  I'm guessing they're for "freebsd-update rollback".
The new BE and rolling back is trivial since it's reboot, stop in loader, select the previous one, boot, delete the latest BE.
On a default ZFS install, /var/db should be following the BE, so deleting the backup files in /var/db should be safe.

I thought the creation of the new BE was configurable via /etc/freebsd-update.conf and the default was changed to "on" in 13.x, did it also change in 12?
There a few different methods posted on the forum where you create a new BE, mount it, chroot and other stuff to do the upgrade, you even run the pkg upgrade command in it to update the applications, then a single reboot into it and all the services would be running.


----------



## covacat (Dec 11, 2022)

>>> World build started on Sun Dec 11 12:48:25 EET 2022
>>> World build completed on Sun Dec 11 15:04:12 EET 2022
my /var/db/freebsd_update/files was empty when i started and there is 2h30min between the earliest and latest file
granted i had the source downloaded and did not build the kernel on the build box but that box is a 2 core 4th gen i3 with spinning disk
so the build time is not that great either


----------



## zirias@ (Dec 11, 2022)

But you don't say now upgrading with freebsd-update takes more than an hour?


----------



## covacat (Dec 11, 2022)

it took more like 3 hours. no matter what mirror i chose it was dog slow
about 4-5 files/second


----------



## acheron (Dec 11, 2022)

I've upgraded a box form 11.2 to 13.1 in less than 10 minutes with freebsd-update...


----------



## mer (Dec 11, 2022)

Everyone's network path is different, so I've never placed much faith in absolutes of "how long".
Now if someone says "12.1 took X but 12.x to 12.x+1 took 5X"  that could be an interesting datapoint.

But that's just me.


----------



## ralphbsz (Dec 12, 2022)

I run update roughly once a week. It typically takes 5-10 minutes. Often, it takes zero, because there is nothing to do. Sometimes it takes half hour. Sometimes, I have to administer things afterwards, but very rarely.

I bet the speed depends heavily on network connection.


----------



## covacat (Dec 12, 2022)

after some digging i found that adding

```
pipeline_prefetch 10
```
to squid.conf downloading improved by a lot (otherwise no in-flight requests and the kind of large TTL bites )
still hard to believe that upgrade including source can take less than 10 minutes
looks like freebsd-update is designed to conserve bandwidth which in my opinion does not work very well when doing a version upgrade
all the files can be downloaded from install mirrors which are third parties that pay for the bandwidth
downloading 50k patches and patching 50k files when you can download all the install txz files in less than a minute does not look that great to me


----------



## SirDice (Dec 12, 2022)

src - FreeBSD source tree
					






					cgit.freebsd.org


----------



## zirias@ (Dec 12, 2022)

SirDice said:


> src - FreeBSD source tree
> 
> 
> 
> ...


I have mixed feelings about that, IMHO a clear warning message would be better. It's a special case of course when the running service just doesn't work any more, so maybe this makes sense because of the way openssh is designed  – still hope that won't be a precedent for "automatically restarting services".


----------



## SirDice (Dec 12, 2022)

Yeah, I don't like automatically restarting services when upgrading. But for freebsd-update(8) I can understand the rational to do it.


----------



## VladiBG (Dec 12, 2022)

> After upgrading, sshd (from OpenSSH 8.8p1) will not accept new connections until it is restarted. After installing the new userland, either reboot (as specified in the source update procedure), or execute service sshd restart.



The above message is from the Release notes of 13.1 and it's not included in Release notes of 12.4.








						FreeBSD 13.1-RELEASE Release Notes
					

FreeBSD is an operating system used to power modern servers, desktops, and embedded platforms.




					www.freebsd.org
				











						FreeBSD 12.4-RELEASE Release Notes
					

FreeBSD is an operating system used to power modern servers, desktops, and embedded platforms.




					www.freebsd.org


----------



## mer (Dec 12, 2022)

modifying squid.conf helped the download?  Isn't squid a proxy thing in the network path?
I wonder if freebsd-update uses a different network protocol to download than git.


----------



## SirDice (Dec 12, 2022)

mer said:


> I wonder if freebsd-update uses a different network protocol to download than git.


Why would it use git? It's just plain HTTP traffic that downloads a bunch of files.


----------



## covacat (Dec 12, 2022)

it uses http
but it issues lots of get requests without waiting for the reply after each, and then gets all the replies
this helps A LOT when round trip time from server to client is large 

unless you have the directive above squid will issue every http get after it finishes with the previous get so download speed will suck
see phttpget(8) which is used by freebsd-update


----------



## mer (Dec 12, 2022)

SirDice said:


> Why would it use git? It's just plain HTTP traffic that downloads a bunch of files.


Sorry I wasn't clear enough.  OP was comparing downloading files with freebsd-update vs updating/downloading the source tree via git.


----------



## SirDice (Dec 12, 2022)

mer said:


> OP was comparing downloading files with freebsd-update vs updating/downloading the source tree via git.


No, he didn't mention updating the source, he compared it to _building_ from source.


----------



## mer (Dec 12, 2022)

SirDice said:


> No, he didn't mention updating the source, he compared it to _building_ from source.


I guess I need another cup of coffee before reading comprehension kicks in today.


----------



## SirDice (Dec 12, 2022)

That makes two of us. Just messed up a server at $DAYJOB trying to fix a 'too many files open'  issue. Now nobody can login any more


----------



## smithi (Dec 12, 2022)

SirDice said:


> That makes two of us. Just messed up a server at $DAYJOB trying to fix a 'too many files open'  issue. Now nobody can login any more



On the upside, when nobody can login the administrative burden is eased considerably ... <&^}=


----------

