Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | ||||||
| 2 | 3 | 4 | 5 | 6 | 7 | 8 |
| 9 | 10 | 11 | 12 | 13 | 14 | 15 |
| 16 | 17 | 18 | 19 | 20 | 21 | 22 |
| 23 | 24 | 25 | 26 | 27 | 28 | 29 |
| 30 | 31 |
Tags
- go new project
- ssh-keygen
- 유닉스
- 리눅스
- 명령어
- html5
- UNIX
- barcode
- 파이프 와이어
- ssh-copy-id
- awk
- go make new project
- carla
- 사회적거리두기
- 예제
- MAN
- grep
- 자율주행
- sudo
- linux
- 리눅스 멀티미디어
- TEE
- WebCam
- tldr
- CODE128
- 코로나바이러스
- go multifile manage
- Go
- linux go new project
- 자택근무
Archives
- Today
- Total
힘내라 일처리
AOSP Build sandboxing disabled due to nsjail error. 해결법 Ubuntu 24.04 (w. Docker Ubuntu 22.04) / Android 16 본문
기록
AOSP Build sandboxing disabled due to nsjail error. 해결법 Ubuntu 24.04 (w. Docker Ubuntu 22.04) / Android 16
일처리 2025. 4. 26. 00:39
00:20:04 Build sandboxing disabled due to nsjail error.
============================================
PLATFORM_VERSION_CODENAME=Baklava
PLATFORM_VERSION=Baklava
TARGET_PRODUCT=aosp_cf_x86_64_phone
TARGET_BUILD_VARIANT=eng
TARGET_ARCH=x86_64
TARGET_ARCH_VARIANT=silvermont
TARGET_2ND_ARCH=x86
TARGET_2ND_ARCH_VARIANT=silvermont
HOST_OS=linux
HOST_OS_EXTRA=Linux-6.8.0-55-generic-x86_64-Ubuntu-22.04.5-LTS
HOST_CROSS_OS=windows
BUILD_ID=BP1A.250405.007
OUT_DIR=out
============================================
위와같이 nsjail 을 통한 샌드박싱에 실패한다는 오류가 나온다.
(여기서는 docker를 통해서 실행하기
이런 오류가 나오더라도 진행은 할수 있으나 나중에 가서 결국 Trusty 를 빌드하는 과정에서 오류가 나서 진행이 안된다.
I can confirm that with docker 19.03 or later, using --security-opt apparmor=unconfined --security-opt seccomp=unconfined --security-opt systempaths=unconfined works instead of --privileged (the patch in #10 was submitted). Still turning off a lot of security, but better than before if you still wanted to run nsjail.
It should be possible to create minimally-modified apparmor & seccomp profiles with just the cutouts that we need instead of leaving them unconfined as well.
https://issuetracker.google.com/issues/123210688?pli=1
위의 방식이 일반적이기도 하고 효과가 있었으나, 최신 ubuntu의 apparmor 정책은 새로운 사용자 네임스페이스에서 대응이 다른듯하다.
[3659605.200351] audit: type=1400 audit(1745592489.725:4281): apparmor="AUDIT" operation="userns_create" class="namespace" info="Userns create - transitioning profile" profile="unconfined" pid=2396683 comm="nsjail" requested="userns_create" target="unprivileged_userns"
[3659605.207663] audit: type=1400 audit(1745592489.732:4282): apparmor="DENIED" operation="mount" class="mount" info="failed mntpnt match" error=-13 profile="unprivileged_userns" name="/" pid=2396684 comm="nsjail" flags="rw, rprivate"
[3659656.037824] audit: type=1400 audit(1745592540.562:4283): apparmor="AUDIT" operation="userns_create" class="namespace" info="Userns create - transitioning profile" profile="unconfined" pid=2397831 comm="nsjail" requested="userns_create" target="unprivileged_userns"
[3659656.038686] audit: type=1400 audit(1745592540.563:4284): apparmor="DENIED" operation="capable" class="cap" profile="unprivileged_userns" pid=2397832 comm="nsjail" capability=6 capname="setgid"
[3659656.038731] audit: type=1400 audit(1745592540.563:4285): apparmor="DENIED" operation="capable" class="cap" profile="unprivileged_userns" pid=2397832 comm="nsjail" capability=1 capname="dac_override"
[3659656.038752] audit: type=1400 audit(1745592540.563:4286): apparmor="DENIED" operation="mount" class="mount" info="failed mntpnt match" error=-13 profile="unprivileged_userns" name="/" pid=2397832 comm="nsjail" flags="rw, rprivate"
새로운 사용자 네임스페이스에서는 unprivileged_userns 라는 별도 ns가 프로파일로 등록 되는 듯 하다. 이때 해당 프로파일이 여러 기능에서 제한이 됨에 따라 오류가 발생하는 것으로 확인이 된다.
해결법
따라서 최신 ubuntu 24.04 에서 docker를 통한 aosp빌드시 nsjail에서 오류가 난다면 해당 도커 실행 인수로 다음을 넣어주면 된다.
--privileged --security-opt apparmor=linux-sandbox
설명
여기서 사용되는 프로필은 아래와 같다.
# This profile allows everything and only exists to give the
# application a name instead of having the label "unconfined"
abi <abi/4.0>,
include <tunables/global>
profile linux-sandbox /usr/libexec/@{multiarch}/bazel/linux-sandbox flags=(unconfined) {
userns,
# Site-specific additions and overrides. See local/README for details.
include if exists <local/linux-sandbox>
}
다른 프로세스를 위한 프로필이나, 일반 unconfined는 userns 시 unprivileged_userns 가 됨에 따라 userns,권한이 추가된 unconfined 프로파일이 있어 샌드박싱 기능등에 제약이 안생긴다. 이를 docker에 적용하여 aosp빌드 과정에서 발생하는 권한 이슈를 해결하게 된다.
좀더 정석적으로는 별도 프로필을 만드는게 좋으나 이걸로 충분하다.
'기록' 카테고리의 다른 글
| 개인 개발 환경 구성 소개 (1) | 2025.04.27 |
|---|---|
| RFC 번역 사이트 개발 후기 (0) | 2023.11.24 |
Comments