LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 04-30-2024, 04:05 PM   #1
r1w1s1
Member
 
Registered: Mar 2004
Location: São Paulo - Brazil
Distribution: Slackware
Posts: 66
Blog Entries: 1

Rep: Reputation: 42
Qemu + OVMF, uefi with grub2 issues


Hi all, I´m trying to run qemu+OVMF, to install slackware-current (AlienBOB iso), works fine with elilo, when I run the commands to install grub2 everythings seems fine but the boot still elilo.

Quote:
/usr/sbin/grub-install --target=x86_64-efi --efi-directory=/boot/efi/ --bootloader-id=uefi
/usr/sbin/grub-mkconfig -o /boot/grub/grub.cfg

Command to start
Quote:
sudo qemu-system-x86_64 \
-machine q35,accel=kvm \
-boot menu=on \
-m 2048 \
-cpu max \
-smp 2 \
-drive file=/home/r1w1s1/VMs/slackware.raw,format=raw \
-bios /usr/share/edk2-ovmf-x64/OVMF_CODE.fd \
-nic user,hostfwd=tcp::8888-:22 \
-device AC97 \
-fsdev local,id=fsdev0,path=/home/r1w1s1,security_model=none -device virtio-9p-pci,id=fs0,fsdev=fsdev0,mount_tag=host_share

Did someone try this setup ? Or have any hints for debug better grub2.
 
Old 04-30-2024, 04:22 PM   #2
Daedra
Senior Member
 
Registered: Dec 2005
Location: Springfield, MO
Distribution: Slackware64-15.0
Posts: 2,697

Rep: Reputation: 1381Reputation: 1381Reputation: 1381Reputation: 1381Reputation: 1381Reputation: 1381Reputation: 1381Reputation: 1381Reputation: 1381Reputation: 1381
During the install at the setup system phase do not install elilo. After the install is finished don't reboot but drop into a shell and run these commands

Code:
chroot /mnt /bin/bash
source /etc/profile
grub-install --target=x86_64-efi --efi-directory=/boot/efi/ --bootloader-id=grub
grub-mkconfig -o /boot/grub/grub.cfg
then exit and reboot and then grub should work fine. On your current install I would think uninstalling elilo and deleting it from /boot/efi then installing grub should do the trick, but I can't confirm since I haven't tried it.
 
Old 04-30-2024, 05:10 PM   #3
r1w1s1
Member
 
Registered: Mar 2004
Location: São Paulo - Brazil
Distribution: Slackware
Posts: 66

Original Poster
Blog Entries: 1

Rep: Reputation: 42
Quote:
Originally Posted by Daedra View Post
During the install at the setup system phase do not install elilo. After the install is finished don't reboot but drop into a shell and run these commands

Code:
chroot /mnt /bin/bash
source /etc/profile
grub-install --target=x86_64-efi --efi-directory=/boot/efi/ --bootloader-id=grub
grub-mkconfig -o /boot/grub/grub.cfg
then exit and reboot and then grub should work fine. On your current install I would think uninstalling elilo and deleting it from /boot/efi then installing grub should do the trick, but I can't confirm since I haven't tried it.
yes I did that, cannot boot.
Attached Thumbnails
Click image for larger version

Name:	qemu-error.png
Views:	35
Size:	38.7 KB
ID:	42757  
 
Old 04-30-2024, 06:07 PM   #4
rizitis
Member
 
Registered: Mar 2009
Location: Greece,Crete
Distribution: Slackware64-current, Slint
Posts: 674
Blog Entries: 1

Rep: Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511
try this might help...

Code:
grub-install --target=x86_64-efi --efi-directory=/boot/efi/ --bootloader-id=grub --removable
 
1 members found this post helpful.
Old 04-30-2024, 07:42 PM   #5
Daedra
Senior Member
 
Registered: Dec 2005
Location: Springfield, MO
Distribution: Slackware64-15.0
Posts: 2,697

Rep: Reputation: 1381Reputation: 1381Reputation: 1381Reputation: 1381Reputation: 1381Reputation: 1381Reputation: 1381Reputation: 1381Reputation: 1381Reputation: 1381
Just out of curiosity, why are you using UEFI with your VM? Nothing wrong with that, but slackware-current will run just fine in qemu with legacy bios. Also when you run grub-install --target=x86_64-efi --efi-directory=/boot/efi/ --bootloader-id=grub does grub-install give you any errors?
 
Old 05-01-2024, 01:22 AM   #6
zeebra
Senior Member
 
Registered: Dec 2011
Distribution: Slackware
Posts: 1,834
Blog Entries: 17

Rep: Reputation: 642Reputation: 642Reputation: 642Reputation: 642Reputation: 642Reputation: 642
Quote:
Originally Posted by Daedra View Post
Just out of curiosity, why are you using UEFI with your VM? Nothing wrong with that, but slackware-current will run just fine in qemu with legacy bios. Also when you run grub-install --target=x86_64-efi --efi-directory=/boot/efi/ --bootloader-id=grub does grub-install give you any errors?
OVMF is UEFI specific and among other things allows particular methods of GPU passthrough ("OVMF method").
 
Old 05-01-2024, 01:32 AM   #7
ponce
LQ Guru
 
Registered: Aug 2004
Location: Pisa, Italy
Distribution: Slackware
Posts: 7,114

Rep: Reputation: 4189Reputation: 4189Reputation: 4189Reputation: 4189Reputation: 4189Reputation: 4189Reputation: 4189Reputation: 4189Reputation: 4189Reputation: 4189Reputation: 4189
Quote:
Originally Posted by r1w1s1 View Post
/usr/sbin/grub-install --target=x86_64-efi --efi-directory=/boot/efi/ --bootloader-id=uefi
I think you are missing the device argument of grub-install, like /dev/sda, to install grub2 in the boot sector and, in doing so, overwriting elilo.

