Skip to contentSkip to conversation

tools: Update files examples PV&PVH with pygrub.

PATCH In review Alexandre GRIVEAUX 2 participants 8 messages Jan 13 – Jan 14

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools: Update files examples PV&PVH with pygrub.

Update files exemples PV&PVH for non direct kernel boot with pygrub.

---
 tools/examples/xlexample.pvhlinux | 3 +++
 tools/examples/xlexample.pvlinux  | 3 +++
 2 files changed, 6 insertions(+)
tools/examples/xlexample.pvhlinux +3 -0
index 18305b80af..2bdd43c2c5 100644
@@ -25,6 +25,9 @@ kernel = "/boot/vmlinuz"
 # Kernel command line options
 extra = "root=/dev/xvda1"
 
+# Enable to use a grub2 emulation inside guest instead of direct kernel boot.
+#bootloader="pygrub"
+
 # Initial memory allocation (MB)
 memory = 512
 
tools/examples/xlexample.pvlinux +3 -0
index bb5996b29f..1a6b91fb47 100644
@@ -22,6 +22,9 @@ kernel = "/boot/vmlinuz"
 # Kernel command line options
 extra = "root=/dev/xvda1"
 
+# Enable to use a grub2 emulation inside guest instead of direct kernel boot.
+#bootloader="pygrub"
+
 # Initial memory allocation (MB)
 memory = 128
 
Signature · 1 line
2.47.3
#1 lore raw
Quoted 13 lines · Alexandre GRIVEAUX

Update files exemples PV&PVH for non direct kernel boot with pygrub.

---
  tools/examples/xlexample.pvhlinux | 3 +++
  tools/examples/xlexample.pvlinux  | 3 +++
  2 files changed, 6 insertions(+)
tools/examples/xlexample.pvhlinux +0 -0
index 18305b80af..2bdd43c2c5 100644

tools/examples/xlexample.pvhlinux kernel = "/boot/vmlinuz" · line 28

Quoted 4 lines
tools/examples/xlexample.pvhlinux +1 -0
@@ -25,6 +25,9 @@ kernel = "/boot/vmlinuz"
  # Kernel command line options
  extra = "root=/dev/xvda1"
 
+# Enable to use a grub2 emulation inside guest instead of direct kernel boot.

I don't think this is correct.

pygrub is running in dom0, not in the guest.

Juergen

#2 lore raw

Le 13/01/2026 à 07:15, Juergen Gross a écrit :

Quoted 20 lines · Alexandre GRIVEAUX
Quoted 14 lines

Update files exemples PV&PVH for non direct kernel boot with pygrub.

---
  tools/examples/xlexample.pvhlinux | 3 +++
  tools/examples/xlexample.pvlinux  | 3 +++

  2 files changed, 6 insertions(+)
tools/examples/xlexample.pvhlinux +0 -0
index 18305b80af..2bdd43c2c5 100644
@@ -25,6 +25,9 @@ kernel = "/boot/vmlinuz"
   # Kernel command line options
Quoted 2 lines

  extra = "root=/dev/xvda1"
  +# Enable to use a grub2 emulation inside guest instead of direct kernel boot.

I don't think this is correct.

Quoted 4 lines

pygrub is running in dom0, not in the guest.

Juergen

Hello,

I doesn't understand your reply, yes pygrub is running on the Dom0, and this goal is to behave like there is a grub2 on the DomU.

My wording seem too confuse for you ? You would like this:

Enable to use a "grub2 emulation inside guest" instead of direct kernel boot.

Or

Enable to use a emulation of grub2 inside guest instead of direct kernel boot.

Or

Enable to use a emulation of grub2 for guest instead of direct kernel boot.

For me, using wiktionary:

