vzctl does not setup HOME correctly (also HISTFILE, LANG)

Bug #622898 reported by Daniel Hahler
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bazaar
Invalid
Medium
Unassigned
OpenVZ Tools
Confirmed
Medium
vzctl (Debian)
Fix Released
Unknown
vzctl (Ubuntu)
Fix Released
Medium
Unassigned

Bug Description

After having upgraded my host system to Debian testing (basically from Hardy), the etckeeper/bzr setup in the containers started logging the debug output to /etc/.bzr.log (instead of /root/.bzr.log as before).

"vzctl exec" which is used to execute the command(s) in the OpenVZ container does not properly setup the $HOME variable, but this had been the case before already.
I will have to investigate if "vzctl exec $VZ 'echo $HOME'" has been "/" before upgrading already, or if this is a detail that has changed.

# vzctl exec 125 bzr --version
Bazaar (bzr) 2.1.2
  Python interpreter: /usr/bin/python 2.5.2
  Python standard library: /usr/lib/python2.5
  Platform: Linux-2.6.32-5-openvz-amd64-i686-with-debian-lenny-sid
  bzrlib: /usr/lib/python2.5/site-packages/bzrlib
  Bazaar configuration: .bazaar
  Bazaar log file: .bzr.log

Copyright 2005-2010 Canonical Ltd.
http://bazaar-vcs.org/

bzr comes with ABSOLUTELY NO WARRANTY. bzr is free software, and
you may use, modify and redistribute it under the terms of the GNU
General Public License version 2 or later.

Bazaar is part of the GNU Project to produce a free operating system.

Daniel Hahler (blueyed)
Changed in bzr:
status: New → Incomplete
Changed in vzctl (Ubuntu):
status: New → Incomplete
description: updated
Changed in bzr:
status: Incomplete → New
Changed in vzctl (Ubuntu):
status: Incomplete → New
Revision history for this message
John A Meinel (jameinel) wrote :

My guess is that vzctl is setting $HOME to /etc now.

Changed in bzr:
importance: Undecided → Medium
status: New → Incomplete
Revision history for this message
Daniel Hahler (blueyed) wrote :

As said before:
  # vzctl exec 123 'echo $HOME'
  /
  # vzctl exec 123 env
  TERM=linux
  PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
  PWD=/
  SHLVL=1
  HOME=/
  _=/usr/bin/env

Changed in bzr:
status: Incomplete → New
Revision history for this message
Martin Pool (mbp) wrote :

It would also be worth checking BZR_HOME and BZR_LOG.

afaics bzr just uses whichever of those variables are set, so I'm fairly sure there's something outside of bzr causing this; please reopen if you're sure it's not.

Maybe there's something different between container 123 and 125?

Changed in bzr:
status: New → Incomplete
Revision history for this message
Daniel Hahler (blueyed) wrote : Re: [Bug 622898] Re: bzr via etckeeper logs to /etc/.bzr.log in OpenVZ containers

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

> It would also be worth checking BZR_HOME and BZR_LOG.

This is not set in env - I have posted the quite minimal "env" output IIRC.

> afaics bzr just uses whichever of those variables are set, so I'm fairly
> sure there's something outside of bzr causing this; please reopen if
> you're sure it's not.

It is caused by $HOME - I had patched vzctl previously to use "/root"
instead of "/", and done so now again (attached):

TERM=linux
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PWD=/
SHLVL=1
HOME=/root
_=/usr/bin/env
Bazaar (bzr) 2.1.2
  Python interpreter: /usr/bin/python 2.5.2
  Python standard library: /usr/lib/python2.5
  Platform: Linux-2.6.32-5-openvz-amd64-i686-with-debian-lenny-sid
  bzrlib: /usr/lib/python2.5/site-packages/bzrlib
  Bazaar configuration: /root/.bazaar
  Bazaar log file: /root/.bzr.log

However, if I remember correctly, Bazaar was using "HOME=/" previously
(and therefore logging to /), while it now discards HOME=/ and
apparently logs to the current working directory.

I am attaching the debdiff for reference.

- --
http://daniel.hahler.de/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iD8DBQFMf842fAK/hT/mPgARAqz9AJ9CnmtgSEMoMuE+aV+DrAxBCCtDeACgoiDs
CGKvoBGkmOvUMWeU4yqaXFI=
=O3pk
-----END PGP SIGNATURE-----

Changed in bzr:
status: Incomplete → New
Revision history for this message
Daniel Hahler (blueyed) wrote : Re: bzr via etckeeper logs to /etc/.bzr.log in OpenVZ containers

Invalid for bzr: it has been like this from the beginning, according to my comment in the vzctl bug (http://bugzilla.openvz.org/show_bug.cgi?id=942#c0).

Changed in bzr:
status: New → Invalid
Changed in vzctl (Ubuntu):
importance: Undecided → Medium
status: New → Triaged
summary: - bzr via etckeeper logs to /etc/.bzr.log in OpenVZ containers
+ vzctl does not setup HOME correctly (also HISTFILE, LANG)
Changed in openvz-tools:
status: Unknown → In Progress
Changed in openvz-tools:
importance: Unknown → Medium
Changed in vzctl (Debian):
status: Unknown → Confirmed
Changed in vzctl (Debian):
status: Confirmed → Fix Released
Changed in openvz-tools:
status: In Progress → Confirmed
Revision history for this message
Simon Déziel (sdeziel) wrote :

vzctl 3.0.24-8 fixed the issue so this is fixed in Ubuntu for Natty and higher.

Changed in vzctl (Ubuntu):
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.