OpenVZ Forum


Home » General » Support » Template and Wrong permision's.
Template and Wrong permision's. [message #37830] Tue, 27 October 2009 11:05 Go to next message
AshleyUk is currently offline  AshleyUk
Messages: 6
Registered: October 2009
Location: Essex, UK
Junior Member
Hello,

I used the basic CentOS 5 Minimal Template, and then updated the template using yum and installed ISPConfig2.

I then shutdown most proccesses mysql,httpd,postfix e.t.c, then shutdown the VPS and tared the template up using " tar -pczf /vz/template/cache/CentOS-5.4-i386-ISPConfig.tar.gz ." while I was inside /vz/private/118

I have done a few templates now and they are all fine, however this one if I use it on the same node it's fine, however if I use it on another node mysql can not start.

For example the directory /var/run/mysql is not owned by mysql:mysql but instead some random number's like 140:140.

Is there a reason for this? Should I be excluding the run directory will it just get created when the VPS boot's up again, why am I not having problems with the other templates ive made?

Thanks,
Ashley
Re: Template and Wrong permision's. [message #37833 is a reply to message #37830] Tue, 27 October 2009 12:55 Go to previous messageGo to next message
kir is currently offline  kir
Messages: 1645
Registered: August 2005
Location: Moscow, Russia
Senior Member

You need to use --numeric-owner option when creating a tarball

Kir Kolyshkin
http://static.openvz.org/userbars/openvz-developer.png
Re: Template and Wrong permision's. [message #37834 is a reply to message #37833] Tue, 27 October 2009 13:06 Go to previous messageGo to next message
AshleyUk is currently offline  AshleyUk
Messages: 6
Registered: October 2009
Location: Essex, UK
Junior Member
Hello,

Will give this a try now and report back.


Thanks,
Ashley
Re: Template and Wrong permision's. [message #37836 is a reply to message #37834] Tue, 27 October 2009 14:29 Go to previous messageGo to next message
AshleyUk is currently offline  AshleyUk
Messages: 6
Registered: October 2009
Location: Essex, UK
Junior Member
Hello,

Still getting this problem, if template is used on the Node it was created on it's fine however straight away i move the tar.gz to another node mysql fails to start becuase of user/group ownership of certain directories.

For example

running ls -l in /var/run shows :

drwxr-xr-x 2 102 104 4096 Oct 27 14:56 mysqld

Where the actual output for the mysqld folder should be

drwxr-xr-x 2 mysql mysql 4096 Oct 27 14:56 mysqld

running "chown -R mysql:mysql mysqld", mysql then starts fine, however I am trying to release these template's for openvz hosts.

I know it must be possible as for example the 3rd party OS templates on openvz.org work fine.

Im using "tar -pczf --numeric-owner /vz/template/cache/CentOS-5.4-i386-ISPConfig2.tar.gz" to tar the files after changing to "/vz/private/#vzid#" directory and stopping the VPS.

Thanks,
Ashley

[Updated on: Tue, 27 October 2009 14:31]

Report message to a moderator

Re: Template and Wrong permision's. [message #37837 is a reply to message #37836] Tue, 27 October 2009 14:52 Go to previous messageGo to next message
kir is currently offline  kir
Messages: 1645
Registered: August 2005
Location: Moscow, Russia
Senior Member

OK...

Quote:
Im using "tar -pczf --numeric-owner /vz/template/cache/CentOS-5.4-i386-ISPConfig2.tar.gz"


This appears to be an incorrect command (at least on my system).

This is because (a) 'f' option should be followed by a file name, i.e. "tar ...f file.tar.gz". In your case you specify to pack the file /vz/template/cache/CentOS-5.4-i386-ISPConfig2.tar.gz into a tarball named (literally) "--numeric-owner". So no, you have not recreated your tarball using the correct options, instead you are just using the old one.
(b) You forgot the dot (.) at the end.

The correct command would be something like

tar -pczf /vz/template/cache/CentOS-5.4-i386-ISPConfig2.tar.gz --numeric-owner .


So, please
(1) use the correct tar command and options
(2) remove the old tarball before creating a new one
(3) check the resulting tarball's date/time.

Also you can check if the uids/gids inside the tarball are correct. For that, find out the uid/gid of mysql inside the CT:

ls -lnd /var/run/mysqld
grep mysql /etc/passwd
grep mysql /etc/group


Then, check the resulting tarball:

tar tzvf file.tar.gz var/run/mysqld

You should see uid/gid as numbers (not names) and they should be the same as the ones you saw the step before (in ls -lnd and grep output).


Kir Kolyshkin
http://static.openvz.org/userbars/openvz-developer.png
Re: Template and Wrong permision's. [message #37838 is a reply to message #37830] Tue, 27 October 2009 14:55 Go to previous messageGo to next message
AshleyUk is currently offline  AshleyUk
Messages: 6
Registered: October 2009
Location: Essex, UK
Junior Member
Hello,

Sorry bit of mistyping

Im using tar -pczf --numeric-owner /vz/template/cache/CentOS-5.4-i386-ISPConfig2.tar.gz .

With a dot at the end, while im the folder /vz/private/#vzid# which my understanding takes all files from that directory and tars them up.

However I will put --numeric-owner at the end and see if that makes any difference.

Thanks,
Ashley
Re: Template and Wrong permision's. [message #37839 is a reply to message #37838] Tue, 27 October 2009 15:14 Go to previous messageGo to next message
kir is currently offline  kir
Messages: 1645
Registered: August 2005
Location: Moscow, Russia
Senior Member

AshleyUk wrote on Tue, 27 October 2009 17:55

I'm using tar -pczf --numeric-owner /vz/template/cache/CentOS-5.4-i386-ISPConfig2.tar.gz .


See, the problem is tar's option 'f' requires an argument, a name of a tarball file. When you run it with 'f --numeric-owner' you specify '--numeric-owner' as a name of a tarball. All the other arguments are treated as files/directories to be (in your case) added to the tarball. Yes, tar is an old program with somewhat strange options, that sometimes lead to strange results.

So run ls in the directory you ran the tar in and be amazed that you have a file named --numeric-owner (and to remove it, use rm -- --numeric-owner, here -- is for rm to treat the following arguments as file names, not options).

Also, do not skip the part where I recommend checking the timestamp on a created tarball, and removing the old tarball before creating a new one.


Kir Kolyshkin
http://static.openvz.org/userbars/openvz-developer.png
Re: Template and Wrong permision's. [message #37840 is a reply to message #37839] Tue, 27 October 2009 15:18 Go to previous messageGo to next message
AshleyUk is currently offline  AshleyUk
Messages: 6
Registered: October 2009
Location: Essex, UK
Junior Member
Hello,

Thanks for your helping, I now created using the correct command, I then checked and it come back with the same uid and gid as the original output from the VPS, so now just waiting for it to be tested on another node and will get back to you.

Thanks,
Ashley

[Updated on: Tue, 27 October 2009 15:23]

Report message to a moderator

Re: Template and Wrong permision's. [message #37842 is a reply to message #37840] Tue, 27 October 2009 17:04 Go to previous message
AshleyUk is currently offline  AshleyUk
Messages: 6
Registered: October 2009
Location: Essex, UK
Junior Member
Hello,

This has now been tested and work's fine, now off to find the donate button Razz

Thanks,
Ashley
Previous Topic: OpenVZ on SheevaPlug
Next Topic: I dont have access to internet in the vps
Goto Forum:
  


Current Time: Sat Dec 21 16:14:37 GMT 2024

Total time taken to generate the page: 0.09391 seconds