# Cannot boot after rollback to 12.1



## simonpie (Oct 31, 2020)

Hello,

After upgrading to 12.2, i did a rollback to 12.1.  Sadly, the machine does boot any more.  It goes to a `mountroot>` prompt.  From there, I can list device or reboot.  That's it.  





I followed advice from VladiBG from this  post, the system goes further, but still ends at the mountroot prompt.  








As VladiBG told me to open a new post, here it is.

Any help would be appreciated


----------



## monwarez (Oct 31, 2020)

Since you are using zfs and have boot environment setup, did you by any chance create(and activate)  a new boot environment before upgrading to 12.2 ? 
What step did you do to downgrade ?
Did you upgrade your zfs pool after upgrading into 12.2 ?
Did you install the new /boot/loader.efi into your EFI partition ?


----------



## VladiBG (Oct 31, 2020)

How did you rollback to 12.1?


----------



## simonpie (Oct 31, 2020)

I did not change any boot environment setup.  I have to admit, I am not very familiar with this part of the OS.

I simply upgraded using `freebsd-update upgrade -r 12.2`.  I approved all the suggestions which seemed ok with my understanding of my box without any modification.  Upgrade proceeded normaly and the box rebooted in 12.2.  Only, some services, rather important for my local network, like dhcpd, did not come back.  Instead of rolling forward, as I did not have time to toy with that, I decided to run `freebsd-update rollback`.

I did not do consciously run any `zfs upgrade` (this I know very well what it is).  I sure hope the installer did not.

I did not install any new file by myself, certainly not loader.efi.


----------



## VladiBG (Oct 31, 2020)

Did you finish the upgrade to 12.2-RELEASE after the first reboot or you rollback at that point?
edit: nvm you can't rollback on the kernel install as there's no rollback directory at this point. So i assume that you install the userland updates by running second time `freebsd-update install` and then reboot and you run rollback. This will rollback only your userland programs and will break all of them. The easy way is to restore your last backup before the upgrade or try to boot the old kernel located in /boo/kernel.old/


----------



## simonpie (Oct 31, 2020)

I believe, from memory that I did the upgrade then install, theN rebooted.  But after the reboot, I did not do the second  `freebsd-update install`.  This is when I ran the rollback.

Sadly, my last backup is quite old.  I actually thought that the upgrade command was taking a snapshot of my pool and was using this snapshot to do a rollback.    Apparently, I was wrong.  

So, if I understand well, I pretty much destroyed my system.  So, what remains to be done is is to salvage all configuration files that can be salvaged and restore from my most recent backup and rebuild the system from the salvaged files by hand.  Luckily, it's a simple system.

Or start from scratch. 

Any other thoughts ?


----------



## simonpie (Nov 1, 2020)

Thanks, I shall go look at the partition configuration.  I have imported the pool on another machine, the [FONT=courier new]/boot/loader[/FONT] directory is still there.  Right in `zroot/ROOT/default` ( I go from memory here ).  Only thing, when I imported the pool on the other machine, all the volumes would not mount, I had to change a couple of zfs mountpoints by hand.  But all my data and configuration files are still there.


----------



## simonpie (Nov 1, 2020)

Hmmm, I wish I knew how to do that.


----------



## simonpie (Nov 1, 2020)

There is a bunch of *.ko file and a kernel file in [FONT=courier new]/boot/kernel/[/FONT].  I guess I shall check gpart.


----------



## monwarez (Nov 1, 2020)

What method are you using to boot: UEFI or legacy bios ?


simonpie said:


> Sadly, my last backup is quite old. I actually thought that the upgrade command was taking a snapshot of my pool and was using this snapshot to do a rollback. Apparently, I was wrong.


For the moment `freebsd-update` does not do that (there some discussion about it), but you can use boot environment to perform this kind of snapshot.  When doing a zfs on boot installation there is a boot environment(BE) created named default, you can use `bectl` to create a new BE like 12.2-release before doing an upgrade and reboot into this new BE. After that you can perform the upgrade as usual, and verify that the upgrade works well. You can leave the previous BE exist until you need the used space by it. `bectl list` will list all the BE along with their space used.

You could try to perform the upgrade from another machine, by using the `freebsd-update -b basedir` option. But backup /etc directory first


----------



## simonpie (Nov 2, 2020)

Same problem in safe mode or single user mode.  I did not try the `boot -s`or `boot -C,` but the machine will boot from the liveCD on a thumbdrive (as expected) and I can import the pool just fine.  As I said before, all the files seems to be present.  Only, the last loader in the chains does not fine whatever it needs on the pool.


----------



## simonpie (Nov 2, 2020)

No, I have yet to do that.  As soon as I have a few minutes I shall do it.


----------



## simonpie (Nov 3, 2020)

anonymous9 said:


> Did you try
> 
> ```
> gpart set -a active -i 2 ada1
> ...


Hello,

`gpart gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 2 ada0`
seems to work
but
`gpart set -a active -i 2 ada0`
outputs :
`gpart: attrib 'active': Device not configured`
as I believe from reading arount that the active attribute is for pre-efi machines.

Nothing change, I still get the `mountroot` prompt.


----------



## simonpie (Nov 3, 2020)

I sorry, what files ?


----------



## simonpie (Nov 3, 2020)

And then, what do I do with them ?


----------



## VladiBG (Nov 3, 2020)

This is bad advice, as it will overwrite it entire configuration and all files. IT's better to make a full backup of your information then to reinstall and restore the data.


----------

