You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by o....@cs.ucc.ie on 2006/07/09 08:57:23 UTC

problem using SVN to manage live /etc on server

Hi all,
I created a repository of the /etc dir on a server, this server is also 
running the Subversion repositories with Apache2 as the method of access.

I used the method in FAQ to do an in-place working copy of /etc
This all seems to work.

Then I setup a root cronjob to do a weekly commit this is where I have a 
problem.

I discovered that much of the repository was becoming locked and that was 
preventing the commit proceeding, so I used a very simple 
script svn-cron.sh:-
cd /etc
/usr/bin/svn cleanup . 
/usr/bin/svn update
/usr/bin/svn commit -m"weekly cron commit .."
exit 0

This fails and logs:-
Authentication realm: <http://hostname:8080> Subversion Repository 
CSSG Group
Password for 'root': Authentication realm: <http://hostname:8080> 
Subversion Repository CSSG Group
Username: /system/bin/hostname/svn-cron.sh: line 11: 14311 Aborted                 
/usr/bin/svn update
svn: Working copy '/etc' locked
svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for 
details)

Line 11 is the update line.

However when the above commands are run manually they work fine.
and no prompt for password is required.

Thanks for reading this far.... any advice much appreciated ..
Oliver
--
Oliver Nash

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: problem using SVN to manage live /etc on server

Posted by Les Mikesell <le...@gmail.com>.
On Mon, 2006-07-10 at 14:25 +0100, o.nash@cs.ucc.ie wrote:

> About the file:// url would that be a wise choice?
> in this case I need to tell svn about the new URL ? I think.
> 
> This repos is never going to be checked out, it is only for recording etc
> dir changes.

Has anyone done this with multiple similar machines checked in as
branches?
I think it might be useful to be able to see diffs between machines as
well as the changes over time.

-- 
  Les Mikesell
   lesmikesell@gmail.com


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: problem using SVN to manage live /etc on server

Posted by o....@cs.ucc.ie.
On Mon, 10 Jul 2006, Ryan Schmidt wrote:

> 
> On Jul 10, 2006, at 16:22, o.nash@cs.ucc.ie wrote:
> 
> > What I meant about changing the URL was that after a working copy is
> > created using some URL, this seems to be recorded in a file
> > .svn/entries
> > So that one does not need to keep entering the full URL.
> > 
> > Is it safe to change this file manually?
> 
> You should not change the contents of the .svn directory manually. You should
> use the "svn switch --relocate" command for this purpose.
> 
> 
Thanks to all those who responded, all the various suggestions were useful 
and provided enough information to solve the problem.

--
Oliver


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: problem using SVN to manage live /etc on server

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Jul 10, 2006, at 16:22, o.nash@cs.ucc.ie wrote:

> What I meant about changing the URL was that after a working copy is
> created using some URL, this seems to be recorded in a file
> .svn/entries
> So that one does not need to keep entering the full URL.
>
> Is it safe to change this file manually?

You should not change the contents of the .svn directory manually.  
You should use the "svn switch --relocate" command for this purpose.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: problem using SVN to manage live /etc on server

Posted by o....@cs.ucc.ie.
On Mon, 10 Jul 2006, Brian Munroe wrote:

