# xen + gentoo in domU

## Aurora

I know someone who is trying to run a Gentoo domU image (the one found on jailtime) on his server.  I'm relatively certain that the user is not running Gentoo as the dom0.

I'm still slightly unsure about the whole xen domU + dom0 kernel process.  Here's a brief rundown of how the jailtime Gentoo domU image works (to the best of my knowledge):

The entire OS is contained in one large .img file

The .img file has a /boot directory in it, but the /boot directory has nothing inside (I imagine this is normal  :Smile: )

The fstab inside the jailtime image has sda1 mounted as root (seems to work fine  :Smile: )

So here's where I'm confused.  From what I understand, the kernel for the domU is stored in the dom0's file system.  It seems the xen .cfg file tells the xen virtual machine what kernel to boot up (and the kernel is located in the dom0's /boot, or some other directory in the dom0's file system) when the VM starts up.  Correct?

This is the big question: can the person run a Gentoo domU without running a Gentoo dom0?  If so, how?  How can someone running, for example, Fedora 7 run Gentoo in a domU if the xen domU kernel is a Fedora xen kernel?

I hope my question made sense.   :Smile: 

Thanks!

----------

## Aurora

Small bump... :Smile:   I'm still tinkering with this problem and am still clueless after having scoured the net.   :Very Happy: 

----------

## Sven Vermeulen

 *Aurora wrote:*   

> 
> 
> So here's where I'm confused.  From what I understand, the kernel for the domU is stored in the dom0's file system.  It seems the xen .cfg file tells the xen virtual machine what kernel to boot up (and the kernel is located in the dom0's /boot, or some other directory in the dom0's file system) when the VM starts up.  Correct?
> 
> 

 

Correct.

 *Aurora wrote:*   

> 
> 
> This is the big question: can the person run a Gentoo domU without running a Gentoo dom0?  If so, how?  How can someone running, for example, Fedora 7 run Gentoo in a domU if the xen domU kernel is a Fedora xen kernel?
> 
> 

 

Yes. It doesn't matter what distribution dom0 and domU's are running. After all, dom0 just needs its Xen-enabled kernel with back-end drivers while the dumU's need a Xen-enabled kernel with front-end drivers.

So you can perfectly run Gentoo in a domU if the xen dumU kernel is a Fedora xen kernel, as long as it is correctly configured.

See also Gentoo in Xen Guide.

----------

## Aurora

Thanks for the reply, Sven.

I created a xen machine using the dd method described in the wiki.  I then got a copy of the domU kernel that the person is trying to use with the Gentoo domU.

Based on the kernel bootup messages, this is not a Gentoo xen-sources kernel.

When the person tries to boot up, here's what is seen in the xen console:

