Correct way to put chromiumos_image.bin to HDD

1,349 views
Skip to first unread message

Uy Van Duc

unread,
Aug 18, 2015, 3:08:07 AM8/18/15
to Chromium OS discuss
Dear All,
Since my board can not boot from USB, and i want to boot from HDD instead.
Right now i use dd if=chromiumos_image.bin of=/dev/sda to create HDD, then setting root=/dev/sda3 from u-boot to boot up.

Chromeos goto Self-repair screen and reboot again and again, checked on first partition and see.

[root@dhcp-10-38-6-210 unencrypted]# cat clobber.log
2015/08/18 03:48:25 UTC Self-repair incoherent stateful partition: var and home. History: /home/chronos /var /home
2015/08/18 03:48:26 UTC (preserve log): /sbin/clobber-state fast keepimg
2015/08/18 03:48:26 UTC (restore log): /sbin/clobber-state fast keepimg
[root@dhcp-10-38-6-210 unencrypted]#


Did some search and see this error because stateful partition corrupted. but i'm not clear how it corrupted.

Any wrong with me to use dd chromiumos image to HDD ?

Thanks
Uy

Mike Frysinger

unread,
Aug 18, 2015, 10:20:28 AM8/18/15
to Uy Van Duc, Chromium OS discuss
normally we use chromeos-install to handle moving the image to the root disk.  it does the dd on the subpartitions.
-mike

--
--
Chromium OS discuss mailing list: chromium-...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-os-discuss?hl=en


Nam Nguyen

unread,
Aug 18, 2015, 11:29:35 AM8/18/15
to Mike Frysinger, Uy Van Duc, Chromium OS discuss
But he can't boot from USB...

Ian Bloss

unread,
Aug 18, 2015, 11:32:01 AM8/18/15
to namn...@chromium.org, Chromium OS discuss, Uy Van Duc, Mike Frysinger

Try reading the source for chromeos-install script and see how it sets up the partitions and dd's the partitions

To unsubscribe from this group and stop receiving emails from it, send an email to chromium-os-dis...@chromium.org.

Richard Barnette

unread,
Aug 18, 2015, 12:39:09 PM8/18/15
to namn...@chromium.org, Mike Frysinger, Uy Van Duc, Chromium OS discuss
On 8/18/15 8:29 AM, Nam Nguyen wrote:
> But he can't boot from USB...
>
It's possible to use chromeos-install from a disk
without booting from it. In particular, you can
use chromeos-install inside a chroot to put an image
on a USB stick so that the stateful partition is sized
to use all the rest of the free space. That's how the
`cros flash --install` option works. If the target
host is also the build host, that command can be used
to install onto an alternate internal disk, and you can
then just boot from the new disk. Problem solved.

If the goal is to build on one host and install on another,
it's likely chromeos-install would need changes to support
it. But, I don't think the changes would be that big.
The new use case ought to look like this:
* Build an image, and put it on a USB stick using
`cros flash`
* Insert the USB stick into a target host running
Linux.
* Mount the Chromium OS root partition from the USB
stick, and run chromeos-install from that partition,
specifying an unused internal disk as the destination.

For reference, here's the chromeos-install command line
used in `cros flash`:
sudo chromeos-install --yes --skip_src_removable \
--skip_dst_removable --payload_image=$IMAGE \
--dst=$DEV --skip_postinstall
--
--jrb
Message has been deleted

Uy Van Duc

unread,
Aug 19, 2015, 4:27:02 AM8/19/15
to Chromium OS discuss, namn...@chromium.org, vap...@chromium.org, vdu...@gmail.com
Thanks Guys for really useful help and solution.
I'm modifying chromeos-install to try, and will report if any other result.

Thank you very much
Uy

Uy Van Duc

unread,
Aug 19, 2015, 4:36:14 AM8/19/15
to Chromium OS discuss, namn...@chromium.org, vap...@chromium.org, vdu...@gmail.com
Here is output of chromeos-install after modified. seem still have some problems with GPT table

