New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 799335 link

Starred by 1 user

Issue metadata

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



Sign in to add a comment

chromeos-install fails if --dst not specified on amd64-generic

Reported by jrbarnette@chromium.org, Jan 5 2018

Issue description

Chrome Version: 
OS: Chrome OS

What steps will reproduce the problem?
(1) Build and boot an amd64-generic image.
(2) Run "chromeos-install" without arguments

What is the expected result?
System should complain that "--dst" was required.

What happens instead?
You get the following output
    cros-disks stop/waiting
    /usr/sbin/chromeos-install: 258: /usr/sbin/chromeos-install: dev: parameter not set


The root cause of the problem is apparently this code in
chromeos-common.sh:

get_fixed_dst_drive() {
  local dev rootdev

  if [ -n "${DEFAULT_ROOTDEV}" ]; then
    # No " here, the variable may contain wildcards.
    for rootdev in ${DEFAULT_ROOTDEV}; do
      dev="/dev/$(basename "${rootdev}")"
      if [ -b "${dev}" ]; then
        break
      else
        dev=""
      fi
    done
  fi
  echo "${dev}"
}

If DEFAULT_ROOTDEV isn't set, then "${dev}" will be uninitialized.
The script runs with `-u` set, so the unset variable is an error.

 

Comment 1 by gu...@chromium.org, Jan 5 2018

Owner: gu...@chromium.org
Status: Started (was: Untriaged)
Project Member

Comment 2 by bugdroid1@chromium.org, Jan 6 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform2/+/fcaade8aa42fff7f145186f251991dc3da5fcf2f

commit fcaade8aa42fff7f145186f251991dc3da5fcf2f
Author: Congbin Guo <guocb@chromium.org>
Date: Sat Jan 06 07:59:09 2018

installer: script error when install amd64-generic w/o --dst

When `chromeos-install` installs amd64-generic image without --dst
option, it fails due to an uninitalized variable. In this
change, I just set the variable to an empty string, and the script can
give more readable error message to users to require --dst option.

BUG= chromium:799335 
TEST=I rebuit the amd64-generic image with the change and ran
    `chromeos-install` on my device. It failed and tip users to specify
    --dst. Then I ran `chromeos-install --dst /dev/mmcblk1`. It
    installed the image successfuly.

Change-Id: Ib94d012381c0c054bf276f6a8b037a14f88ed667
Reviewed-on: https://chromium-review.googlesource.com/853279
Commit-Ready: Congbin Guo <guocb@chromium.org>
Tested-by: Congbin Guo <guocb@chromium.org>
Reviewed-by: Richard Barnette <jrbarnette@google.com>

[modify] https://crrev.com/fcaade8aa42fff7f145186f251991dc3da5fcf2f/installer/share/chromeos-common.sh

Comment 3 by gu...@chromium.org, Jan 8 2018

Status: Fixed (was: Started)

Sign in to add a comment