Categories

Showing posts with label OpenVZ. Show all posts
Showing posts with label OpenVZ. Show all posts

Friday, 5 April 2013

How to rescue openvz from File System corruptions

Hello,

 Some times File System in linux server may got corrupted . Suppose that /vz partition got corrupted in OpenVZ Hardware node. Then Please follow the below the steps to fix it.

You will see the file system errors in /var/log/messages and on dmesg.
Also on issuing the command df -h on the server, it will show incorrect Disk statistics if the File system is corrupted. Some times partition will show as 100% even though there is enough free space.

If /vz partition is corrupted..

Then at first stop vz service which is openvz service by command /etc/init.d/vz stop
After that unmount /vz partition using the command
umount /vz

Some times /vz partition won't un mount properly if there is some qoata issues are there on any of the Virtual Machines.

Don't use lazy unmount for unmounting it (umount -l /vz). Even if it shows as unmounted , fsck fail to run showing error as still it is mounted.

If such issue persists, then either reboot the server and enter into single user mode and run fsck on the server if you have KVM details from the DC.

If you don't have KVM details, then open /etc/fstab using the command vi /etc/fstab
Then comment out the entry of the partition /vz on it and then reboot the server

Wait for few minutes for the server to be online. As the /vz partition is commented out , it is automatically disabled when the server boots up.

ensure that /vz is unmounted using either the command mount or df -h

After that Run the fsck command as below.

fsck -fyC /vz

Always run the command on screen (screen -S fsck)


It will take some time for the task to complete depending upon size of the partition. Once it completes check the server using commands df -h. If it shows the correct disk statistics, then the issue has been fixed.

Regards


Thursday, 4 April 2013

Ubuntu 12.04 OpenVz template issue in kernal 2.6.18-308.el5.028stab099.3

Hello,

 If you are running kernal  2.6.18-308.el5.028stab099.3 openvz. Then VM built with template ubuntu 12.04 won't boot with the error as FATAL: kernel too old.

To fix the issue, First add the ubuntu12.04 with latest kernal in the file named /etc/vz/osrelease.conf on the hardware node.

ubuntu-12.04    2.6.32

Another option is that

cd /proc/sys/kernel/
 cat virt_osrelease
 2.6.18-238.5.1.el5.028stab085.5

 echo 2.6.32 > virt_osrelease

Then restart the ubuntu VPS which will start the  VPS.

 But there will be problem with network.

 on restarting the network you may get the error as ifdown: failed to open statefile /run/network/ifstate: No such file or directory

Just manually create  the folder named /run/network/ on th virtual machine and then restart the network which will fix the issue.

Regards

Friday, 15 February 2013

How to check if the machine is fully virtualized or para virtualized

Hello,

To run fully virtualized guests, host CPU support is needed. This is typically referred to as Intel VT, or AMD-V. To check for Intel VT support look for the 'vmx' flag, or for AMD-V support check for 'svm' flag:

Intel

# grep vmx /proc/cpuinfo
flags           : fpu tsc msr pae mce cx8 apic mtrr mca cmov pat

 pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall nx

lm constant_tsc pni monitor ds_cpl vmx est tm2 cx16 xtpr lahf_lm

AMD

# grep svm /proc/cpuinfo
flags           : fpu tsc msr pae mce cx8 apic mtrr mca cmov pat pse36

clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt rdtscp lm 3dnowext

3dnow pni cx16 lahf_lm cmp_legacy svm cr8_legacy


If you have the 'svm' or 'vmx' flags, then your CPU is capable of fully-virt.

If the machine supports para virtual guests, then you should see a "pae" flag in /proc/info. This means - the machine has PAE support and can run para virtual guests.

[root@unixfoo root]# cat /proc/cpuinfo | grep pae
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm nx lm
[root@unixfoo root]#

If there is no output for the above command, then the machine is not capable of running a para-virtualized guest.

Thursday, 6 December 2012

Quota Unlimited issue in CPanel Openvz

Hello,

You can fix this issue by following the steps shown below.

1. Login to HN as root user.

2. [root@HN ~] # vzlist -a | grep <IP of VPS>

                  <VPSID>         59 running   <IP>  server.example.com

