Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run docker as the current user #1630

Merged
merged 1 commit into from
Sep 10, 2024
Merged

Conversation

Timmmm
Copy link
Contributor

@Timmmm Timmmm commented Sep 6, 2024

If you have real Docker (not Podman) then by default it will run everything as root, so your build directory is owned by root and the Makefile will not work at all because it tries to modify the build directory.

This adds a flag so that Asciidoctor runs as the current user in Docker instead of root.

Copy link
Member

@aswaterman aswaterman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This breaks the build on my Mac.

waterman@Andrews-Mac-mini:~/riscv-isa-manual$ make build/riscv-privileged.html
id: illegal option -- -
usage: id [user]
       id -A
       id -F [user]
       id -G [-n] [user]

       id -P [user]
       id -g [-nr] [user]
       id -p [user]
       id -u [-nr] [user]
rm -rf build/riscv-privileged.html.workdir && mkdir -p build/riscv-privileged.html.workdir && cp -r src docs-resources build/riscv-privileged.html.workdir
docker run --rm -v /Users/waterman/riscv-isa-manual/build/riscv-privileged.html.workdir:/build -w /build --user  riscvintl/riscv-docs-base-container-image:latest /bin/sh -c " LANG=C.utf8 asciidoctor --trace -a compress -a mathematical-format=svg -a pdf-fontsdir=docs-resources/fonts -a pdf-theme=docs-resources/themes/riscv-pdf.yml  -D build --failure-level=ERROR --require=asciidoctor-bibtex --require=asciidoctor-diagram --require=asciidoctor-lists --require=asciidoctor-mathematical src/riscv-privileged.adoc "
docker: invalid reference format.
See 'docker run --help'.
make: *** [build/riscv-privileged.html] Error 125

If you have real Docker (not Podman) then by default it will run everything as root, so your build directory is owned by root and the Makefile will not work at all because it tries to modify the build directory.

This adds a flag so that Asciidoctor runs as the current user in Docker instead of root.
@Timmmm
Copy link
Contributor Author

Timmmm commented Sep 9, 2024

Ah I guess Mac doesn't support id --user, only id -u. I changed it to the latter so it should work now (I don't have a Mac to test on unfortunately).

Copy link
Member

@aswaterman aswaterman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I confirmed this version works. Thanks.

@aswaterman aswaterman merged commit 3539eff into riscv:main Sep 10, 2024
2 checks passed
@wmat
Copy link
Collaborator

wmat commented Sep 23, 2024

Reverting for now as this breaks Linux builds, i.e. my local Fedora 40, as well as the GH workflow to release on merge.

wmat added a commit that referenced this pull request Sep 23, 2024
@Timmmm
Copy link
Contributor Author

Timmmm commented Sep 23, 2024

This didn't break the GH workflow to release on merge. That is still working, e.g. here. All of the failures are in forks which obviously shouldn't be able to publish new releases. (Maybe that step should be skipped for forks to make it less confusing...)

Also when you said you tried a clean checkout, did you actually delete the build directory or just do git reset --hard/git checkout .? I suspect what has happened is you have an old build directory from when Docker was running as root; now it isn't so it can't write to the build directory any more. Just deleting it should fix it.

Please can you confirm and re-apply this?

@Timmmm
Copy link
Contributor Author

Timmmm commented Sep 23, 2024

e.g. here.

Actually this was after it merged; but the point still stands - the failures are expected.

@Timmmm
Copy link
Contributor Author

Timmmm commented Sep 23, 2024

Actually this was after it merged

*before :-D

@wmat
Copy link
Collaborator

wmat commented Sep 23, 2024

Yep, I completely deleted the riscv-isa-manual repo locally and re-cloned it. The issue occurred again. Post revert, the broken GH workflow completed successfully. See here: https://github.com/riscv/riscv-isa-manual/actions I have to leave this reverted for now so that the merges successfully create releases when branches are merged. But I'll continue to investigate.

@Timmmm
Copy link
Contributor Author

Timmmm commented Sep 23, 2024

Can you point me to the failed GH workflow though? I can't see any unexpected failures.

Can you also tell me what command you are running that fails, and are you using Docker or Podman?

@wmat
Copy link
Collaborator

wmat commented Sep 23, 2024

Sure, here's a link to a failed workflow: https://github.com/riscv/riscv-isa-manual/actions/runs/10986155225/job/30499080610

And here's the actual error:
Run softprops/action-gh-release@v2
with:
tag_name: riscv-isa-release-78a4dc9-2024-09-23
name: Release riscv-isa-release-78a4dc9-2024-09-23
draft: false
prerelease: false
make_latest: true
generate_release_notes: true
body: This release was created by: aswaterman
Release of RISC-V ISA, built from commit 78a4dc9, is now available.

