New issue
Advanced search Search tips

Issue 822323 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Closed: Jun 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Bug



Sign in to add a comment

/usr/sbin and /sbin missing from PATH in cros chroot

Project Member Reported by norvez@chromium.org, Mar 15 2018

Issue description


After creating a fresh chroot, calls to setup_board fail in update_chroot  (https://chromium.googlesource.com/chromiumos/platform/crosutils/+/master/update_chroot#130) because etc-update is not in the PATH

Modifying .bashrc to add /usr/sbin to the PATH fixes the problem but it's not very user-friendly. We should add those directories to the PATH automatically when creating the chroot.
 

Comment 1 by norvez@chromium.org, Mar 15 2018

Attaching .cros_chroot_init that patches the chroot's .bashrc to add /usr/sbin and /sbin to the PATH
.cros_chroot_init
222 bytes Download
Cc: vapier@chromium.org
+vapier

This is more of an 'cros_sdk' issue than a toolchain issue.
Not sure what would be a more appropriate component.

Comment 3 by vapier@chromium.org, Mar 16 2018

Components: -Tools>ChromeOS-Toolchain Infra>Client>ChromeOS
sbin paths are supposed to be added to $PATH automatically when using sudo
Cc: zentaro@chromium.org
I'm also hitting this. Tried both cyan and veyron_minnie.

Comment 5 by vapier@chromium.org, Jun 12 2018

Components: -Infra>Client>ChromeOS Infra>Client>ChromeOS>Build
please check your chroot settings.  /sbin:/usr/sbin do not need to be in the non-root user's $PATH.  they're in the sudo env which is how etc-update is run.

i created a new one from scratch:
  $ cros_sdk --chroot foo
then in there i ran:
  $ sudo env | grep ^PATH=
  PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/opt/bin
looks correct.  so what about etc-update:
  $ sudo etc-update --help
  etc-update: Handle configuration file updates

so do you have an alias to `sudo` or something that would be messing this up ?  i can't get it to be wrong:
  # Clear PATH before running sudo.
  $ env -uPATH /usr/bin/sudo /usr/bin/env | grep ^PATH=
  PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/opt/bin

  # Break PATH before running sudo.
  $ env PATH=/usr/bin /usr/bin/sudo /usr/bin/env | grep ^PATH=
  PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/opt/bin
This is what I see in the path below...

Let me know if there is anything else I can try to debug. I never had this problem until today, but it's the first time I've nuked a board or started working on a new board for a few weeks.

$ sudo env | grep ^PATH=
PATH=/usr/local/bin:/usr/bin:/bin:/opt/bin:/usr/x86_64-pc-linux-gnu/gcc-bin/4.9.x:/usr/x86_64-pc-linux-gnu/aarch64-cros-linux-gnu/gcc-bin/4.9.x:/usr/x86_64-pc-linux-gnu/arm-none-eabi/gcc-bin/4.9.x:/usr/x86_64-pc-linux-gnu/armv7a-cros-linux-gnueabi/gcc-bin/4.9.x:/usr/x86_64-pc-linux-gnu/armv7a-cros-linux-gnueabihf/gcc-bin/4.9.x:/usr/x86_64-pc-linux-gnu/i686-pc-linux-gnu/gcc-bin/4.9.x:/usr/x86_64-pc-linux-gnu/x86_64-cros-linux-gnu/gcc-bin/4.9.x:/mnt/host/source/chromite/bin:/mnt/host/depot_tools

Also the only aliases I have are a few "--colour=auto" on grep and ls.

Comment 8 by vapier@chromium.org, Jun 12 2018

do you both have a /etc/sudoers.d/signer file ?  and if you delete it, things work as expected ?
Indeed, I have 2 chroots one with the file /etc/sudoers.d/signer and the other without. The former is failing after a vanilla cros_sdk, the latter does not ...

deleting the file fixed it
Thanks !
This worked for me too. Thanks for tracking that down.
Project Member

Comment 11 by bugdroid1@chromium.org, Jun 13 2018

The following revision refers to this bug:
  https://chrome-internal.googlesource.com/chromeos/cros-signing/+/b525d5f33c2df7f0acb365ec24bb1ba40e02fbce

commit b525d5f33c2df7f0acb365ec24bb1ba40e02fbce
Author: Mike Frysinger <vapier@chromium.org>
Date: Wed Jun 13 14:39:23 2018

Owner: vapier@chromium.org
Status: Fixed (was: Unconfirmed)
i'm going to mark this as fixed because not too many people run the signer unittests, and you guys have manually cleaned up the fragment on your systems.  so i don't think we need to roll out anything more widespread.

Sign in to add a comment