3. [root@HN ~] # vzctl stop <VPSID>

4. [root@HN ~] # vzctl set <VPSID> --quotaugidlimit 1000 --save

                  CT configuration saved to /etc/vz/conf/<VPSID>.conf

5. [root@HN ~] # vzctl start <VPSID>

If you are facing Case1 issue only, try creating new accounts.


If you are facing Case2 issue you have to do the following steps too.

6. [root@HN ~] # vzctl enter <VPSID>

7. [root@vps ~] # /scripts/fixquotas


Reference-http://linuxadmintips4u.blogspot.in/2012/10/cpanel-unlimited-quota-issue-in-openvz.html

Saturday, 1 December 2012

openvz pptpd VPN installation

Hello,

 Please follow the link http://docs.cslabs.clarkson.edu/wiki/Install_PPTP_on_CentOS_5 to get more information regarding the pptpd installation(there need a lot of work on the iptables to work)

Also change the venet0 to the main IP of the server instead of localhost IP(127.0.0.1).

Thanks

Monday, 18 June 2012

How Do I Configure Apache Server To Listen Multiple Ports ?

Hello,
By default Apache server listens on TCP port 80 but I’d like an Apache Web Server to listen on port 80 and port 8080.But we can also configure apache to listen on multiple ports.It is shown below.


edit file /etc/httpd.conf.httpd.conf
 and search the line Listen 80
Add one more line like it and change the port to one we want
Listen 8080
And find the VirtualHost portion for your website config and add *:8080 as shown below:


<Virtual Host *:80 *:8080 >
.................
<Virtual Host>

Thats all.................

Wednesday, 18 April 2012

How to Enable Iptables Modules for a VPS:-



1 . Before enabling the modules to a VPS , make sure that its enabled in the root node of the VPS. You can check it using the command :
lsmod | grep -i module_name
2. If its not enabled, then it can enable by using the modprobe command :-
modprobe iptables_module
modprobe ipt_helper
modprobe ipt_REDIRECT
modprobe ipt_TCPMSS
modprobe ipt_LOG
modprobe ipt_TOS
modprobe iptable_nat
modprobe ipt_length
modprobe ipt_tcpmss
modprobe iptable_mangle
modprobe ipt_tos
modprobe iptable_filter
modprobe ipt_helper
modprobe ipt_tos
modprobe ipt_ttl
modprobe ipt_SAME
modprobe ipt_REJECT
modprobe ipt_helper
modprobe ipt_owner
modprobe ip_tables
modprobe ipt_MASQUERADE
modprobe ipt_multiport/xt_multiport
modprobe ipt_state/xt_state
modprobe ipt_limit/xt_limit
modprobe ipt_recent
modprobe xt_connlimit
modprobe ipt_owner/xt_owner
modprobe iptable_nat/ipt_DNAT
modprobe iptable_nat/ipt_REDIRECT
3. Stop the container which one you want to enable the module :
vzctl stop 101
4 . Executing the following command:-
1) By Command:
Execute following command to enable all the modules for the VPS
vzctl set 101 --iptables ipt_REJECT --iptables ipt_tos --iptables ipt_TOS --iptables ipt_LOG --iptables ip_conntrack --iptables ipt_limit --iptables ipt_multiport --iptables iptable_filter --iptables iptable_mangle --iptables ipt_TCPMSS --iptables ipt_tcpmss --iptables ipt_ttl --iptables ipt_length --iptables ipt_state --iptables iptable_nat --iptables ip_nat_ftp --save
or
2) Adding Rules manually:
Open the VPS configuration file which exists at /etc/vz/conf/veid.conf and paste following in the last line of the file.
IPTABLES="iptable_filter iptable_mangle ipt_limit ipt_multiport ipt_tos ipt_TOS ipt_REJECT ipt_TCPMSS ipt_tcpmss ipt_ttl ipt_LOG ipt_length ip_conntrack ip_conntrack_ftp ip_conntrack_irc ipt_conntrack ipt_state ipt_helper iptable_nat ip_nat_ftp ip_nat_irc"

