Error "cp: cannot stat `/usr/bin/linaro-hwpack-install': No such file or directory" in 0.4.2

Bug #710104 reported by Spring Zhang
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Linaro Image Tools
Fix Released
Medium
Loïc Minier

Bug Description

$ sudo linaro-media-create --rootfs ext3 --mmc /dev/sdb --dev mx51evk --binary linaro-natty-headless-tar-20110130-0.tar.gz --hwpack hwpack_linaro-imx51_20110130-0_armel_unsupported.tar.gz

Logs:
.....
cp: cannot stat `/usr/bin/linaro-hwpack-install': No such file or directory
Traceback (most recent call last):
  File "/usr/local/bin/linaro-media-create", line 122, in <module>
    install_hwpacks(ROOTFS_DIR, TMP_DIR, args.hwpack_force_yes, *hwpacks)
  File "/usr/local/lib/python2.6/dist-packages/linaro_media_create/hwpack.py", line 50, in install_hwpacks
    os.path.join(chroot_dir, 'usr', 'bin'))
  File "/usr/local/lib/python2.6/dist-packages/linaro_media_create/hwpack.py", line 101, in copy_file
    cmd_runner.run(['cp', filepath, directory], as_root=True).wait()
  File "/usr/local/lib/python2.6/dist-packages/linaro_media_create/cmd_runner.py", line 65, in wait
    raise SubcommandNonZeroReturnValue(self._my_args, returncode)
linaro_media_create.cmd_runner.SubcommandNonZeroReturnValue: Sub process "['sudo', 'cp', '/usr/bin/linaro-hwpack-install', '/tmp/tmpBOtSVd/binary/usr/bin']" returned a non-zero value: 1

Related branches

Revision history for this message
Spring Zhang (qzhang) wrote :

Need to change the following line in /usr/local/lib/python2.6/dist-packages/linaro_media_create/hwpack.py
    if not os.path.exists(linaro_hwpack_install_path):
        linaro_hwpack_install_path = '/usr/bin/linaro-hwpack-install'
to:
    if not os.path.exists(linaro_hwpack_install_path):
        linaro_hwpack_install_path = '/usr/local/bin/linaro-hwpack-install'

Revision history for this message
Loïc Minier (lool) wrote :

linaro_media_create/hwpack.py hardcodes /usr/bin/linaro-hwpack-install (unless running from a checkout)

perhaps we should:
* rely on PATH and run linaro-hwpack-install
* amend PATH and PYTHONPATH when running from a checkout

Changed in linaro-image-tools:
importance: Undecided → Medium
status: New → Triaged
Revision history for this message
James Westby (james-w) wrote : Re: [Bug 710104] Re: Error "cp: cannot stat `/usr/bin/linaro-hwpack-install': No such file or directory" in 0.4.2

On Sun, 30 Jan 2011 19:24:45 -0000, Loïc Minier <email address hidden> wrote:
> linaro_media_create/hwpack.py hardcodes /usr/bin/linaro-hwpack-install
> (unless running from a checkout)
>
> perhaps we should:
> * rely on PATH and run linaro-hwpack-install
> * amend PATH and PYTHONPATH when running from a checkout

It copies it in to the chroot doesn't it?

We could iterate over PATH and use the first though.

Thanks,

James

Revision history for this message
Loïc Minier (lool) wrote :

Yes, this is to copy it into the chroot (not sure how that relates?)

The problem is that the source path is hardcoded:
    # FIXME: This is an ugly hack to make sure we use the l-h-i script from
    # the current development tree when possible.
    here = os.path.dirname(__file__)
    linaro_hwpack_install_path = os.path.join(
        here, '..', 'linaro-hwpack-install')
    if not os.path.exists(linaro_hwpack_install_path):
        linaro_hwpack_install_path = '/usr/bin/linaro-hwpack-install'
    copy_file(linaro_hwpack_install_path,
              os.path.join(chroot_dir, 'usr', 'bin'))

(the chroot/usr/bin dest path is ok, usr/local/bin or custom dir might be more elegant though)

Revision history for this message
James Westby (james-w) wrote :

On Sun, 30 Jan 2011 21:02:56 -0000, Loïc Minier <email address hidden> wrote:
> Yes, this is to copy it into the chroot (not sure how that relates?)

Because cp doesn't use $PATH?

If all we wanted to do was execute the script then relying on $PATH is
fine.

Instead what we want to do instead is copy the script in to the chroot,
then run "sudo chroot $chroot /usr/bin/linaro-hwpack-install", and then
remove it again.

Thanks,

James

Revision history for this message
Loïc Minier (lool) wrote :

Hmm I don't understand my own first reply anymore; I think I worded my initial reply poorly... anyway, we agree that we should be searching the PATH for linaro-hwpack-install and copy it to the chroot.

Revision history for this message
Loïc Minier (lool) wrote :

I think fixing bug #711312 would also fix this bug, but I didn't test.

Loïc Minier (lool)
Changed in linaro-image-tools:
milestone: none → 0.4.4
Loïc Minier (lool)
Changed in linaro-image-tools:
assignee: nobody → Loïc Minier (lool)
status: Triaged → In Progress
Loïc Minier (lool)
Changed in linaro-image-tools:
status: In Progress → Fix Committed
Mattias Backman (mabac)
Changed in linaro-image-tools:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.