Skip to content

stale zpool.cache in initrd #3

@mrdrmmn

Description

@mrdrmmn

/etc/zfs/zpool.cache gets built into the initrd. This can become problematic and prevent your zfs filesystems from mounting at boot and require them to be forcibly re-imported. As a workaround, you can run 'update-initramfs -k all -u' and that will fix the problem short term.

This became a problem for me because I create a pool using the /dev/sd? names from disks that were attached via USB. While I have this pool attached via USB, there was an update which triggered my initrd to be rebuilt. I them moved these disk onto my sata controller and off of the usb device and then imported it with 'zpool import -d /dev/disk/by-id [pool]'. Everything was working and then I rebooted and none of my zpools mounted (except for my root zpool). A zpool status showed that the pool was unavailable because the /dev/sd? devices were missing. So I exported the pool, did an import as mentioned above and that failed until I added -f to the import which was successful. I checked the contents of zpool.cache and it correctly had the device paths using by-id.

At this point I rebooted and the whole process started over again. The zpool.cache had the correct information, but zpool status showed the wrong device paths. I get everything back into working order and rebuilt my initrd. Finally I rebooted and all was well.

Really, the zpool.cache file should not be in the initrd. But clearly it is and it is being used and causing a problem. Perhaps updating the code to ensure that the zpool.cache file is ignored prior to the real / is mounted?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions