Skip to contentSkip to conversation

Lacking documentation and kexec failure with Xen 4.19-rc4 and 4.20-dev on linux host

KEXEC A Kundu 4 participants 10 messages Jul 30, 2024 – Aug 5, 2024 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A Kundu

author
#1 lore raw

I am experiencing issues using kexec to load Xen 4.19-rc4 and 4.20-dev on a debian host.

The current documentation at
https://xenbits.xenproject.org/docs/4.19-testing/misc/kexec_and_kdump.txt
appears to be missing crucial details on properly using kexec with the --vmm option for loading Xen.

kexec complains the --vmm option is not present.

System information:

$ uname -a
Linux host 6.9.10-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.9.10-1 (2024-07-19) x86_64 GNU/Linux
$ kexec --version # compiled from source tarball with ./configure --with-xen
kexec-tools 2.0.29

Steps to reproduce:

1. Set variables:

XEN_HYPERVISOR="/boot/xen.gz"
XEN_CMD="dom0_mem=6G dom0_max_vcpus=6 dom0_vcpus_pin cpufreq=xen"

2. Attempt to load Xen 4.19-rc4:

# kexec -l "$XEN_HYPERVISOR" --command-line="$XEN_CMD"
Could not find a free area of memory of 0x3b6001 bytes...
elf_exec_build_load_relocatable: ELF exec load failed

3. Attempt to load Xen 4.20-dev:

# kexec -l "$XEN_HYPERVISOR" --command-line="$XEN_CMD"
Could not find a free area of memory of 0x3f8001 bytes...
elf_exec_build_load_relocatable: ELF exec load failed

4. Follow the steps in the Xen manual at misc/kexec_and_kdump.txt:

# Set variables

XEN_IMAGE="/boot/xen-4.19-rc.gz"
DOM0_IMAGE="/boot/vmlinuz-6.9.10-amd64"
DOM0_INITRD="/boot/initrd.img-6.9.10-amd64"
DOM0_MEMORY="6G"
DOM0_CPUS="0-5"

# Prepare Xen and dom0 command line arguments

XEN_ARGS="no-real-mode dom0_mem=${DOM0_MEMORY}" DOM0_ARGS="max_cpus=6 dom0_max_vcpus=6 dom0_vcpus_pin"

# Load Xen and dom0 kernel

kexec -l --append="${XEN_ARGS} -- ${DOM0_ARGS}" --initrd=${DOM0_INITRD} \
  --vmm=${XEN_IMAGE} ${DOM0_IMAGE}

Result:
kexec: unrecognized option '--vmm=/boot/xen-4.19-rc.gz'

I have tried compiling kexec-tools 2.0.29 from source using ./configure --with-xen, as well as using debian's apt version, but both result in the same "unrecognized option '--vmm'" error.

Please provide guidance on the correct steps to get kexec working for loading Xen 4.19-rc4 and 4.20-dev. Additionally, I kindly request that the documentation be updated with these details to assist other users who may encounter this issue.

If you need any further information to investigate this problem, please let me know.

Thank you for your attention to this matter.

A Kundu

author
#2 lore raw

kexec failure with Xen 4.19-rc4 and 4.20-dev on linux host