emulate (computing <https://en.wiktionary.org/wiki/computing#Noun>) of a program or device: to imitate another program or device

And according to man page of xl.cfg:

Quoted 5 lines

*bootloader="PROGRAM"* <https://manpages.debian.org/trixie/xen-utils-common/xl.cfg.5.en.html#bootloader=_PROGRAM_>
Run "PROGRAM" to find the kernel image and ramdisk to use.
Normally "PROGRAM" would be "pygrub", which is an emulation of
grub/grub2/syslinux. Either *kernel* or *bootloader* must be
specified for PV guests.

And when using it like with a lx start -c <name>.cfg, one of the screen will welcome an user with pygrub.

Thanks.

#3 lore raw
Quoted 24 lines · Alexandre GRIVEAUX

Le 13/01/2026 à 07:15, Juergen Gross a écrit :

Quoted 23 lines · Alexandre GRIVEAUX
Quoted 14 lines

Update files exemples PV&PVH for non direct kernel boot with pygrub.

---
  tools/examples/xlexample.pvhlinux | 3 +++
  tools/examples/xlexample.pvlinux  | 3 +++

  2 files changed, 6 insertions(+)
tools/examples/xlexample.pvhlinux +0 -0
index 18305b80af..2bdd43c2c5 100644
@@ -25,6 +25,9 @@ kernel = "/boot/vmlinuz"
   # Kernel command line options
Quoted 2 lines

  extra = "root=/dev/xvda1"
  +# Enable to use a grub2 emulation inside guest instead of direct kernel boot.

I don't think this is correct.

pygrub is running in dom0, not in the guest.

Quoted 6 lines
Quoted 1 line

Juergen

Hello,

I doesn't understand your reply, yes pygrub is running on the Dom0, and this goal is to behave like there is a grub2 on the DomU.

Yes. This is why I don't like the wording "inside guest", which is just not true.

Please be aware that we are trying to phase out pygrub, as it widens the attack surface of dom0 from a guest. pygrub needs to look into guest controlled file systems, so any bug in the related code (e.g. failure to handle a corrupted or maliciously modified file system) might result in security issues like code injection.

So I'm on the edge whether we really should make it easier to use pygrub.

Juergen

#4 lore raw
Quoted 35 lines · Jürgen Groß
Quoted 24 lines · Alexandre GRIVEAUX

Le 13/01/2026 à 07:15, Juergen Gross a écrit :

Quoted 23 lines · Alexandre GRIVEAUX
Quoted 14 lines

Update files exemples PV&PVH for non direct kernel boot with pygrub.

---
  tools/examples/xlexample.pvhlinux | 3 +++
  tools/examples/xlexample.pvlinux  | 3 +++

  2 files changed, 6 insertions(+)
tools/examples/xlexample.pvhlinux +0 -0
index 18305b80af..2bdd43c2c5 100644
@@ -25,6 +25,9 @@ kernel = "/boot/vmlinuz"
   # Kernel command line options
Quoted 2 lines

  extra = "root=/dev/xvda1"
  +# Enable to use a grub2 emulation inside guest instead of direct kernel boot.

I don't think this is correct.

pygrub is running in dom0, not in the guest.

Quoted 6 lines
Quoted 1 line

Juergen

Hello,

I doesn't understand your reply, yes pygrub is running on the Dom0, and this goal is to behave like there is a grub2 on the DomU.

Yes. This is why I don't like the wording "inside guest", which is just not true.

Quoted 7 lines

Please be aware that we are trying to phase out pygrub, as it widens the attack surface of dom0 from a guest. pygrub needs to look into guest controlled file systems, so any bug in the related code (e.g. failure to handle a corrupted or maliciously modified file system) might result in security issues like code injection.

So I'm on the edge whether we really should make it easier to use pygrub.

One further note:

The only real advantage of pygrub is its ability to determine whether to create a 32- or 64-bit PV guest depending on the kernel selected.

As 32-bit PV mode isn't supported by the Linux kernel since several years now, this feature of pygrub is mostly interesting for very few legacy guests which can be used with 32- OR 64-bit PV kernels.

For most use cases it is much better to use the PV or PVH variant of grub2, which will really run inside the guest.

Juergen

#5 lore raw
In reply to Jürgen Groß

Le 14/01/2026 à 08:43, Jürgen Groß a écrit :

Quoted 2 lines

Yes. This is why I don't like the wording "inside guest", which is just not true.

Before wasting more time for that side, there is chroot with bind-mount of DomU FS.

Rephrasing like this should be more than enough:

# Enable to use a grub2 emulation boot instead of direct kernel boot.

Quoted 6 lines

Please be aware that we are trying to phase out pygrub, as it widens the attack surface of dom0 from a guest. pygrub needs to look into guest controlled file systems, so any bug in the related code (e.g. failure to handle a corrupted or maliciously modified file system) might result in security issues like code injection.

Effectively, if pygrub is on verge of being phased out, there is not need for this patch...

But could you point me to the discussion of alternatives ? As pygrub allow a more easy management...

Should this be noted to the wiki ?

Quoted 2 lines

So I'm on the edge whether we really should make it easier to use pygrub.

Legit, Should patch subject need to be [RFC PATCH] ?

Quoted 3 lines

Juergen

Thanks.

#6 lore raw
Quoted 11 lines · Alexandre GRIVEAUX

Le 14/01/2026 à 08:43, Jürgen Groß a écrit :

Quoted 2 lines

Yes. This is why I don't like the wording "inside guest", which is just not true.

Before wasting more time for that side, there is chroot with bind-mount of DomU FS.

Rephrasing like this should be more than enough:

# Enable to use a grub2 emulation boot instead of direct kernel boot.

Quoted 1 line
Quoted 7 lines
Quoted 5 lines

Please be aware that we are trying to phase out pygrub, as it widens the attack surface of dom0 from a guest. pygrub needs to look into guest controlled file systems, so any bug in the related code (e.g. failure to handle a corrupted or maliciously modified file system) might result in security issues like code injection.

Effectively, if pygrub is on verge of being phased out, there is not need for this patch...

:-)

