如何在加载 Xen 虚拟机管理程序时加载附加模块?

如何在加载 Xen 虚拟机管理程序时加载附加模块?

我目前正在运行安装了 Xen 4.12 的 Debian 10。
我按照以下步骤在另一台机器上从源代码编译了 Xen:

  1. ./configure --target=x86_64 --with-platform=efi --enable-systemd
  2. 创造世界
  3. 制作分布
  4. 制造德巴尔

之后,我在 Debian 10 主机上安装了 Xen 包。
此外,我还编译了一个 Vanilla 内核 (5.3.8) 并安装在 Debian 10 主机上。

现在一切都正常,但是在加载 Xen 虚拟机管理程序后,无法加载 coretemp 等附加模块:

root@xen1:/# modprobe coretemp
modprobe: ERROR: could not insert 'coretemp': No such device
root@xen1:/# uname -a
Linux xen1 5.3.8 #1 SMP Wed Nov 6 13:42:42 CET 2019 x86_64 GNU/Linux
root@xen1:/# ll /usr/lib/modules/5.3.8/kernel/drivers/hwmon/coretemp.ko 
-rw-r--r-- 1 root root 24872 Nov  6 13:41 /usr/lib/modules/5.3.8/kernel/drivers/hwmon/coretemp.ko

当启动没有 Xen 虚拟机管理程序的主机时,我能够毫无问题地加载 coretemp 模块。

配置有问题吗(可能是 grub)?
请参阅以下我当前的 grub 配置:

root@xen1:/# cat /boot/grub/grub.cfg 
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
  set have_grubenv=true
  load_env
fi
if [ "${next_entry}" ] ; then
   set default="${next_entry}"
   set next_entry=
   save_env next_entry
   set boot_once=true
else
   set default="Debian GNU/Linux, with Xen hypervisor"
fi

if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
else
  menuentry_id_option=""
fi

export menuentry_id_option

if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}
function load_video {
  if [ x$feature_all_video_module = xy ]; then
    insmod all_video
  else
    insmod efi_gop
    insmod efi_uga
    insmod ieee1275_fb
    insmod vbe
    insmod vga
    insmod video_bochs
    insmod video_cirrus
  fi
}

if [ x$feature_default_font_path = xy ] ; then
   font=unicode
else
insmod part_gpt
insmod lvm
insmod ext2
set root='lvmid/bvbEzC-juKi-DnNc-yxrz-7KHu-uh1P-n6EPWK/tkAuXS-e4Gq-DY98-kkIY-nNf3-4fxn-u8QT2G'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint='lvmid/bvbEzC-juKi-DnNc-yxrz-7KHu-uh1P-n6EPWK/tkAuXS-e4Gq-DY98-kkIY-nNf3-4fxn-u8QT2G'  988e72e2-cc10-46d6-9cd8-3b58827fe864
else
  search --no-floppy --fs-uuid --set=root 988e72e2-cc10-46d6-9cd8-3b58827fe864
fi
    font="/usr/share/grub/unicode.pf2"
fi

if loadfont $font ; then
  set gfxmode=auto
  load_video
  insmod gfxterm
  set locale_dir=$prefix/locale
  set lang=en_GB
  insmod gettext
fi
terminal_output gfxterm
if [ "${recordfail}" = 1 ] ; then
  set timeout=30
