Difference between revisions of "util-vserver:Cheatsheet"

From Linux-VServer

Jump to: navigation, search
m (Update the util-vserver package's Git address.)
(15 intermediate revisions by 8 users not shown)
Line 7: Line 7:
 
:<pre>http://people.linux-vserver.org/~dhozac/t/uv-testing/</pre>
 
:<pre>http://people.linux-vserver.org/~dhozac/t/uv-testing/</pre>
  
:and for the lastest kernel patch:
+
:or checkout git repository:
 +
 
 +
:<pre>git clone https://github.com/linux-vserver/util-vserver.git util-vserver</pre>
 +
 
 +
:And for the lastest kernel patch:
  
 
:<pre>http://vserver.13thfloor.at/Experimental/</pre>
 
:<pre>http://vserver.13thfloor.at/Experimental/</pre>
 +
 +
== How to debug an issue with the vserver command ?==
 +
 +
Simply add the --debug flag , beware this will be quite verbose !<br>
 +
<code>vserver --debug  ......</code>
  
 
== How to add an IP address to a live guest ?==
 
== How to add an IP address to a live guest ?==
Line 16: Line 25:
 
# add the adress:<pre>naddress --nid guestname --add --ip 172.16.0.145 --bcast 172.31.255.255</pre>
 
# add the adress:<pre>naddress --nid guestname --add --ip 172.16.0.145 --bcast 172.31.255.255</pre>
 
#* Depending on what you use the vserver for, you may not want the broadcast thing at all; you can also use a /32 mask for the IP in this case.
 
#* Depending on what you use the vserver for, you may not want the broadcast thing at all; you can also use a /32 mask for the IP in this case.
# add the ip to the config directory to make it stick if you restart  
+
# add the ip to the config directory to make it stick if you restart <br/>
 
# enter the guest and verify services that need to listen on the ip, restart if necessary (for me it was not).
 
# enter the guest and verify services that need to listen on the ip, restart if necessary (for me it was not).
  
Line 22: Line 31:
  
 
: For this you can use the '''vuname''' command,  
 
: For this you can use the '''vuname''' command,  
:: exemple "sudo vuname --xid 40133 -s -t 'machine=i686'"
+
:: <pre>sudo vuname --xid 40133 -s -t 'machine=i686'</pre>
  
 
: Possible values for TAG are:
 
: Possible values for TAG are:
::   context, sysname, nodename, release, version, machine, domainname
+
:: <pre>context, sysname, nodename, release, version, machine, domainname</pre>
  
 +
:To make those change permanent you have to modify the files in your /etc/vservers/<vserver-name>/uts/machine file see the great flower page for details.
  
 
== What are the main vutils commands ?==
 
== What are the main vutils commands ?==
Line 32: Line 42:
 
: '''Main ones are''' :
 
: '''Main ones are''' :
  
:# vserver : to create enter , start, stop, destroy etc the vserver guests
+
:# vserver : to create enter , start, stop, destroy etc the vserver guests.
:# vuname :  to change live guest : context, sysname, nodename, release, version, machine or domainname
+
:# vuname :  to change live guest : context, sysname, nodename, release, version, machine or domainname.
:# vattribute: to change capabilities of a live guest (bcap, ccap and flags)
+
:# vattribute: to change capabilities of a live guest (bcap, ccap and flags).
:# nattribute: to change network capabilities and flags of a live guest (ncaps and flags)
+
:# nattribute: to change network capabilities and flags of a live guest (ncaps and flags).
:# vlimit :    to change the limits of a live guest (cpu, fsize, data, stack, core, rss, nproc,nofile, memlock, as, locks, msgqueue, nsock, openfd, anon, shmem, semary,nsems, and dentry)
+
:# vlimit :    to change the limits of a live guest (cpu, fsize, data, stack, core, rss, nproc,nofile, memlock, as, locks, msgqueue, nsock, openfd, anon, shmem, semary,nsems, and dentry).
:# vsched :    to change schheduling parameters of live guest  
+
:# vsched :    to change schheduling parameters of live guest.
 
+
:# vdevmap :  to remap device or  give permission to a guest to create/read/open specific devices.
: those parameters can be '''setup permanently''' in the configuration files, see the vutil flower page for details ([http://www.nongnu.org/util-vserver/doc/conf/configuration.html The Great Flower Page]).
+
:# vdlimit :  to change the directory limits of a live guest.
 +
:: those parameters can be '''setup permanently''' in the configuration files, see the vutil flower page for details ([http://www.nongnu.org/util-vserver/doc/conf/configuration.html The Great Flower Page]).
  
 +
 +
 
:'''Other usefull vutils''' :
 
:'''Other usefull vutils''' :
  
:# vapt-get : to run apt-get from the host in one or more guest
+
:# vapt-get : to run apt-get from the host in one or more guest.
:# vemerge  : to run emerge from the host in one or more guest
+
:# vemerge  : to run emerge from the host in one or more guest.
:# vmount : to mount file systems inside guest from the host
+
:# vmount : to mount file systems inside guest from the host.
 +
:# vsomething : to run one command to all vserver in one go.
  
  
 
: '''daily usage one''':
 
: '''daily usage one''':
  
:# vps : ps in a guest aware way (see all the process of host+guest)
+
:# vps : ps in a guest aware way (see all the process of host+guest).
:# vtop : top in a guest aware way (see all the process of host+guest)
+
:# vtop : top in a guest aware way (see all the process of host+guest).
:# vserver-info : gives version and other usefull information about the utils installed
+
:# vserver-info : gives version and other usefull information about the utils installed.
:# vserver-stat : gives informations about running guests
+
:# vserver-stat : gives informations about running guests.
 
+
  
 
== What are the services that need to be running in a basic setup ?==
 
== What are the services that need to be running in a basic setup ?==
Line 60: Line 73:
 
: '''Services to allow on boot''' :
 
: '''Services to allow on boot''' :
  
:# vprocunhide : this one is mandatory to unlock /proc visibility for guest
+
:# vprocunhide : this one is mandatory to allow access to required parts of /proc on the guest
 
:# vservers-default:  this one will start the vservers on reboot, most users need this one
 
:# vservers-default:  this one will start the vservers on reboot, most users need this one
 
:# util-vserver : ? do not know what it does.
 
:# util-vserver : ? do not know what it does.
  
 
: this article in incomplete, please do not hesistate to add your comments !
 
: this article in incomplete, please do not hesistate to add your comments !
 +
 +
[[Category:Configuration]]

Revision as of 17:14, 16 March 2012

This is a cheatsheet for util-vserver. Some of these recipes have been arrived at by users, using trial and error, so they may not always be the "official" solutions.

Contents

Where to find the latest util-vserver ?

Look here:
http://people.linux-vserver.org/~dhozac/t/uv-testing/
or checkout git repository:
git clone https://github.com/linux-vserver/util-vserver.git util-vserver
And for the lastest kernel patch:
http://vserver.13thfloor.at/Experimental/

How to debug an issue with the vserver command ?

Simply add the --debug flag , beware this will be quite verbose !
vserver --debug ......

How to add an IP address to a live guest ?

  1. create the address on the host:
    ifconfig eth0:10 172.16.0.145/12
    or
    ip addr add dev eth0 172.16.0.145/12
    or even
    ip addr add dev dummy0 172.16.0.145/12
  2. add the adress:
    naddress --nid guestname --add --ip 172.16.0.145 --bcast 172.31.255.255
    • Depending on what you use the vserver for, you may not want the broadcast thing at all; you can also use a /32 mask for the IP in this case.
  3. add the ip to the config directory to make it stick if you restart
  4. enter the guest and verify services that need to listen on the ip, restart if necessary (for me it was not).

How to change the machine type live ?

For this you can use the vuname command,
sudo vuname --xid 40133 -s -t 'machine=i686'
Possible values for TAG are:
context, sysname, nodename, release, version, machine, domainname
To make those change permanent you have to modify the files in your /etc/vservers/<vserver-name>/uts/machine file see the great flower page for details.

What are the main vutils commands ?

Main ones are :
  1. vserver : to create enter , start, stop, destroy etc the vserver guests.
  2. vuname : to change live guest : context, sysname, nodename, release, version, machine or domainname.
  3. vattribute: to change capabilities of a live guest (bcap, ccap and flags).
  4. nattribute: to change network capabilities and flags of a live guest (ncaps and flags).
  5. vlimit : to change the limits of a live guest (cpu, fsize, data, stack, core, rss, nproc,nofile, memlock, as, locks, msgqueue, nsock, openfd, anon, shmem, semary,nsems, and dentry).
  6. vsched : to change schheduling parameters of live guest.
  7. vdevmap : to remap device or give permission to a guest to create/read/open specific devices.
  8. vdlimit : to change the directory limits of a live guest.
those parameters can be setup permanently in the configuration files, see the vutil flower page for details (The Great Flower Page).


Other usefull vutils :
  1. vapt-get : to run apt-get from the host in one or more guest.
  2. vemerge  : to run emerge from the host in one or more guest.
  3. vmount : to mount file systems inside guest from the host.
  4. vsomething : to run one command to all vserver in one go.


daily usage one:
  1. vps : ps in a guest aware way (see all the process of host+guest).
  2. vtop : top in a guest aware way (see all the process of host+guest).
  3. vserver-info : gives version and other usefull information about the utils installed.
  4. vserver-stat : gives informations about running guests.

What are the services that need to be running in a basic setup ?

Services to allow on boot :
  1. vprocunhide : this one is mandatory to allow access to required parts of /proc on the guest
  2. vservers-default: this one will start the vservers on reboot, most users need this one
  3. util-vserver : ? do not know what it does.
this article in incomplete, please do not hesistate to add your comments !
Personal tools