View previous topic :: View next topic |
Author |
Message |
setan Tux's lil' helper
Joined: 21 Feb 2024 Posts: 77
|
Posted: Sun Mar 03, 2024 11:47 am Post subject: Problems with compiling gentoo-sources |
|
|
Hello,
I want to virtualize some stuff with quemu and i have noticed that my kernel (gentoo-kernel-bin) does not support kvm.
(I know that my hardware does)
I have decided to try and make my own kernel from gentoo-sources.
I have run `make menuconfig` and set just for a test disabled AMD KVM modules as I am running intel's 11gen i5.
When I try to build (make) the kernel, it compiles for some time and then i get this error:
Code: | CC [M] kernel/sysctl-test.o
CC certs/system_keyring.o
HOSTCC certs/extract-cert
CERT certs/x509_certificate_list
make[3]: *** No rule to make target '/var/tmp/portage/sys-kernel/gentoo-kernel-6.6.16/temp/kernel_key.pem', needed by 'certs/signing_key.x509'. Stop.
make[2]: *** [scripts/Makefile.build:480: certs] Error 2
make[1]: *** [/usr/src/linux-6.6.13-gentoo/Makefile:1913: .] Error 2
make: *** [Makefile:234: __sub-make] Error 2
|
why does my .13 kernel want something from .16? How do I fix this? |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54450 Location: 56N 3W
|
Posted: Sun Mar 03, 2024 12:22 pm Post subject: |
|
|
setan,
Exactly how ... every step please, do you install, configure and build the kernel?
Put your .config file onto a pastebin site please. wgetpaste is your friend.
The kernel in normally installed to /usr/src and Gentoo builds it there too, so I don't understand why its trying to use /var/tmp/portage/... at all.
During Code: | emerge gentoo-sources | the kernel is unpacked there before being copied to /usr/src.
Is this the guest kernel or the host kernel? _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
logrusx Veteran
Joined: 22 Feb 2018 Posts: 1743
|
Posted: Sun Mar 03, 2024 12:23 pm Post subject: Re: Problems with compiling gentoo-sources |
|
|
setan wrote: | Hello,
I want to virtualize some stuff with quemu and i have noticed that my kernel (gentoo-kernel-bin) does not support kvm. |
I'm pretty sure that's not correct. Try modprobing the appropriate module - kvm-amd or kvm-intel.
See also.
EDIT: just checked, it indeed does support kvm, you only need to load the module as there's no reason for it to be auto loaded. If you want it to be, refer the the link above.
Best Regards,
Georgi
Last edited by logrusx on Sun Mar 03, 2024 12:28 pm; edited 1 time in total |
|
Back to top |
|
|
NichtDerHans Tux's lil' helper
Joined: 27 Jan 2023 Posts: 147
|
Posted: Sun Mar 03, 2024 12:26 pm Post subject: |
|
|
What is the output from:
Code: | eselect kernel list |
? |
|
Back to top |
|
|
setan Tux's lil' helper
Joined: 21 Feb 2024 Posts: 77
|
Posted: Sun Mar 03, 2024 4:10 pm Post subject: |
|
|
NeddySeagoon wrote: | Exactly how ... every step please, do you install, configure and build the kernel? |
1. emerge gentoo-sources -- it downloads 6.1.13
2. cd /usr/src/linux-6.6.13-gentoo/
3. doas make menuconfig and save to .config
3alt. copy the config from the pastebin
4.. doas make
5. get error
Quote: | Put your .config file onto a pastebin site please. |
Here it is: link
Quote: | wgetpaste is your friend. |
LOL. nice.
Quote: | Is this the guest kernel or the host kernel? |
I am not sure what you mean. It is the kernel that I am currently not running.
Code: |
$ uname -r
6.6.16-gentoo-dist
$ eselect kernel list
Available kernel symlink targets:
[1] linux-6.6.13-gentoo
[2] linux-6.6.16-gentoo-dist *
|
Quote: | Try modprobing the appropriate module - kvm-amd or kvm-intel. |
Code: | # modprobe intel-kvm
modprobe: FATAL: Module intel-kvm not found in directory /lib/modules/6.6.16-gentoo-dist
|
Quote: | it indeed does support kvm, you only need to load the module as there's no reason for it to be auto loaded. If you want it to be, refer the the link above. |
Is there any way that I can check that on my system?
I have put kvm and kvm-intel in /etc/modules-load.d/ and rebooted (twice) and even upgraded grub.
Still no kvm support |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54450 Location: 56N 3W
|
Posted: Sun Mar 03, 2024 6:03 pm Post subject: |
|
|
setan,
Code: | 1. emerge gentoo-sources -- it downloads 6.1.13
2. cd /usr/src/linux-6.6.13-gentoo/ |
6.1.74 is the current stable 6.1.x kernel and 6.6.13 the current 6.6.x kernel.
6.1.13 is long gone.
Code: | modprobe: FATAL: Module intel-kvm not found in directory /lib/modules/6.6.16-gentoo-dist |
I use so its probably kvm-intel for you, as you quoted.
You will have two kernels, running at the same time soon. One on your system that works with the actual hardware you have and another is your kvm guest.
That will work with either the emulated hardware or virtio devices.
The former just works. No guest modifications required. The virtio is faster but requires both host and guest support.
Code: | $ uname -r
6.6.16-gentoo-dist
$ eselect kernel list
Available kernel symlink targets:
[1] linux-6.6.13-gentoo
[2] linux-6.6.16-gentoo-dist * |
You are running 6.6.16-gentoo-dist. The /usr/src/linux symlink points to linux-6.6.16-gentoo-dist so external kernel modules will be compiled for linux-6.6.16-gentoo-dist.
The kernel .config you posted says Code: | CONFIG_LOCALVERSION="-gentoo-dist" | is it the gentoo-dist .config file or the kernel you are working on?
It says
Code: | CONFIG_KVM_INTEL=m
CONFIG_X86_SGX_KVM=y
# CONFIG_KVM_AMD is not set | and at the top it says
Code: | # Automatically generated file; DO NOT EDIT.
# Linux/x86 6.6.13-gentoo Kernel Configuration | so its not the linux-6.6.16-gentoo-dist that you have installed.
Being old and cynical heres what I did ...
Code: | sudo su -
emerge =gentoo-sources-6.6.13
cd /usr/src/linux-6.6.13-gentoo/
wget https://pastebin.com/raw/pi5x3N4i
cp pi5x3N4i .config
make -j40 |
which ended in tears with
Code: | make[1]: *** [/usr/src/linux-6.6.13-gentoo/Makefile:1913: .] Error 2
make: *** [Makefile:234: __sub-make] Error 2 |
To get more of the error, I reran make with only one thread.
Code: | make
CALL scripts/checksyscalls.sh
DESCEND objtool
make[4]: 'install_headers' is up to date.
CHK kernel/kheaders_data.tar.xz
CERT certs/x509_certificate_list
make[3]: *** No rule to make target '/var/tmp/portage/sys-kernel/gentoo-kernel-6.6.16/temp/', needed by 'certs/signing_key.x509'. Stop.
make[2]: *** [scripts/Makefile.build:480: certs] Error 2
make[1]: *** [/usr/src/linux-6.6.13-gentoo/Makefile:1913: .] Error 2 as its private to Gentoo
make: *** [Makefile:234: __sub-make] Error 2 |
and it broke just as you said
Heres why. You started with the .config from the gentoo-dist kernel.
That config contains Code: | # grep -i kernel_key.pem .config
CONFIG_MODULE_SIG_KEY="/var/tmp/portage/sys-kernel/gentoo-kernel-6.6.16/temp/kernel_key.pem" | which you don't have as its private to Gentoo.
Fix that CONFIG_MODULE_SIG_KEY entry and it builds.
Fix CONFIG_LOCALVERSION="-gentoo-dist" or you will get confused. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
logrusx Veteran
Joined: 22 Feb 2018 Posts: 1743
|
Posted: Sun Mar 03, 2024 6:42 pm Post subject: |
|
|
setan wrote: |
Quote: | Try modprobing the appropriate module - kvm-amd or kvm-intel. |
Code: | # modprobe intel-kvm
modprobe: FATAL: Module intel-kvm not found in directory /lib/modules/6.6.16-gentoo-dist
|
|
It is kvm-intel. I specifically emerged gentoo-kernel-bin and confirmed a module named kvm-intel.ko is installed. Since it's AMD here I can't try to load it but it would be really weird if it doesn't work. After all this is a tested distribution kernel.
In fact I still have the logs in my console:
Code: | >>> /lib/modules/6.6.16-gentoo-dist/kernel/arch/x86/
>>> /lib/modules/6.6.16-gentoo-dist/kernel/arch/x86/kvm/
>>> /lib/modules/6.6.16-gentoo-dist/kernel/arch/x86/kvm/kvm.ko
>>> /lib/modules/6.6.16-gentoo-dist/kernel/arch/x86/kvm/kvm-intel.ko
>>> /lib/modules/6.6.16-gentoo-dist/kernel/arch/x86/kvm/kvm-amd.ko
|
setan wrote: | I have put kvm and kvm-intel in /etc/modules-load.d/ and rebooted (twice) and even upgraded grub.
Still no kvm support :( |
Actually that might not work. I now see I have nothing there and still have the kvm modules loaded. I remember I did something about that, but I don't remember what.
EDIT: once something didn't work for me because the file extension should have been .conf. Did you put it in a .conf file?
NeddySeagoon wrote: | setan,
Code: | 1. emerge gentoo-sources -- it downloads 6.1.13
2. cd /usr/src/linux-6.6.13-gentoo/ |
6.1.74 is the current stable 6.1.x kernel and 6.6.13 the current 6.6.x kernel.
6.1.13 is long gone. |
It's later written 6.6.13, I guess OP wrote it by hand and made a mistake.
Best Regards,
Georgi |
|
Back to top |
|
|
setan Tux's lil' helper
Joined: 21 Feb 2024 Posts: 77
|
Posted: Sun Mar 03, 2024 8:04 pm Post subject: |
|
|
logrusx wrote: | setan wrote: |
Quote: | Try modprobing the appropriate module - kvm-amd or kvm-intel. |
Code: | # modprobe intel-kvm
modprobe: FATAL: Module intel-kvm not found in directory /lib/modules/6.6.16-gentoo-dist
|
|
It is kvm-intel. I specifically emerged gentoo-kernel-bin and confirmed a module named kvm-intel.ko is installed. Since it's AMD here I can't try to load it but it would be really weird if it doesn't work. After all this is a tested distribution kernel.
|
Yep i also have those.
logrusx wrote: |
setan wrote: | I have put kvm and kvm-intel in /etc/modules-load.d/ and rebooted (twice) and even upgraded grub.
Still no kvm support |
Actually that might not work. I now see I have nothing there and still have the kvm modules loaded. I remember I did something about that, but I don't remember what.
EDIT: once something didn't work for me because the file extension should have been .conf. Did you put it in a .conf file?
|
Yes it is the `kvm.conf` file.
logrusx wrote: | It's later written 6.6.13, I guess OP wrote it by hand and made a mistake. |
Yes, that's true.
@NeddySeagoon you're a huge help.
It indeed was the signing key.
Now it seems to build without problems.
Also what do you mean by fixing CONFIG_LOCALVERSION="-gentoo-dist"? |
|
Back to top |
|
|
logrusx Veteran
Joined: 22 Feb 2018 Posts: 1743
|
Posted: Sun Mar 03, 2024 8:16 pm Post subject: |
|
|
I'm still positive that the dist kernel must work and you're overlooking something. Unfortunately I'm out of ideas. Maybe try with 6.6.13, I find it strange that the bin kernel is at 6.6.16 and the sources are still at 6.6.13. Could it be a problem in the dist kernel after all?
EDIT: what does uname -a say when you boot it?
Best Regards,
Georgi |
|
Back to top |
|
|
setan Tux's lil' helper
Joined: 21 Feb 2024 Posts: 77
|
Posted: Sun Mar 03, 2024 8:24 pm Post subject: |
|
|
I hope that there is no problems in the dist kernel.
Code: | $ uname -a
Linux HOSTNAME 6.6.16-gentoo-dist #1 SMP PREEMPT_DYNAMIC Tue Feb 6 12:30:47 -00 2024 x86_64 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz GenuineIntel GNU/Linux
|
also after doing sudo modprobe kvm-intel:
Code: | $ lsmod | grep kvm
kvm_intel 389120 0
kvm 1146880 1 kvm_intel
irqbypass 12288 1 kvm
|
yet still virt-manager claims that for QEMU/KVM user session KVM is not available :/ |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54450 Location: 56N 3W
|
Posted: Sun Mar 03, 2024 8:29 pm Post subject: |
|
|
setan,
Code: | CONFIG_LOCALVERSION="-gentoo-dist" |
Will append -gentoo-dist to the kernel name.
The default name will be Makefile: | VERSION = 6
PATCHLEVEL = 6
SUBLEVEL = 13
EXTRAVERSION = -gentoo | for 6.6.13-gentoo.
Your kernel will be called 6.6.13-gentoo-gentoo-dist when the LOCALVERSION string is appended to the default name.
As long as you know that its not the gentoo-dist kernel it won't matter.
Its a full kernel rebuild to change LOCALVERSION as the kernel uses the full version to find bits of itself.
Make friends with the find in menuconfig.
Also be aware that kernel make is single threaded unless you use make -jX, where X is the number of threads that make should use. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
Hu Administrator
Joined: 06 Mar 2007 Posts: 21907
|
Posted: Sun Mar 03, 2024 8:43 pm Post subject: |
|
|
setan wrote: | yet still virt-manager claims that for QEMU/KVM user session KVM is not available :/ | Per Guidelines item #4 ("Include logs and tell us commands executed"), please show us exactly what virt-manager prints, and tell us how you caused it to print that. As what user did you run virt-manager? Does that user have permission to use KVM? What are the permissions on the KVM character device file? |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54450 Location: 56N 3W
|
Posted: Sun Mar 03, 2024 8:55 pm Post subject: |
|
|
setan,
Quote: | yet still virt-manager claims that for QEMU/KVM user session KVM is not available :/ |
That's a different problem ... its progress though.
virt-manager connects to libvirtd over the network ... including over localhost.
By default, libvirtd is locked down. You will need to configure it or add permitted users to the group that is permitted to connect.
As Hu said, give use the information to reproduce the problem.
That approach worked with your kernel. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
logrusx Veteran
Joined: 22 Feb 2018 Posts: 1743
|
Posted: Sun Mar 03, 2024 9:01 pm Post subject: |
|
|
As Hu said and more: did you enable the service? I don't know about OpenRC, but there's a systemd service that needs to be started. It's libvirtd.service
Best Regards,
Georgi |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54450 Location: 56N 3W
|
Posted: Sun Mar 03, 2024 9:16 pm Post subject: |
|
|
logrusx,
Its libvirtd on openrc _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
setan Tux's lil' helper
Joined: 21 Feb 2024 Posts: 77
|
Posted: Mon Mar 04, 2024 6:39 am Post subject: |
|
|
libvirtd is started at runlevel manual.
I launch virt-manager from the terminal (it detaches) as my USER:
Code: | $ groups
wheel cron audio video usb users portage plugdev vboxusers USER
|
I connect to quemu/kvm user session succesfully.
My vm runs very bad and if I try to make a new one i get a warning in the "New VM" window:
Quote: | Warning: KVM is not available. This may men the KVM package is not installed, or the KVM kernel modules are not loaded. Your VMs may perform poorly.
|
while at the same time
Code: | $ lsmod | grep kvm
kvm_intel 389120 0
kvm 1146880 1 kvm_intel
irqbypass 12288 1 kvm
|
Code: | /lib/modules/6.6.16-gentoo-dist/kernel/arch/x86/kvm $ ls -la
total 3776
drwxr-xr-x 2 root root 58 Feb 28 22:28 .
drwxr-xr-x 6 root root 59 Feb 25 10:21 ..
-rw-r--r-- 1 root root 404620 Feb 28 22:27 kvm-amd.ko
-rw-r--r-- 1 root root 997012 Feb 28 22:27 kvm-intel.ko
-rw-r--r-- 1 root root 2459884 Feb 28 22:27 kvm.ko
|
@NeddySeagoon
okay, I get it.
I did not expect the build to be single threaded to be honest.
Thanks! |
|
Back to top |
|
|
logrusx Veteran
Joined: 22 Feb 2018 Posts: 1743
|
Posted: Mon Mar 04, 2024 7:01 am Post subject: |
|
|
My user is in the kvm group as well. I'm pretty sure I followed the wiki and got it working that way, did you do that as well?
The only thing I can't find in the wiki is a oage that listed all services that needed to be enabled. Maybe I have looked at Arch Wiki, but also it maybe updated as some of the services were already deprecated or removed back then.
Best Regards,
Georgi |
|
Back to top |
|
|
setan Tux's lil' helper
Joined: 21 Feb 2024 Posts: 77
|
Posted: Mon Mar 04, 2024 9:17 am Post subject: |
|
|
Adding my user to the KVM group made QUEMU users session use KVM.
All the problems that I have raised in this thread are now fixed.
I suppose the next step is to learn how to install the kernel manually or with genkernel. |
|
Back to top |
|
|
pietinger Moderator
Joined: 17 Oct 2006 Posts: 4437 Location: Bavaria
|
|
Back to top |
|
|
|