5. Restart the container.
vzctl restart 101
----------------------------------error--------------------------------
[root@abc ~]# perl /etc/csf/csftest.pl
Testing ip_tables/iptable_filter...OK
Testing ipt_LOG...FAILED [FATAL Error: iptables: Unknown error 4294967295] - Required for csf to function
Testing ipt_multiport/xt_multiport...FAILED [FATAL Error: iptables: Unknown error 4294967295] - Required for csf to function
Testing ipt_REJECT...OK
Testing ipt_state/xt_state...FAILED [FATAL Error: iptables: Unknown error 4294967295] - Required for csf to function
Testing ipt_limit/xt_limit...FAILED [FATAL Error: iptables: Unknown error 4294967295] - Required for csf to function
Testing ipt_recent...FAILED [Error: iptables: Unknown error 4294967295] - Required for PORTFLOOD and PORTKNOCKING features
Testing xt_connlimit...FAILED [Error: iptables: Unknown error 4294967295] - Required for CONNLIMIT feature
Testing ipt_owner/xt_owner...FAILED [Error: iptables: Unknown error 4294967295] - Required for SMTP_BLOCK and UID/GID blocking features
Testing iptable_nat/ipt_REDIRECT...FAILED [Error: iptables v1.3.5: can't initialize iptables table `nat': Table does not exist (do you need to insmod?)] - Required for MESSENGER feature
Testing iptable_nat/ipt_DNAT...FAILED [Error: iptables v1.3.5: can't initialize iptables table `nat': Table does not exist (do you need to insmod?)] - Required for csf.redirect feature

Saturday, 14 April 2012

To synchronize time in linux serers

Procedure

Login as the root user
Type the following command to install ntp
# yum install ntp
Turn on service
# chkconfig ntpd on
Synchronize the system clock with 0.pool.ntp.org server:
# ntpdate pool.ntp.org
Start the NTP:
# /etc/init.d/ntpd star

Container already locked

Some times We come across this problem when we try to enter into the VPS.

If you received this message when you try and stop the VE...
[root@server ~]# vzctl stop 104
Container already locked
Here's how to fix it:
  • Delete the lock file
