I tried to dual boot windows to my 20.04 ubuntu machine. After successfully installing windows I found I can no longer access ubuntu.
The state right now:
- I enter the bios and choose the ubuntu boot.
- After choosing ubuntu the grub2 command line is prompted.
- If I run
grub> exit
I exit the grub and the windows os is loaded. - after roaming the internet I found that there is a way to boot through the grub2.
- if I run the suggested command :
grunb> set root=(hd1,msdos5) grunb> linux /boot/vmlinuz-5.13.0-39-generic root=/dev/nvme1n1p5 ro grunb> initrd /boot/inintrd.img-5.13.0-39-generic grunb> boot
- Next, it seems like ubuntu start to load but got stuck at (initramfs) and there are some notable error lines before:
Begin: running /script/int-bottom ... mount: mounting /dev on /root/dev Mounting: mounting /dev on /root/dev failed: no such file or directory done. Mounting: mounting /dev on /root/dev failed: no such file or directory run-init: can't execute '/sbin/init': no such file or directory target filesystem dosen't have requested /sbin/init run-init: can't execute '/sbin/init': no such file or directory run-init: can't execute '/etc/init': no such file or directory run-init: can't execute '/bin/init': no such file or directory run-init: can't execute '/bin/sh': no such file or directory run-init: can't execute '': no such file or directory No init found. Try passing init= bootarg
(initramfs)
More data:
- Even before I added windows, ubuntu will first load the grub command line, and then I would have to enter
grub>exit
to enter ubuntu. - I use a new m.2 512GB disk for the windows installation.
- I can view all of my files and directory of the Ubuntu partition using the Grub ls command.
- Some
grub> ls
command ouput:
Grub> ls (proc) (hd0) (hd0,gpt5) (hd0,gpt4) (hd0,gpt3) (hd0,gpt2) (hd0,gpt1) (hd1) (hd1,msdos5) (hd1,msdos1)
Grub> ls (hd1,msdos5)/ lost+found/ boot/ swampfile etc/ media/ var/ bin dev/ home/ lib lib32 lib64 libx32 mnt/ opt/ proc/ root/ run/ sbin snap/ srv/ sys/ tmp/ usr/ cdrom/ -(My ubuntu partition)
Grub> ls (hd0,gpt2)/ efi/
Grub> ls (hd0,gpt4)/ /Program File /Program File (x86) ...
- (My Windows partition...)
Grub> ls (hd1,msdos1)/ efi/ System Volume Information/ $recycle.bin/ Recovery
- (ubuntu efi boot?)
Grub ls (hd1,msdos1)/efi/ ubuntu/ boot/
- Some
grub> set
command ouput:
Grub> set cmdpath=(hd1,msdos1)/EFI/UBUNTU grub_cpu=x86_64 grub_platform=efi lang= locale_dir= prefix=(hd1,msdos1)/boot/grub root=hd1,msdos1
some failed methods:
- I tried to boot Linux on live cd and update the grub
- I tried to use boot-repair
- I tried to add those lines to the grub:
Grub> set prefix=(hd1,msdos5)/boor/grub Grub> insmod normal Grub> normal
- I tried to change the root folder of the linux command to
root=/dev/sda1 ro
. As far as I understand I should use thenvme1n1p5
as my disks are m.2 type. - I have seen somewhere that you can't dual boot legacy bios with UEFI and that I should change this setting in the bios. but all the relevant options were on "legacy bios only"
So, this is my last painful experience with dual booting. I hope I have been clear enough. If you need any other information please tell me. And of course, thank you very much for the will to help me :)
update:
After reading the boot-repair report:
https://paste.ubuntu.com/p/VG5skMbhVk/
I realize that in the second line of the Grub I should have written nvme0n1p5
instead of nvme1n1p5
, Currently, I'm successfully booted into my ubuntu.
Right now I am not sure how to update my grub. My end goal would be that when powering the computer I'll be prompt with a grub menu with ubuntu and windows.
nvme0n1p5
instead ofnvme1n1p5
. I just did it and now I am writing from my ubuntu. BTW how do I update the grub? I guess I should just doGrub-update
but I am afraid to break this stuff again... And as I mentioned I didn't have the grub menu even before dual booting... – Bel Garat Apr 12 '22 at 10:43