When boot fails and you end up in initramfs, typically the recovery process involves booting off of a USB stick with the Proxmox installer so you can mount the system and fix things up.
I discovered that there's a way you can (often) get into a booted system without needing to go to recovery. In my case, I used this twice: once, when the /etc/kernel/cmdline file has the wrong root pool specified. Second, when I had two pools with the same name and manually needed to import one by number.
First, when you're at the (initramfs) prompt make sure you have zpool, zfs, and other tools available. If what's broken is due to missing zfs modules, or the initramfs not containing the zfs tools, you'll have to go all the way to using the Proxmox installer.
Let's say you need to import a specific pool by pool ID to boot:
I found this process worked better than trying to use the zfsunlock script when things were broken. Hopefully this helps someone else!
I discovered that there's a way you can (often) get into a booted system without needing to go to recovery. In my case, I used this twice: once, when the /etc/kernel/cmdline file has the wrong root pool specified. Second, when I had two pools with the same name and manually needed to import one by number.
First, when you're at the (initramfs) prompt make sure you have zpool, zfs, and other tools available. If what's broken is due to missing zfs modules, or the initramfs not containing the zfs tools, you'll have to go all the way to using the Proxmox installer.
Let's say you need to import a specific pool by pool ID to boot:
Code:
# This will show all discovered pools including their Pool ID.
(initramfs) zpool import
# Import the specific pool, forcing it if it was last mounted on another system.
(initramfs) zpool import [-f] <pool id>
# If the pool is imported but not unlocking, or you need to do any other zfs commands, do them now!
(initramfs) zfs load-key rpool
# Find the process ID of your shell. If you're connecting over ssh, use the lowest process ID as that's the one attached to the console.
(initramfs) ps auxww | grep sh
# If all goes well, this should continue boot and you can fix things permanently in the comfort of your full environment.
(initramfs) kill -9 <pid>
I found this process worked better than trying to use the zfsunlock script when things were broken. Hopefully this helps someone else!