linuxkit icon indicating copy to clipboard operation
linuxkit copied to clipboard

linuxkit-efi.iso usage discussion

Open arm64b opened this issue 8 years ago • 10 comments

Description This is not for a issue tracking, just about the usage case of linuxkit-efi.iso. With bin/moby build -output iso-efi linuxkit.yml we can get the linuxkit-efi.iso file, but when we run it with linuxkit tool like this: #bin/linuxkit run linuxkit-efi.iso The command will pending on that and no any output, I am wondering if something I am missing or I am take wrong way to use the iso file, if that's true, what's expect usage scenario for this ISO file?

Steps to reproduce the issue:

Describe the results you received:

Describe the results you expected:

Additional information you deem important (e.g. issue happens only occasionally):

arm64b avatar Aug 09 '17 10:08 arm64b

crap, hit wrong button, re-open

rn avatar Aug 09 '17 10:08 rn

You should be able to boot an EFI ISO on some platforms - it works on Hyperkit and Hyper-V and should run on physical hardware. It should also run on qemu if you provide EFI firmware. You don't say what platform you are running on though, so it is hard to know what your issue is...

justincormack avatar Aug 09 '17 10:08 justincormack

I am using the a x86_64 workstation for this. Ah, seems we need to feed an external uefi to it, but bin/linuxkit run -uefi linuxkit-efi.iso shows: FATA[0000] File [/usr/share/ovmf/bios.bin] does not exist, please ensure OVMF is installed

arm64b avatar Aug 09 '17 10:08 arm64b

Is this on Linux then with qemu/kvm? You need to have the ovmf firmware installed which depends on your distro. on alpine it's apk add ovmf. Ubuntu also seem to have ovmf package. It may put the UEFI firmware file somewhere else and you can specify the path with -fw

rn avatar Aug 09 '17 10:08 rn

Sure on ubuntu 16.04 linux with qemu/kvm. OK, after install the ovmf pacakge, bin/linuxkit run qemu -uefi -fw "/usr/share/ovmf/OVMF.fd" linuxkit-efi.iso can boot to shell.

arm64b avatar Aug 09 '17 10:08 arm64b

I will try to burn the ISO file into an optical DVD and boot from my bare mental x86_64 machine. Since in server area, they have BMC installed, with the tiny web server running from BMC, we can push the iso file to the machine remotely (no physical dvd needed), so this will be a very useful usage if the experiment can succeed.

arm64b avatar Aug 09 '17 10:08 arm64b

@arm64b yes it should work with BMC, we have people using that

justincormack avatar Aug 09 '17 10:08 justincormack

I know this is an old issue, but I'm still encountering this problem despite having OVMF.fd (in ubuntu 16.04). Can anyone venture a guess as to what is happening?

$ linuxkit run qemu -uefi -fw "/usr/share/ovmf/OVMF.fd" linuxkit-efi.iso
qemu-system-x86_64: -drive if=pflash,format=raw,file=/usr/share/ovmf/OVMF.fd: Could not open '/usr/share/ovmf/OVMF.fd': Permission denied
FATA[0000] exit status 1    

The permissions look OK:

$ ls -la /usr/share/ovmf/OVMF.fd
-rw-r--r-- 1 root root 2097152 Jan  6 15:26 /usr/share/ovmf/OVMF.fd

lestephane avatar Jan 23 '21 17:01 lestephane

I would start with getting the qemu commandline constructed by linuxkit. Add -v to the commandline.

I'd then just run the qemu invocation through strace and see why it fails

rn avatar Jan 23 '21 19:01 rn

The strace output shows that the -fw disk file is being opened in read-write mode, which seems weird. This is formatted for convenience:

$ strace -bexecve -s1024 -f linuxkit run -fw "/usr/share/ovmf/OVMF.fd" -iso -uefi linuxkit-efi.iso
[pid  9619] execve("/usr/bin/qemu-system-x86_64", 
[
  "/usr/bin/qemu-system-x86_64",
  "-smp",
  "1",
  "-m",
  "1024",
  "-uuid",
  "8d9790cb-862c-47fe-a692-70dd804a0773",
  "-pidfile",
  "linuxkit-efi-state/qemu.pid",
  "-machine",
  "q35,accel=kvm:tcg",
  "-object",
  "rng-random,id=rng0,filename=/dev/urandom",
  "-device",
  "virtio-rng-pci,rng=rng0",
  "-boot",
  "d",
  "-cdrom",
  "linuxkit-efi.iso",
  "-drive",
  "if=pflash,format=raw,file=/usr/share/ovmf/OVMF.fd",     <<<< should there not be readonly=on?
  "-device",
  "virtio-net-pci,netdev=t0,mac=8e:02:dd:81:7d:a0",
  "-netdev",
  "user,id=t0",
  "-nographic"
]

lestephane avatar Jan 26 '21 07:01 lestephane