develop/west/troubleshooting.html · develop/west/troubleshooting.rst 공식 원문 ↗

Zephyr 3.7.0 · Develop · West · Troubleshooting

West 문제 해결

West 오류 message를 원인별로 분류하고 workspace와 package 상태를 확인해 안전하게 복구합니다.

Official pathdevelop/west/troubleshooting.html
Source filedevelop/west/troubleshooting.rst
Source versionZephyr 3.7.0
TranslationFull · reviewed

본문 기준: Zephyr 3.7.0 LTS3 · 이후 유지보수 패치는 별도입니다.

Part 1

요약·해설

west update fetch 진단, Windows PATH, requires_workspace package 충돌, extension command 인식, 오래된 West와 workspace 탐색 문제를 해결합니다.

Network

verbose fetch · credential · proxy

Install

PATH · pip · virtual environment

Workspace

extensions · ZEPHYR_BASE · re-init

Part 2

접을 수 있는 영어 원문 전체

영어 원문 전체 펼치기
원문 SHA-256 C1839D83B07E22FE5966089FE7ED1215691AA90828FB4FF78CA3CA60D812432F
.. _west-troubleshooting:

Troubleshooting West
####################

This page covers common issues with west and how to solve them.

``west update`` fetching failures
*********************************

One good way to troubleshoot fetching issues is to run ``west update`` in
verbose mode, like this:

.. code-block:: shell

   west -v update

The output includes Git commands run by west and their outputs. Look for
something like this:

.. code-block:: none

   === updating your_project (path/to/your/project):
   west.manifest: your_project: checking if cloned
   [...other west.manifest logs...]
   --- your_project: fetching, need revision SOME_SHA
   west.manifest: running 'git fetch ... https://github.com/your-username/your_project ...' in /some/directory

The ``git fetch`` command example in the last line above is what needs to
succeed.

One strategy is to go to ``/path/to/your/project``, copy/paste and run the entire
``git fetch`` command, then debug from there using the documentation for your
credential storage helper.

If you're behind a corporate firewall and may have proxy or other issues,
``curl -v FETCH_URL`` (for HTTPS URLs) or ``ssh -v FETCH_URL`` (for SSH URLs)
may be helpful.

If you can get the ``git fetch`` command to run successfully without prompting
for a password when you run it directly, you will be able to run ``west
update`` without entering your password in that same shell.

"'west' is not recognized as an internal or external command, operable program or batch file.'
**********************************************************************************************

On Windows, this means that either west is not installed, or your :envvar:`PATH`
environment variable does not contain the directory where pip installed
:file:`west.exe`.

First, make sure you've installed west; see :ref:`west-install`. Then try
running ``west`` from a new ``cmd.exe`` window. If that still doesn't work,
keep reading.

You need to find the directory containing :file:`west.exe`, then add it to your
:envvar:`PATH`. (This :envvar:`PATH` change should have been done for you when
you installed Python and pip, so ordinarily you should not need to follow these
steps.)

Run this command in ``cmd.exe``::

  pip3 show west

Then:

#. Look for a line in the output that looks like ``Location:
   C:\foo\python\python38\lib\site-packages``. The exact location
   will be different on your computer.
#. Look for a file named ``west.exe`` in the ``scripts`` directory
   ``C:\foo\python\python38\scripts``.

   .. important::

      Notice how ``lib\site-packages`` in the ``pip3 show`` output was changed
      to ``scripts``!
#. If you see ``west.exe`` in the ``scripts`` directory, add the full path to
   ``scripts`` to your :envvar:`PATH` using a command like this::

     setx PATH "%PATH%;C:\foo\python\python38\scripts"

   **Do not just copy/paste this command**. The ``scripts`` directory location
   will be different on your system.
#. Close your ``cmd.exe`` window and open a new one. You should be able to run
   ``west``.

"Error: unexpected keyword argument 'requires_workspace'"
*********************************************************

This error occurs on some Linux distributions after upgrading to west 0.7.0 or
later from 0.6.x. For example:

.. code-block:: none

   $ west update
   [... stack trace ...]
   TypeError: __init__() got an unexpected keyword argument 'requires_workspace'

