# [Solved] Switch from 32bit kernel to 64bit kernel

## papahuhn

Hi,

I am running a pure x86 Gentoo on an x64-capable server and would like to use 64bit KVM virtual guests on it. That is only possible on a x64 host-OS, I heard. I don't have physical access to the server, so I cannot reinstall the OS the usual way. An online-migration towards x64 may be possible somehow, but the risk is too high that something goes wrong and I end up with an inaccessible server. But what if I compiled a 64bit kernel, put it in my grub.conf and rebooted? Will the kernel work with a 32bit userland? Lets assume, that it will boot correctly, will it mess up my system when I emerge new packages? Will it help me with virtualizing 64bit guests with KVM?

Thanks so far!

----------

## Ant P.

Yes, everything should work fine afterwards. Emerge doesn't care what kernel you use, it only looks at the profile.

I'm not sure if a 32-bit KVM can run 64-bit OSes, the safest workaround for that would be a 64-bit chroot install (this but inverted).

----------

## papahuhn

Thanks for the info!

The problem with chroot is, that it's not possible to do from 32bit into 64bit.

----------

## Logicien

Hi,

I do not think a 64 bits kernel will change anything. If your processor is 64 bits capable, a PC emulator should be able to use the capability of the processor and create a 64 bits virtual machine running in native mode without emulation even if the OS and PC emulator are a pure 32 bits (may be possible but not sure). 64 bits emulation should be also possible depending on the PC emulator you use. You have to check the architectures options at virtual machine creation.

----------

## papahuhn

Yes, from the hardware's perspective that should work, but KVM does not support it. It is possible with a pure QEMU-setup, but that one is very slow.

----------

## Logicien

I don't understand what KVM do not support exactly. Is a 32 bits KVM cannot use the 64 bits capability of the processor? Perhaps with a 64 bits kernel it will be possible. You can try VirtualBox who is faster.

----------

## papahuhn

The following does not work with KVM:

64 bit Host CPU <--> 32 bit host OS [**] <--> 64 bit KVM Guest OS

This is KVM's fault, because generally this should be possible with VT-x or AMD-V capable CPUs.

[**] And I am not sure here, what 32 bit host OS means, either. It may mean the 32 bit kernel, or it may mean the "qemu-system-x86_64" process which represents a VM. If it's the kernel only, I can switch to a 64bit version and keep the 32bit userland. If it is the qemu-system process, then I have lost.

----------

## papahuhn

Ok, I could not resist to try it out. It worked! Running a 64-bit kernel with 32-bit userland and 64-bit KVM guests.

Bye

----------

## papahuhn

Just in case that somebody is interested:

Guest vRAM on a 64-bit-kernel+32-bit-qemu-kvm host is still limited to 2047MB.

----------