~# /mnt/usr/sbin/chromeos-install  --dst=/dev/sdb
This will install from 'sdc' to '/dev/sdb'.
This will erase all data at this destination: /dev/sdb
Are you sure (y/N)? y
32+0 records in
32+0 records out
16384 bytes (16 kB) copied, 0.00018658 s, 87.8 MB/s
33+0 records in
33+0 records out
16896 bytes (17 kB) copied, 0.0012182 s, 13.9 MB/s
WARNING: Primary GPT header is invalid
ERROR: Can't open 12: No such file or directory
Running a hw diagnostics test -- this might take a couple minutes.
Checking blocks 0 to 125034839
Checking for bad blocks (read-only test): done
Pass completed, 0 bad blocks found. (0/0/0 errors)
:~#

And for next boot Linux does not detect GPT table
sd 1:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
 sdb: unknown partition table


Though we need to use some tool to fix GPT table also

Thanks
Uy

Ian Bloss

unread,
Aug 19, 2015, 9:59:35 AM8/19/15
to vdu...@gmail.com, Chromium OS discuss, namn...@chromium.org, Mike Frysinger
did you try wiping the partition table before running the install script?

--
--
Chromium OS discuss mailing list: chromium-...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-os-discuss?hl=en

Richard Barnette

unread,
Aug 19, 2015, 12:08:18 PM8/19/15
to vdu...@gmail.com, Chromium OS discuss, namn...@chromium.org, vap...@chromium.org
On 8/19/15 1:36 AM, Uy Van Duc wrote:
> Here is output of chromeos-install after modified. seem still have some
> problems with GPT table
>
> ~# /mnt/usr/sbin/chromeos-install --dst=/dev/sdb

Unless you've heavily modified the script, the options
above won't be enough. My original mail included a whole
lot of other options (the ones used with `cros flash --install`).
Those options are mandatory. Either the script has to be
changed to make those options default, or you'll want to
include the options on the command line.


> This will install from 'sdc' to '/dev/sdb'.
> This will erase all data at this destination: /dev/sdb
> Are you sure (y/N)? y
> 32+0 records in
> 32+0 records out
> 16384 bytes (16 kB) copied, 0.00018658 s, 87.8 MB/s
> 33+0 records in
> 33+0 records out
> 16896 bytes (17 kB) copied, 0.0012182 s, 13.9 MB/s
> WARNING: Primary GPT header is invalid

I think this message is a red herring.


> ERROR: Can't open 12: No such file or directory

I think this is the trouble. I *think* this means that
the script got the source device wrong, and consequently
tried to read from partition 12 as a file named '12'.
I can't fully explain it, though, because the earlier
output says the script could read from _something_
successfully.

You can debug this by running the script with the '-x'
option, or you can put `set -x` at strategic points where
you think the bug might be living.


> Running a hw diagnostics test -- this might take a couple minutes.
> Checking blocks 0 to 125034839
> Checking for bad blocks (read-only test): done
> Pass completed, 0 bad blocks found. (0/0/0 errors)
> :~#
>
> And for next boot Linux does not detect GPT table
> sd 1:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't
> support DPO or FUA
> sdb: unknown partition table
>
>
> Though we need to use some tool to fix GPT table also
>
> Thanks
> Uy
>

Uy Van Duc

unread,
Aug 20, 2015, 3:35:02 AM8/20/15
to Chromium OS discuss, vdu...@gmail.com, namn...@chromium.org, vap...@chromium.org
Thanks Richard,

1. I just modify chromeos-install script for correct include path, and didnot lookup ROOT by using rootdev (my target boot linux from NFS), i hard code it by using /dev/sdb3 is partition 3 on USB Stick.
2. mount partition 3 on USB to /mnt, export PATH=$PATH:/mnt/usr/bin:/mnt/usr/sbin
3. Running chromeos-install script as following. output was in attached file, and it look good, as same as cros flash usb://

chromeos-install --yes --skip_src_removable \
         --skip_dst_removable --payload_image=/opt/chromiumos_image.bin \
         --dst=/dev/sda --skip_postinstall