I am experiencing issues using kexec to load Xen 4.17(debian's apt version), Xen 4.19-rc4 (compiled from source) and 4.20-dev (compiled from source) on a debian host.

System information:

$ uname -a
Linux host 6.9.10-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.9.10-1 (2024-07-19) x86_64 GNU/Linux
$ kexec --version # compiled from source tarball with ./configure --with-xen
kexec-tools 2.0.29

Steps to reproduce:

1. Set variables:

XEN_HYPERVISOR="/boot/xen.gz"
XEN_CMD="dom0_mem=6G dom0_max_vcpus=6 dom0_vcpus_pin cpufreq=xen"

2. Attempt to load Xen 4.19-rc4:

# kexec -l "$XEN_HYPERVISOR" --command-line="$XEN_CMD"
Could not find a free area of memory of 0x3b6001 bytes...
elf_exec_build_load_relocatable: ELF exec load failed

3. Attempt to load Xen 4.20-dev:

# kexec -l "$XEN_HYPERVISOR" --command-line="$XEN_CMD"
Could not find a free area of memory of 0x3f8001 bytes...
elf_exec_build_load_relocatable: ELF exec load failed

4. Attempt to load Xen 4.17 (from debian rrepositories):

# kexec -l /boot/xen-4.17-amd64.gz --command-line="$XEN_CMD"
Could not find a free area of memory of 0x3b4001 bytes...
elf_exec_build_load_relocatable: ELF exec load failed

If you need any further information to investigate this problem, please let me know.

PS: If I used apt's pacakged version (which might be compiled --without-xen), it shows,

# kexec -l "$XEN_HYPERVISOR" --command-line="$XEN_CMD"
Cannot determine the file type of /boot/xen-4.17-amd64.gz
# kexec -l "$XEN_HYPERVISOR" --command-line="$XEN_CMD" --type=bzImage
Cannot determine the file type of /boot/xen-4.17-amd64.gz

Thank you for your attention to this matter.

A Kundu

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#3 lore raw

Re: kexec failure with Xen 4.19-rc4 and 4.20-dev on linux host

Quoted 3 lines · A Kundu

I am experiencing issues using kexec to load Xen 4.17(debian's apt version), Xen 4.19-rc4 (compiled from source) and 4.20-dev (compiled from source) on a debian host.

You should CC this to XEN dev list so that XEN dev knows this and may provide help. Not everyone is interested in and knows XEN.

Quoted 47 lines

System information:

$ uname -a
Linux host 6.9.10-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.9.10-1 (2024-07-19)
x86_64 GNU/Linux
$ kexec --version # compiled from source tarball with ./configure --with-xen
kexec-tools 2.0.29

Steps to reproduce:

1. Set variables:

XEN_HYPERVISOR="/boot/xen.gz"
XEN_CMD="dom0_mem=6G dom0_max_vcpus=6 dom0_vcpus_pin cpufreq=xen"

2. Attempt to load Xen 4.19-rc4:

# kexec -l "$XEN_HYPERVISOR" --command-line="$XEN_CMD"
Could not find a free area of memory of 0x3b6001 bytes...
elf_exec_build_load_relocatable: ELF exec load failed

3. Attempt to load Xen 4.20-dev:

# kexec -l "$XEN_HYPERVISOR" --command-line="$XEN_CMD"
Could not find a free area of memory of 0x3f8001 bytes...
elf_exec_build_load_relocatable: ELF exec load failed

4. Attempt to load Xen 4.17 (from debian rrepositories):

# kexec -l /boot/xen-4.17-amd64.gz --command-line="$XEN_CMD"
Could not find a free area of memory of 0x3b4001 bytes...
elf_exec_build_load_relocatable: ELF exec load failed

If you need any further information to investigate this problem, please let me know.

PS: If I used apt's pacakged version (which might be compiled --without-xen),
it shows,

# kexec -l "$XEN_HYPERVISOR" --command-line="$XEN_CMD"
Cannot determine the file type of /boot/xen-4.17-amd64.gz
# kexec -l "$XEN_HYPERVISOR" --command-line="$XEN_CMD" --type=bzImage
Cannot determine the file type of /boot/xen-4.17-amd64.gz
Quoted 9 lines

Thank you for your attention to this matter.

A Kundu

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

author
#4 lore raw

Re: kexec failure with Xen 4.19-rc4 and 4.20-dev on linux host

Done.

Quoted 62 lines · Baoquan He
Quoted 3 lines · A Kundu

I am experiencing issues using kexec to load Xen 4.17(debian's apt version), Xen 4.19-rc4 (compiled from source) and 4.20-dev (compiled from source) on a debian host.

You should CC this to XEN dev list so that XEN dev knows this and may provide help. Not everyone is interested in and knows XEN.

Quoted 55 lines

System information:

$ uname -a
Linux host 6.9.10-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.9.10-1 (2024-07-19)
x86_64 GNU/Linux
$ kexec --version # compiled from source tarball with ./configure --with-xen
kexec-tools 2.0.29

Steps to reproduce:

1. Set variables:

XEN_HYPERVISOR="/boot/xen.gz"
XEN_CMD="dom0_mem=6G dom0_max_vcpus=6 dom0_vcpus_pin cpufreq=xen"

2. Attempt to load Xen 4.19-rc4:

# kexec -l "$XEN_HYPERVISOR" --command-line="$XEN_CMD"
Could not find a free area of memory of 0x3b6001 bytes...
elf_exec_build_load_relocatable: ELF exec load failed

3. Attempt to load Xen 4.20-dev:

# kexec -l "$XEN_HYPERVISOR" --command-line="$XEN_CMD"
Could not find a free area of memory of 0x3f8001 bytes...
elf_exec_build_load_relocatable: ELF exec load failed

4. Attempt to load Xen 4.17 (from debian rrepositories):

# kexec -l /boot/xen-4.17-amd64.gz --command-line="$XEN_CMD"
Could not find a free area of memory of 0x3b4001 bytes...
elf_exec_build_load_relocatable: ELF exec load failed

If you need any further information to investigate this problem, please let me know.

PS: If I used apt's pacakged version (which might be compiled --without-xen),
it shows,

# kexec -l "$XEN_HYPERVISOR" --command-line="$XEN_CMD"
Cannot determine the file type of /boot/xen-4.17-amd64.gz
# kexec -l "$XEN_HYPERVISOR" --command-line="$XEN_CMD" --type=bzImage
Cannot determine the file type of /boot/xen-4.17-amd64.gz

Thank you for your attention to this matter.

A Kundu

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#5 lore raw

Re: kexec failure with Xen 4.19-rc4 and 4.20-dev on linux host

Quoted 31 lines · A Kundu
Quoted 30 lines · Baoquan He
Quoted 3 lines · A Kundu

I am experiencing issues using kexec to load Xen 4.17(debian's apt version), Xen 4.19-rc4 (compiled from source) and 4.20-dev (compiled from source) on a debian host.

You should CC this to XEN dev list so that XEN dev knows this and may provide help. Not everyone is interested in and knows XEN.

Quoted 23 lines

System information:

$ uname -a
Linux host 6.9.10-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.9.10-1 (2024-07-19)
x86_64 GNU/Linux
$ kexec --version # compiled from source tarball with ./configure --with-xen
kexec-tools 2.0.29

Steps to reproduce:

1. Set variables:

XEN_HYPERVISOR="/boot/xen.gz"
XEN_CMD="dom0_mem=6G dom0_max_vcpus=6 dom0_vcpus_pin cpufreq=xen"

2. Attempt to load Xen 4.19-rc4:

# kexec -l "$XEN_HYPERVISOR" --command-line="$XEN_CMD"
Could not find a free area of memory of 0x3b6001 bytes...
elf_exec_build_load_relocatable: ELF exec load failed

3. Attempt to load Xen 4.20-dev:

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
# kexec -l "$XEN_HYPERVISOR" --command-line="$XEN_CMD"
Could not find a free area of memory of 0x3f8001 bytes...
elf_exec_build_load_relocatable: ELF exec load failed

4. Attempt to load Xen 4.17 (from debian rrepositories):

# kexec -l /boot/xen-4.17-amd64.gz --command-line="$XEN_CMD"
Could not find a free area of memory of 0x3b4001 bytes...
elf_exec_build_load_relocatable: ELF exec load failed

And with all of them saying effectively the same, did you verify you actually have a sufficiently large area reserved? The obvious place for you to look at is Xen's boot log (obtained via serial console or "xl dmesg" immediately after booting the system). If you find everything as expected there, ...

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

If you need any further information to investigate this problem, please let me know.

... please provide that boot log.

Jan

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

author
#6 lore raw

Re: kexec failure with Xen 4.19-rc4 and 4.20-dev on linux host

Quoted 47 lines · Jan Beulich
Quoted 31 lines · A Kundu
Quoted 30 lines · Baoquan He
Quoted 3 lines · A Kundu

I am experiencing issues using kexec to load Xen 4.17(debian's apt version), Xen 4.19-rc4 (compiled from source) and 4.20-dev (compiled from source) on a debian host.

You should CC this to XEN dev list so that XEN dev knows this and may provide help. Not everyone is interested in and knows XEN.

Quoted 23 lines

System information:

$ uname -a
Linux host 6.9.10-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.9.10-1 (2024-07-19)
x86_64 GNU/Linux
$ kexec --version # compiled from source tarball with ./configure --with-xen
kexec-tools 2.0.29

Steps to reproduce:

1. Set variables:

XEN_HYPERVISOR="/boot/xen.gz"
XEN_CMD="dom0_mem=6G dom0_max_vcpus=6 dom0_vcpus_pin cpufreq=xen"

2. Attempt to load Xen 4.19-rc4:

# kexec -l "$XEN_HYPERVISOR" --command-line="$XEN_CMD"
Could not find a free area of memory of 0x3b6001 bytes...
elf_exec_build_load_relocatable: ELF exec load failed

3. Attempt to load Xen 4.20-dev:

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
# kexec -l "$XEN_HYPERVISOR" --command-line="$XEN_CMD"
Could not find a free area of memory of 0x3f8001 bytes...
elf_exec_build_load_relocatable: ELF exec load failed

4. Attempt to load Xen 4.17 (from debian rrepositories):

# kexec -l /boot/xen-4.17-amd64.gz --command-line="$XEN_CMD"
Could not find a free area of memory of 0x3b4001 bytes...
elf_exec_build_load_relocatable: ELF exec load failed

And with all of them saying effectively the same, did you verify you actually have a sufficiently large area reserved? The obvious place for you to look at is Xen's boot log (obtained via serial console or "xl dmesg" immediately after booting the system). If you find everything as expected there, ...

Quoted 4 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

If you need any further information to investigate this problem, please let me know.

... please provide that boot log.

Dear Jan,

Thank you for your response and suggestions.

As mentioned in my original message, I have already attempted to load Xen using kexec with various versions (4.17, 4.19-rc4, and 4.20-dev), all of which resulted in the same error:

Could not find a free area of memory of 0x3b6001 bytes... elf_exec_build_load_relocatable: ELF exec load failed

I have also followed up on your suggestion to check the Xen boot log using "xl dmesg", but unfortunately, I received the following error:

xencall: error: Could not obtain handle on privileged command interface: No such file or directory
libxl: error: libxl.c:102:libxl_ctx_alloc: cannot open libxc handle: No such file or directory cannot init xl context

This indicates that Xen did not boot successfully, so there are no logs available.

Quoted 7 lines

And with all of them saying effectively the same, did you verify you actually have a sufficiently large area reserved? The obvious place for you to look at is Xen's boot log (obtained via serial console or "xl dmesg" immediately after booting the system). If you find everything as expected there, ...

In an attempt to resolve the memory allocation issue, I have tried the following:

Added a crashkernel=<size>@<offset> parameter to the host kernel command line to reserve a dedicated memory region for kexec, and attempted to load Xen into that area.

Experimented with the mem=<size> parameter to limit the amount of memory used by the host kernel, hoping to leave more contiguous space available for loading Xen.

Unfortunately, neither of these approaches resolved the issue, and I still encounter the same memory allocation error when attempting to load Xen with kexec.

I have also reviewed the available documentation for kexec and Xen, but much of it appears to be outdated, referencing archaic options like --vmm which no longer exist in the current version of kexec-tools.

Quoted 1 line

Jan

At this point, I'm unsure of how to proceed. I suspect the issue may be related to changes in the kexec codebase and its interaction with Xen, as kexec docs for Xen has not been actively maintained since 2017.

git log -1 --format="%ad" -- docs/misc/kexec_and_kdump.txt Fri Jun 9 14:11:37 2017 +0200

If it's not too much to ask, could you please check if you can successfully launch the Xen kernel using kexec with kexec-tools version > 2.x.x and a Linux kernel version >= 6.6?

I have never been able to boot the Xen kernel with anything (syslinux, zfsbootmenu)other than GRUB and mboot.c32, as used by Citrix or XCP-ng.

In fact, I have never come across a Xen distribution that doesn't rely on GRUB for xen, which makes me question whether kexec'ing the Xen kernel is even possible at this point.

For reference, I'm providing a log of my attempts to boot Xen using ZFSBootMenu (a barebones linux kernel trying to boot via kexec; other details irrelevant):

tee: /zfsbootmenu/environments/zroot/ROOT/debian/mnt/var/zbm.log: Read-only file system === Attempting to Launch Xen ===
Selected Kernel     : /boot/vmlinuz-6.9.12-amd64
Selected initramfs  : /boot/initrd.img-6.9.12-amd64
Selected BE         : zroot/ROOT/debian
Selected Mountpoint : /zfsbootmenu/environments/zroot/ROOT/debian/mnt ZFSBootMenu kernel commandline: quiet loglevel=0

zfs get org.zfsbootmenu:commandline zroot/ROOT/debian
NAME               PROPERTY VALUE                                        SOURCE zroot/ROOT/debian  org.zfsbootmenu:commandline  quiet crashkernel=0M memmap=64M$0x100000000  local (^^^ This is the linux/dom0 commandline, executed by kexec)

=== Memory reported by head /proc/meminfo ===
MemTotal:        8044084 kB
MemFree:         7822332 kB
MemAvailable:    7687320 kB
Buffers:              0 kB
Cached:           49136 kB
SwapCached:           0 kB
Active:           45868 kB
Inactive:             0 kB
Active(anon):     45868 kB
Inactive(anon):       0 kB
=== End of Memory Report ===

Xen kernel found. Attempting kexec...
Xen Kernel Path     : /zfsbootmenu/environments/zroot/ROOT/debian/mnt/boot/xen.gz Try gzip decompression.
Could not find a free area of memory of 0x3ba001 bytes... elf_exec_build_load_relocatable: ELF exec load failed
Executing kexec...
Nothing has been loaded!

After booting into linux what happens, I have already shared.

If you have any further insights or suggestions on how to overcome this memory allocation issue or successfully boot Xen using kexec on a modern system, I would greatly appreciate your guidance.

Thank you for your time and assistance.

Best regards,
A Kundu

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#7 lore raw

Re: kexec failure with Xen 4.19-rc4 and 4.20-dev on linux host

Quoted 60 lines · A Kundu
Quoted 4 lines · Jan Beulich
Quoted 3 lines · A Kundu
Quoted 2 lines · Baoquan He
Quoted 1 line · A Kundu

I am experiencing issues using kexec to load Xen 4.17(debian's apt

version),

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

Xen 4.19-rc4 (compiled from source) and 4.20-dev (compiled from

source) on a

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 1 line

debian host.

You should CC this to XEN dev list so that XEN dev knows this and may provide help. Not everyone is interested in and knows XEN.

Quoted 3 lines

System information:

$ uname -a
Linux host 6.9.10-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.9.10-1 

(2024-07-19)

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

x86_64 GNU/Linux

$ kexec --version # compiled from source tarball with ./configure 

--with-xen

Quoted 32 lines
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines

kexec-tools 2.0.29

Steps to reproduce:

1. Set variables:

XEN_HYPERVISOR="/boot/xen.gz"
XEN_CMD="dom0_mem=6G dom0_max_vcpus=6 dom0_vcpus_pin cpufreq=xen"

2. Attempt to load Xen 4.19-rc4:

# kexec -l "$XEN_HYPERVISOR" --command-line="$XEN_CMD"
Could not find a free area of memory of 0x3b6001 bytes...
elf_exec_build_load_relocatable: ELF exec load failed

3. Attempt to load Xen 4.20-dev:

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
# kexec -l "$XEN_HYPERVISOR" --command-line="$XEN_CMD"
Could not find a free area of memory of 0x3f8001 bytes...
elf_exec_build_load_relocatable: ELF exec load failed

4. Attempt to load Xen 4.17 (from debian rrepositories):

# kexec -l /boot/xen-4.17-amd64.gz --command-line="$XEN_CMD"
Could not find a free area of memory of 0x3b4001 bytes...
elf_exec_build_load_relocatable: ELF exec load failed

And with all of them saying effectively the same, did you verify you actually have a sufficiently large area reserved? The obvious place for you to look at is Xen's boot log (obtained via serial console or "xl dmesg" immediately after booting the system). If you find everything as expected there, ...

Quoted 4 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

If you need any further information to investigate this problem, please let me know.

... please provide that boot log.

I have also followed up on your suggestion to check the Xen boot log using "xl dmesg", but unfortunately, I received the following error:

Quoted 8 lines

xencall: error: Could not obtain handle on privileged command interface:
No such file or directory
libxl: error: libxl.c:102:libxl_ctx_alloc: cannot open libxc handle: No such file or directory
cannot init xl context

This indicates that Xen did not boot successfully, so there are no logs available.

The fact that you have Dom0 up makes clear that Xen booted okay(ish). The fact that you get "No such file or directory" from xencall suggests you either didn't load the xen-privcmd driver (normally arrangements are made by distros for this to happen automatically), or you didn't even build it.

Quoted 7 lines
Quoted 6 lines

And with all of them saying effectively the same, did you verify you actually have a sufficiently large area reserved? The obvious place for you to look at is Xen's boot log (obtained via serial console or "xl dmesg" immediately after booting the system). If you find everything as expected there, ...

Quoted 6 lines

In an attempt to resolve the memory allocation issue, I have tried the following:

Added a crashkernel=<size>@<offset> parameter to the host kernel command line to reserve a dedicated memory region for kexec, and attempted to load Xen into that area.

That was a remote guess of mine. This command line option is meaningless when running under Xen. The reservation needs to be done in Xen.

Overall for the moment I'm inclined to say that xen-devel@ isn't the right forum here. xen-users@ might be quite a bit more appropriate until you actually run into issues with Xen itself, not with its (correct) use.

Jan

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#8 lore raw

Re: kexec failure with Xen 4.19-rc4 and 4.20-dev on linux host

Quoted 67 lines · Jan Beulich
Quoted 66 lines · A Kundu
Quoted 4 lines · Jan Beulich
Quoted 3 lines · A Kundu
Quoted 2 lines · Baoquan He
Quoted 1 line · A Kundu

I am experiencing issues using kexec to load Xen 4.17(debian's apt

version),

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

Xen 4.19-rc4 (compiled from source) and 4.20-dev (compiled from

source) on a

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 1 line

debian host.

You should CC this to XEN dev list so that XEN dev knows this and may provide help. Not everyone is interested in and knows XEN.

Quoted 3 lines

System information:

$ uname -a
Linux host 6.9.10-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.9.10-1

(2024-07-19)

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

x86_64 GNU/Linux

$ kexec --version # compiled from source tarball with ./configure

--with-xen

Quoted 32 lines
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines

kexec-tools 2.0.29

Steps to reproduce:

1. Set variables:

XEN_HYPERVISOR="/boot/xen.gz"
XEN_CMD="dom0_mem=6G dom0_max_vcpus=6 dom0_vcpus_pin cpufreq=xen"

2. Attempt to load Xen 4.19-rc4:

# kexec -l "$XEN_HYPERVISOR" --command-line="$XEN_CMD"
Could not find a free area of memory of 0x3b6001 bytes...
elf_exec_build_load_relocatable: ELF exec load failed

3. Attempt to load Xen 4.20-dev:

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
# kexec -l "$XEN_HYPERVISOR" --command-line="$XEN_CMD"
Could not find a free area of memory of 0x3f8001 bytes...
elf_exec_build_load_relocatable: ELF exec load failed

4. Attempt to load Xen 4.17 (from debian rrepositories):

# kexec -l /boot/xen-4.17-amd64.gz --command-line="$XEN_CMD"
Could not find a free area of memory of 0x3b4001 bytes...
elf_exec_build_load_relocatable: ELF exec load failed

And with all of them saying effectively the same, did you verify you actually have a sufficiently large area reserved? The obvious place for you to look at is Xen's boot log (obtained via serial console or "xl dmesg" immediately after booting the system). If you find everything as expected there, ...

Quoted 4 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

If you need any further information to investigate this problem, please let me know.

... please provide that boot log.

I have also followed up on your suggestion to check the Xen boot log using "xl dmesg", but unfortunately, I received the following error:

xencall: error: Could not obtain handle on privileged command interface:
No such file or directory
libxl: error: libxl.c:102:libxl_ctx_alloc: cannot open libxc handle: No such file or directory
cannot init xl context

Quoted 7 lines
Quoted 2 lines

This indicates that Xen did not boot successfully, so there are no logs available.

The fact that you have Dom0 up makes clear that Xen booted okay(ish). The fact that you get "No such file or directory" from xencall suggests you either didn't load the xen-privcmd driver (normally arrangements are made by distros for this to happen automatically), or you didn't even build it.

The messages seen don't indicate that Xen booted okay(ish). I get the same messages when having booted the Linux kernel on bare metal without Xen.

Quoted 11 lines
Quoted 11 lines
Quoted 7 lines

And with all of them saying effectively the same, did you verify you actually have a sufficiently large area reserved? The obvious place for you to look at is Xen's boot log (obtained via serial console or "xl dmesg" immediately after booting the system). If you find everything as expected there, ...

In an attempt to resolve the memory allocation issue, I have tried the following:

Quoted 6 lines
Quoted 3 lines

Added a crashkernel=<size>@<offset> parameter to the host kernel command line to reserve a dedicated memory region for kexec, and attempted to load Xen into that area.

That was a remote guess of mine. This command line option is meaningless when running under Xen. The reservation needs to be done in Xen.

Just one thing to add here: what do you want to accomplish by kexec-ing into Xen? You need to specify a dom0 kernel and probably the dom0's initrd, too.

Or do you have configured your dom0 to work without an initrd? Even in this case you'd need to pass on the dom0 to Xen via the kexec command.

Juergen

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#9 lore raw

Re: kexec failure with Xen 4.19-rc4 and 4.20-dev on linux host

Quoted 71 lines · Juergen Gross
Quoted 70 lines · Jan Beulich
Quoted 68 lines · A Kundu
Quoted 4 lines · Jan Beulich
Quoted 3 lines · A Kundu
Quoted 2 lines · Baoquan He
Quoted 1 line · A Kundu

I am experiencing issues using kexec to load Xen 4.17(debian's apt

version),

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

Xen 4.19-rc4 (compiled from source) and 4.20-dev (compiled from

source) on a

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 1 line

debian host.

You should CC this to XEN dev list so that XEN dev knows this and may provide help. Not everyone is interested in and knows XEN.

Quoted 3 lines

System information:

$ uname -a
Linux host 6.9.10-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.9.10-1

(2024-07-19)

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

x86_64 GNU/Linux

$ kexec --version # compiled from source tarball with ./configure

--with-xen

Quoted 32 lines
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines

kexec-tools 2.0.29

Steps to reproduce:

1. Set variables:

XEN_HYPERVISOR="/boot/xen.gz"
XEN_CMD="dom0_mem=6G dom0_max_vcpus=6 dom0_vcpus_pin cpufreq=xen"

2. Attempt to load Xen 4.19-rc4:

# kexec -l "$XEN_HYPERVISOR" --command-line="$XEN_CMD"
Could not find a free area of memory of 0x3b6001 bytes...
elf_exec_build_load_relocatable: ELF exec load failed

3. Attempt to load Xen 4.20-dev:

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
# kexec -l "$XEN_HYPERVISOR" --command-line="$XEN_CMD"
Could not find a free area of memory of 0x3f8001 bytes...
elf_exec_build_load_relocatable: ELF exec load failed

4. Attempt to load Xen 4.17 (from debian rrepositories):

# kexec -l /boot/xen-4.17-amd64.gz --command-line="$XEN_CMD"
Could not find a free area of memory of 0x3b4001 bytes...
elf_exec_build_load_relocatable: ELF exec load failed

And with all of them saying effectively the same, did you verify you actually have a sufficiently large area reserved? The obvious place for you to look at is Xen's boot log (obtained via serial console or "xl dmesg" immediately after booting the system). If you find everything as expected there, ...

Quoted 4 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

If you need any further information to investigate this problem, please let me know.

... please provide that boot log.

I have also followed up on your suggestion to check the Xen boot log using "xl dmesg", but unfortunately, I received the following error:

xencall: error: Could not obtain handle on privileged command interface:
No such file or directory
libxl: error: libxl.c:102:libxl_ctx_alloc: cannot open libxc handle: No such file or directory
cannot init xl context

This indicates that Xen did not boot successfully, so there are no logs available.

Quoted 7 lines
Quoted 4 lines

The fact that you have Dom0 up makes clear that Xen booted okay(ish). The fact that you get "No such file or directory" from xencall suggests you either didn't load the xen-privcmd driver (normally arrangements are made by distros for this to happen automatically), or you didn't even build it.

The messages seen don't indicate that Xen booted okay(ish). I get the same messages when having booted the Linux kernel on bare metal without Xen.

Hmm, I didn't even think of this as a possible case, considering the question was forwarded to xen-devel (from a kexec list). I'm afraid Xen simply plays no role when setting up kexec (to whatever target) from a bare metal env.

Jan

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#10 lore raw
In reply to A Kundu
Quoted 59 lines · A Kundu

I am experiencing issues using kexec to load Xen 4.19-rc4 and 4.20-dev on a debian host.

The current documentation at
https://xenbits.xenproject.org/docs/4.19-testing/misc/kexec_and_kdump.txt
appears to be missing crucial details on properly using kexec with the --vmm option for loading Xen.

kexec complains the --vmm option is not present.

System information:

$ uname -a
Linux host 6.9.10-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.9.10-1 (2024-07-19) x86_64 GNU/Linux
$ kexec --version # compiled from source tarball with ./configure --with-xen
kexec-tools 2.0.29

Steps to reproduce:

1. Set variables:

XEN_HYPERVISOR="/boot/xen.gz"
XEN_CMD="dom0_mem=6G dom0_max_vcpus=6 dom0_vcpus_pin cpufreq=xen"

2. Attempt to load Xen 4.19-rc4:

# kexec -l "$XEN_HYPERVISOR" --command-line="$XEN_CMD"
Could not find a free area of memory of 0x3b6001 bytes...
elf_exec_build_load_relocatable: ELF exec load failed

3. Attempt to load Xen 4.20-dev:

# kexec -l "$XEN_HYPERVISOR" --command-line="$XEN_CMD"
Could not find a free area of memory of 0x3f8001 bytes...
elf_exec_build_load_relocatable: ELF exec load failed

4. Follow the steps in the Xen manual at misc/kexec_and_kdump.txt:

# Set variables

XEN_IMAGE="/boot/xen-4.19-rc.gz"
DOM0_IMAGE="/boot/vmlinuz-6.9.10-amd64"
DOM0_INITRD="/boot/initrd.img-6.9.10-amd64"
DOM0_MEMORY="6G"
DOM0_CPUS="0-5"

# Prepare Xen and dom0 command line arguments

XEN_ARGS="no-real-mode dom0_mem=${DOM0_MEMORY}" DOM0_ARGS="max_cpus=6 dom0_max_vcpus=6 dom0_vcpus_pin"

# Load Xen and dom0 kernel

kexec -l --append="${XEN_ARGS} -- ${DOM0_ARGS}" --initrd=${DOM0_INITRD} \
  --vmm=${XEN_IMAGE} ${DOM0_IMAGE}

Result:
kexec: unrecognized option '--vmm=/boot/xen-4.19-rc.gz'

Quoted 8 lines

I have tried compiling kexec-tools 2.0.29 from source using ./configure --with-xen, as well as using debian's apt version, but both result in the same "unrecognized option '--vmm'" error.

Please provide guidance on the correct steps to get kexec working for loading Xen 4.19-rc4 and 4.20-dev. Additionally, I kindly request that the documentation be updated with these details to assist other users who may encounter this issue.

The mentioned documentation hasn't seen any updates since 2008 in the part you are interested in. I believe the most sane action would be to remove the "Kexec" chapter completely.

With Xen I'm not aware of any use case nowadays other than that explained in the "Kdump" chapter.

Juergen