else
  if [ x$feature_timeout_style = xy ] ; then
    set timeout_style=menu
    set timeout=5
  # Fallback normal timeout code in case the timeout_style feature is
  # unavailable.
  else
    set timeout=5
  fi
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/08_linux_xen ###
menuentry 'Debian GNU/Linux, with Xen hypervisor' --class debian --class gnu-linux --class gnu --class os --class xen $menuentry_id_option 'xen-gnulinux-simple-988e72e2-cc10-46d6-9cd8-3b58827fe864' {
    insmod part_gpt
    insmod ext2
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root  e9e6e232-aef7-4e2e-ac20-cd8b218952b1
    else
      search --no-floppy --fs-uuid --set=root e9e6e232-aef7-4e2e-ac20-cd8b218952b1
    fi
    echo    'Loading Xen 4.12.2-pre ...'
        if [ "$grub_platform" = "pc" -o "$grub_platform" = "" ]; then
            xen_rm_opts=
        else
            xen_rm_opts="no-real-mode edd=off"
        fi
    multiboot2  /xen-4.12.2-pre.gz placeholder  dom0_mem=2560M,max:2560M ${xen_rm_opts}
    echo    'Loading Linux 5.3.8 ...'
    module2 /vmlinuz-5.3.8 placeholder root=/dev/mapper/vg00-lvroot ro  quiet pcie_aspm=force
    echo    'Loading initial ramdisk ...'
    module2 --nounzip   /initrd.img-5.3.8
}
submenu 'Advanced options for Debian GNU/Linux (with Xen hypervisor)' $menuentry_id_option 'gnulinux-advanced-988e72e2-cc10-46d6-9cd8-3b58827fe864' {
    submenu 'Xen hypervisor, version 4.12.2-pre' $menuentry_id_option 'xen-hypervisor-4.12.2-pre-988e72e2-cc10-46d6-9cd8-3b58827fe864' {
        menuentry 'Debian GNU/Linux, with Xen 4.12.2-pre and Linux 5.3.8' --class debian --class gnu-linux --class gnu --class os --class xen $menuentry_id_option 'xen-gnulinux-5.3.8-advanced-988e72e2-cc10-46d6-9cd8-3b58827fe864' {
            insmod part_gpt
            insmod ext2
            if [ x$feature_platform_search_hint = xy ]; then
              search --no-floppy --fs-uuid --set=root  e9e6e232-aef7-4e2e-ac20-cd8b218952b1
            else
              search --no-floppy --fs-uuid --set=root e9e6e232-aef7-4e2e-ac20-cd8b218952b1
            fi
            echo    'Loading Xen 4.12.2-pre ...'
                if [ "$grub_platform" = "pc" -o "$grub_platform" = "" ]; then
                    xen_rm_opts=
                else
                    xen_rm_opts="no-real-mode edd=off"
                fi
            multiboot2  /xen-4.12.2-pre.gz placeholder  dom0_mem=2560M,max:2560M ${xen_rm_opts}
            echo    'Loading Linux 5.3.8 ...'
            module2 /vmlinuz-5.3.8 placeholder root=/dev/mapper/vg00-lvroot ro  quiet pcie_aspm=force
            echo    'Loading initial ramdisk ...'
            module2 --nounzip   /initrd.img-5.3.8
        }
        menuentry 'Debian GNU/Linux, with Xen 4.12.2-pre and Linux 5.3.8 (recovery mode)' --class debian --class gnu-linux --class gnu --class os --class xen $menuentry_id_option 'xen-gnulinux-5.3.8-recovery-988e72e2-cc10-46d6-9cd8-3b58827fe864' {
            insmod part_gpt
            insmod ext2
            if [ x$feature_platform_search_hint = xy ]; then
              search --no-floppy --fs-uuid --set=root  e9e6e232-aef7-4e2e-ac20-cd8b218952b1
            else
              search --no-floppy --fs-uuid --set=root e9e6e232-aef7-4e2e-ac20-cd8b218952b1
            fi
            echo    'Loading Xen 4.12.2-pre ...'
                if [ "$grub_platform" = "pc" -o "$grub_platform" = "" ]; then
                    xen_rm_opts=
                else
                    xen_rm_opts="no-real-mode edd=off"
                fi
            multiboot2  /xen-4.12.2-pre.gz placeholder  ${xen_rm_opts}
            echo    'Loading Linux 5.3.8 ...'
            module2 /vmlinuz-5.3.8 placeholder root=/dev/mapper/vg00-lvroot ro single 
            echo    'Loading initial ramdisk ...'
            module2 --nounzip   /initrd.img-5.3.8
        }
        menuentry 'Debian GNU/Linux, with Xen 4.12.2-pre and Linux 4.19.0-6-amd64' --class debian --class gnu-linux --class gnu --class os --class xen $menuentry_id_option 'xen-gnulinux-4.19.0-6-amd64-advanced-988e72e2-cc10-46d6-9cd8-3b58827fe864' {
            insmod part_gpt
            insmod ext2
            if [ x$feature_platform_search_hint = xy ]; then
              search --no-floppy --fs-uuid --set=root  e9e6e232-aef7-4e2e-ac20-cd8b218952b1
            else
              search --no-floppy --fs-uuid --set=root e9e6e232-aef7-4e2e-ac20-cd8b218952b1
            fi
            echo    'Loading Xen 4.12.2-pre ...'
                if [ "$grub_platform" = "pc" -o "$grub_platform" = "" ]; then
                    xen_rm_opts=
                else
                    xen_rm_opts="no-real-mode edd=off"
                fi
            multiboot2  /xen-4.12.2-pre.gz placeholder  dom0_mem=2560M,max:2560M ${xen_rm_opts}
            echo    'Loading Linux 4.19.0-6-amd64 ...'
            module2 /vmlinuz-4.19.0-6-amd64 placeholder root=/dev/mapper/vg00-lvroot ro  quiet pcie_aspm=force
            echo    'Loading initial ramdisk ...'
            module2 --nounzip   /initrd.img-4.19.0-6-amd64
        }
        menuentry 'Debian GNU/Linux, with Xen 4.12.2-pre and Linux 4.19.0-6-amd64 (recovery mode)' --class debian --class gnu-linux --class gnu --class os --class xen $menuentry_id_option 'xen-gnulinux-4.19.0-6-amd64-recovery-988e72e2-cc10-46d6-9cd8-3b58827fe864' {
            insmod part_gpt
            insmod ext2
            if [ x$feature_platform_search_hint = xy ]; then
              search --no-floppy --fs-uuid --set=root  e9e6e232-aef7-4e2e-ac20-cd8b218952b1
            else
              search --no-floppy --fs-uuid --set=root e9e6e232-aef7-4e2e-ac20-cd8b218952b1
            fi
            echo    'Loading Xen 4.12.2-pre ...'
                if [ "$grub_platform" = "pc" -o "$grub_platform" = "" ]; then
                    xen_rm_opts=
                else
                    xen_rm_opts="no-real-mode edd=off"
                fi
            multiboot2  /xen-4.12.2-pre.gz placeholder  ${xen_rm_opts}
            echo    'Loading Linux 4.19.0-6-amd64 ...'
            module2 /vmlinuz-4.19.0-6-amd64 placeholder root=/dev/mapper/vg00-lvroot ro single 
            echo    'Loading initial ramdisk ...'
            module2 --nounzip   /initrd.img-4.19.0-6-amd64
        }
    }
}