4. recheck partition and see all 12 partitions seem to be correct.
5. Boot target using uboot to download uImage, DeviceTree TFTP, and set root=/dev/sda3, partition 3 of HDD for Chromeos Rootfs.
6. After boot up ChromeOS goto repair itself again and reboot my target.


Do you think i still missing something? expecially at step 5, do i need to pass any other parameters from u-boot?

Thanks
Uy
chromeos-install.log

Uy Van Duc

unread,
Aug 20, 2015, 6:25:52 AM8/20/15
to Chromium OS discuss, vdu...@gmail.com, namn...@chromium.org, vap...@chromium.org
Dear All,

Continue debug and i see system reboot because can not mount-encrypted, temporary disable it and system can boot to console.

trying to run mount-encrypted from console and see some following error. Do I missed some kernel configuration? i usued 3.18 kernel for ARM64

Thanks
UY

chronos@dhcp-10-38-6-210 / $ sudo mount-encrypted

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

Password:
[pid:1488] Starting.
[pid:1488] VFS mount state sanity check ok.
Unable to open FDT property firmware-type
[pid:1488] Using default insecure system key.
[pid:1488] /mnt/stadevice-mapper: table: 252:0: crypt: Error creating IV
teful_partition/device-mapper: ioctl: error adding target to table
encrypted.key does not exist.
[pid:1488] /mnt/stateful_partition/encrypted.needdevice-mapper: table: 252:0: crypt: Error creating IV
s-finalization ddevice-mapper: ioctl: error adding target to table
oes not exist.
[pid:1488] Generating new encryption key.
[pid:1488] Creating sparse backing file with size 36451528704.
[pid:1488] Loopback attaching /mnt/stateful_partition/encrypted.block (named encstateful).
[pid:1488] Setting up dm-crypt /dev/loop0 as /dev/mapper/encstateful.
ERROR[pid:1488] runcmd (../../../cryptohome-0.0.1/platform2/cryptohome/mount-helpers.c, 88): /sbin/dmsetup failed (256)

device-mapper: reload ioctl on encstateful failed: No such file or directory
Command failed

ERROR[pid:1488] runcmd (../../../cryptohome-0.0.1/platform2/cryptohome/mount-helpers.c, 88): /sbin/dmsetup failed (256)

device-mapper: reload ioctl on encstateful failed: No such file or directory
Command failed

ERROR[pid:1488] setup_encrypted (../../../cryptohome-0.0.1/platform2/cryptohome/mount-encrypted.c, 859): dm_setup failed
[pid:1488] Unlooping /dev/loop0.
[pid:1488] Done.



Nam Nguyen

unread,
Aug 20, 2015, 11:09:26 AM8/20/15
to Uy Van Duc, Chromium OS discuss, Mike Frysinger
Are you using a custom kernel with a custom kernel config?

Based on the error related to IV and dmcrypt, my guess is you might
have missed some crypto stuffs in the kernel. Try enabling SHA, AES
and similar modules.

Nam

Richard Barnette

unread,
Aug 20, 2015, 11:58:27 AM8/20/15
to vdu...@gmail.com, Chromium OS discuss, namn...@chromium.org, vap...@chromium.org
On 8/20/15 3:25 AM, Uy Van Duc wrote:
> Dear All,
>
> Continue debug and i see system reboot because can not mount-encrypted,
> temporary disable it and system can boot to console.
>
> trying to run mount-encrypted from console and see some following error.
> Do I missed some kernel configuration? i usued 3.18 kernel for ARM64
>
I think mount-encrypted does have some kernel configuration
requirements. However, I recommend you just build with
this use-flag setting:
USE=-encrypted_stateful
That will make your system just not use mount-encrypted at
boot, and avoid needing to figure out the kernel configuration.

Uy Van Duc

unread,
Aug 20, 2015, 9:50:54 PM8/20/15
to Chromium OS discuss, vdu...@gmail.com, namn...@chromium.org, vap...@chromium.org
Thanks all guys for help,

after reconfig kernel and I can pass the repair itself steps.

UI still not come up but it should be another story.

Have a nice days
Uy
Reply all
Reply to author
Forward
0 new messages