# Woes with FreeBSD 11.2 to 12.0 upgrade (SU+J errors: "cylinder checksum failed")



## Veeny (Oct 24, 2019)

Folks,
I've been trying to set up a new virtual (XEN) FreeBSD box (at a Gandi datacenter). Unfortunately, Gandi for the time being doesn’t offer anything else than 11.2. Alright. I go for that, then use freebsd-update to overhaul the system to 12.0. Unfortunately, as soon as the new kernel is written and the box rebooted, the root disk becomes unwritable because of SU+J errors:


```
UFS /dev/gpt/gandiroot (/) cylinder checksum failed: cg 1, cgp: 0xc57d4dcd != bp: 0xebc30f19
UFS /dev/gpt/gandiroot (/) cylinder checksum failed: cg 2, cgp: 0x161e51ff != bp: 0xdff280c3
UFS /dev/gpt/gandiroot (/) cylinder checksum failed: cg 3, cgp: 0x303c6f0c != bp: 0xb6c61ff5
```

Etc. Oodles of those lines. Writing on / is impossible (file system full errors). I tried fsck, first by changing / into ro mode, then back in rw. No dice. Tried to create another FreeBSD server, attach that root disk as a data disk and fsck it. No luck either. FSCK fixes a certain number of problems, but apparently that doesn’t solve the SU+J inconsistency.

I booted single user. Tried to FSCK from there. Still no biscuit:


```
# fsck /
** /dev/gpt/gandiroot
USE JOURNAL? [yn] y
** SU+J Recovering /dev/gpt/gandiroot
** Reading 16777216 byte journal from inode 4.
RECOVER? [yn] y
** Building recovery table.
** Resolving unreferenced inode list.
** Processing journal entries.
WRITE CHANGES? [yn] y
** 3 journal records in 1536 bytes for 6.25% utilization
** Freed 3 inodes (0 dirs) 0 blocks, and 0 frags.
***** FILE SYSTEM MARKED CLEAN *****
# exit
Setting hostuuid: 9a1d5b35-e917-446e-851f-29b04a426102.
Setting hostid: 0x0b66b4e5.
Fast boot: skipping disk checks.
UFS /dev/gpt/gandiroot (/) cylinder checksum failed: cg 2, cgp: 0x161e51ff != bp: 0xdff280c3
UFS /dev/gpt/gandiroot (/) cylinder checksum failed: cg 3, cgp: 0x303c6f0c != bp: 0xe1a8319e
UFS /dev/gpt/gandiroot (/) cylinder checksum failed: cg 5, cgp: 0x0 != bp: 0x639c9405
UFS /dev/gpt/gandiroot (/) cylinder checksum failed: cg 9, cgp: 0x0 != bp: 0xe41dfdb5
UFS /dev/gpt/gandiroot (/) cylinder checksum failed: cg 17, cgp: 0x0 != bp: 0x66f5b199
UFS /dev/gpt/gandiroot (/) cylinder checksum failed: cg 1, cgp: 0xc57d4dcd != bp: 0xc38b47c3
UFS /dev/gpt/gandiroot (/) cylinder checksum failed: cg 4, cgp: 0x0 != bp: 0x21fb7f73
UFS /dev/gpt/gandiroot (/) cylinder checksum failed: cg 5, cgp: 0x0 != bp: 0x639c9405
UFS /dev/gpt/gandiroot (/) cylinder checksum failed: cg 6, cgp: 0x0 != bp: 0x37c2e95e
```

Also, I've used TUNEFS to turn off every sort of journaling (-J, -j, -n) but the errors are still there, and FSCK doesn’t complain anymore.

I’m a bit at wits' end here, so if anyone knows a way out, I'd be forever beholden to them.

Thanks a lot of any help out of this predicament!

V.


----------



## ljboiler (Oct 24, 2019)

Looks like the disk drive is physically damaged in some way, having trouble reading data from the disk and verifying the on-disk checksum.


----------



## SirDice (Oct 24, 2019)

In this case it's likely caused by a bug. You can get into a situation like this if you have SU+J enabled and get a panic (or otherwise crash the machine). But as far as I know it's been fixed already; PR 225110.


----------



## Veeny (Oct 24, 2019)

Thanks to both. That can’t be the disk. I've tried to upgrade two different virtual servers located in two different datacentres, same result.
There was no crash. I just rebooted the system after a first "freebsd-update install" following a "freebsd-update -r 12.0 upgrade". I think it’s the right procedure, innit?

At the moment, I’m doing this: I have created a new 11.2 server (works fine). I've attached one of the faulty disks to it, done a newfs on the UFS partition, and I installed FreeBSD 12 from the tarballs inside. I’ll probably have to copy /etc/passwords to at least have a superuser access. Then I’ll reattach the drive to the virtual server and see if I can boot on it.


----------



## SirDice (Oct 24, 2019)

For the upgrade to 12.x try skipping the reboot in between. It's not really necessary. Just run `freebsd-update install` three times in a row (no reboots in between). Then run `pkg upgrade` to upgrade/reinstall your packages. Only when everything is done do the reboot.


----------



## Veeny (Oct 24, 2019)

SirDice said:


> For the upgrade to 12.x try skipping the reboot in between. It's not really necessary. Just run `freebsd-update install` three times in a row (no reboots in between). Then run `pkg upgrade` to upgrade/reinstall your packages. Only when everything is done do the reboot.


Thanks. If all else fails, I’ll try that and let you know. I really appreciate your help!


----------



## Veeny (Oct 24, 2019)

Nope, not better
`Trying to mount root from ufs:/dev/gpt/gandiroot [rw]...
WARNING: /usr/local/poudriere/data/images/system-ovGq/world was not properly dismounted
Setting hostuuid: 5a2b444e-c932-45f7-ae77-d77c102e8501.
Setting hostid: 0x855beaa3.
Starting file system checks:
** SU+J Recovering /dev/gpt/gandiroot
** Reading 16777216 byte journal from inode 4.
** Building recovery table.
** Resolving unreferenced inode list.
** Processing journal entries.
** 5 journal records in 1536 bytes for 10.42% utilization
** Freed 1 inodes (0 dirs) 35 blocks, and 0 frags.
***** FILE SYSTEM MARKED CLEAN *****
/dev/gpt/gandiroot: FILE SYSTEM CLEAN; SKIPPING CHECKS
/dev/gpt/gandiroot: clean, 3519372 free (3404 frags, 439496 blocks, 0.1% fragmentation)
UFS /dev/gpt/gandiroot (/) cylinder checksum failed: cg 2, cgp: 0x161e51ff != bp: 0xe66ecba8
UFS /dev/gpt/gandiroot (/) cylinder checksum failed: cg 3, cgp: 0x303c6f0c != bp: 0x573a2720
[…]`


----------



## Veeny (Oct 25, 2019)

So, I tried to make a bootable disk with FreeBSD 12 preloaded. I partitioned the disk, used gpart, etc. Everything should be fine, but all I get is this error message:

`Unknown command `else'.
Try `help' for usage`

And the boot process stops. Does anyone know what causes this?


----------

