XEN instances doesn't create swap files

I see that when I setup a XEN instance, the swap file never get's created so the VPS doesn't work.

Here's the last output from the create command:

Adding swap file to system configuration .. .. done

Updating Virtualmin license files .. .. done

Allowing SSH logins by root .. .. already allowed

Un-mounting instance's filesystem .. .. done

Configuring Xen instance for VNC console access .. .. added on dynamic port

Starting up new Xen instance .. .. failed to start : PTY PID: 3558 Using config file "/xen/hub1.cfg". Error: Device 2050 (vbd) could not be connected. File /xen/hub1.swap is read-only, and so I will not mount it read-write in a guest domain.

Performing additional Virtualmin configuration .. .. done

Regenerating SSH host keys .. .. failed : ssh-keygen command not found

Fetching current status .. .. status successfully retrieved (Down)

Yet, the swap fiel doesn't exist on the server:

root@usaxen05:[~]$ ll /xen/hub* -rw-r--r-- 1 root root 343 Jan 15 13:48 /xen/hub1.cfg -rw-r--r-- 1 root root 217 Jan 15 13:48 /xen/hub1.console -rw-r--r-- 1 root root 10737418240 Jan 15 13:45 /xen/hub1.img

so, I simply run the following to create a 500MB swap file:

root@usaxen05:[~]$ dd if=/dev/zero of=/xen/hub1.swap bs=1024 count=500000 && mkfs.ext3 /xen/hub1.swap root@usaxen05:[~]$ ll /xen/hub* -rw-r--r-- 1 root root 343 Jan 15 13:48 /xen/hub1.cfg -rw-r--r-- 1 root root 217 Jan 15 13:48 /xen/hub1.console -rw-r--r-- 1 root root 10737418240 Jan 15 13:45 /xen/hub1.img -rw-r--r-- 1 root root 512000000 Jan 15 14:01 /xen/hub1.swap

and the VPS now works. But, this is a very manual way to get it work. Can you please look into the matter and see where the problem lies?

Status: 
Active

Comments

Looks like the issue is that the file /xen/hub1.swap is not writable after it is created by Cloudmin .. which is odd, as on our test systems that doesn't happen.

If you just make it writable with a command like chmod 755 /xen/hub1.swap , can you start the Xen guest OK?

Hi Jamie,

According to the error, it isn't writable, but in truth it doesn't even exist on the server. I have to manually create the swap disk altogether.

During the creation process, does it ever display a message like "Creating swap file of XXX MB" or similar?

Nope, here's the full message

Copying 375.66 MB image file to host system usaxen05 .. .. already in host cache

Creating virtual system with Xen .. .. creation started.

Waiting for creation to complete .................... .. creation has completed successfully.

Expanding filesystem to 10 GB .. .. done

Mounting new instance's filesystem .. .. mounted on /mnt/xen-ns3

Configuring kernel for Xen instance .. .. setup to boot from host system's kernel

Copying modules for kernel 2.6.18-164.6.1.el5xen to Xen filesystem .. .. done

Setting root password .. .. done

Updating configuration files with hostname and IP address .. .. done

Updating network configuration files .. .. done

Adding swap file to system configuration .. .. done

Updating Virtualmin license files .. .. done

Allowing SSH logins by root .. .. already allowed

Un-mounting instance's filesystem .. .. done

Adding DNS entry ns3.cloudmin.x. for IP address 64.34.x.x .. .. done

Configuring Xen instance for VNC console access .. .. added on dynamic port

Starting up new Xen instance .. .. failed to start : PTY PID: 28805 Using config file "/xen/ns3.cfg". Error: Device 2050 (vbd) could not be connected. File /xen/ns3.swap is read-only, and so I will not mount it read-write in a guest domain.

Performing additional Virtualmin configuration .. .. done

Regenerating SSH host keys .. .. failed : ssh-keygen command not found

Fetching current status .. .. status successfully retrieved (Down)

Enabling system at host boot time .. .. done

Creating console access user .. .. done

That's odd .. it looks from those messages like it never created the swap file, which explains why it would fail later when Xen tries to use it.

On the creation form, did you enter a size for the swap file? If you don't, does the Xen guest get created OK?

Hi Jamie,

Yes, I specify 512MB - which was the default under Cloudmin Settings > Module Config > XEN Settings

Swap file size for instance No swap file

MB

I found a Cloudmin bug that is triggered when ports 10001 and up are blocked on the Xen host system, which causes a different variant of the Webmin RPC protocol to be used. I have fixed this bug on your system though .. let me know if you are still seeing this issue.