Currently used for resolv.conf and hosts, because these files can
change during the lifetime of a chroot, for example on computers
with more dynamic network (laptops).
While this creates a persistent process in the background for the
sole purpose of syncing files, the performance impact is negligible.
BUG=12316
TEST=below
1) enter_chroot once+quit, many times + quit, verify correct exit
behaviour
2) enter_chroot, modify host resolv.conf, see chroot being updated
Change-Id: I26573570c027acc2c214a00838a6f982a7585b13
R=robotboy@chromium.org,dparker@chromium.org,sosa@chromium.org
Review URL: http://codereview.chromium.org/6720005
git config doesn't behave well if there are multiple callers
calling it at the same time. Since this is best effort anyway,
I'm adding an || true so that multithreads calls to this don't
fail.
I removed my previous work around to this since it wasn't generic enough.
Change-Id: I12f2d3faaa745c1ff675a297bb09c567a88aa185
BUG=chromium-os:13070
TEST=Ran it a lot
Review URL: http://codereview.chromium.org/6693001
BUG=chromium-os:11944
TEST=the correct test for this is a complete rebuild; I have this running, but it's going to take a little while. I have tested this on the specific cases of ssh_auth_sock and .subversion
Change-Id: I61723356c58bfb7c2090e950208b8a6ab8fa2fc9
Review URL: http://codereview.chromium.org/6519022
Also refactors some cut-and-paste code
Fix: makes mountpoint for subversion directory
BUG=chromium-os:11944 chromium-os:12058
TEST=enter_chroot.sh with and without another enter_chroot running. Note that there are 0 or 1 mounts of the /tmp/ssh-.... directory. Check that /proc,/sys,/dev,$SSH_AUTH_SOCK,/dev/pts,/home/${USER}/trunk,/home/${USER}/.subversion are all mounted. Test that subversion mountpoint is created
Change-Id: I9dada6f7f98d263345af29a5734c1c70709f6a1e
Review URL: http://codereview.chromium.org/6498001
Review URL: http://codereview.chromium.org/6525020
Also refactors some cut-and-paste code
BUG=11944
TEST=enter_chroot.sh with and without another enter_chroot running. Note that there are 0 or 1 mounts of the /tmp/ssh-.... directory. Check that /proc,/sys,/dev,$SSH_AUTH_SOCK,/dev/pts,/home/${USER}/trunk,/home/${USER}/.subversion are all mounted
Change-Id: I9dada6f7f98d263345af29a5734c1c70709f6a1e
Review URL: http://codereview.chromium.org/6498001
Change-Id: I6593336a52b7298bd358f3e55531b2e6a9e6dff1
BUG=chromium-os:11883
TEST=Tried deleting the symlink and deleting the line from bashrc and things got updated; ran again w/ no problems.
Review URL: http://codereview.chromium.org/6480005
Change-Id: I5f76f0f27b5789d88740b36fa6ce696ef7e68e8a
BUG=chromium-os:11602
TEST=Tried steps in bug 11602 (but hacked a sudo -K to the start of teardown_env so I didn't need to wait 15 mins).
Review URL: http://codereview.chromium.org/6286069
Change-Id: Ibd32a4be12e88d183dd0acbcb156582ad946c92f
BUG=chromium-os:11602
TEST=Added a 'sudo -K' as the first line of teardown_env to simulate sudo timeout, then performed steps in bug report (without 15 minute wait).
Review URL: http://codereview.chromium.org/6250116
from within the chroot.
It also fixes a number of style issues.
It changes the meaning of cros_workon "list-all" to list all available
packages, and adds "list-live" to list all live packages.
It changes things that load chromeos-common.sh from the installer to
load it from /usr/lib/installer.
BUG=chromium-os:4230
TEST=synced, rebuilt chroot, made packages, made images, built chrome
from source, and wrote an image to a USB stick.
Review URL: http://codereview.chromium.org/6240018
Change-Id: I90c34420af1a64020402bafef8e9e77f56837c02
It's very rarely needed anyway but enter_chroot does everything under the sun.
Avoids:
error: could not lock config file ~/.gitconfig
Change-Id: Ide72b14fd434b182a88d2fc636559b3515905509
BUG=chromium-os:11523
TEST=Ran it ... 10x
Review URL: http://codereview.chromium.org/6312069
TEST=clean (first) enter_chroot.sh; repo sync
The developer instructions for setting up chroot include steps to set up
~/.ssh/config to correctly set up ports and options. And while several
attempts are made in enter_chroot to forward ssh-agent and ssh
authentication to chroot as well, the ssh config stays outside of
chroot, which prevents all attempts to contact the git servers if rw URL
is used.
This makes a copy of config on entering the chroot, allowing people to
use repo from within the chroot. That is not bulletproof and does not
reflect changes of config while inside the chroot, but that should be a
borderline case.
Change-Id: I1fcbf00c413c7af8ef14fc1e846192ac95de106d
BUG=n0ne
Review URL: http://codereview.chromium.org/6065011
Examples of how people might be using enter_chroot:
1. ./enter_chroot [chroot_flags] VAR1=val1 VAR2=val2 -- cmd arg1 arg2
Set env vars and run cmd w/ args
2. ./enter_chroot [chroot_flags] VAR1=val1 VAR2=val2
Set env vars and run shell
3. ./enter_chroot [chroot_flags] -- cmd arg1 arg2
Run cmd w/ args
4. ./enter_chroot [chroot_flags] VAR1=val1 VAR2=val2 cmd arg1 arg2
Like #1 _if_ args aren't flags (if they are, enter_chroot will claim them)
5. ./enter_chroot [chroot_flags] cmd arg1 arg2
Like #3 _if_ args aren't flags (if they are, enter_chroot will claim them)
I also updated the help to indicate that whole-command quoting is no longer
supported. If you really need whole-command quoting (maybe you want in-
chroot redirection), you'll need to use sh -c like:
./enter_chroot.sh -- sh -c "echo \"Save me\" > /tmp/save.txt"
You should avoid single quotes in the command and arguments. This isn't
a new limitation: it's shflags related.
Change-Id: I0452a8730ac9b8197834edc753b9eece69896135
BUG=chromium-os:7072
TEST=Tried a whole bunch of these commands.
Review URL: http://codereview.chromium.org/5840003
Change-Id: I906f1959769ac9d7a2abc04827cad8f5201984de
BUG=chromeos:9168
TEST=Made sure that setting and unsetting this value and enter_chroot is honoring the pass thru setting.
Review URL: http://codereview.chromium.org/5008006
This function is now called by enter_chroot.sh. A separate change
will call the function from make_chroot
Change-Id: I4fc07c413e56db3e5e7617428f20f2ffc02790d7
BUG=chromium-os:7072
TEST=Took root out of sudoers and ran enter_chroot.sh script; saw that it was re-added.
Review URL: http://codereview.chromium.org/3909001
BUG=none
TEST=run from within and without a repo
Change-Id: I00eb999974656450f6af24583ca2247805b5799e
Review URL: http://codereview.chromium.org/3529005
If git author name is different in the chroot from outside the chroot, repo
may auto-delete your changes when you run repo sync. These changes can be
recovered, but their deletion is inconvenient.
BUG=chromium-os:5934
TEST=Check that git var GIT_COMMITTER_IDENT is now correct inside chroot.
Change-Id: I622cd37caa404a7482c55c4b3984877b32b3807c
Review URL: http://codereview.chromium.org/3352008
This also mounts the path to our ssh-agent socket (usually in /tmp) inside the
chroot so we can use our external agent.
TEST=None
BUG=None
Change-Id: I543e8b2527be9958c1158234f39ecc34fc9dd0df
Signed-Off-By: Elly Jones <ellyjones@chromium.org>
Signed-Off-By: sosa <sosa@chromium.org>
Review URL: http://codereview.chromium.org/3277006
so that the original users' subversion access permissions are preserved inside the chroot
Change-Id: I486070b3c1a2dda169ae0a95982ba693574e001b
BUG=
TEST=
Review URL: http://codereview.chromium.org/3249008
It's sometimes useful to run a command in chroot and redirect/pipe stdout. Any objections to having enter_chroot send its chatter to stderr?
Review URL: http://codereview.chromium.org/3160024
This fix separates out any additional command line arguments given to
the enter_chroot.sh script when passed to the interior chroot. This
allows one to pass environment variable settings to the interior
chroot shell such as:
./enter_chroot.sh -- CHROME_ORIGIN=LOCAL_SOURCE emerge-x86-generic ...
Before this fix any of these variable settings will be sucked up by
the shell launching the chroot, not the interior shell.
BUG=chromium-os:2457
TEST=ran test cases detailed in bug report
Review URL: http://codereview.chromium.org/2855034
* This also adds reverse sort into the umount list, because of cascading mounts, so that /foo/anything is always before /foo, and as such is always unmounted first. If the list were not sorted, "mount point busy" errors might occur, depending on various conditions.
TEST=
1) With a previously created chroot, I ran enter_chroot.sh, and got the correct prompt. After logging out of that prompt, everything else was correctly unmounted, without any error messages. When entering chroot twice from two different shells, everything was correctly unmounted after the last shell exited.
2) Repeat 1 but with cleanly created chroot just for this purpose.
3) In the chroot, make packages for one board (x86-generic) using build_packages
4) The messages "openpty failed: 'out of pty devices'" whenever trying to emerge anything (or other commands looking up pts) have disappeared.
Review URL: http://codereview.chromium.org/2714010
Added chrome_root_mount option to specify the mount point to work around a permissions issue.
BUG=3464
TEST=none
Review URL: http://codereview.chromium.org/2126011
Unfortunately, bind mounting /media inside the chroot did not allow us
to programmatically unmount automounted USB sticks from within the chroot.
Instead, I disable automounting on our corporate desktops when you enter the
chroot. Your normal setting is restored when you exit the chroot again.
TEST=run gconftool-2 -g /apps/nautilus/preferences/media_automount to print the current value of your automount pref; run this before entering the chroot, outside the chroot while you've got some other terminal that's inside the chroot, and then after exiting the chroot.
Review URL: http://codereview.chromium.org/2029009
Talked to kmixter, and we felt that bindmounting the directory in
which the host os creates mount points for automounted external
devices is the cleanest solution to the inside/outside the chroot problem.
By doing this, image_to_usb can be run from inside the chroot without concern.
That means that (as far as I understand) the factory install flow can all be
done inside the chroot, as well as modding images for test and everything else.
Review URL: http://codereview.chromium.org/1991006
This is useful for various JTAG and fastboot based flashing of
targets. It is also useful in that we will now have access to
USB card readers and mass storage devices inside the chroot.
BUG=None
TEST=Enter and exit the chroot cleanly.
Review URL: http://codereview.chromium.org/1711016
The safe_unmount function first tries a regular unmount, If that
fails it warns and tries a lazy unmount. If the lazy unmount fails
it dies.
Both unmounts take the -d option in case the mount is a loop device.
BUG=None
TEST=Entered and exited multiple chroots
Review URL: http://codereview.chromium.org/1593021
That way we can directly build an image onto a usb stick/sd card without a separate step.
Also, add mounting of /sys into the chroot that is needed by build_gpt on a block device.
Review URL: http://codereview.chromium.org/1521012
This is necessary for two reasons:
1) It's nice to get an error message when mount/unmount fails
2) set -e mode doesn't have any effect when you're in a subshell
Note that these mount/unmount failures do happen regularly in development,
so folks who depended on mount/umount failing silently will no longer be
able to rely on this and will have to kill the mounts manually.
Also fix subtle bugs in regexes for matching mount paths. (E.g. where the
regex for $HOME/chroot also matches $HOME/chroot2).
TEST=Tested mount/unmount with concurrently open shells.
Tested mount/unmount when mount is being used by a process but the
lock file does not reflect this.
BUG=none
Review URL: http://codereview.chromium.org/1211001
Another CL is coming to automatically add depot_tools to the PATH
inside the chroot. It's in a different repo.
Review URL: http://codereview.chromium.org/605016
If one passes --chrome_root=.../path/to/chrome_root/outside/chroot to
enter_chroot.sh once, enter_chroot will make a note inside the croot
and mount it on all subsequent calls to enter_chroot, even if the
argument is not passed again. If ever enter_chroot can't find the
proper dir, it deletes any stored note.
chrome_root must contain a "src" subdirectory.
Review URL: http://codereview.chromium.org/596102