This appears to be a problem with the distribution's pip; see `this comment in
west issue 373`_ for details. Some versions of **Ubuntu** and **Linux Mint** are known to
have this problem. Some users report issues on Fedora as well.

Neither macOS nor Windows users have reported this issue. There have been no
reports of this issue on other Linux distributions, like Arch Linux, either.

.. _this comment in west issue 373:
   https://github.com/zephyrproject-rtos/west/issues/373#issuecomment-583489272

**Workaround 1**: remove the old version, then upgrade:

.. code-block:: none

   $ pip3 show west | grep Location: | cut -f 2 -d ' '
   /home/foo/.local/lib/python3.6/site-packages
   $ rm -r /home/foo/.local/lib/python3.6/site-packages/west
   $ pip3 install --user west==0.7.0

**Workaround 2**: install west in a Python virtual environment

One option is to use the `venv module`_ that's part of the Python 3 standard
library. Some distributions remove this module from their base Python 3
packages, so you may need to do some additional work to get it installed on
your system.

.. _venv module:
   https://docs.python.org/3/library/venv.html

"invalid choice: 'build'" (or 'flash', etc.)
********************************************

If you see an unexpected error like this when trying to run a Zephyr extension
command (like :ref:`west flash <west-flashing>`, :ref:`west build
<west-building>`, etc.):

.. code-block:: none

   $ west build [...]
   west: error: argument <command>: invalid choice: 'build' (choose from 'init', [...])

   $ west flash [...]
   west: error: argument <command>: invalid choice: 'flash' (choose from 'init', [...])

The most likely cause is that you're running the command outside of a
:ref:`west workspace <west-workspace>`. West needs to know where your workspace
is to find :ref:`west-extensions`.

To fix this, you have two choices:

#. Run the command from inside a workspace (e.g. the :file:`zephyrproject`
   directory you created when you :ref:`got started <getting_started>`).

   For example, create your build directory inside the workspace, or run ``west
   flash --build-dir YOUR_BUILD_DIR`` from inside the workspace.

#. Set the :envvar:`ZEPHYR_BASE` :ref:`environment variable <env_vars>` and re-run
   the west extension command. If set, west will use :envvar:`ZEPHYR_BASE` to
   find your workspace.

If you're unsure whether a command is built-in or an extension, run ``west
help`` from inside your workspace. The output prints extension commands
separately, and looks like this for mainline Zephyr:

.. code-block:: none

   $ west help

   built-in commands for managing git repositories:
     init:                 create a west workspace
     [...]

   other built-in commands:
     help:                 get help for west or a command
     [...]

   extension commands from project manifest (path: zephyr):
     build:                compile a Zephyr application
     flash:                flash and run a binary on a board
     [...]

"invalid choice: 'post-init'"
*****************************

If you see this error when running ``west init``:

.. code-block:: none

   west: error: argument <command>: invalid choice: 'post-init'
   (choose from 'init', 'update', 'list', 'manifest', 'diff',
   'status', 'forall', 'config', 'selfupdate', 'help')

Then you have an old version of west installed, and are trying to use it in a
workspace that requires a more recent version.

The easiest way to resolve this issue is to upgrade west and retry as follows:

#. Install the latest west with the ``-U`` option for ``pip3 install`` as shown
   in :ref:`west-install`.

#. Back up any contents of :file:`zephyrproject/.west/config` that you want to
   save. (If you don't have any configuration options set, it's safe to skip
   this step.)

#. Completely remove the :file:`zephyrproject/.west` directory (if you don't,
   you will get the "already in a workspace" error message discussed next).

#. Run ``west init`` again.

"already in an installation"
****************************

You may see this error when running ``west init`` with west 0.6:

.. code-block:: none

   FATAL ERROR: already in an installation (<some directory>), aborting

If this is unexpected and you're really trying to create a new west workspace,
then it's likely that west is using the :envvar:`ZEPHYR_BASE` :ref:`environment
variable <env_vars>` to locate a workspace elsewhere on your system.

This is intentional; it allows you to put your Zephyr applications in
any directory and still use west to build, flash, and debug them, for example.

To resolve this issue, unset :envvar:`ZEPHYR_BASE` and try again.

Part 3

한국어 전문 번역

West 문제 해결

이 페이지는 West에서 자주 만나는 문제의 증상, 원인 확인 방법과 복구 절차를 설명합니다.

west update fetch 실패

Fetch 문제를 조사하는 좋은 첫 단계는 verbose mode로 west update를 실행하는 것입니다.

west -v update

출력에는 West가 실행한 Git command와 그 결과가 포함됩니다. 다음과 같은 project update 부분을 찾습니다.

=== updating your_project (path/to/your/project):
west.manifest: your_project: checking if cloned
[...other west.manifest logs...]
--- your_project: fetching, need revision SOME_SHA
west.manifest: running 'git fetch ... https://github.com/your-username/your_project ...' in /some/directory

마지막 줄에 표시되는 실제 git fetch command가 성공해야 합니다.

한 가지 방법은 표시된 project directory로 이동해 전체 git fetch command를 그대로 실행하고, 사용 중인 credential storage helper 문서에 따라 인증 문제를 조사하는 것입니다.

회사 환경의 corporate firewall 뒤에서 proxy나 network 문제가 의심되면 HTTPS URL은 curl -v FETCH_URL, SSH URL은 ssh -v FETCH_URL로 연결 과정을 확인할 수 있습니다.

같은 shell에서 직접 실행한 git fetch가 password prompt 없이 성공하도록 만들면 west update도 password 입력 없이 실행할 수 있습니다.

Windows: 'west'를 내부 또는 외부 command로 인식하지 못함

Windows에서 이 message는 West가 설치되지 않았거나 PATH 환경 변수에 pip가 west.exe를 설치한 directory가 없다는 뜻입니다.

West 설치 안내에 따라 설치했는지 확인하고 새 cmd.exe window에서 west를 실행합니다. 여전히 실패하면 west.exe 위치를 찾아 PATH에 추가합니다. 보통 Python과 pip 설치 과정에서 자동 처리되므로 일반적으로 아래 수동 절차는 필요하지 않습니다.

cmd.exe에서 package 위치를 확인합니다.

pip3 show west
  1. Location: C:\foo\python\python38\lib\site-packages와 비슷한 줄을 찾습니다. 실제 위치는 system마다 다릅니다.
  2. lib\site-packages를 scripts로 바꾼 C:\foo\python\python38\scripts directory에서 west.exe를 찾습니다.
  3. west.exe가 있다면 실제 scripts path를 PATH에 추가합니다.
    setx PATH "%PATH%;C:\foo\python\python38\scripts"
    예제 path를 그대로 복사하지 말고 자신의 pip3 show west 결과에서 계산한 path를 사용해야 합니다.
  4. cmd.exe를 닫고 새 window를 연 뒤 west를 실행합니다.

Error: unexpected keyword argument 'requires_workspace'

일부 Linux 배포판에서 West 0.6.x를 0.7.0 이상으로 upgrade한 뒤 다음 오류가 발생할 수 있습니다.

$ west update
[... stack trace ...]
TypeError: __init__() got an unexpected keyword argument 'requires_workspace'

West issue 373의 설명에 따르면 배포판 pip 문제로 보입니다. 일부 Ubuntu와 Linux Mint version에서 알려졌고 Fedora 보고도 있습니다. macOS·Windows와 Arch Linux 같은 다른 배포판에서는 당시 보고가 없었습니다.

우회 방법 1은 old package 위치를 확인해 제거한 뒤 0.7.0을 다시 설치하는 것입니다.

$ pip3 show west | grep Location: | cut -f 2 -d ' '
/home/foo/.local/lib/python3.6/site-packages
$ rm -r /home/foo/.local/lib/python3.6/site-packages/west
$ pip3 install --user west==0.7.0

우회 방법 2는 Python virtual environment 안에 West를 설치하는 것입니다. Python 3 standard library의 venv module을 사용할 수 있지만 일부 배포판은 base Python package에서 venv를 빼므로 별도 package 설치가 필요할 수 있습니다.

invalid choice: 'build' 또는 'flash'

Zephyr extension command를 실행할 때 다음과 같은 예상 밖 오류가 날 수 있습니다.

$ west build [...]
west: error: argument <command>: invalid choice: 'build' (choose from 'init', [...])

$ west flash [...]
west: error: argument <command>: invalid choice: 'flash' (choose from 'init', [...])

가장 가능성 높은 원인은 command를 West workspace 밖에서 실행한 것입니다. West는 workspace 위치를 알아야 manifest의 extension command를 찾을 수 있습니다.

해결 방법은 둘 중 하나입니다.

  1. 시작 안내에서 만든 zephyrproject처럼 workspace 안에서 command를 실행합니다. Build directory를 workspace 안에 만들거나 workspace 안에서 west flash --build-dir YOUR_BUILD_DIR를 실행할 수 있습니다.
  2. ZEPHYR_BASE 환경 변수를 설정하고 extension command를 다시 실행합니다. West는 이 값으로 workspace를 찾습니다.

west help를 workspace 안에서 실행하면 built-in command와 extension command를 구분해 표시하므로 command 종류가 확실하지 않을 때 확인할 수 있습니다.

$ west help

built-in commands for managing git repositories:
  init:                 create a west workspace
  [...]

other built-in commands:
  help:                 get help for west or a command
  [...]

extension commands from project manifest (path: zephyr):
  build:                compile a Zephyr application
  flash:                flash and run a binary on a board
  [...]

invalid choice: 'post-init'

west init 중 다음 오류가 나면 설치된 West가 오래됐고 workspace는 더 최신 version을 요구한다는 뜻입니다.

west: error: argument <command>: invalid choice: 'post-init'
(choose from 'init', 'update', 'list', 'manifest', 'diff',
'status', 'forall', 'config', 'selfupdate', 'help')

가장 쉬운 해결은 West를 upgrade한 뒤 workspace를 다시 초기화하는 것입니다.

  1. West 설치 안내처럼 pip3 install에 -U option을 사용해 최신 West를 설치합니다.
  2. 보존할 zephyrproject/.west/config 내용을 backup합니다. 설정 option이 없다면 생략할 수 있습니다.
  3. zephyrproject/.west directory를 완전히 제거합니다. 남겨 두면 다음 절의 "already in a workspace" 오류가 납니다.
  4. west init을 다시 실행합니다.

already in an installation

West 0.6에서 west init을 실행할 때 다음 오류를 볼 수 있습니다.

FATAL ERROR: already in an installation (<some directory>), aborting

새 workspace를 만들려던 중 예상 밖에 이 오류가 났다면 West가 ZEPHYR_BASE 환경 변수로 system의 다른 workspace를 찾았을 가능성이 큽니다.

이 동작은 의도된 것입니다. Zephyr application을 어느 directory에 두어도 West로 build·flash·debug할 수 있게 합니다.

ZEPHYR_BASE를 unset한 뒤 다시 west init을 실행하면 해결됩니다.

Source

출처

영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.