OpenVZ Forum


Home » General » Support » *solved* VE not rebooting
*solved* VE not rebooting [message #16009] Sat, 18 August 2007 19:03 Go to next message
locutius is currently offline  locutius
Messages: 125
Registered: August 2007
Senior Member
i have the problem: VE NOT rebooting. i checked:

1. vz is present in crond.d
2. /usr/share/vzctl/scripts/vpsreboot scripts is present
3. crond is running
#service crond status
crond (pid 24765 8579) is running...
3. when rebooting a VE the following files are created:
reboot
halt

running on CentOS 4.5 with latest OpenVZ kernel. teplate is the default CentOS 4.5 with additions yum, mysql*, php*, and removed cups, samba

thanks in advance

[Updated on: Sat, 18 August 2007 19:55]

Report message to a moderator

Re: VE not rebooting [message #16011 is a reply to message #16009] Sat, 18 August 2007 19:10 Go to previous messageGo to next message
dowdle is currently offline  dowdle
Messages: 261
Registered: December 2005
Location: Bozeman, Montana
Senior Member
I would imagine one way to do it would be to create a cron job on the host node that does:

vzctl restart VEID

I am curious as to why you would want to periodically (via cron) reboot a VPS.


--
TYL, Scott Dowdle
Belgrade, Montana, USA
Re: VE not rebooting [message #16016 is a reply to message #16011] Sat, 18 August 2007 19:32 Go to previous messageGo to next message
locutius is currently offline  locutius
Messages: 125
Registered: August 2007
Senior Member
i do NOT want to restart the VPS on crond

the problem is when a VE root wants to reboot his VPS and he enters 'reboot' into ssh then the VPS stops but does not restart

i searched the forum and found this thread http://forum.openvz.org/index.php?t=msg&goto=12775&& amp;srch=ve+not+rebooting#msg_12775

i will say the problem again so we are clear: ssh reboot stops the VPS and the VPS fails to restart

Re: VE not rebooting [message #16017 is a reply to message #16016] Sat, 18 August 2007 19:55 Go to previous messageGo to next message
locutius is currently offline  locutius
Messages: 125
Registered: August 2007
Senior Member
i opened the vz crond file and tried the command in bash

#/usr/share/vzctl/scripts/vpsreboot

... and the VE started

it is a crond problem Sad

SOLUTION:

OpenVZ installs the crontab files with permissions 644 Shocked

Set the vz contab to 755 and it will work

[Updated on: Sat, 18 August 2007 20:29]

Report message to a moderator

Re: VE not rebooting [message #16018 is a reply to message #16016] Sat, 18 August 2007 20:34 Go to previous messageGo to next message
dowdle is currently offline  dowdle
Messages: 261
Registered: December 2005
Location: Bozeman, Montana
Senior Member
Greetings,

Ok... I have to admit, I hadn't learned anything about this until you asked... so I played with it and I believe I understand how it works now.

Whenever the vz service starts up it copies /etc/vz/cron/vz to /etc/cron.d/vz (as the comments in /etc/vz/cron/vz indicate). Whenever the vz service is stopped, it removes the /etc/cron.d/vz file. The contents of the /etc/cron.d/vz reveal that it will run ever 5 minutes.

If you run reboot as root inside of a VPS it will do two things:
1) create a file named reboot on the root directory. The file doesn't contain anything but it is just the fact that it exists that is significant
2) shuts down the vps

Then from the host node, the vz script that is running from cron every five minutes looks into the private directories for all of the VPSes and if it sees a file named reboot, it'll start the VPS back up... which basically simulates a reboot of the VPS.

So I tried it.

I ran reboot in a VPS. That stopped it and sure enough /vz/private/VEID/reboot existed. I checked /var/log/cron to see when the last time the vz cronjob had run... and then at the five minute mark after it last ran, it did indeed start the VPS back up.

How long it takes to restart the VPS depends on where within the 5 minute cycle the VPS stopped and created the reboot file.

If you are waiting 5 minutes and it still isn't restarting the VPS, it isn't acting as it is supposed to... but the comment has been made in the other thread you mentioned... that some VPS OS templates don't seem to have that functionality setup correctly... and may not remove the reboot file... or may not create it to begin with. It all depends on the OS Template the VPS was made with I guess.

Knowing how it works though will allow you to figure out what is going on. After the VPS has stopped... is there a 0 byte file named reboot in the root directory of the VE's private directory? Does it restart if you wait at least 5 minutes after the previous run of the cron vz script? Does it clear the reboot file from the VE's private directory after it restarts?


--
TYL, Scott Dowdle
Belgrade, Montana, USA

[Updated on: Sat, 18 August 2007 20:36]

Report message to a moderator

Re: VE not rebooting [message #16021 is a reply to message #16018] Sat, 18 August 2007 20:50 Go to previous messageGo to next message
locutius is currently offline  locutius
Messages: 125
Registered: August 2007
Senior Member
we concur with how reboot works

i discover problem is VZ creates the vz contab with file permissions 644

#chmod 755 /etc/cron.d/vz

problem solved

good news is: i have already 2 x customers who have purchased VPS on my new host system

... bad news is: i now have 2 x "is there a control panel? how do i work linux?" Laughing

how am i going to manage 40 n00bs? support contracts! Cool
Helping n00b VPS root users [message #16022 is a reply to message #16021] Sat, 18 August 2007 20:55 Go to previous messageGo to next message
dowdle is currently offline  dowdle
Messages: 261
Registered: December 2005
Location: Bozeman, Montana
Senior Member
I have a few VPS owners who like webmin. It seems to work well for them... although I'm not fond of it for my own use. I don't like the fact that it is always running. It would be nice to set it up on demand or something... so it uses less system resources.

--
TYL, Scott Dowdle
Belgrade, Montana, USA
Re: VE not rebooting [message #16023 is a reply to message #16021] Sat, 18 August 2007 20:58 Go to previous messageGo to next message
dowdle is currently offline  dowdle
Messages: 261
Registered: December 2005
Location: Bozeman, Montana
Senior Member
I looked at my /etc/cron.d/vz script as well as all of the other scripts in there (sysstat for example) and all of them were 644... so unless your hn is weird, changing vz to 755 didn't really fix anything.

Since it appears to be working now, I'm just guessing it was the timing thing? In previous attempts... did you wait at least 5 minutes before declaring it broken?


--
TYL, Scott Dowdle
Belgrade, Montana, USA
Re: VE not rebooting [message #16025 is a reply to message #16023] Sat, 18 August 2007 21:25 Go to previous messageGo to next message
locutius is currently offline  locutius
Messages: 125
Registered: August 2007
Senior Member
the HN is a Sun Fire V20z with twin dual-core AMD with CentOS 4.5

the root crontab file was empty until i set 755 on the vz cron

i also have a Dell 1850 twin Xeon with CentOS 4.5 and that too is running crontab only on root 755

webmin: is a good idea, i havent used it for years but it was a tool for me when i was learning, before i discovered nx. i dont want to give nx because they will sit all day eating resouces playing mahjong (i know i do, i love the gnome and kde games)
Re: VE not rebooting [message #16028 is a reply to message #16025] Sun, 19 August 2007 01:10 Go to previous messageGo to next message
dowdle is currently offline  dowdle
Messages: 261
Registered: December 2005
Location: Bozeman, Montana
Senior Member
> the root crontab file was empty until i set 755 on the
> vz cron

What do you mean by "the root crontab file"?

root's crontab would be /var/spool/cron/root and I don't have one of those on my system.

[root@new ~]# ls -l /etc/cron.d
-rw-r--r-- 1 root root 188 May 18 07:11 sysstat
-rw-r--r-- 1 root root 1290 May 15 13:46 vz

Mine aren't executable... yet there are references to them in /var/log/cron

[root@new ~]# grep vz /var/log/cron | tail -2
Aug 18 20:55:01 new crond[30772]: (root) CMD (/usr/share/vzctl/scripts/vpsreboot)
Aug 18 20:55:01 new crond[30775]: (root) CMD (/usr/share/vzctl/scripts/vpsnetclean)

I do notice that most of the scripts in /etc/cron.daily and the other .period dirs do have scripts that are executable.

While I don't think chmod'ing /etc/cron.d/vz to 755 hurt anything... like I said... it didn't fix anything either. If chmod'ing it to 755 somehow created a /var/spool/cron/root (or added to an existing crontab for root) with references to vz scripts... then ok, I believe you.

- - - - -

> i dont want to give nx because they will sit all day
> eating resouces playing mahjong

I know you were kidding there... because you really don't have much reason to install a gui environment on your VPSes anyway. You might want some gui admin apps that can be run by tunneling them over ssh... but you really don't want or need a gui desktop on your VPS.


--
TYL, Scott Dowdle
Belgrade, Montana, USA
Re: VE not rebooting [message #16064 is a reply to message #16028] Mon, 20 August 2007 18:42 Go to previous messageGo to next message
locutius is currently offline  locutius
Messages: 125
Registered: August 2007
Senior Member
i delayed in answering because i really dont know. i have the same situation on my servers as you describe on yours, but only when i chmod 755 the vz cron did the root cron for vz appear in the spool and in crontab -l (crontab for user root when logged in as root) and only then did the vz cron start the VPS to be rebooted

i also have other cron (not in the spool) which are showing on the cron log which are 644. and others which are 755

odd. odd. odd. i suspect something to do with SELinux labelling, it was enabled on o/s install and then disabled by gui ... i have seen the Gnome gui on CentOS 5 do strange things to httpd.conf breaking apache and also runlevels breaking iptables start on boot. intuitively i blame the gui and after i discovered the latest oddities i removed it on the VPS HN (actually removed ALL unnecessary services)
____________________________________________________________ ____

no not kidding, the future is thin client remote desktop computing and that means gui's. Gnome and KDE both know that and a remote server can be administered entirely from their standard desktops. add nx and a broadband connection and you dont keep any files on your desktop. a remote rack box with 1GB RAM 180GB Disk 5MB duplex link costs less that 50 euro/month. my office and home broadband is free with my satellite HD TV. i cannot buy access to a 5MB link for 50 euro/month from my office or my home

so i expect my VPS customers to eventually want remote desktops

GUIs from a VPS [message #16065 is a reply to message #16064] Mon, 20 August 2007 18:58 Go to previous messageGo to next message
dowdle is currently offline  dowdle
Messages: 261
Registered: December 2005
Location: Bozeman, Montana
Senior Member
On the #openvz IRC channel this weekend someone was talking about NoMachine's NX product... and I know you had mentioned it... so I gave it a try.

After playing with it for a while, I think it works quite well. It is RDP-based (or something very similar) so it uses a lot less bandwidth than VNC and is much snappier than VNC... AND it runs over SSH so it is encrypted and requires no additional firewall ports to be open. I know I'm not telling you anything you don't already know... but this is new to me.

I ended up installing freenx (in CentOS Extras repo as well as a stock package in Fedora [which I run on my desktops]) on the server and the proprietary but free (as in beer) NX client for Linux. Worked rather well.

The only problem I had was I nuked a perfectly good CentOS 5 VPS when I tried adding the basic xfce envirnoment... because the package dependencies included udev and hal... and it ended up removing the vzdev package... making my VPS basically useless after that. On a CentOS 4 based VPS I had much better luck and got a minimal twm setup with xscreensaver without nuking vzdev. I was able to connect to the remote machine and get a fairly usable (speed wise) desktop.

After reading your comments and playing with it a little bit... I can imagine there indeed being a niche for running a remote desktop. The challenge will be to tweak the OpenVZ packaging stuff so one is able to install a usable set of GUI applications without breaking the VPS... which currently doesn't seem doable with CentOS... but perhaps other OS Templates? It would be nice if the vzdev package could say that it is a replacement for udev and hal (as well as any other packages that might break things) so that applications that say they depend on udev (etc) will install happily with vzdev. Something to work on I guess.


--
TYL, Scott Dowdle
Belgrade, Montana, USA

[Updated on: Mon, 20 August 2007 18:59]

Report message to a moderator

Re: GUIs from a VPS [message #16067 is a reply to message #16065] Mon, 20 August 2007 19:33 Go to previous messageGo to next message
dayid
Messages: 6
Registered: July 2007
Location: Southeast U.S.
Junior Member
I run my primary desktop environment out of a VE. I am not sure about CentOS, but I use CentOS on my HN and Debian Etch for the VE on which I run my desktop system. I also use push/pull with VNC to drag a desktop on this same machine to my office, my house, or hotels when I am not at home. It works precisely like any other VNC installation and I haven't had any problems with it what-so-ever. VNC was the choice for me as I didn't have to install anything locally (as I can use java-VNC through browser @ hotels w/o having to do any work on their computers to change settings or install anything).

I also have run desktops out of VE's based on Gentoo & Slackware (12) without any troubles either, so I'm surprised that CentOS has any troubles with this. That said, I'm still running CentOS 4.5 everywhere and not 5.
Re: GUIs from a VPS [message #16068 is a reply to message #16065] Mon, 20 August 2007 19:38 Go to previous messageGo to next message
locutius is currently offline  locutius
Messages: 125
Registered: August 2007
Senior Member
i have nxserver running on CentOS 5 without any xfce* package installed

i will shoot my config at you in case it means anything:

did you see this?
http://wiki.centos.org/HowTos/FreeNX

in the middle of the document there is:

Note: No Machine just released a version 3.0.0 NX client.
I am not sure if it works with the CentOS NX/freeNx solution.
Here is a link to the latest 2.1.0 i386 client from no machine,
which does work.


although he is talking about the client on the local desktop, i use the nxclient v2 on the servers and not v3. then nxclient v3 works fine from the local desktop

also important, the standard gnome install that ships with CentOS 4 and 5 will not start a nxserver session. always i find it necessary to yum install gnome*. i have not isolated which package is missing but it always works

____________________________________________________________ ___


i am pleased you like nx. vnc sux and is just about unusable for playing mahjong, good for flying a Russian spaceship but nothing more

when the nx factors finally soak into that linux brain of yours i am convinced you will start to see scifi opportunities with real merit

e.g. portable nx on a mobile fone with a remote VPS

thank you for conceding a niche use for nx and vps. that niche is a secure ledge for my next project Very Happy
CentOS 5 VPS with GUI? [message #16070 is a reply to message #16067] Mon, 20 August 2007 19:49 Go to previous messageGo to next message
dowdle is currently offline  dowdle
Messages: 261
Registered: December 2005
Location: Bozeman, Montana
Senior Member
Well, it really isn't a CentOS thing... it's a package management within the VPS thing. Whenever It try to install much in the way fo a GUI environment inside of a CentOS VPS, something demands it also install hal and udev... and when the stock CentOS udev package replaces the OpenVZ dummy vzdev package, the VPS gets broken at that point.



--
TYL, Scott Dowdle
Belgrade, Montana, USA
Re: GUIs from a VPS [message #16071 is a reply to message #16068] Mon, 20 August 2007 19:53 Go to previous messageGo to next message
dowdle is currently offline  dowdle
Messages: 261
Registered: December 2005
Location: Bozeman, Montana
Senior Member
Wow, that was a lot of work in that howto.

All I did was enable the CentOS Extras repo, install freenx (which brought along nx with it)... and then copy the /etc/nxserver/client.* key to my client machine and import it.

I install the nxclient on the client and imported the key... and connected.


--
TYL, Scott Dowdle
Belgrade, Montana, USA
Re: GUIs from a VPS [message #16077 is a reply to message #16071] Mon, 20 August 2007 20:39 Go to previous messageGo to next message
locutius is currently offline  locutius
Messages: 125
Registered: August 2007
Senior Member
you are one of the lucky ones, nx has a history with a reputation for being quirky and without much clear documentation but with many many frustrated topics on boards everywhere. frequently it was broken by a routine library update and it would be months before it was working again

also the no-machine version works differently from the freenx version, is way more complicated to set up with nodes and everything

6 months ago they appeared to get on top of the issues and things stabilized. my personal favorite server for mahjong is a x86_64 box, 64_bit remote mahjong was unheard of until very recently

ON TOPIC: log a bug, dude
Re: GUIs from a VPS [message #16139 is a reply to message #16077] Thu, 23 August 2007 20:29 Go to previous messageGo to next message
locutius is currently offline  locutius
Messages: 125
Registered: August 2007
Senior Member
i just attempted nx install into a CentOS 4.5 VPS

# nxserver --useradd root
NX> 100 NXSERVER - Version 1.5.0-60 OS (GPL)
NX> 1000 NXNODE - Version 1.5.0-60 OS (GPL)
cat: /etc/nxserver/users.id_dsa.pub: No such file or directory
cat: /etc/nxserver/users.id_dsa.pub: No such file or directory
NX> 716 Public key added to: /root/.ssh/authorized_keys2
NX> 1001 Bye.
NX> 999 Bye

is failing to create the client key because of a missing public key Confused
Re: GUIs from a VPS [message #16147 is a reply to message #16139] Thu, 23 August 2007 22:33 Go to previous message
dowdle is currently offline  dowdle
Messages: 261
Registered: December 2005
Location: Bozeman, Montana
Senior Member
I gave up on freenx because after the initial luck I had, I had nothing but problems.

I installed vnc-server and have been using vncviewer... and over my 100Mbit LAN it works great.

From outside the LAN it is a bit pokey but usable.


--
TYL, Scott Dowdle
Belgrade, Montana, USA
Previous Topic: *SOLVED* Centos 4 or 5 for HN?
Next Topic: problem nfs-user-server
Goto Forum:
  


Current Time: Fri Aug 09 02:18:45 GMT 2024

Total time taken to generate the page: 0.02918 seconds