Snapper rollback no vuelve al snapshot deseado después de reiniciar en Fedora 31
Snapper rollback funcionaba correctamente pero al reiniciar y mirar btrfs subvolume get-default /
seguía en el snaphsot antiguo. Esto no me había ocurrido en versiones antiguas de Fedora.
EDIT: esto sólo vale para partición /boot por separado (formateada sin BTRFS), que es la configuración por defecto en Fedora 31. Para /boot dentro una sola partición / con BTRFS, ver mi entrada más reciente en Arch.
Al regenerar grub2 con grub2-mkconfig -o /boot/grub2/grub.cfg
se me quedaba a peñón fijo el snapshot 84:
set default_kernelopts="root=/dev/mapper/yatai-root ro rootflags=subvol=.snapshots/84/snapshot resume=/dev/mapper/yatai-swap rd.lvm.lv=yatai/root rd.lvm.lv=yatai/swap rhgb quiet systemd.unified_cgroup_hierarchy=0 video=HDMI-A-2:D drm_kms_helper.edid_firmware=HDMI-A-2:edid/CPD-E220E.bin"
Encontré la solución en un foro de Arch (y también aquí y aquí, aquí):
Edit /etc/grub.d/10_linux
https://bbs.archlinux.org/viewtopic.php?pid=1538864#p1538864
(Maybe around line 59) remove the part that says «rootflags=subvol=${rootsubvol} «. You can likely remove more in that area, but I left it alone at that point, even though it may not be the most efficient.
Check elsewhere for rootflags, removing it as well.
Then run grub-mkconfig. It won’t give the rootflags option anymore.
Without the flag, the kernel boots into the default subvol. (set with btrfs subvolume set-default)
For penetal, this method also works with snapper rollbacks, as it sets the btrfs default subvolume for you.
Somewhere in the grub or kernel documentation (can’t remember which) I read the rootflags was a required option for booting off a btrfs partition, but it works just fine for me omitting it.
Efectivamente, al quitar rootflags=subvol=${rootsubvol}
en /etc/grub.d/10_linux (línea GRUB_CMDLINE_LINUX
)
case x"$GRUB_FS" in
xbtrfs)
if [ "x${SUSE_BTRFS_SNAPSHOT_BOOTING}" = "xtrue" ]; then
GRUB_CMDLINE_LINUX="${GRUB_CMDLINE_LINUX} \${extra_cmdline}"
else
rootsubvol="`make_system_path_relative_to_its_root /`"
rootsubvol="${rootsubvol#/}"
if [ "x${rootsubvol}" != x ]; then
GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}"
fi
fi;;
…y regenerar grub2 nuevamente (grub2-mkconfig -o /boot/grub2/grub.cfg),
desapareció el snapshot de default_kernelopts
:
set default_kernelopts="root=/dev/mapper/yatai-root ro resume=/dev/mapper/yatai-swap rd.lvm.lv=yatai/root rd.lvm.lv=yatai/swap rhgb quiet systemd.unified_cgroup_hierarchy=0 video=HDMI-A-2:D drm_kms_helper.edid_firmware=HDMI-A-2:edid/CPD-E220E.bin"
Reinicié y ya estaba en el snapshot correcto.