### END /etc/grub.d/08_linux_xen ###

### BEGIN /etc/grub.d/10_linux ###
function gfxmode {
    set gfxpayload="${1}"
}
set linux_gfx_mode=
export linux_gfx_mode
menuentry 'Debian GNU/Linux' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-988e72e2-cc10-46d6-9cd8-3b58827fe864' {
    load_video
    insmod gzio
    if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
    insmod part_gpt
    insmod ext2
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root  e9e6e232-aef7-4e2e-ac20-cd8b218952b1
    else
      search --no-floppy --fs-uuid --set=root e9e6e232-aef7-4e2e-ac20-cd8b218952b1
    fi
    echo    'Loading Linux 5.3.8 ...'
    linux   /vmlinuz-5.3.8 root=/dev/mapper/vg00-lvroot ro  quiet pcie_aspm=force
    echo    'Loading initial ramdisk ...'
    initrd  /initrd.img-5.3.8
}
submenu 'Advanced options for Debian GNU/Linux' $menuentry_id_option 'gnulinux-advanced-988e72e2-cc10-46d6-9cd8-3b58827fe864' {
    menuentry 'Debian GNU/Linux, with Linux 5.3.8' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.3.8-advanced-988e72e2-cc10-46d6-9cd8-3b58827fe864' {
        load_video
        insmod gzio
        if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
        insmod part_gpt
        insmod ext2
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root  e9e6e232-aef7-4e2e-ac20-cd8b218952b1
        else
          search --no-floppy --fs-uuid --set=root e9e6e232-aef7-4e2e-ac20-cd8b218952b1
        fi
        echo    'Loading Linux 5.3.8 ...'
        linux   /vmlinuz-5.3.8 root=/dev/mapper/vg00-lvroot ro  quiet pcie_aspm=force
        echo    'Loading initial ramdisk ...'
        initrd  /initrd.img-5.3.8
    }
    menuentry 'Debian GNU/Linux, with Linux 5.3.8 (recovery mode)' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.3.8-recovery-988e72e2-cc10-46d6-9cd8-3b58827fe864' {
        load_video
        insmod gzio
        if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
        insmod part_gpt
        insmod ext2
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root  e9e6e232-aef7-4e2e-ac20-cd8b218952b1
        else
          search --no-floppy --fs-uuid --set=root e9e6e232-aef7-4e2e-ac20-cd8b218952b1
        fi
        echo    'Loading Linux 5.3.8 ...'
        linux   /vmlinuz-5.3.8 root=/dev/mapper/vg00-lvroot ro single 
        echo    'Loading initial ramdisk ...'
        initrd  /initrd.img-5.3.8
    }
    menuentry 'Debian GNU/Linux, with Linux 4.19.0-6-amd64' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.19.0-6-amd64-advanced-988e72e2-cc10-46d6-9cd8-3b58827fe864' {
        load_video
        insmod gzio
        if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
        insmod part_gpt
        insmod ext2
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root  e9e6e232-aef7-4e2e-ac20-cd8b218952b1
        else
          search --no-floppy --fs-uuid --set=root e9e6e232-aef7-4e2e-ac20-cd8b218952b1
        fi
        echo    'Loading Linux 4.19.0-6-amd64 ...'
        linux   /vmlinuz-4.19.0-6-amd64 root=/dev/mapper/vg00-lvroot ro  quiet pcie_aspm=force
        echo    'Loading initial ramdisk ...'
        initrd  /initrd.img-4.19.0-6-amd64
    }
    menuentry 'Debian GNU/Linux, with Linux 4.19.0-6-amd64 (recovery mode)' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.19.0-6-amd64-recovery-988e72e2-cc10-46d6-9cd8-3b58827fe864' {
        load_video
        insmod gzio
        if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
        insmod part_gpt
        insmod ext2
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root  e9e6e232-aef7-4e2e-ac20-cd8b218952b1
        else
          search --no-floppy --fs-uuid --set=root e9e6e232-aef7-4e2e-ac20-cd8b218952b1
        fi
        echo    'Loading Linux 4.19.0-6-amd64 ...'
        linux   /vmlinuz-4.19.0-6-amd64 root=/dev/mapper/vg00-lvroot ro single 
        echo    'Loading initial ramdisk ...'
        initrd  /initrd.img-4.19.0-6-amd64
    }
}

### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/30_uefi-firmware ###
menuentry 'System setup' $menuentry_id_option 'uefi-firmware' {
    fwsetup
}
### END /etc/grub.d/30_uefi-firmware ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f  ${config_directory}/custom.cfg ]; then
  source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###

/boot 文件夹包含以下文件:

root@xen1:/# ll /boot/
total 74084
-rw-r--r-- 1 root root   206243 Sep 20 12:51 config-4.19.0-6-amd64
-rw-r--r-- 1 root root   219726 Nov  6 13:41 config-5.3.8
-rw-r--r-- 1 root root     1638 Nov  5 09:37 config-xen-4.12.2-pre
drwx------ 3 root root     4096 Jan  1  1970 efi
drwxr-xr-x 5 root root     4096 Nov  6 15:08 grub
-rw-r--r-- 1 root root 28041914 Nov  5 15:10 initrd.img-4.19.0-6-amd64
-rw-r--r-- 1 root root 28213404 Nov  6 14:45 initrd.img-5.3.8
drwx------ 2 root root    16384 Nov  5 13:32 lost+found
-rw-r--r-- 1 root root  3409486 Sep 20 12:51 System.map-4.19.0-6-amd64
-rw-r--r-- 1 root root  3622883 Nov  6 13:41 System.map-5.3.8
-rw-r--r-- 1 root root  5262576 Sep 20 12:51 vmlinuz-4.19.0-6-amd64
-rw-r--r-- 1 root root  5548416 Nov  6 13:41 vmlinuz-5.3.8
-rw-r--r-- 1 root root  1176799 Nov  5 10:00 xen-4.12.2-pre.gz

在我的系统 (Debian 10) 上,文件 /lib/systemd/system/systemd-modules-load.service 不可用。我已经检查了配置 /usr/local/lib/modules-load.d/xen.conf 并将模块重命名为正确的模块。所有适当的 XEN 模块将在启动时加载,不会出现任何问题:

Nov 10 09:35:34 xen1 systemd-modules-load[227]: Inserted module '8021q'
Nov 10 09:35:34 xen1 systemd-modules-load[227]: Inserted module 'nct6775'
Nov 10 09:35:34 xen1 systemd-modules-load[227]: Failed to insert module 'coretemp': No such device
Nov 10 09:35:34 xen1 systemd-modules-load[227]: Inserted module 'xen_evtchn'
Nov 10 09:35:34 xen1 systemd-modules-load[227]: Inserted module 'xen_gntdev'
Nov 10 09:35:34 xen1 systemd-modules-load[227]: Inserted module 'xen_gntalloc'
Nov 10 09:35:34 xen1 systemd-modules-load[227]: Inserted module 'xen_blkback'
Nov 10 09:35:34 xen1 systemd-modules-load[227]: Inserted module 'xen_netback'
Nov 10 09:35:34 xen1 systemd-modules-load[227]: Inserted module 'xen_pciback'
Nov 10 09:35:34 xen1 systemd-modules-load[227]: Inserted module 'xen_scsiback'
Nov 10 09:35:34 xen1 systemd-modules-load[227]: Inserted module 'xen_acpi_processor'

当尝试加载 coretemp 模块时,我得到以下输出:

root@xen1:~# modprobe -vvvvv coretemp
modprobe: INFO: ../libkmod/libkmod.c:364 kmod_set_log_fn() custom logging function 0x561d960ca150 registered
modprobe: DEBUG: ../libkmod/libkmod-index.c:755 index_mm_open() file=/lib/modules/5.5.6/modules.dep.bin
modprobe: DEBUG: ../libkmod/libkmod-index.c:755 index_mm_open() file=/lib/modules/5.5.6/modules.alias.bin
modprobe: DEBUG: ../libkmod/libkmod-index.c:755 index_mm_open() file=/lib/modules/5.5.6/modules.symbols.bin
modprobe: DEBUG: ../libkmod/libkmod-index.c:755 index_mm_open() file=/lib/modules/5.5.6/modules.builtin.bin
modprobe: DEBUG: ../libkmod/libkmod-module.c:556 kmod_module_new_from_lookup() input alias=coretemp, normalized=coretemp
modprobe: DEBUG: ../libkmod/libkmod-module.c:562 kmod_module_new_from_lookup() lookup modules.dep coretemp
modprobe: DEBUG: ../libkmod/libkmod.c:574 kmod_search_moddep() use mmaped index 'modules.dep' modname=coretemp
modprobe: DEBUG: ../libkmod/libkmod.c:402 kmod_pool_get_module() get module name='coretemp' found=(nil)
modprobe: DEBUG: ../libkmod/libkmod.c:410 kmod_pool_add_module() add 0x561d97869ea0 key='coretemp'
modprobe: DEBUG: ../libkmod/libkmod-module.c:202 kmod_module_parse_depline() 0 dependencies for coretemp
modprobe: DEBUG: ../libkmod/libkmod-module.c:583 kmod_module_new_from_lookup() lookup coretemp=0, list=0x561d978716b0
modprobe: DEBUG: ../libkmod/libkmod.c:501 lookup_builtin_file() use mmaped index 'modules.builtin' modname=coretemp
modprobe: DEBUG: ../libkmod/libkmod-module.c:1750 kmod_module_get_initstate() could not open '/sys/module/coretemp/initstate': No such file or directory
modprobe: DEBUG: ../libkmod/libkmod-module.c:1760 kmod_module_get_initstate() could not open '/sys/module/coretemp': No such file or directory
modprobe: DEBUG: ../libkmod/libkmod-module.c:1393 kmod_module_get_options() modname=snd_pcsp mod->name=coretemp mod->alias=(null)
modprobe: DEBUG: ../libkmod/libkmod-module.c:1393 kmod_module_get_options() modname=snd_usb_audio mod->name=coretemp mod->alias=(null)
modprobe: DEBUG: ../libkmod/libkmod-module.c:1393 kmod_module_get_options() modname=cx88_alsa mod->name=coretemp mod->alias=(null)
modprobe: DEBUG: ../libkmod/libkmod-module.c:1393 kmod_module_get_options() modname=snd_atiixp_modem mod->name=coretemp mod->alias=(null)
modprobe: DEBUG: ../libkmod/libkmod-module.c:1393 kmod_module_get_options() modname=snd_intel8x0m mod->name=coretemp mod->alias=(null)
modprobe: DEBUG: ../libkmod/libkmod-module.c:1393 kmod_module_get_options() modname=snd_via82xx_modem mod->name=coretemp mod->alias=(null)
modprobe: DEBUG: ../libkmod/libkmod-module.c:1393 kmod_module_get_options() modname=bonding mod->name=coretemp mod->alias=(null)
modprobe: DEBUG: ../libkmod/libkmod-module.c:1393 kmod_module_get_options() modname=dummy mod->name=coretemp mod->alias=(null)
modprobe: DEBUG: ../libkmod/libkmod-module.c:1750 kmod_module_get_initstate() could not open '/sys/module/coretemp/initstate': No such file or directory
modprobe: DEBUG: ../libkmod/libkmod-module.c:1760 kmod_module_get_initstate() could not open '/sys/module/coretemp': No such file or directory
modprobe: DEBUG: ../libkmod/libkmod-module.c:744 kmod_module_get_path() name='coretemp' path='/lib/modules/5.5.6/kernel/drivers/hwmon/coretemp.ko'
modprobe: DEBUG: ../libkmod/libkmod-module.c:744 kmod_module_get_path() name='coretemp' path='/lib/modules/5.5.6/kernel/drivers/hwmon/coretemp.ko'
insmod /lib/modules/5.5.6/kernel/drivers/hwmon/coretemp.ko 
modprobe: DEBUG: ../libkmod/libkmod-module.c:744 kmod_module_get_path() name='coretemp' path='/lib/modules/5.5.6/kernel/drivers/hwmon/coretemp.ko'
modprobe: INFO: ../libkmod/libkmod-module.c:886 kmod_module_insert_module() Failed to insert module '/lib/modules/5.5.6/kernel/drivers/hwmon/coretemp.ko': No such device
modprobe: ERROR: could not insert 'coretemp': No such device
modprobe: DEBUG: ../libkmod/libkmod-module.c:468 kmod_module_unref() kmod_module 0x561d97869ea0 released
modprobe: DEBUG: ../libkmod/libkmod.c:418 kmod_pool_del_module() del 0x561d97869ea0 key='coretemp'
modprobe: INFO: ../libkmod/libkmod.c:331 kmod_unref() context 0x561d97869530 released

但是文件 coretemp.ko 仍然存在:

root@xen1:~# ll /lib/modules/5.5.6/kernel/drivers/hwmon/coretemp.ko
-rw-r--r-- 1 root root 24872 Feb 26  2020 /lib/modules/5.5.6/kernel/drivers/hwmon/coretemp.ko

来自 syslog 的一些进一步详细信息:

Nov  7 09:17:48 xen1 systemd-modules-load[228]: Inserted module '8021q'
Nov  7 09:17:48 xen1 systemd-modules-load[228]: Failed to insert module 'coretemp': No such device
Nov  7 09:17:48 xen1 systemd-modules-load[228]: Inserted module 'nct6775'
Nov  7 09:17:48 xen1 systemd-modules-load[228]: Inserted module 'xen_evtchn'
Nov  7 09:17:48 xen1 systemd-modules-load[228]: Inserted module 'xen_gntdev'
Nov  7 09:17:48 xen1 systemd-modules-load[228]: Inserted module 'xen_gntalloc'
Nov  7 09:17:48 xen1 systemd-modules-load[228]: Inserted module 'xen_blkback'
Nov  7 09:17:48 xen1 systemd-modules-load[228]: Inserted module 'xen_netback'
Nov  7 09:17:48 xen1 systemd-modules-load[228]: Inserted module 'xen_pciback'
Nov  7 09:17:48 xen1 systemd-modules-load[228]: Failed to find module 'evtchn'
Nov  7 09:17:48 xen1 systemd-modules-load[228]: Failed to find module 'gntdev'
Nov  7 09:17:48 xen1 systemd-modules-load[228]: Failed to find module 'netbk'
Nov  7 09:17:48 xen1 systemd-modules-load[228]: Failed to find module 'blkbk'
Nov  7 09:17:48 xen1 systemd-modules-load[228]: Failed to find module 'xen-scsibk'
Nov  7 09:17:48 xen1 systemd-modules-load[228]: Failed to find module 'usbbk'
Nov  7 09:17:48 xen1 systemd-modules-load[228]: Failed to find module 'pciback'
Nov  7 09:17:48 xen1 systemd-modules-load[228]: Inserted module 'xen_acpi_processor'
Nov  7 09:17:48 xen1 systemd-modules-load[228]: Failed to find module 'blktap2'

更多信息:

  1. xl 信息
root@xen1:~# xl info
host                   : xen1
release                : 5.5.6
version                : #1 SMP Wed Feb 26 10:01:08 CET 2020
machine                : x86_64
nr_cpus                : 4
max_cpu_id             : 3
nr_nodes               : 1
cores_per_socket       : 4
threads_per_core       : 1
cpu_mhz                : 3192.622
hw_caps                : bfebfbff:76faf3ff:2c100800:00000021:00000001:00002fbb:00000000:00000100
virt_caps              : pv hvm hvm_directio pv_directio
total_memory           : 32645
free_memory            : 23537
sharing_freed_memory   : 0
sharing_used_memory    : 0
outstanding_claims     : 0
free_cpus              : 0
xen_major              : 4
xen_minor              : 12
xen_extra              : .2-pre
xen_version            : 4.12.2-pre
xen_caps               : xen-3.0-x86_64 xen-3.0-x86_32p hvm-3.0-x86_32 hvm-3.0-x86_32p hvm-3.0-x86_64
xen_scheduler          : credit2
xen_pagesize           : 4096
platform_params        : virt_start=0xffff800000000000
xen_changeset          : Fri Oct 25 11:43:49 2019 +0200 git:c28853456b
xen_commandline        : placeholder dom0_mem=2560M,max:2560M no-real-mode edd=off
cc_compiler            : gcc (Debian 8.3.0-6) 8.3.0
cc_compile_by          : root
cc_compile_domain      : ###
cc_compile_date        : Tue Nov  5 09:59:50 CET 2019
build_id               : 46bcb9e3757cb39d0679276a15f19b39fa7dcff9
xend_config_format     : 4
  1. 启动配置

/etc/默认/grub

root@xen1:~# cat /etc/default/grub
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
#   info -f grub -n 'Simple configuration'

GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet pcie_aspm=force"
GRUB_CMDLINE_LINUX=""

# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY="true"

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"

/etc/default/grub.d/xen.cfg

root@xen1:~# cat /etc/default/grub.d/xen.cfg
GRUB_DISABLE_OS_PROBER=true
GRUB_CMDLINE_XEN_DEFAULT="dom0_mem=2560M,max:2560M"
GRUB_DEFAULT="Debian GNU/Linux, with Xen hypervisor"

答案1

xl info 对您的 CPU 功能有何说明?xl info 对 xen_commandline 有何说明?

由于您可以在没有 Xen 的情况下加载 coretemp 模块,因此 Xen 很可能向 dom0 隐藏了处理器的某些功能。

我无法在您包含的启动配置中看到任何 cpuid_mask*= 选项,但也许您的发行版从包含的文件或类似文件向您的 xen 命令行添加了一些 cpu_mask 选项?(使用 xl info 检查生成的命令行实际上是什么。)

快速浏览一下 coretemp 的源代码后(https://github.com/torvalds/linux/blob/master/drivers/hwmon/coretemp.c) 我怀疑 711-729 行是导致模块无法加载的原因。至于模块为什么无法看到您的 CPU 具有所需的支持,我猜是 CPU 掩码。

来自最新的 xen 命令行文档 (https://xenbits.xen.org/docs/unstable/misc/xen-command-line.html#cpuid_mask_ecx) 不再需要指定掩码,因为它们默认为所有位都设置。但是,我之前遇到过 Xen CPU 掩码功能的问题,这需要我明确提供 ECX 和 EDX 掩码才能恢复我需要的所有功能。那是一个长的虽然是很久以前的事情了。

有关 CPUID 位的更多信息(其中一些与 coretemp 模块相关),请参阅https://en.wikipedia.org/wiki/CPUID#EAX=1:_Processor_Info_and_Feature_Bits

答案2

您的问题可能与...有关systemd-modules-load.service

检查以下引用的一个文件:

/lib/systemd/system/systemd-modules-load.service

在我的系统中,它是该文件:

/usr/local/lib/modules-load.d/xen.conf

将模块重命名为正确的名称:

'evtchn' -> xen-evtchn
'gntdev' -> xen-gntdev
'netbk' -> xen-netback
'blkbk' -> xen-blkback
'xen-scsibk' -> xen-scsiback

ETC..

此外,如果不使用 systemd,您可以检查 xencommons:

检查 xencommons 是否正在加载正确的模块,如果没有,请将其重命名为正确的 xen 相关模块。

find /lib/modules -name '*gntdev*'
grep '^BACKEND_MODULES=' /etc/init.d/xencommons

相关内容