Quoted 1 line

But could you point me to the discussion of alternatives ? As pygrub allow a more easy management...

Oh, the fun of selecting the grub variant. :-)

There are:

- pygrub as discussed already

- grub-pv (32- and 64-bit) and grub-pvh: official flavors of grub2 for PV and PVH guests, selected by specifying them as the kernel to boot, running in domU context

- pvgrub (32- and 64-bit): legacy grub 0.97 variants based on Mini-OS for PV guests, selected by specifying them as the kernel to boot, running in domU context

Quoted 2 lines

Should this be noted to the wiki ?

Yes. Documentation should really be enhanced.

Quoted 2 lines
Quoted 1 line

So I'm on the edge whether we really should make it easier to use pygrub.

Legit, Should patch subject need to be [RFC PATCH] ?

No, I don't think so. Others might have other opinions than me regarding pygrub.

Juergen

#7 lore raw

Le 14/01/2026 à 09:41, Jürgen Groß a écrit :

Quoted 41 lines · Alexandre GRIVEAUX
Quoted 11 lines

Le 14/01/2026 à 08:43, Jürgen Groß a écrit :

Quoted 2 lines

Yes. This is why I don't like the wording "inside guest", which is just not true.

Before wasting more time for that side, there is chroot with bind-mount of DomU FS.

Rephrasing like this should be more than enough:

# Enable to use a grub2 emulation boot instead of direct kernel boot.

Quoted 1 line
Quoted 7 lines
Quoted 5 lines

Please be aware that we are trying to phase out pygrub, as it widens the attack surface of dom0 from a guest. pygrub needs to look into guest controlled file systems, so any bug in the related code (e.g. failure to handle a corrupted or maliciously modified file system) might result in security issues like code injection.

Effectively, if pygrub is on verge of being phased out, there is not need for this patch...

:-)

Quoted 1 line

But could you point me to the discussion of alternatives ? As pygrub allow a more easy management...

Oh, the fun of selecting the grub variant. :-)

There are:

- pygrub as discussed already

- grub-pv (32- and 64-bit) and grub-pvh: official flavors of grub2 for PV and
  PVH guests, selected by specifying them as the kernel to boot, running in domU context

- pvgrub (32- and 64-bit): legacy grub 0.97 variants based on Mini-OS for PV
  guests, selected by specifying them as the kernel to boot, running in domU context

Quoted 1 line
Quoted 3 lines
Quoted 1 line

Should this be noted to the wiki ?

Yes. Documentation should really be enhanced.

No problem to that, I have commit access to the wiki but beside updating, I need to test it, and check if Debian have packaged grub-pv...

For me the pvgrub should also be noted as being phased out in favor of grub-pv.

As for me the documentation should be usable by user without advanced knowledge to read code.

Quoted 7 lines
Quoted 3 lines
Quoted 2 lines

So I'm on the edge whether we really should make it easier to use pygrub.

Legit, Should patch subject need to be [RFC PATCH] ?

No, I don't think so. Others might have other opinions than me regarding pygrub.

Juergen

Ok.

Thanks.