> On 7/10/06, o.nash@cs.ucc.ie <o....@cs.ucc.ie> wrote:
> 
> > 
> > About the file:// url would that be a wise choice?
> > in this case I need to tell svn about the new URL ? I think.
> 
> Oliver, Little confused on your question.  If I understand you
> correctly, then no, you do not need to do anything to SVN to get
> file:// to work, it is built in by default.  Is that what you are
> asking?
> 
> BUT, I might reconsider using it, as Nico pointed out in a previous
> email.  I forgot, it *can* be a real adventure trying to maintain the
> permissions on the repository -if you have more then one user checking
> stuff in (correct me if I'm wrong, Nico).  If this repository is only
> accessed by one user (root) then it shouldn't be too big of a deal.
> 
> -- brian
> 





> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org
> 
> 

Brian, thanks yes it is confusing.
first confusion: repository permissions I take this to only refer to the 
actual Subversion repository and NOT the contents of the .svn dir in the 
working copy. correct?

We would want to have the repository readable by the Apache user so that 
viewing diff can be carried out with a web interface like viewvc.

What I meant about changing the URL was that after a working copy is 
created using some URL, this seems to be recorded in a file
.svn/entries
So that one does not need to keep entering the full URL.

Is it safe to change this file manually?
Oliver


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: problem using SVN to manage live /etc on server

Posted by Nico Kadel-Garcia <nk...@comcast.net>.
Brian Munroe wrote:
> On 7/10/06, o.nash@cs.ucc.ie <o....@cs.ucc.ie> wrote:
>
>>
>> About the file:// url would that be a wise choice?
>> in this case I need to tell svn about the new URL ? I think.
>
> Oliver, Little confused on your question.  If I understand you
> correctly, then no, you do not need to do anything to SVN to get
> file:// to work, it is built in by default.  Is that what you are
> asking?
>
> BUT, I might reconsider using it, as Nico pointed out in a previous
> email.  I forgot, it *can* be a real adventure trying to maintain the
> permissions on the repository -if you have more then one user checking
> stuff in (correct me if I'm wrong, Nico).  If this repository is only
> accessed by one user (root) then it shouldn't be too big of a deal.

Bingo. The usual work-around is to set up the repository with group "svn" 
ownership and appropriate membership, and set all directories in the 
repository to 2775 to get them to publish the group permissions for any 
newly created files or directories. 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: problem using SVN to manage live /etc on server

Posted by Brian Munroe <br...@gmail.com>.
On 7/10/06, o.nash@cs.ucc.ie <o....@cs.ucc.ie> wrote:

>
> About the file:// url would that be a wise choice?
> in this case I need to tell svn about the new URL ? I think.

Oliver, Little confused on your question.  If I understand you
correctly, then no, you do not need to do anything to SVN to get
file:// to work, it is built in by default.  Is that what you are
asking?

BUT, I might reconsider using it, as Nico pointed out in a previous
email.  I forgot, it *can* be a real adventure trying to maintain the
permissions on the repository -if you have more then one user checking
stuff in (correct me if I'm wrong, Nico).  If this repository is only
accessed by one user (root) then it shouldn't be too big of a deal.

-- brian

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: problem using SVN to manage live /etc on server

Posted by o....@cs.ucc.ie.
On Sun, 9 Jul 2006, Brian Munroe wrote:

> On 7/9/06, Ryan Schmidt <su...@ryandesign.com> wrote:
> 
> > 
> > Sounds like when you run the command manually, your password is
> > cached (in the directory ~/.subversion/auth) and when you run it from
> > cron, it's running under a different user who doesn't have the
> > password cached. If you can figure out which user cron runs as, you
> > could become that user on the shell and manually do a Subversion
> > command so it caches your username and password. Or you may need to
> > pass the username and password to the svn update and svn commit
> > commands with the --username and --password switches.
> > 
> 
> Additionally, since the /etc dir is on the same server as the SVN
> repo, could Oliver change the URL format from http:// to file:// and
> make sure the crontab user as write permission to the repository?
> 
> -- brian
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org
> 
> 
Brian, Ryan,
Thanks for this points
I was as sudo user when manually running so the passwords were sure enough
only cached in my own home dir .subversion
I am about to test with cron [ which since it is a root cron run's as
root] again having first done a true svn connection to repo with root
user.

About the file:// url would that be a wise choice?
in this case I need to tell svn about the new URL ? I think.

This repos is never going to be checked out, it is only for recording etc
dir changes.

regards
-- Oliver

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: problem using SVN to manage live /etc on server

Posted by Nico Kadel-Garcia <nk...@comcast.net>.
Brian Munroe wrote:
> On 7/9/06, Ryan Schmidt <su...@ryandesign.com> wrote:
>
>>
>> Sounds like when you run the command manually, your password is
>> cached (in the directory ~/.subversion/auth) and when you run it from
>> cron, it's running under a different user who doesn't have the
>> password cached. If you can figure out which user cron runs as, you
>> could become that user on the shell and manually do a Subversion
>> command so it caches your username and password. Or you may need to
>> pass the username and password to the svn update and svn commit
>> commands with the --username and --password switches.
>>
>
> Additionally, since the /etc dir is on the same server as the SVN
> repo, could Oliver change the URL format from http:// to file:// and
> make sure the crontab user as write permission to the repository?

Doing file:// based access is a bit of an adventure to maintain access 
control parallel with the HTTP/HTTPS access control with, unless you start 
using svnperms.py or something like it.

But ignore that: for many users, they log in as themselves and "su" or 
"sudo" to do root operations or run things as root. The result is that they 
wind up inheriting a lot of their environment from their login account, and 
this can confuse things like cron scripts run as that bare user in seriously 
odd ways.

Ryan? Try actually logging in as root and running the cron scripts by hand, 
making sure not to do it as su or sudo, as a test. I actually ran into a 
very similar problem with a web repository this year that I solved by doing 
the checkout as the root login user, not the "sudo" root user. 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: problem using SVN to manage live /etc on server

Posted by Brian Munroe <br...@gmail.com>.
On 7/9/06, Ryan Schmidt <su...@ryandesign.com> wrote:

>
> Sounds like when you run the command manually, your password is
> cached (in the directory ~/.subversion/auth) and when you run it from
> cron, it's running under a different user who doesn't have the
> password cached. If you can figure out which user cron runs as, you
> could become that user on the shell and manually do a Subversion
> command so it caches your username and password. Or you may need to
> pass the username and password to the svn update and svn commit
> commands with the --username and --password switches.
>

Additionally, since the /etc dir is on the same server as the SVN
repo, could Oliver change the URL format from http:// to file:// and
make sure the crontab user as write permission to the repository?

-- brian

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: problem using SVN to manage live /etc on server

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Jul 9, 2006, at 10:57, o.nash@cs.ucc.ie wrote:

[snip]
> svn-cron.sh:-
> cd /etc
> /usr/bin/svn cleanup .
> /usr/bin/svn update
> /usr/bin/svn commit -m"weekly cron commit .."
> exit 0
>
> This fails and logs:-
> Authentication realm: <http://hostname:8080> Subversion Repository
> CSSG Group
> Password for 'root': Authentication realm: <http://hostname:8080>
> Subversion Repository CSSG Group
> Username: /system/bin/hostname/svn-cron.sh: line 11: 14311 Aborted
> /usr/bin/svn update
> svn: Working copy '/etc' locked
> svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for
> details)
>
> Line 11 is the update line.
>
> However when the above commands are run manually they work fine.
> and no prompt for password is required.

Sounds like when you run the command manually, your password is  
cached (in the directory ~/.subversion/auth) and when you run it from  
cron, it's running under a different user who doesn't have the  
password cached. If you can figure out which user cron runs as, you  
could become that user on the shell and manually do a Subversion  
command so it caches your username and password. Or you may need to  
pass the username and password to the svn update and svn commit  
commands with the --username and --password switches.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org