```
[root@localhost ~]# xm create gentoo && xm console gentoo

Using config file "/etc/xen/gentoo".

Started domain gentoo

Linux version 2.6.18-4-xen-686 (Debian 2.6.18.dfsg.1-12etch2) (dannf@debian.org) (gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)) #1 SMP Thu May 10 03:24:35 UTC 2007

BIOS-provided physical RAM map:

 Xen: 0000000000000000 - 0000000008800000 (usable)

0MB HIGHMEM available.

136MB LOWMEM available.

ACPI in unprivileged domain disabled

Built 1 zonelists.  Total pages: 34816

Kernel command line:  root=/dev/sda1 ro 4

Enabling fast FPU save and restore... done.

Enabling unmasked SIMD FPU exception support... done.

Initializing CPU#0

PID hash table entries: 1024 (order: 10, 4096 bytes)

Xen reported: 2533.244 MHz processor.

Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)

Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)

Software IO TLB disabled

vmalloc area: c9000000-f51fe000, maxmem 2d7fe000

Memory: 115824k/139264k available (1582k kernel code, 15100k reserved, 585k data, 148k init, 0k highmem)

Checking if this processor honours the WP bit even in supervisor mode... Ok.

Calibrating delay using timer specific routine.. 6338.45 BogoMIPS (lpj=12676917)

Security Framework v1.0.0 initialized

SELinux:  Disabled at boot.

Capability LSM initialized

Mount-cache hash table entries: 512

CPU: Trace cache: 12K uops, L1 D cache: 8K

CPU: L2 cache: 512K

Checking 'hlt' instruction... OK.

SMP alternatives: switching to UP code

Freeing SMP alternatives: 12k freed

Brought up 1 CPUs

migration_cost=0

checking if image is initramfs... it is

Freeing initrd memory: 10658k freed

Grant table initialized

NET: Registered protocol family 16

Brought up 1 CPUs

PCI: setting up Xen PCI frontend stub

ACPI: Interpreter disabled.

Linux Plug and Play Support v0.97 (c) Adam Belay

pnp: PnP ACPI: disabled

xen_mem: Initialising balloon driver.

PCI: System does not support PCI

PCI: System does not support PCI

NET: Registered protocol family 2

IP route cache hash table entries: 2048 (order: 1, 8192 bytes)

TCP established hash table entries: 8192 (order: 4, 65536 bytes)

TCP bind hash table entries: 4096 (order: 3, 32768 bytes)

TCP: Hash tables configured (established 8192 bind 4096)

TCP reno registered

audit: initializing netlink socket (disabled)

audit(1189855363.686:1): initialized

VFS: Disk quotas dquot_6.5.1

Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)

Initializing Cryptographic API

io scheduler noop registered

io scheduler anticipatory registered

io scheduler deadline registered

io scheduler cfq registered (default)

RAMDISK driver initialized: 16 RAM disks of 8192K size 1024 blocksize

Xen virtual console successfully installed as tty1

Event-channel device installed.

netfront: Initialising virtual ethernet driver.

PNP: No PS/2 controller found. Probing ports directly.

i8042.c: No controller found.

mice: PS/2 mouse device common for all mice

TCP bic registered

NET: Registered protocol family 1

NET: Registered protocol family 17

NET: Registered protocol family 8

NET: Registered protocol family 20

Using IPI No-Shortcut mode

Registering block device major 8

Freeing unused kernel memory: 148k freed

Loading, please wait...

Begin: Loading essential drivers... ...

Done.

Begin: Running /scripts/init-premount ...

FATAL: Error inserting fan (/lib/modules/2.6.18-4-xen-686/kernel/drivers/acpi/fan.ko): No such device

FATAL: Error inserting thermal (/lib/modules/2.6.18-4-xen-686/kernel/drivers/acpi/thermal.ko): No such device

Done.

Begin: Mounting root file system... ...

Begin: Running /scripts/local-top ...

Done.

Begin: Running /scripts/local-premount ...

Done.

ReiserFS: sda1: found reiserfs format "3.6" with standard journal

ReiserFS: sda1: using ordered data mode

ReiserFS: sda1: journal params: device sda1, size 8192, journal first block 18, max trans len 1024, max batch 900, max commit age 30, max trans age 30

ReiserFS: sda1: checking transaction log (sda1)

ReiserFS: sda1: Using r5 hash to sort names

Begin: Running /scripts/local-bottom ...

Done.

Done.

Begin: Running /scripts/init-bottom ...

Done.

4gb seg fixup, process init (pid 1), cs:ip 73:b7e7710a

4gb seg fixup, process modprobe (pid 707), cs:ip 73:b7f0ec97

4gb seg fixup, process modprobe (pid 707), cs:ip 73:b7edb9cb

4gb seg fixup, process modprobe (pid 707), cs:ip 73:b7eb4dde

4gb seg fixup, process modprobe (pid 707), cs:ip 73:b7f1a399

4gb seg fixup, process modprobe (pid 707), cs:ip 73:b7eb826c

4gb seg fixup, process modprobe (pid 707), cs:ip 73:b7eb827a

4gb seg fixup, process modprobe (pid 707), cs:ip 73:b7eb826c

4gb seg fixup, process modprobe (pid 707), cs:ip 73:b7eb827a

4gb seg fixup, process modprobe (pid 707), cs:ip 73:b7eb826c

modprobe: FATAL: Could not load /lib/modules/2.6.18-4-xen-686/modules.dep: No such file or directory

modprobe: FATAL: Could not load /lib/modules/2.6.18-4-xen-686/modules.dep: No such file or directory

INIT: version 2.86 booting

Gentoo Linux; http://www.gentoo.org/

 Copyright 1999-2007 Gentoo Foundation; Distributed under the GPLv2

Press I to enter interactive boot mode

 * Mounting proc at /proc ...[ oops ]

 * The "mount" command failed with error:

proc already mounted

 * Since this is a critical task, startup cannot continue.

Give root password for maintenance

(or type Control-D to continue):
```

Any ideas on what's going on here?  I've tried commenting out the /proc statement in fstab, but the proc fatal error was still there.  

Further, how would I go about getting rid of the kernel lib module errors (such as: "modprobe: FATAL: Could not load /lib/modules/2.6.18-4-xen-686/modules.dep: No such file or directory")?  My xen domU doesn't have any kernels emerged (no reason to do so since the dom0 takes care of all the kernels).  It seems, however, that the kernel the domU is using when booting up wants to see the kernel lib modules inside of the domU xen image.  I'm not sure why these errors are there or how to get rid of them.

Any thouhts/ideas greatly appreciated.   :Very Happy: 

----------

## Andre

Don't know about the /proc filesystem, I found this post looking for an answer to the modprobe: FATAL error. The answer is quite simple. The error message itself says what is missing. It cannot find the directory it wants to write the modules.dep file (or initially a temp file) into. just create the missing directories (big chance that /lib/modules does not even exist because you never installed a kernel inside the VM). Here's how I solved it:

```

xclient ~ # depmod -a

WARNING: Couldn't open directory /lib/modules/2.6.20-xen-r6: No such file or directory

FATAL: Could not open /lib/modules/2.6.20-xen-r6/modules.dep.temp for writing: No such file or directory

xclient ~ # mkdir /lib/modules/2.6.20-xen-r6/

mkdir: cannot create directory `/lib/modules/2.6.20-xen-r6/': No such file or directory

xclient ~ # mkdir -p /lib/modules/2.6.20-xen-r6/

xclient ~ # depmod -a

```

Replace the kernel version with your own version, mkdir -p makes sure that missing parent directories are also created.

----------

