Closed alfarock closed 4 years ago
hello,
In the Grub menu, open a command prompt (by pressing "c" key) then,
type this command: echo $prefix
Write the result somewhere and compare it to the grub-btrfs.cfg
file in your grub folder
.
If the path does not match, please provide me with your grub-btrfs.cfg
file ,grub.cfg
and the result of command above.
You are using the latest version present in the master branch, is that right?
Here is the output of the command:
Here are the files as requested: grub.cfg.txt grub-btrfs.cfg.txt
Yes indeed I believe I am using the latest version in the master branch.
A quick fix
Modify the file 41_snapshots-btrfs
in the directory /etc/grub.d
Line 84
boot_device=$(${grub_probe} --target=device ${grub_directory})
replace by :
boot_device=$(${grub_probe} --target=device /boot)
Then re-generate your grub.cfg
grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
Changing that line in 41_snapshots-btfs file seems to do the trick! I can boot off of snapshots now.
I need to correct this in the master branch.
It appears that, using the grub
directory to define the boot partition is a bad idea, as it induces several problems.
Note, that a system without a separate boot partition doesn't have a problem.
/boot/grub
does not contain the kernels and initramfs.
When generating menu entries, the $root
variable of grub is incorrectly set.
It should be set to find kernels/initramfs.
On an EFI
installation the grub
folder may be in a different location:
Either on the same partition as the system
Either on a separate boot partition
Either on the EFI fat32 partition
In your initial post, I noticed that you change the grub_directory
variable to /boot/efi/EFI/fedora
.
This means that the grub.cfg
file is in this location, not in the grub directory.
If this is correct, I need to improve the explanation in the config file and/or change the name of the variable for a better understanding. (In any case, you modified it correctly, because you can load the menu called "Fedora snapshots")
To fix the original issue, I'm thinking of defining a variable, which will be used for both the boot partition and the kernel/initramfs localization.
That is correct, for EFI
installations thegrub.cfg
file is found under /boot/efi/EFI/(os name)/grub.cfg.
Seems like you have it all under control, thanks for a really cool project!
Seems like you have it all under control, thanks for a really cool project!
Thanks for your support.
I made some corrections/modifications. Can you try and give me a feedback, before I merge this patch in the master branch and close this issue, please.
Just tested that branch with the modifications on a VM and on my daily driver and everything is working as intended on Fedora 32. Thank you.
Thank you for your feedback. Glad to hear it all works.
Scratch that, works fine on my VM but now my daily driver wont boot (from snapshot)
bad :( Can you tell me what the error is ?
It says:
error: ../../grub-core/commands/efi/tmp.c:315:Uknown TPM error.
error: ../../grub-core/commands/efi/tmp.c:315:Uknown TPM error.
error: ../../grub-core/commands/efi/tmp.c:315:Uknown TPM error.
error: ../../grub-core/commands/efi/tmp.c:315:Uknown TPM error.
error: ../../grub-core/loader/i386/efi/linux.c:208:you need to load kernel first.
Press any key to continue...
you need to load kernel first.
It does not find the kernel.
Can you tell me which variable is modified in the config file. And again, your grub.cfg and grub-btrfs.cfg
Here is my config file:
# Disable grub-btrfs.
# Default: "false"
#GRUB_BTRFS_DISABLE="true"
# Name appearing in the Grub menu.
# Default: "Use distribution information from /etc/os-release."
#GRUB_BTRFS_SUBMENUNAME="Arch Linux snapshots"
# Add a name ahead your snapshots entries in the Grub menu.
# Default: "Snapshot:"
#GRUB_BTRFS_PREFIXENTRY="Snapshot:"
# Show full path snapshot or only name in the Grub menu, weird reaction with snapper.
# Default: "true"
#GRUB_BTRFS_DISPLAY_PATH_SNAPSHOT="false"
# Custom title.
# shows/hides p"prefix" d"date" n"name" in the Grub menu, separator "/", custom order available.
# Default: "p/d/n"
#GRUB_BTRFS_TITLE_FORMAT="p/d/n"
# Limit the number of snapshots populated in the GRUB menu.
# Default: "50"
#GRUB_BTRFS_LIMIT="50"
# Sort the found subvolumes by "ogeneration" or "generation" or "path" or "rootid".
# # See Sorting section to https://btrfs.wiki.kernel.org/index.php/Manpage/btrfs-subvolume#SUBCOMMAND
# "-rootid" means list snapshot by new ones first.
# Default: "-rootid"
#GRUB_BTRFS_SUBVOLUME_SORT="+ogen,-gen,path,rootid"
# Show snapshots found during run "grub-mkconfig"
# Default: "true"
#GRUB_BTRFS_SHOW_SNAPSHOTS_FOUND="false"
# Show Total of snapshots found during run "grub-mkconfig"
# Default: "true"
#GRUB_BTRFS_SHOW_TOTAL_SNAPSHOTS_FOUND="true"
# By default, "grub-btrfs" automatically detects most existing kernels.
# If you have one or more custom kernels, you can add them here.
# Default: ("")
#GRUB_BTRFS_NKERNEL=("kernel-custom" "vmlinux-custom")
# By default, "grub-btrfs" automatically detects most existing initramfs.
# If you have one or more custom initramfs, you can add them here.
# Default: ("")
#GRUB_BTRFS_NINIT=("initramfs-custom.img" "initrd-custom.img" "otherinit-custom.gz")
# By default, "grub-btrfs" automatically detects most existing microcodes.
# If you have one or more custom microcodes, you can add them here.
# Default: ("")
#GRUB_BTRFS_CUSTOM_MICROCODE=("custom-ucode.img" "custom-uc.img "custom_ucode.cpio")
# Ignore specific path during run "grub-mkconfig".
# Only exact paths are ignored.
# e.g : if `specific path` = @, only `@` snapshot will be ignored.
# Default: ("@")
GRUB_BTRFS_IGNORE_SPECIFIC_PATH=("@")
# Ignore prefix path during run "grub-mkconfig".
# Any path starting with the specified string will be ignored.
# e.g : if `prefix path` = @, all snapshots beginning with "@/..." will be ignored.
# Default: ("var/lib/docker" "@var/lib/docker" "@/var/lib/docker")
GRUB_BTRFS_IGNORE_PREFIX_PATH=("var/lib/docker" "@var/lib/docker" "@/var/lib/docker")
# By default "grub-btrfs" automatically detects your boot partition,
# either located at the system root or on a separate partition,
# but cannot detect if it is in a subvolume.
# Change to "true" if you have a boot partition in a different subvolume.
# Default: "false"
#GRUB_BTRFS_OVERRIDE_BOOT_PARTITION_DETECTION="true"
# Location of the folder containing the "grub.cfg" file.
# Use by grub-btrfs to save the file "grub-btrfs.cfg".
# Might be grub2 on some systems.
# For example, on Fedora with EFI : "/boot/efi/EFI/fedora"
# Default: "/boot/grub"
GRUB_BTRFS_GRUB_DIRNAME="/boot/efi/EFI/fedora"
# Location of kernels/initramfs/microcode.
# Use by "grub-btrfs" to detect the boot partition and the location of kernels/initrafms/microcodes.
# Default: "/boot"
#GRUB_BTRFS_BOOT_DIRNAME="/boot"
# Name/path of grub-mkconfig, use by "grub-btrfs.service"
# Might be 'grub2-mkconfig' on some systems
# For example, on Fedora : "/sbin/grub2-mkconfig"
# Default: /usr/bin/grub-mkconfig
GRUB_BTRFS_MKCONFIG=/sbin/grub2-mkconfig
# Snapper
# Snapper's config name to use
# Default: "root"
#GRUB_BTRFS_SNAPPER_CONFIG="root"
# Password protection management for submenu,snapshots
# Refer to the Grub documentation https://www.gnu.org/software/grub/manual/grub/grub.html#Authentication-and-authorisation
# and this comment https://github.com/Antynea/grub-btrfs/issues/95#issuecomment-682295660
#
# Add authorized usernames separate by comma (foo,bar)
# When Grub's password protection is enabled, the superuser is authorized by default, it isn't necessary to add it
# Default: ""
#GRUB_BTRFS_PROTECTION_AUTHORIZED_USERS="foo,bar"
#
# Disable authentication support for submenu of Grub-btrfs only (--unrestricted)
# doesn't work if GRUB_BTRFS_PROTECTION_AUTHORIZED_USERS isn't empty
# Default: "false"
#GRUB_BTRFS_DISABLE_PROTECTION_SUBMENU="true"
Here are the requested files:
Very strange because it works perfectly fine in my VM with the same exact config file.
Thank you I will analyze your data And I'll get back to you later (I'm busy, sorry).
I back,
in 41_snapshots-btrfs
file (/etc/grub.d
)
line 178:
insmod ${boot_fs}
Replace by
insmod part_gpt
insmod ${boot_fs}
Then re-generate your grub.cfg
grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
or somethings else
Hi, same error as before. :(
I've tried... but i can't reproduce this error.
In VM, all is works. In Fresh install on hdd with efi, all is works.
Maybe reinstall grub2 ?
Just tried reinstalling grub2 and nothing. Going to try reinstalling the whole thing because for some reason it works on VMs but not on my hardware.
Edit: Works completely fine on a fresh installation of Fedora 32. Seems like there was something wrong with my previous installation. Thanks for the help.
Glad to hear that. We won't know what happened, the important thing is that everything works. Have a good day :)
Hi,
I will write onto this thread here because there is definitely "something" going on. The OP wrote a couple of weeks ago when the config file changed. For me it was yesterday here on F35 and it is definitely exactly the same behaviour, and absolutely non-resolvable on a production system. You can do whatever you want, reinstall all grub and shim, regenerate grub.cfg etc., it always leads to Unknown TPM error. I did not find a single solution within hours for this and so have to scratch the whole system, as also new snapshots will not work anymore. It is just dead.
Here it was caused due to a recent grub2 update, which actually should have nothing to do with it at all. grub2-common is just an example, all grub- and shim- packages were updated
Changelogs for grub2-common-1:2.06-10.fc35.noarch
* Fri Dec 10 00:00:00 2021 Robbie Harwood <rharwood@redhat.com> - 2.06-10
- Bump to re-do signing (no code changes)
* Thu Dec 09 00:00:00 2021 Robbie Harwood <rharwood@redhat.com> - 2.06-9
- Restore grub.cfg umask (CVE-2021-3981)
- Resolves: rhbz#2030358
snapshot handling is gone with it. And I don't have the slightest idea....
@Antynea : As this seems to have to do something with not the most recent change but in general with updates of either grub- or shim-packages, do you have any clue?
The thing why you could not replicate this I think is because you did not update grub packages. Everything works fine on a new install on Fedora, as long as grub packages are not updated. I also filed this here https://bugzilla.redhat.com/show_bug.cgi?id=2031640 But in the end I am not sure what is the culprit, the grub packages doing something strange on Fedora specifically (remember OP was on Fedora 32, I am now on 35) or if it is a problem with grub-btrfs itself. In either way there is an issue because @alfarock thought something was wrong with his install, there was definitely nothing wrong with mine. It was rather fresh when it happened and it had clearly to do with update of the packages.
I am having this issue as well
error: ../../grub-core/commands/efi/tmp.c:150:Uknown TPM error.
error: ../../grub-core/commands/efi/tmp.c:150:Uknown TPM error.
error: ../../grub-core/commands/efi/tmp.c:150:Uknown TPM error.
error: ../../grub-core/commands/efi/tmp.c:150:Uknown TPM error.
My disk is encrypted and i am running UEFI, if that changes anything. I am running fedora 40 with latest kernel, so system should be up to date
OS: Fedora 32 Version: Latest from Github
Hi, I was using grub-btrfs to boot from snapshots just fine until a couple of weeks ago when the config file changed. Now I get the following error:
I've tried it both on my laptop and in a virtual machine with the same result.
These are the only things I've changed from the default config file:
cat /etc/default/grub-btrfs/config
Thanks for your help and work on a great utility!