# Upgrade from 12.2 to 13.1



## sidney (May 18, 2022)

Went OK. *But* my video/fonts settings got hosed. Startx chokes.
Is there a way to re-probe the hardware in 13.1 RELEASE to maybe fix these issues?

I'm dual-booting an ASUS 64-bit laptop using GRUB2 antiX Linux distro / freeBSD-13.1 RELEASE
TIA


----------



## Alexander88207 (May 18, 2022)

Did you also an pkg upgrade so that you get modules that matches to your kernel?


----------



## sidney (May 18, 2022)

I followed the handbook recommendation:
freebsd-update -r 13.1-RELEASE upgrade
freebsd-update install
shutdown -r now
freebsd-update install


----------



## SirDice (May 18, 2022)

With a _major_ version upgrade, you need to run `freebsd-update install` _three_ times in total. You also need to reinstall _all_ your installed ports/packages.


----------



## sidney (May 18, 2022)

SirDice freebsd-update install a third time!!  I must have missed that in the handbook. I just finished doing so, which dealt with *zfs.* I re-booted, but everything is still *hosed!* 
What's the fastest, easiest, safest and guaranteed-to-work-the-first-time method to re-install ports/packages?


----------



## mer (May 18, 2022)

if you are using binary packages:
pkg-static upgrade -f

That should also work for any installed ports, but the pkgs will likely overwrite the ports.


----------



## SirDice (May 18, 2022)

sidney said:


> What's the fastest, easiest, safest and guaranteed-to-work-the-first-time method to re-install ports/packages?


`pkg bootstrap -f`
`pkg upgrade`


----------



## sidney (May 18, 2022)

SirDice Thanks!!
mer  Thanks for your input!!


----------



## sidney (May 18, 2022)

Pkg upgrade done - almost. Got this issue that cropped up while almost done:



> [415/426] Extracting en-freebsd-doc-20220326, 1: 100%
> pkg: Fail to rename /usr/local/share/doc/freebsd/en/a
> rticles/bsdl-gpl/.pkgtemp. bsdl-gpl_en.pdf.6JRRFKcolBz
> M ->/usr/local/share/doc/freebsd/en/articles/bsdl-gp
> ...



Is there a way to fix this and then complete the process? The process got to 415 only. Need to get to 426.


----------



## Phishfry (May 18, 2022)

mer said:


> pkg-static upgrade -f


then pkg update [Read your UPDATING]
then pkg upgrade.

One machine I was having troubles with I said screw it.
`pkg delete -a`

I can rebuild easy from packages. It was 11.2 to 13.1-R so I am not shocked.

I been where this guy was once and I did not like it.


----------



## mer (May 18, 2022)

Read UPDATING?  Are you insane?  Noone ever reads that!



11 to 13 is a big jump.
If you are using ZFS, it actually becomes "easy" (or easier).  Lot's of things posted here, at least 3 different methods of upgrading into a new BE that keeps everything pretty clean.


----------



## SirDice (May 18, 2022)

Phishfry said:


> One machine I was having troubles with I said screw it.
> `pkg delete -a`


Useful as a last resort but usually not really needed. In this case I would just remove that offending package and see how things go after that. 

Looking at the error it's likely misc/freebsd-doc-all or specifically misc/freebsd-doc-en. Neither are really required for the system to operate, so could be removed without taking out anything important. That documentation can easily be reinstalled after the upgrade.


----------



## sidney (May 18, 2022)

OK folks! So how do I complete this upgrade after the process choked because of some @#$%$ "doc" files?


----------



## SirDice (May 18, 2022)

`pkg delete freebsd-doc\*`

Then try `pkg upgrade` again.


----------



## sidney (May 18, 2022)

SirDice that did the trick, thx again!  I need to buy you an excellent Tuborg Green! Never mind that 2nd-rate Heineken dish water.  Thanks again!!


----------



## SirDice (May 18, 2022)

sidney said:


> I need to buy you an excellent Tuborg Green!


Cheers. Looks good. 


sidney said:


> Never mind that 2nd-rate Heineken dish water.


Don't worry, that stuff is mostly for export. We don't drink it ourselves   I prefer Hertog Jan myself.


----------



## sidney (May 18, 2022)

*Hertog Jan* - I'll have to look for it here in western Canada. Thx for the tip.


----------



## grahamperrin@ (May 19, 2022)

sidney said:


> freebsd-update install a third time!!



*Four* runs, in some cases.

Please see, for example, this week's <https://www.freebsd.org/releases/13.1R/installation/#upgrade-binary>.



sidney said:


> I must have missed that in the handbook.



The FreeBSD Handbook may be a source of confusion.

<https://docs.freebsd.org/en/books/handbook/cutting-edge/#freebsdupdate-upgrade> – _Performing Major and Minor Version Upgrades_ (currently _24.2.3_) – seems to begin with the second run: 

* no hint of the fetch and install (not an upgrade) that may be appropriate *prior to* `freebsd-update upgrade -r 13.1-RELEASE`.