I never tried in an emulated machine but on real hardware I also needed to mount the efivars filesystem (if not already mounted, you can check with "grep efivars /proc/mounts") for grub 2 to install correctly
Code:
mount -t efivarfs none /sys/firmware/efi/efivars

Last edited by ponce; 05-01-2024 at 01:37 AM.
 
1 members found this post helpful.
Old 05-01-2024, 03:57 AM   #8
Thom1b
Member
 
Registered: Mar 2010
Location: France
Distribution: Slackware
Posts: 486

Rep: Reputation: 339Reputation: 339Reputation: 339Reputation: 339
Hi,

Here is my qemu options about ovmf :
Code:
-drive if=pflash,format=raw,readonly=on,file=/usr/share/edk2-ovmf-x64/OVMF_CODE.fd -drive if=pflash,format=raw,file=OVMF_VARS.fd
where OVMF_VARS.fd is read/write by qemu user and is used only by this virtual host.
 
2 members found this post helpful.
Old 05-01-2024, 04:30 AM   #9
henca
Member
 
Registered: Aug 2007
Location: Linköping, Sweden
Distribution: Slackware
Posts: 989

Rep: Reputation: 674Reputation: 674Reputation: 674Reputation: 674Reputation: 674Reputation: 674
Quote:
Originally Posted by Thom1b View Post
where OVMF_VARS.fd is read/write by qemu user and is used only by this virtual host.
Yes, with qemu you will not only need the "BIOS" ovmf file but also a "parameter" ovmf file where you can store your ovmf boot settings.

regards Henrik
 
1 members found this post helpful.
Old 05-01-2024, 11:04 AM   #10
r1w1s1
Member
 
Registered: Mar 2004
Location: São Paulo - Brazil
Distribution: Slackware
Posts: 66

Original Poster
Blog Entries: 1

Rep: Reputation: 42
Quote:
Originally Posted by rizitis View Post
try this might help...

Code:
grub-install --target=x86_64-efi --efi-directory=/boot/efi/ --bootloader-id=grub --removable
works! I will do more tests and write some notes about it.

I will also try to add OVMF parameter file to test it.


Thank you guys!!!

Last edited by r1w1s1; 05-01-2024 at 11:48 AM.
 
Old 05-01-2024, 12:44 PM   #11
rizitis
Member
 
Registered: Mar 2009
Location: Greece,Crete
Distribution: Slackware64-current, Slint
Posts: 674
Blog Entries: 1

Rep: Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511
Quote:
Originally Posted by r1w1s1 View Post
works! I will do more tests and write some notes about it.

I will also try to add OVMF parameter file to test it.


Thank you guys!!!
Nice!
Jfyi this was a very fast written script for schoolkids. the idea was to easy download and run Slackware in a school for one day it might work until now idont know, but you can take a better idea about ovmf...

https://github.com/rizitis/Qemu-slac...slackware64-15
 
2 members found this post helpful.
Old 05-01-2024, 01:40 PM   #12
Daedra
Senior Member
 
Registered: Dec 2005
Location: Springfield, MO
Distribution: Slackware64-15.0
Posts: 2,697

Rep: Reputation: 1381Reputation: 1381Reputation: 1381Reputation: 1381Reputation: 1381Reputation: 1381Reputation: 1381Reputation: 1381Reputation: 1381Reputation: 1381
Quote:
Originally Posted by r1w1s1 View Post
works! I will do more tests and write some notes about it.

I will also try to add OVMF parameter file to test it.


Thank you guys!!!
I have had to us the --removable flag on some Slackware installs lately. I didn't think to suggest it since you didn't say you were getting any errors during grub-install. Good thing rizitis thought of it .
 
1 members found this post helpful.
Old 05-01-2024, 02:40 PM   #13
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,065

Rep: Reputation: Disabled
Quote:
Originally Posted by rizitis View Post
Nice!
Jfyi this was a very fast written script for schoolkids. the idea was to easy download and run Slackware in a school for one day it might work until now idont know, but you can take a better idea about ovmf...

https://github.com/rizitis/Qemu-slac...slackware64-15
Nice but be careful my friend. Your command:
Code:
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=slint-15.0 --removable
writes the OS loader boot/efi/EFI/BOOT/BOOTX64.EFI as expected but not /boot/efi/EFI/slint-15.0/grubx64.efi as does:
Code:
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=slint-15.0
So if you really want to write an OS loader in both locations you have to issue two commands. In my case:
Code:
grub-install --target=x86_64-efi --efi-directory=/boot/efi --removable
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=slint-15.0
What is a little weird is that in case of your command grub-install does not warn that it discards the option --bootloader-id. I had to type "find /boot/efi to realize that.

Last edited by Didier Spaier; 05-01-2024 at 02:42 PM.
 
1 members found this post helpful.
Old 05-01-2024, 02:47 PM   #14
rizitis
Member
 
Registered: Mar 2009
Location: Greece,Crete
Distribution: Slackware64-current, Slint
Posts: 674
Blog Entries: 1

Rep: Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511
@Didier Spaier thanks
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
OVMF UEFI Screen resolution mhbeyle Linux - Virtualization and Cloud 3 09-18-2022 07:12 AM
UEFI Class 3 :: To use UEFI, or not to use UEFI? jheengut Slackware 19 12-30-2020 09:24 AM
Tianocore/OVMF UEFI max resolution under KVM/Qemu? axialf Linux - Virtualization and Cloud 3 07-13-2018 10:39 AM
OVMF no sound razing32 Linux - Virtualization and Cloud 2 09-25-2016 11:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 11:41 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration