문제 상황

로컬 Kiro CLI에서 OCI 인스턴스에 띄워둔 remote Kiro Crew Gateway에 연결 시도 시 아래 오류 발생:

1
2
3
4
5
6
7
8
token mint failed: remote token mint on oci-kiro exited 127: kirocrew binary not found in any of:
  /home/ubuntu/.local/bin/kirocrew,
  /home/ubuntu/.kirocrew-app/.venv/bin/kirocrew

candidate diagnosis:
  /home/ubuntu/.local/bin/kirocrew: DANGLING symlink -> /home/ubuntu/.kiro/crew-venv/bin/kirocrew (target missing)
  /home/ubuntu/.kirocrew-app/.venv/bin/kirocrew: absent
  /home/ubuntu/.kirocrew-app/.venv/bin/python MISSING

환경

  • OCI Ampere A1 (ARM64 / aarch64)
  • Ubuntu 22.04
  • kirocrew systemd 서비스로 운영 중

원인 분석

1. 현재 상태 확인

1
2
3
4
5
6
7
ls -la /home/ubuntu/.local/bin/kirocrew
# lrwxrwxrwx ... kirocrew -> /home/ubuntu/.kiro/crew-venv/bin/kirocrew

ls /home/ubuntu/.kiro/crew-venv  # 없음

find /home/ubuntu -name "kirocrew" 2>/dev/null
# /home/ubuntu/.kiro/crew-venv.pre-rebuild.716938/bin/kirocrew

crew-venv.pre-rebuild.{숫자} 형태의 백업 디렉토리가 남아 있고 실제 crew-venv는 없는 상태.

2. gateway.log에서 원인 확인

1
tail -100 ~/.kiro/crew/gateway.log
1
2
3
4
5
6
11:54:37 CRITICAL kiro_crew.dashboard.stale_asset_watchdog [PID 3784314]:
  Dashboard static assets vanished — an update likely pruned the running install.
  Initiating graceful shutdown so a supervisor can restart a fresh gateway.

11:54:38 WARNING kiro_crew.slack.gateway [PID 3784314]:
  Auto-update (wheel): cancelled — installer child killed

3. 재빌드 실패 메커니즘

자동 업데이트 진행 순서:

  1. kirocrew가 자동 업데이트 감지
  2. 기존 crew-venv를 crew-venv.pre-rebuild.716938으로 rename (백업)
  3. 새 crew-venv 설치 시작
  4. watchdog이 “static assets가 사라졌다”고 감지 → graceful shutdown 트리거
  5. shutdown으로 installer child process가 killed
  6. 새 venv 설치 미완료 → crew-venv 없는 상태로 남음

업데이트 도중 watchdog이 자기 자신을 죽이는 자충수 케이스.

4. pre-rebuild venv도 사용 불가

1
2
/home/ubuntu/.kiro/crew-venv.pre-rebuild.716938/bin/kirocrew --version
# ModuleNotFoundError: No module named 'kiro_crew'

백업 venv도 이미 손상된 상태라 symlink 복구 방법은 쓸 수 없음.

해결 방법

1. 깨진 venv 정리

1
2
3
rm -rf ~/.kiro/crew-venv
rm -rf ~/.kiro/crew-venv.pre-rebuild.716938
rm -f ~/.local/bin/kirocrew

2. kirocrew 재설치

공식 one-line installer 사용 (ARM64 포함 멀티 아키텍처 지원):

1
curl -fsSL https://download.crew.kiro.dev/cli.sh | sh

설치 완료 시 출력:

1
2
3
4
Provisioned managed Python: /home/ubuntu/.kiro/crew-python/cpython-3.12-linux-aarch64-gnu/bin/python3.12
Verified signed manifest.
Installing kirocrew 0.8.0 ...
Installed kirocrew 0.8.0 (channel: stable).

3. systemd 서비스 재시작

1
2
sudo systemctl restart kirocrew
sudo systemctl status kirocrew

정상 상태:

1
2
3
● kirocrew.service - Kiro Crew gateway (dashboard + Slack + cron)
     Active: active (running) since ...
             └─ /home/ubuntu/.kiro/crew-venv/bin/python3.12 /home/ubuntu/.local/bin/kirocrew gateway --no-open

주의할 점

  • 재설치 시 ~/.kiro/crew/ 데이터(세션, Slack 설정, config, history)는 유지됨. installer는 crew-venv만 새로 생성
  • OCI ARM64 인스턴스에 amd64용 .deb 파일로 재설치 시도하면 아키텍처 불일치 오류 발생. cli.sh 스크립트 사용 필수
  • kirocrew.service 파일의 ExecStart가 /home/ubuntu/.local/bin/kirocrew를 참조하므로, 해당 symlink가 정상적으로 생성됐는지 확인
1
2
ls -la ~/.local/bin/kirocrew
# ~/.local/bin/kirocrew -> /home/ubuntu/.kiro/crew-venv/bin/kirocrew