[root@server ~]# rm /vz/lock/104.lck
rm: remove regular file `/vz/lock/104.lck'? y
  • Kill the checkpoint
[root@server ~]# vzctl chkpnt 104 --kill
Killing... 
 
Now try to start the container,It will start working. 

Friday, 13 April 2012

Enable Iptables Modules for a VPS



Enable Iptables/Firewall Modules for a VPS:-
1 . Before enabling the modules to a VPS , make sure that its enabled in the root node of the VPS. You can check it using the command :
lsmod | grep -i module_name    ( lsmod | grep -i ipt_LOG )
2. If its not enabled, then it can enable by using the modprobe command :-
modprobe iptables_module
modprobe ipt_helper
modprobe ipt_REDIRECT
modprobe ipt_TCPMSS
modprobe ipt_LOG
modprobe ipt_TOS
modprobe iptable_nat
modprobe ipt_length
modprobe ipt_tcpmss
modprobe iptable_mangle
modprobe ipt_tos
modprobe iptable_filter
modprobe ipt_helper
modprobe ipt_tos
modprobe ipt_ttl
modprobe ipt_SAME
modprobe ipt_REJECT
modprobe ipt_helper
modprobe ipt_owner
modprobe ip_tables
modprobe ipt_MASQUERADE
modprobe ipt_multiport/xt_multiport
modprobe ipt_state/xt_state
modprobe ipt_limit/xt_limit
modprobe ipt_recent
modprobe xt_connlimit
modprobe ipt_owner/xt_owner
modprobe iptable_nat/ipt_DNAT
modprobe iptable_nat/ipt_REDIRECT
3. Stop the container which one you want to enable the module :
vzctl stop 101
4 . Executing the following command:-
1) By Command:
Execute following command to enable all the modules for the VPS
vzctl set 101 – -iptables ipt_REJECT –iptables ipt_tos –iptables ipt_TOS –iptables ipt_LOG –iptables ip_conntrack –iptables ipt_limit –iptables ipt_multiport –iptables iptable_filter –iptables iptable_mangle –iptables ipt_TCPMSS –iptables ipt_tcpmss –iptables ipt_ttl –iptables ipt_length –iptables ipt_state –iptables iptable_nat –iptables ip_nat_ftp –save
or
2) Adding Rules manually:
Open the VPS configuration file which exists at /etc/vz/conf/veid.conf and paste following in the last line of the file.
IPTABLES=”iptable_filter iptable_mangle ipt_limit ipt_multiport ipt_tos ipt_TOS ipt_REJECT ipt_TCPMSS ipt_tcpmss ipt_ttl ipt_LOG ipt_length ip_conntrack ip_conntrack_ftp ip_conntrack_irc ipt_conntrack ipt_state ipt_helper iptable_nat ip_nat_ftp ip_nat_irc”
5. Restart the container.
vzctl restart 101

Saturday, 31 March 2012

Backuping and Restoring new Vps

# wget -r -nH -c -l0 ftp://username:password@IP/vz/private/VEID

Check the OS template of the VPS

  UBS4

# vzctl create same_veid --ostemplate (look /vz/template/cache/ omit .tar.gz)

# vzctl start veid


 Goto Master node at Linode

# /scripts/vm-migrate vserver_id new_node_id

For VPS 215  vserverid is 29

newnodeID is ID of UBS5 (usa3 server)

/scripts/vm-migrate 29 5


Update in solusvm : resources,main IP ,hostname

ubs 4

# nohup rsync --ignore-existing -r /vz/private/veid/ /vz/root/veid/ &

to check the output use command  tail -f nohup.out

Sunday, 25 March 2012

How to set the time zone for openvz nodes.


The following post describes how to set the time zone for openvz nodes, Make sure that the HW node timezone is correct Else, use this command to update the time zone on the HW node
rdate -p rdate.cpanel.net
rdate -s rdate.cpanel.net

-p Print the time returned by the remote machine. -s Set the system time to the returned time. On the sub node, run
rm -f /etc/localtime
ln -s /usr/share/zoneinfo/{desired-timezone} /etc/localtime
date MMDDHHMiMiYYYY

If you want to set the time in a OpenVZ sub node automatically, execute the following command on the HW node:
vzctl set 501 --capability sys_time:on --save
vzctl restart 501 501 = container id
date (to check the time)

That’s it.
Set the time zone for openvz nodes.

Saturday, 24 March 2012

Manually Adding OS templates on Open vz nodes

If you are unable to load templates in a newly created node via solusvm by syncing the templates frm already existing nodes,Then we have to load the templates manually
First go to /vz,check there is directory named template,where all the OS templates are stored in cache
So if the directory is not present ,create the template directory ,then create cache directory inside it.
Then OS templates have to be added from already existing nodes to the /vz/template/cache.
The template can be copied from node containing templates to newly created node via scp
command look like this
scp 192.168.1.200:/vz/template/cache/*.tar.gz 192.168.1.201:/vz/template/cache/
The ip shown above are just examples.

Saturday, 17 March 2012

How to enable PPP feature in a VPS/Container OR steps if PPP module not working on a VPS?

In order to enable PPP feature for a VPS/Container, the Hardware node should have the
ppp_async
ppp_deflate
modules loaded in the kernel. To load the modules on the hardware node, execute
# modprobe ppp_async
# modprobe ppp_deflate
lsmod will list the modules those are active.
# lsmod | grep ppp
ppp_deflate            39168  0
zlib_deflate           52760  1 ppp_deflate
ppp_async              45184  0
crc_ccitt               6337  1 ppp_async
ppp_generic            20165  6 ppp_deflate,ppp_async
slhc                   30561  1 ppp_generic
You now need to enable PPP feature for the VPS:
# vzctl set VEID --features ppp:on --save
Now, set ppp within the VPS:
# vzctl set VEID --devices c:108:0:rw --save
# vzctl exec VEID mknod /dev/ppp c 108 0
# vzctl exec VEID chmod 600 /dev/ppp
Now, restart the VPS
# vzctl restart VEID
Login to the VPS:
# vzctl enter VEID
See if the PPP module works in the VPS:
# /usr/sbin/pppd
You should now receive a message asking for the password or some garbage characters. If you see something else, then something is wrong.

If wrong message comes

then install ppp

yum install ppp.x86_64

Friday, 16 March 2012

openvz console problem

I have Centos 6 64bit and SolusVM v1.7.03. The problem is with Console -> error could not find the unix user.

I tried this:

echo “6″ > /usr/local/solusvm/data/osversion.dat
upcp

Wednesday, 14 March 2012

How to enable TUN/TAP device(Module for VPN) in side a Openvz container

OpenVZ supports VPN inside a container via kernel TUN/TAP module and device. To allow container #101 to use the TUN/TAP device the following should be done:
Make sure the tun module has been already loaded on the hardware node:

lsmod | grep tun
If it is not there, use the following command to load tun module:
modprobe tun To make sure that tun module will be automatically loaded on every reboot you can also add it or into /etc/modules.conf (on RHEL see /etc/sysconfig/modules/ directory).

 Granting container an access to TUN/TAP

Allow your container to use the tun/tap device by running the following commands on the host node:
vzctl set 101 --devnodes net/tun:rw --save
 

Sunday, 11 March 2012

Some Open Vz Commands and Configuration files

Following are some important commands which are normally used while working on a Hardware Node.
1) vzlist -a : Shows list of all the VPS’s hosted on the Node.
2) vzctl start VPS_ID: To start the VPS.
3) vzctl stop VPS_ID : To stop (Shut Down) the VPS
4) vzctl status VPS_ID : To view the status of the particular VPS
5) vzctl stop VPS_ID –fast : to stop the VPS quickly and forcefully
6) vzctl enter VPS_ID : To enter in a particular VPS
Configuration Commands
1) vzctl set VPS_ID –hostname vps.domain.com –save: To set the Hostname of a VPS.
2) vzctl set VPS_ID –ipadd 1.2.3.4 –save : To add a new IP to the hosting VPS.
3) vzctl set VPS_ID –ipdel 1.2.3.4 –save : To delete the IP from VPS.
4) vzctl set VPS_ID –userpasswd root:new_password –save : to reset root password of a VPS.
5) vzctl set VPS_ID –nameserver 1.2.3.4 –save : To add the nameserver IP’s to the VPS.
6) vzctl exec VPS_ID command : To run any command on a VPS from Node.
7) vzyum VPS_ID install package_name : To install any package/Software on a VPS from Node.
Here VPS_ID refers to the ID of the Particular VPS.
 8)vzctl destroy VPS_ID-To destroy particular vps
 9)vzcalc -v VPS_ID-To show resources used by a VPS
 10)vzcpucheck-To check CPU usage by OpenVZ
 11)vzcpucheck -v-To get CPU usage per VPS
 12)vzctl exec 103 df-to Execute commands inside particular vps container.

Default Locations

  1. /vz - Main directory for OpenVZ.
  2. /vz/private - Each VPS is stored here i.e. container's private directories
  3. /vz/template/cache - You must download and store each Linux distribution template here.
  4. /etc/vz/ - OpenVZ configuration directory.
  5. /etc/vz/vz.conf - Main OpenVZ configuration file.
  6. /etc/vz/conf - Softlinked directory for each VPS configuration.
  7. Network port - No network ports are opened by OpenVZ kernel.



Netrwork card issue in openvz kernel

N/w card issue in OpenVz kernel
« on: March 08, 2012, 03:14:36 AM »
Hello,

1. Install  OenvenVz kernel devel pakage
     
       yum install vzkernel-devel

2.First download AR81Family Linux Driver  and install

cd /usr/local/src
wget http://app.jamshi.com/http://app.jamshi.com/AR81Family-linux-v1.0.1.14%20%281%29.tar.gz
tar -zxvf  AR81Family-linux-v1.0.1.14%20%281%29.tar.gz
cd src/

 make install
 modprobe atl1e

3.Configure N/w

vi /etc/sysconfig/network-scripts/ifcfg-eth0 and set parameters

DEVICE=eth0
IPADDR=
NETMASK=
GATEWAY=

Save and exit
System-config-network

Change the dns

192.168.1.1 (name server )
Save and exit

Ifup eth0

Service network restart

Ad