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

Issue 806383 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner: ----
Closed: Feb 2018
Cc:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 3
Type: Bug



Sign in to add a comment

chromeos_startup calls firmware-boot-update which might not exist

Project Member Reported by diand...@chromium.org, Jan 26 2018

Issue description

While doing bringup on a new board I was digging through the /sbin/chromeos_startup script.

...and as part of that digging, I found that there's a part that says:

    # 'firmware-boot-update' is provided by chromeos-firmware for legacy systems.
    # On most new boards, it should be simply an empty file.
    firmware-boot-update

On my board nothing provided the "firmware-boot-update" command and thus it didn't exist.  This seemed like something I needed to fix.

--

I looked on "kevin" and found that this file was empty (as per the comments) and provided by private firmware.  AKA:

    $ equery-kevin belongs /usr/sbin/firmware-boot-update
     * Searching for /usr/sbin/firmware-boot-update ... 
    chromeos-base/chromeos-firmware-kevin-0.0.1-r175 (/usr/sbin/firmware-boot-update)


That confused me because I _knew_ I had built a kevin image without any private overlays and it had booted.  Indeed, I confirmed that when I went to my public chroot:

    $ ls /build/kevin/usr/sbin/firmware-boot-update
    ls: cannot access '/build/kevin/usr/sbin/firmware-boot-update': No such file or directory

...so it looks as if it's OK if this file doesn't exist.

--

As far as I can tell the chromeos_startup script isn't setup to die upon errors.  ...so when we hit this statement on a board without "firmware-boot-update" it spits an error to stderr (which goes nowhere) and then moves on to the next command.

I guess this is OK, but...  

  Ick.

...it seems like a bad idea for this script to be unconditionally calling a command that we know might not exist.  

I figure there will be opinionated people that will know how they want this fixed (or maybe they really want it not fixed???), so I'll let others decide if they care and how they'd like it fixed.


NOTE: I originally noticed this because I was debugging chromeos_startup and had stderr output straight to the serial port.  At first I actually thought that this error was fatal, but I have since come to understand that it's not.
 

Comment 1 by derat@chromium.org, Jan 27 2018

Agreed that the script should at the very least test that the command exists first.

Tangentially related: for  issue 784651 , I was about to update chromeos_startup to create a lockfile directory that'll soon by used by flashrom:

https://crrev.com/c/886831
https://crrev.com/c/809853

Comment 2 by hungte@chromium.org, Jan 27 2018

I can give some story here.

In the very beginning I did plan to detect and run, as something like

 if [ -x /usr/sbin/firmware-boot-update ]; then
   /usr/sbin/firmware-boot-update
 fi

But the code reviewers (Mike?) suggested it's better to always have the file (and be empty if no boot update needed) - faster in execution, easier to understand and similar boot path. So I changed the implementation to simply "/usr/sbin/firmware-boot-update" with comments that most files should be zero.

However, the file is decided by chromeos-firmware-* ebuild package. It's usually in private overlays, and the public overlay was using a dummy ebuild file. Since all "real" chromeos should have firmware ebuilds in private overlay, we didn't spend too much time fixing this.

Now back to the issue. I'm fine if you want to change to chromeos-base/chromeos-firmware in public overlay to include that dummy file. But watch out - then you have to pay attention when creating chromeos-firmware-$BOARD in overlay, since files prepared by two different ebuild packages will cause conflict, and it's usually hard for partners or many googlers (who need to make contribution to the ebuild files) to figure out what to do. It seems to me leaving some error message in an unofficial build image is not a big deal, in comparison to the ebuild migration issues.
Ick.  I definitely don't want to screw around with having two different ebuilds providing the same file.  That's always a hassle.

...so it sorta sounds like this is by design and people want to keep it that way.  If that's true, I guess I'd at least prefer to change the comment to indicate that.

Comment 4 by hungte@chromium.org, Jan 30 2018

changing the comment sounds great, maybe even with a link to this issue :)
Project Member

Comment 6 by bugdroid1@chromium.org, Feb 6 2018

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

commit d66fbc595e21a93ebf5a98441f8b18f53f67bc83
Author: Douglas Anderson <dianders@chromium.org>
Date: Tue Feb 06 23:41:23 2018

init: chromeos_startup: Add a comment about firmware-boot-update

I recently got confused and spent a little time debugging why
firmware-boot-update didn't exist on my board, only to find that the
error was non-fatal.

Add a comment to avoid future confusion.

BUG= chromium:806383 
TEST=Put this on a board and see that it still boots

Change-Id: Ia91c3339b0be29c01e1e61b330281c71e2b36211
Reviewed-on: https://chromium-review.googlesource.com/902457
Commit-Ready: Douglas Anderson <dianders@chromium.org>
Tested-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Dan Erat <derat@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>

[modify] https://crrev.com/d66fbc595e21a93ebf5a98441f8b18f53f67bc83/init/chromeos_startup