files: /home/runner/work/riscv-isa-manual/riscv-isa-manual/build/riscv-privileged.pdf

/home/runner/work/riscv-isa-manual/riscv-isa-manual/build/riscv-privileged.html
/home/runner/work/riscv-isa-manual/riscv-isa-manual/build/riscv-privileged.epub
/home/runner/work/riscv-isa-manual/riscv-isa-manual/build/riscv-unprivileged.pdf
/home/runner/work/riscv-isa-manual/riscv-isa-manual/build/riscv-unprivileged.html
/home/runner/work/riscv-isa-manual/riscv-isa-manual/build/riscv-unprivileged.epub

token: ***

env:
SHORT_SHA: 78a4dc9
CURRENT_DATE: 2024-09-23
GITHUB_TOKEN:
👩‍🏭 Creating new GitHub release for tag riscv-isa-release-78a4dc9-2024-09-23...
⚠️ GitHub release failed with status: 403
{"message":"Resource not accessible by integration","documentation_url":"https://docs.github.com/rest/releases/releases#create-a-release","status":"403"}
Skip retry — your GitHub token/PAT does not have the required permission to create a release
Error: Resource not accessible by integration - https://docs.github.com/rest/releases/releases#create-a-release

Locally, I was simply running make. It was erroring on permissions against the build directory. And I'm using Docker.

@Timmmm
Copy link
Contributor Author

Timmmm commented Sep 23, 2024

your GitHub token/PAT does not have the required permission to create a release

Yeah that failure has nothing to do with this PR. It failed because it was running in a fork. Your recent workflow passed because it was not running in a fork:

image

If you check the history of that action every run from a fork fails in the same way.

To debug the other issue (which sounds very strange; I'm also using Docker, and the distro shouldn't make a difference), can you run these commands and post the output?

id
id -u
docker --version
git clone https://github.com/riscv/riscv-isa-manual.git
cd riscv-isa-manual
git switch -d 3539eff338352aba83dbae9e7b310d6a7d9a7d56
make
ls -ld build
ls -l build
docker run --rm -v $(pwd)/build/riscv-privileged.pdf.workdir:/build:z -w /build riscvintl/riscv-docs-base-container-image:latest /bin/ls -ld /build
docker run --rm -v $(pwd)/build/riscv-privileged.pdf.workdir:/build:z -w /build riscvintl/riscv-docs-base-container-image:latest /bin/touch /build/foo

@Timmmm
Copy link
Contributor Author

Timmmm commented Sep 23, 2024

Sorry, ignore the last two docker lines and do this instead:

docker run --rm -v $(pwd)/build/riscv-privileged.pdf.workdir:/build:z -w /build --user $(id -u) riscvintl/riscv-docs-base-container-image:latest /bin/ls -ld /build
docker run --rm -v $(pwd)/build/riscv-privileged.pdf.workdir:/build:z -w /build --user $(id -u) riscvintl/riscv-docs-base-container-image:latest /bin/touch /build/foo
docker run --rm -v $(pwd)/build/riscv-privileged.pdf.workdir:/build:z -w /build --user $(id -u) riscvintl/riscv-docs-base-container-image:latest /bin/id

@wmat
Copy link
Collaborator

wmat commented Sep 24, 2024