----------



## grahamperrin@ (May 19, 2022)

Phishfry said:


> then pkg update [Read your UPDATING] …



Which part of the file, exactly?

I can't see `pkg update` anywhere in <https://cgit.freebsd.org/src/tree/UPDATING>.


----------



## SirDice (May 19, 2022)

grahamperrin said:


> *Four* runs, in some cases.
> 
> Please see, for example, this week's <https://www.freebsd.org/releases/13.1R/installation/#upgrade-binary>.


No. The first one that's mentioned there is done after a `freebsd-update fetch`, which is only to get your _currently_ installed version up to date with the latest patches. 

After a `freebsd-update -r <version> upgrade` there's only 3 _install_ runs after a major version upgrade (and 2 if it's a minor version upgrade). 



grahamperrin said:


> no hint of the fetch and install (not an upgrade) that may be appropriate *prior to* `freebsd-update upgrade -r 13.1-RELEASE`.


Usually not necessary. Sometime ago there was a bug in freebsd-update(8) that would prevent it from upgrading to the next major version. If you have any of the versions _prior_ to the fix then it's is actually necessary to update to the latest patch update _before_ attempting to do the major version upgrade. In order to be absolutely sure the upgrade will actually work it is therefor advisable to make sure you have the latest patches of your currently installed version.

With regards to pkg-update(8), most of the time you don't need to run it. `pkg upgrade` usually detects the changes in the catalog and will update it automatically. In some cases this detection misses the updated catalogs (if you muck around with repositories long and often enough). Then it's useful to force update the locally cached catalog.


```
Package repository catalogues will be automatically updated whenever pkg
     upgrade is run by a user ID with write access to the package database,
     unless disabled by the -U flag or setting REPO_AUTOUPDATE to NO in
     pkg.conf(5).
```
pkg-upgrade(8)


----------



## mer (May 19, 2022)

freebsd-update install  the number of times mimics what's needed when upgrading from source I think.
First one is the equivalent of make installkernel, second would take care of a mergemaster on /etc and other configs the third roughly make installworld.
When doing it in a BE, I've often seen the third install say "nothing to do", which is actually a nice thing about freebsd-update command.  It tells you it's not doing anything.


----------



## grahamperrin@ (May 19, 2022)

IIRC Ed Maste mentioned a couple of things missing from this part of the FreeBSD Handbook. Maybe the first run is one of them.


----------



## SirDice (May 19, 2022)

mer said:


> First one is the equivalent of make installkernel, second would take care of a mergemaster on /etc and other configs the third roughly make installworld.


Second install from freebsd-update(8) is more a combined installworld and mergemaster/etcupdate. The third install is more like `delete-old` and `delete-old-libs`.



mer said:


> When doing it in a BE, I've often seen the third install say "nothing to do", which is actually a nice thing about freebsd-update command.


That's probably a minor version upgrade. There's nothing 'old' to remove in that case, so no use for the third install run that removes the 'old' libraries and files. But yeah, I just blindly run `freebsd-update install` several times in a row until it tells me there's nothing more to do


----------



## grahamperrin@ (May 20, 2022)

SirDice said:


> … yeah, I just blindly run `freebsd-update install` several times in a row until it tells me there's nothing more to do



I sometimes run blind without following a proper routine, paying only partial attention to what's on screen, it's OK for people who know enough about what they're doing and the consequences … the potential for trouble comes when people unwittingly do things that cause the on-screen advice to mislead them.


----------



## SirDice (May 20, 2022)

grahamperrin said:


> I sometimes run blind without following a proper routine, paying only partial attention to what's on screen, it's OK for people who know enough about what they're doing and the consequences … the potential for trouble comes when people unwittingly do things that cause the on-screen advice to mislead them.


True. I've done so many upgrades now, both from source and with freebsd-update(8). Although I know what I'm doing I still make the occasional mistake. But that's the point, I know how to recover from those mistakes. Rarely hosed a system so much I couldn't recover it though. That only happened once or twice in the past 20-25 years.


----------



## grahamperrin@ (May 22, 2022)

grahamperrin said:


> IIRC Ed Maste mentioned a couple of things missing from this part of the FreeBSD Handbook.



It took me a couple of days to remember where this was mentioned. Found: <https://reviews.freebsd.org/D35108#795740>



> … at least the FreeBSD handbook documentation of freebsd-update appears to be missing a step or two.





grahamperrin said:


> The FreeBSD Handbook … no hint of the fetch and install (not an upgrade) that may be appropriate *prior to* `freebsd-update upgrade -r 13.1-RELEASE`.



FreeBSD bugs:

264113 – FreeBSD 13.1-RELEASE Installation Instructions: update
264142 – Handbook section 24.2.3; Add "freebsd-update fetch install" step before version upgrade – Glen Barber (Lead, Primary Release Engineering Team; FreeBSD Documentation Engineering Team) discussed with Pau Amma.


----------