Status: Fixed (was: Untriaged)
after firmware-boot-update is dropped (i.e., devices using updater3 are EOL'ed), we can:
 - remove updater3.sh
 - drop mode=startup
 - drop mode=todev
 - since the only updater is updater4 now, consider dropping UPDATER_SCRIPT and always use the single script.
Project Member

Comment 9 by bugdroid1@chromium.org, Aug 18

Project Member

Comment 10 by bugdroid1@chromium.org, Aug 18

Project Member

Comment 11 by bugdroid1@chromium.org, Aug 18

Project Member

Comment 12 by bugdroid1@chromium.org, Aug 28

Project Member

Comment 13 by bugdroid1@chromium.org, Aug 30

Project Member

Comment 14 by bugdroid1@chromium.org, Sep 8

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/firmware/+/3f37125e1b3e15172d3143e0b188e23101edf04c

commit 3f37125e1b3e15172d3143e0b188e23101edf04c
Author: Hung-Te Lin <hungte@chromium.org>
Date: Sat Sep 08 13:49:50 2018

firmware: Drop 'todev' mode.

The 'todev' was mainly used by updater v2 generation (alex, zgb; those
need to reflash a DEV firmware) and was replaced by crossystem settings
since v3, and since then replaced by enable_dev_usb_boot script in
vboot_reference repository.

We have already revised all documents to use enable_dev_usb_boot instead
of running "chromeos-firmwareupdate --mode=todev", and updater v2 has
been removed for a long time so it should be fine to drop 'todev' support.

BUG= chromium:806383 
TEST=make test

Change-Id: Ibbd7dd9a6626ea6388ca67f30d4efafd41f0f1d7
Reviewed-on: https://chromium-review.googlesource.com/1180622
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>

[modify] https://crrev.com/3f37125e1b3e15172d3143e0b188e23101edf04c/pack_dist/crosutil.sh
[modify] https://crrev.com/3f37125e1b3e15172d3143e0b188e23101edf04c/pack_dist/updater4.sh
[modify] https://crrev.com/3f37125e1b3e15172d3143e0b188e23101edf04c/pack_dist/common.sh
[modify] https://crrev.com/3f37125e1b3e15172d3143e0b188e23101edf04c/pack_dist/updater3.sh

Project Member

Comment 15 by bugdroid1@chromium.org, Oct 30

Project Member

Comment 16 by bugdroid1@chromium.org, Oct 30

Project Member

Comment 17 by bugdroid1@chromium.org, Nov 1

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/firmware/+/71a517f90489ebafa322302c2b07c64b09f04930

commit 71a517f90489ebafa322302c2b07c64b09f04930
Author: Hung-Te Lin <hungte@chromium.org>
Date: Thu Nov 01 04:59:17 2018

firmware: Remove updater3.sh

The Chromebooks using updater3 are now all EOL'ed, and the updater
ebuilds are also removed from overlays, so it should be fine to finally
remove the updater3 script.

BUG= chromium:806383 
TEST=make test
CQ-DEPEND=CL:*664037, CL:*677811

Change-Id: I3992ecd026491180f28dea317965c30a96d165b5
Reviewed-on: https://chromium-review.googlesource.com/1179740
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>

[delete] https://crrev.com/f5d5098fa56bdc705d95218ca04a4df784f5f29e/pack/dist/updater3.sh

Project Member

Comment 18 by bugdroid1@chromium.org, Nov 1

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

commit 49da94ad20ce233d75ee8bf39bf0dccd14137282
Author: Mike Frysinger <vapier@chromium.org>
Date: Thu Nov 01 04:59:31 2018

init: chromeos-startup: drop support for firmware-boot-update

This is only used by lumpy/stumpy/butterfly/parrot/stout which are EOL.
Drop support for executing this script at startup.

BUG= chromium:806383 
TEST=precq passes

Change-Id: I5e5671a18f7cab1654ae3ce63c4b0f984f9003c0
Reviewed-on: https://chromium-review.googlesource.com/1156069
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>

[modify] https://crrev.com/49da94ad20ce233d75ee8bf39bf0dccd14137282/init/chromeos_startup

Project Member

Comment 19 by bugdroid1@chromium.org, Nov 1

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/firmware/+/844b203aec9cf2353f7d14fca5768baab524f4af

commit 844b203aec9cf2353f7d14fca5768baab524f4af
Author: Hung-Te Lin <hungte@chromium.org>
Date: Thu Nov 01 17:02:16 2018

firmware: Drop 'startup' mode (boot update) and firmware-boot-update

The 'startup' mode was mainly used for updating non-Chrome EC without
software sync, and only needed by updater v3 (already deprecated).

As a result, it should be fine to drop the 'startup' mode' and its
supporting files (firmware-boot-update*).

BUG= chromium:806383 
TEST=make test
CQ-DEPEND=CL:1310154

Change-Id: I8b2d08b43e73b6e0453e89a0fe1db2f994047cc3
Reviewed-on: https://chromium-review.googlesource.com/1180621
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>

[delete] https://crrev.com/2cd6f5a4299d77480847f5f27676e20aabd719d7/sbin/firmware-boot-update.3
[modify] https://crrev.com/844b203aec9cf2353f7d14fca5768baab524f4af/unittests/crosutil_unittest
[modify] https://crrev.com/844b203aec9cf2353f7d14fca5768baab524f4af/pack/dist/crosutil.sh
[modify] https://crrev.com/844b203aec9cf2353f7d14fca5768baab524f4af/pack/dist/common.sh
[modify] https://crrev.com/844b203aec9cf2353f7d14fca5768baab524f4af/pack/dist/updater4.sh
[delete] https://crrev.com/2cd6f5a4299d77480847f5f27676e20aabd719d7/sbin/firmware-boot-update
[delete] https://crrev.com/2cd6f5a4299d77480847f5f27676e20aabd719d7/sbin/README

all removed :)

Sign in to add a comment