id
uid=1000(wmat) gid=1000(wmat) groups=1000(wmat),10(wheel),18(dialout),976(docker) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
id -u
1000
docker --version
Docker version 27.3.1, build ce12230
git clone https://github.com/riscv/riscv-isa-manual.git
cd riscv-isa-manual
git switch -d 3539eff
HEAD is now at 3539eff Run docker as the current user (#1630)
make
Checking if Docker is available...
Docker is available, building inside Docker container...
make[1]: Entering directory '/home/wmat/dev/riscv-isa-manual'
Starting build inside Docker container...
make build-docs
make[2]: Entering directory '/home/wmat/dev/riscv-isa-manual'
rm -rf build/riscv-privileged.pdf.workdir && mkdir -p build/riscv-privileged.pdf.workdir && cp -r src docs-resources build/riscv-privileged.pdf.workdir
docker run --rm -v /home/wmat/dev/riscv-isa-manual/build/riscv-privileged.pdf.workdir:/build -w /build --user 1000 riscvintl/riscv-docs-base-container-image:latest /bin/sh -c " LANG=C.utf8 asciidoctor-pdf --trace -a compress -a mathematical-format=svg -a pdf-fontsdir=docs-resources/fonts -a pdf-theme=docs-resources/themes/riscv-pdf.yml -D build --failure-level=ERROR --require=asciidoctor-bibtex --require=asciidoctor-diagram --require=asciidoctor-lists --require=asciidoctor-mathematical src/riscv-privileged.adoc "
asciidoctor: ERROR: riscv-privileged.adoc: line 3: include file not found: /build/docs-resources/global-config.adoc
asciidoctor: ERROR: priv-preface.adoc: line 2: level 0 sections can only be used when doctype is book
asciidoctor: ERROR: images/bytefield/misareg.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/mvendorid.adoc: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/marchid.adoc: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/mimpid.adoc: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/mhartid.adoc: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/wavedrom/mstatusreg-rv321.edn: line 3: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/wavedrom/mstatusreg.edn: line 3: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/wavedrom/mstatushreg.edn: line 3: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/mtvec.adoc: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/medeleg.adoc: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/mideleg.adoc: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/mideleg.adoc: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/mideleg.adoc: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/mipreg-standard.adoc: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/miereg-standard.adoc: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/hpmevents.adoc: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/counteren.adoc: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/counterinh.adoc: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/mscratch.adoc: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/mepcreg.adoc: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/mcausereg.adoc: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/mtvalreg.adoc: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/mconfigptrreg.adoc: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/wavedrom/menvcfgreg.edn: line 3: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/wavedrom/mseccfg.edn: line 3: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/mtime.adoc: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/mtimecmp.adoc: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/wavedrom/mm-env-call.edn: line 5: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/wavedrom/trap-return.edn: line 5: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/wavedrom/wfi.edn: line 5: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/cust-sys-instr.adoc: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/pmp-rv32.adoc: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/pmp-rv64.adoc: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/pmpaddr-rv32.adoc: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/pmpaddr-rv64.adoc: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/pmpcfg.adoc: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: smstateen.adoc: line 180: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: smstateen.adoc: line 199: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: smstateen.adoc: line 217: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/mnscratch.adoc: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/mnepc.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/mncause.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/mnstatus.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: supervisor.adoc: line 49: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: supervisor.adoc: line 76: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/stvec.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/sip.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/sie.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/sipreg-standard.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/siereg-standard.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/scounteren.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/sscratch.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/epcreg.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/scausereg.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/stvalreg.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: supervisor.adoc: line 724: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: supervisor.adoc: line 741: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/rv32satp.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/rv64satp.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/wavedrom/sfencevma.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/sv32va.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/sv32pa.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/sv32pte.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/sv39va.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/sv39pa.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/sv39pte.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/sv48va.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/sv48pa.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/sv48pte.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/sv57va.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/sv57pa.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/sv57pte.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/wavedrom/sinvalvma.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/wavedrom/sfencewinval.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/wavedrom/sfenceinvalir.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/wavedrom/hinvalvvma.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/wavedrom/hinvalgvma.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/hstatusreg-rv32.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/hstatusreg.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/hedelegreg.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/hidelegreg.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/hvipreg.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/hvipreg-standard.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/hipreg.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/hiereg.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/hipreg-standard.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/hiereg-standard.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/hgeipreg.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/hgeiereg.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: hypervisor.adoc: line 588: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/hcounterenreg.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/htimedelta.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/htvalreg.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/htinstreg.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/rv32hgatp.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/rv64hgatp.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: hypervisor.adoc: line 944: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: hypervisor.adoc: line 971: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/vsipreg.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/vsiereg.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/vsipreg-standard.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/vsiereg-standard.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/vstvecreg.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/vsscratchreg.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/vsepcreg.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/vscausereg.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/vstvalreg.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/rv32vsatpreg.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/rv64vsatpreg.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/wavedrom/hypv-virt-load-and-store.edn: line 4: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/wavedrom/hypv-mm-fence.edn: line 4: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/hypv-mstatus.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/hypv-mstatush.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/hypv-mipreg-standard.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/hypv-miereg-standard.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/mtval2reg.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/mtinstreg.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/sv32x4va.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/sv39x4va.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/sv48x4va.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/sv57x4va.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/wavedrom/transformedloadinst.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/wavedrom/transformedstoreinst.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/wavedrom/transformedatomicinst.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/wavedrom/transformedvmaccessinst.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
asciidoctor: ERROR: images/bytefield/priv-instr-set.edn: line 2: Failed to generate image: Permission denied @ dir_s_mkdir - /build/images
/var/lib/gems/3.0.0/gems/asciidoctor-mathematical-0.3.5/lib/asciidoctor-mathematical/extension.rb:168:in write': asciidoctor: FAILED: /build/src/riscv-privileged.adoc: Failed to load AsciiDoc document - Permission denied @ rb_sysopen - /build/src/images/stem-527c932105a6826cbbe80abc7f968d0b.svg (Errno::EACCES) from /var/lib/gems/3.0.0/gems/asciidoctor-mathematical-0.3.5/lib/asciidoctor-mathematical/extension.rb:168:in make_equ_image'
from /var/lib/gems/3.0.0/gems/asciidoctor-mathematical-0.3.5/lib/asciidoctor-mathematical/extension.rb:141:in block in handle_inline_stem' from /var/lib/gems/3.0.0/gems/asciidoctor-mathematical-0.3.5/lib/asciidoctor-mathematical/extension.rb:124:in gsub'
from /var/lib/gems/3.0.0/gems/asciidoctor-mathematical-0.3.5/lib/asciidoctor-mathematical/extension.rb:124:in handle_inline_stem' from /var/lib/gems/3.0.0/gems/asciidoctor-mathematical-0.3.5/lib/asciidoctor-mathematical/extension.rb:96:in handle_prose_block'
from /var/lib/gems/3.0.0/gems/asciidoctor-mathematical-0.3.5/lib/asciidoctor-mathematical/extension.rb:40:in block in process' from /var/lib/gems/3.0.0/gems/asciidoctor-mathematical-0.3.5/lib/asciidoctor-mathematical/extension.rb:39:in each'
from /var/lib/gems/3.0.0/gems/asciidoctor-mathematical-0.3.5/lib/asciidoctor-mathematical/extension.rb:39:in process' from /var/lib/gems/3.0.0/gems/asciidoctor-2.0.23/lib/asciidoctor/document.rb:545:in []'
from /var/lib/gems/3.0.0/gems/asciidoctor-2.0.23/lib/asciidoctor/document.rb:545:in block in parse' from /var/lib/gems/3.0.0/gems/asciidoctor-2.0.23/lib/asciidoctor/document.rb:544:in each'
from /var/lib/gems/3.0.0/gems/asciidoctor-2.0.23/lib/asciidoctor/document.rb:544:in parse' from /var/lib/gems/3.0.0/gems/asciidoctor-2.0.23/lib/asciidoctor/load.rb:84:in load'
from /var/lib/gems/3.0.0/gems/asciidoctor-2.0.23/lib/asciidoctor/convert.rb:78:in convert' from /var/lib/gems/3.0.0/gems/asciidoctor-2.0.23/lib/asciidoctor/convert.rb:190:in block in convert_file'
from /var/lib/gems/3.0.0/gems/asciidoctor-2.0.23/lib/asciidoctor/convert.rb:190:in open' from /var/lib/gems/3.0.0/gems/asciidoctor-2.0.23/lib/asciidoctor/convert.rb:190:in convert_file'
from /var/lib/gems/3.0.0/gems/asciidoctor-2.0.23/lib/asciidoctor/cli/invoker.rb:129:in block in invoke!' from /var/lib/gems/3.0.0/gems/asciidoctor-2.0.23/lib/asciidoctor/cli/invoker.rb:112:in each'
from /var/lib/gems/3.0.0/gems/asciidoctor-2.0.23/lib/asciidoctor/cli/invoker.rb:112:in invoke!' from /var/lib/gems/3.0.0/gems/asciidoctor-pdf-2.3.18/bin/asciidoctor-pdf:46:in <top (required)>'
from /usr/local/bin/asciidoctor-pdf:25:in load' from /usr/local/bin/asciidoctor-pdf:25:in

'
/var/lib/gems/3.0.0/gems/asciidoctor-mathematical-0.3.5/lib/asciidoctor-mathematical/extension.rb:168:in write': Permission denied @ rb_sysopen - /build/src/images/stem-527c932105a6826cbbe80abc7f968d0b.svg (Errno::EACCES) from /var/lib/gems/3.0.0/gems/asciidoctor-mathematical-0.3.5/lib/asciidoctor-mathematical/extension.rb:168:in make_equ_image'
from /var/lib/gems/3.0.0/gems/asciidoctor-mathematical-0.3.5/lib/asciidoctor-mathematical/extension.rb:141:in block in handle_inline_stem' from /var/lib/gems/3.0.0/gems/asciidoctor-mathematical-0.3.5/lib/asciidoctor-mathematical/extension.rb:124:in gsub'
from /var/lib/gems/3.0.0/gems/asciidoctor-mathematical-0.3.5/lib/asciidoctor-mathematical/extension.rb:124:in handle_inline_stem' from /var/lib/gems/3.0.0/gems/asciidoctor-mathematical-0.3.5/lib/asciidoctor-mathematical/extension.rb:96:in handle_prose_block'
from /var/lib/gems/3.0.0/gems/asciidoctor-mathematical-0.3.5/lib/asciidoctor-mathematical/extension.rb:40:in block in process' from /var/lib/gems/3.0.0/gems/asciidoctor-mathematical-0.3.5/lib/asciidoctor-mathematical/extension.rb:39:in each'
from /var/lib/gems/3.0.0/gems/asciidoctor-mathematical-0.3.5/lib/asciidoctor-mathematical/extension.rb:39:in process' from /var/lib/gems/3.0.0/gems/asciidoctor-2.0.23/lib/asciidoctor/document.rb:545:in []'
from /var/lib/gems/3.0.0/gems/asciidoctor-2.0.23/lib/asciidoctor/document.rb:545:in block in parse' from /var/lib/gems/3.0.0/gems/asciidoctor-2.0.23/lib/asciidoctor/document.rb:544:in each'
from /var/lib/gems/3.0.0/gems/asciidoctor-2.0.23/lib/asciidoctor/document.rb:544:in parse' from /var/lib/gems/3.0.0/gems/asciidoctor-2.0.23/lib/asciidoctor/load.rb:84:in load'
from /var/lib/gems/3.0.0/gems/asciidoctor-2.0.23/lib/asciidoctor/convert.rb:78:in convert' from /var/lib/gems/3.0.0/gems/asciidoctor-2.0.23/lib/asciidoctor/convert.rb:190:in block in convert_file'
from /var/lib/gems/3.0.0/gems/asciidoctor-2.0.23/lib/asciidoctor/convert.rb:190:in open' from /var/lib/gems/3.0.0/gems/asciidoctor-2.0.23/lib/asciidoctor/convert.rb:190:in convert_file'
from /var/lib/gems/3.0.0/gems/asciidoctor-2.0.23/lib/asciidoctor/cli/invoker.rb:129:in block in invoke!' from /var/lib/gems/3.0.0/gems/asciidoctor-2.0.23/lib/asciidoctor/cli/invoker.rb:112:in each'
from /var/lib/gems/3.0.0/gems/asciidoctor-2.0.23/lib/asciidoctor/cli/invoker.rb:112:in invoke!' from /var/lib/gems/3.0.0/gems/asciidoctor-pdf-2.3.18/bin/asciidoctor-pdf:46:in <top (required)>'
from /usr/local/bin/asciidoctor-pdf:25:in load' from /usr/local/bin/asciidoctor-pdf:25:in '
make[2]: *** [Makefile:98: build/riscv-privileged.pdf] Error 1
make[2]: Leaving directory '/home/wmat/dev/riscv-isa-manual'
make[1]: *** [Makefile:123: build-container] Error 2
make[1]: Leaving directory '/home/wmat/dev/riscv-isa-manual'
make: *** [Makefile:113: build] Error 2

ls -ld build
drwxr-xr-x. 1 wmat wmat 56 Sep 24 10:04 build/
ls -l build
total 0
drwxr-xr-x. 1 wmat wmat 34 Sep 24 10:04 riscv-privileged.pdf.workdir

docker run --rm -v $(pwd)/build/riscv-privileged.pdf.workdir:/build:z -w /build --user $(id -u) riscvintl/riscv-docs-base-container-image:latest /bin/ls -ld /build
drwxr-xr-x. 1 root root 34 Sep 24 14:04 /build

docker run --rm -v $(pwd)/build/riscv-privileged.pdf.workdir:/build:z -w /build --user $(id -u) riscvintl/riscv-docs-base-container-image:latest /bin/touch /build/foo
/bin/touch: cannot touch '/build/foo': Permission denied

docker run --rm -v $(pwd)/build/riscv-privileged.pdf.workdir:/build:z -w /build --user $(id -u) riscvintl/riscv-docs-base-container-image:latest /bin/id
uid=1000 gid=0(root) groups=0(root)

@Timmmm
Copy link
Contributor Author

Timmmm commented Sep 24, 2024

Ah I think maybe you're running rootless docker? What's the output of this command?

docker info -f '{{println .SecurityOptions}}'

@wmat
Copy link
Collaborator

wmat commented Sep 24, 2024

I am indeed running it rootless:
[name=seccomp,profile=builtin name=rootless name=cgroupns]

I believe when I set it up I followed the instructions here: https://docs.docker.com/engine/install/linux-postinstall/

@Timmmm Timmmm deleted the fix_docker_user branch September 25, 2024 08:17
@Timmmm
Copy link
Contributor Author

Timmmm commented Sep 25, 2024

@wmat can you check if #1647 works for you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants