KVM-VMI / kvm

Fork of KVM with Virtual Machine Introspection patches
Other
33 stars 28 forks source link

Compile Failure: kvm-vmi/kvm/tools/objtool/.fixdep.o.cmd:1: *** Missing separator. Stop. #57

Closed prcuzz closed 1 year ago

prcuzz commented 1 year ago

I wanted to install and use libvmi/libvmi, so I tried to compile the kernel here to enable the kvm introspection feature.

I followed the step in https://kvm-vmi.github.io/kvm-vmi/kvmi-v7/setup.html#kvm. But I had a problem:

➜ kvm git:(master) sudo make -j$(nproc)
CHK include/config/kernel.release CHK include/generated/uapi/linux/version.h DESCEND objtool /home/zzc/Desktop/zzc/kvm-vmi/kvm/tools/objtool/.fixdep.o.cmd:1: 缺失分隔符。 停止。 make[3]: [Makefile:42:/home/zzc/Desktop/zzc/kvm-vmi/kvm/tools/objtool/fixdep-in.o] 错误 2 make[2]: [/home/zzc/Desktop/zzc/kvm-vmi/kvm/tools/build/Makefile.include:4:fixdep] 错误 2 make[1]: [Makefile:60:objtool] 错误 2 make: [Makefile:1614:tools/objtool] 错误 2 make: 正在等待未完成的任务....

It says "Missing separator" in line 1. And I find the file ".fixdep.o.cmd":

# cannot find fixdep (/home/zzc/Desktop/zzc/kvm-vmi/kvm/tools/objtool//fixdep) # using basic dep data

/home/zzc/Desktop/zzc/kvm-vmi/kvm/tools/objtool/fixdep.o: fixdep.c \ /usr/include/stdc-predef.h /usr/include/x86_64-linux-gnu/sys/types.h \ /usr/include/features.h /usr/include/features-time64.h \ /usr/include/x86_64-linux-gnu/bits/wordsize.h \ /usr/include/x86_64-linux-gnu/bits/timesize.h \ /usr/include/x86_64-linux-gnu/sys/cdefs.h \ /usr/include/x86_64-linux-gnu/bits/long-double.h \ /usr/include/x86_64-linux-gnu/gnu/stubs.h \ /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \ /usr/include/x86_64-linux-gnu/bits/types.h \ /usr/include/x86_64-linux-gnu/bits/typesizes.h \ /usr/include/x86_64-linux-gnu/bits/time64.h \ ......

I can see no space or tab here. How can I solve this problem? Please help me.

adlazar commented 1 year ago

I don't know, but you must build the kernel from the kvmi-v7 branch.

And I think the latest documentation is this: https://kvm-vmi.github.io/kvm-vmi/master/setup.html

Also, you don't have to use the root user to build the kernel. You need sudo only with make modules_install and make install. Building the kernel with sudo should work, but I haven't test it.

Keep in mind that you've picked the bare-metal setup (not Valgrant). You'll have to install that kernel on a/your system and that system must boot :). If it doesn't, you'll have to set your block device drivers (scsi,nvme...) to Y, not M, during make menuconfig.

Wenzel commented 1 year ago

HI @adlazar , thanks for replying ! hi @prcuzz , are you compiling on Ubuntu 22.04 ? There is an issue related with objtool that i'm investigating.

Also, as @adlazar noticed, I see the master branch in your git history. the main repo tracks the kvmi-v7 commit in the kvm submodule. you shouldn't checkout the master branch there :)

Wenzel commented 1 year ago

Okay, so the issue with objtool and binutils on ubuntu 22.04 has already been addressed here: https://github.com/KVM-VMI/kvm/issues/54

prcuzz commented 1 year ago

@adlazar @Wenzel Thank you for your reply. I tried compiling the kvmi-v7 version of the code and ran into a new problem.

➜  kvm git:(kvmi-v7) make -j$(nproc) 
  ...
  AS      arch/x86/boot/compressed/piggy.o
  LD      arch/x86/boot/compressed/vmlinux
  ZOFFSET arch/x86/boot/zoffset.h
  OBJCOPY arch/x86/boot/vmlinux.bin
  AS      arch/x86/boot/header.o
  LD      arch/x86/boot/setup.elf
  OBJCOPY arch/x86/boot/setup.bin
  BUILD   arch/x86/boot/bzImage
Setup is 18044 bytes (padded to 18432 bytes).
System is 11825 kB
CRC 98886c23
Kernel: arch/x86/boot/bzImage is ready  (#2)
ERROR: "unlock_device_hotplug" [drivers/dax/kmem.ko] undefined!
ERROR: "add_memory_resource" [drivers/dax/kmem.ko] undefined!
ERROR: "lock_device_hotplug" [drivers/dax/kmem.ko] undefined!
make[1]: *** [scripts/Makefile.modpost:94: __modpost] Error 1
make: *** [Makefile:1280: modules] Error 2

I found someone who had the same problem as me: https://github.com/KVM-VMI/kvm-vmi/issues/100 So I followed your suggetsion and executed these cmd:

make distclean
make olddefconfig
./scripts/config --enable KVM
./scripts/config --enable KVM_INTEL
./scripts/config --enable KVM_AMD
./scripts/config --enable KVM_INTROSPECTION
./scripts/config --disable TRANSPARENT_HUGEPAGE
./scripts/config --enable REMOTE_MAPPING

then I got this:

➜  kvm git:(kvmi-v7) sudo make modules_install INSTALL_MOD_STRIP=1
sed: can't read modules.order: No such file or directory
make: *** [Makefile:1312: _modinst_] Error 2

I googled it and executed "make modules", then I got this:

➜  kvm git:(kvmi-v7) sudo make modules_install INSTALL_MOD_STRIP=1   
cp: cannot stat './modules.builtin.modinfo': No such file or directory
make: *** [Makefile:1314: _modinst_] Error 1

I didn't find any useful infomation yet.

I use ubuntu 20.04.

I followed the steps in order in https://kvm-vmi.github.io/kvm-vmi/master/setup.html#kvm. What could have gone wrong? Any suggestions to help me solve this problem? Thank you very much!!

prcuzz commented 1 year ago

I found the solution in https://github.com/frankaemika/libfranka/issues/62 .

I finished the installation. Thank you!

➜  ~ uname -a
Linux ubuntu 5.4.24+ #1 SMP Tue Mar 7 06:01:40 PST 2023 x86_64 x86_64 x86_64 GNU/Linux
Wenzel commented 1 year ago

poke @prcuzz see this ticket: https://github.com/KVM-VMI/kvm-vmi/issues/149

And this PR which implements the compilation fixes: https://github.com/KVM-VMI/kvm-vmi/pull/148

I'm working on a documentation update as well.

prcuzz commented 1 year ago

@Wenzel Thank you for your maintenance and I hope the problems I encountered will be helpful to others.

Wenzel commented 1 year ago

Per the last comment, closing this issue. Thanks !