PDA

View Full Version : Failed to switch root: Specified switch root path '/sysroot' does not seem to be an O



drnagalkar
25th November 2017, 09:41 AM
My laptop has Fedora 26 and Fedora 27 installed on separate /boot and root partitions on a GPT disk. I have given the command ........
grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.13.13-300.fc27.x86_64
Found initrd image: /boot/initramfs-4.13.13-300.fc27.x86_64.img
Found linux image: /boot/vmlinuz-4.13.9-300.fc27.x86_64
Found initrd image: /boot/initramfs-4.13.9-300.fc27.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-7c2afdf585904dc490837663869248bf
Found initrd image: /boot/initramfs-0-rescue-7c2afdf585904dc490837663869248bf.img
Found Windows Boot Manager on /dev/sda1@/EFI/Microsoft/Boot/bootmgfw.efi
Found Fedora 26 (Workstation Edition) on /dev/mapper/fedora-root
done
But when I try to boot in to Fedora 26 from grub.cfg it goes to emergency mode with message "Failed to switch root"
My rdsosreport.txt is attached herewith.
Only os-prober section is giving error.
Is there any solution to this problem? Please help because grub.cfg is a automatically generated file.
Thanks
Dr Nagalkar

amiga
25th November 2017, 10:41 AM
There appears to be a problem with the generated entries for F26 in that it makes the rescue entry the default and gives all four entries the same title. os-prober often gives bad output. I have it disabled.

It appears you were logged in to F27 and os-prober generated an entry for Windows and bad entries for F26.

I recommend that you don't use os-prober. Instead create custom entries for F26 and for Windows in the file /etc/grub.d/40_custom and disable os-prober in the file /etc/default/grub by adding the line GRUB_DISABLE_OS_PROBER=true

If the entry for Windows works you can add it to the 40_custom file as is.

For Fedora 26 I recommend you use config file loading as follows. Give your F26 /boot partition a file system label (or use its UUID)
and then search for that partition. This will allow you to reference and use the existing F26 grub.cfg and not rely on bad output from os-prober.

In the file /etc/grub.d/40_custom


menuentry 'Fedora 26 using grub2 configfile' {
insmod ext2
insmod part_gpt
search --no-floppy --set=root --label boot_fedora26
configfile /grub2/grub.cfg
}

menuentry 'Windows Boot Manager (on /dev/sda1)' --class windows --class os $menuentry_id_option 'osprober-efi-BCC2-F007' {
insmod part_gpt
insmod fat
set root='hd0,gpt1'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1 BCC2-F007
else
search --no-floppy --fs-uuid --set=root BCC2-F007
fi
chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}

Then regenerate your config with grub2-mkconfig as you have done.

drnagalkar
25th November 2017, 01:50 PM
Dear Amiga,
Thanks for your reply.My windows 10 entry was working with os-prober only entries for Fedora were giving the error message.I edited the automatically generated file manually by changing the root entry in linuxefi from "root=/dev/dm-4" to "root=/dev/mapper/fedora-root ro rd.lvm.lv=fedora/root rd.lvm.lv=fedora/swap rd.lvm.lv=fedora/swap rhgb quiet" and now everything is working fine. I will disable os-prober by GRUB_DISABLE_OS_PROBER=true.
With regards
Dr Nagalkar

amiga
25th November 2017, 06:25 PM
My windows 10 entry was working with os-prober only entries for Fedora were giving the error message.

This is normal as os-prober gives better results for Windows than linux as linux requires more complex grub entries. Windows can simply be chain-loaded. Just copy this Windows entry to the 40_custom file.


I edited the automatically generated file manually by changing the root entry in linuxefi from "root=/dev/dm-4" to "root=/dev/mapper/fedora-root ro rd.lvm.lv=fedora/root rd.lvm.lv=fedora/swap rd.lvm.lv=fedora/swap rhgb quiet" and now everything is working fine. I will disable os-prober by GRUB_DISABLE_OS_PROBER=true.


First of all rd.lvm.lv=fedora/swap appears twice. Remove the duplicate. It won't cause problems but is unnecessary.

It is good that it is working however you shouldn't edit grub.cfg manually as your changes will be wiped out next regeneration. Please move these entries into the 40_custom file.

drnagalkar
26th November 2017, 04:21 AM
This is normal as os-prober gives better results for Windows than linux as linux requires more complex grub entries. Windows can simply be chain-loaded. Just copy this Windows entry to the 40_custom file.
I did this already.
First of all rd.lvm.lv=fedora/swap appears twice. Remove the duplicate. It won't cause problems but is unnecessary.
Yes I will do that.
It is good that it is working however you shouldn't edit grub.cfg manually as your changes will be wiped out next regeneration. Please move these entries into the 40_custom file.
I already did that after manual edit.
Thanks for corrections and pointing out.
Dr Nagalkar