swift-aws-lambda-runtime: Building on linux (Ubuntu)... getting permission problems (due to Docker running as root?)
Expected behavior
I’d like to be able to build the lambdas for Arm using a Linux host, because a buying a chonky Raspberry Pi is much cheaper than a new MacBook with Apple Silicon:
swift package archive --allow-network-connections docker
Actual behavior
The archiving stage fails with a permission error:
{lots of build output deleted}
[495/497] Compiling SuggestionGetFunction SuggestionGet.swift
[495/497] Write Objects.LinkFileList
/usr/lib/swift_static/linux/libFoundationEssentials.a(FoundationEssentials-1.o):FoundationEssentials-1.o:function $s20FoundationEssentials19createTemporaryFile33_FC9EC52B075D2ACCFF86F1C9F84293BELL2at6inPath6prefix7optionss5Int32V_SStSS_AA0Q5OrURLOSSAA4DataV14WritingOptionsVtKFTf4nnnd_n: warning: the use of `mktemp' is dangerous, better use `mkstemp' or `mkdtemp'
/usr/lib/swift_static/linux/libFoundationEssentials.a(FoundationEssentials-1.o):FoundationEssentials-1.o:function $s20FoundationEssentials19createTemporaryFile33_FC9EC52B075D2ACCFF86F1C9F84293BELL2at6inPath6prefix7optionss5Int32V_SStSS_AA0Q5OrURLOSSAA4DataV14WritingOptionsVtKFTf4nnnd_n: warning: the use of `mktemp' is dangerous, better use `mkstemp' or `mkdtemp'
/usr/lib/swift_static/linux/libFoundationEssentials.a(FoundationEssentials-1.o):FoundationEssentials-1.o:function $s20FoundationEssentials19createTemporaryFile33_FC9EC52B075D2ACCFF86F1C9F84293BELL2at6inPath6prefix7optionss5Int32V_SStSS_AA0Q5OrURLOSSAA4DataV14WritingOptionsVtKFTf4nnnd_n: warning: the use of `mktemp' is dangerous, better use `mkstemp' or `mkdtemp'
/usr/lib/swift_static/linux/libFoundationEssentials.a(FoundationEssentials-1.o):FoundationEssentials-1.o:function $s20FoundationEssentials19createTemporaryFile33_FC9EC52B075D2ACCFF86F1C9F84293BELL2at6inPath6prefix7optionss5Int32V_SStSS_AA0Q5OrURLOSSAA4DataV14WritingOptionsVtKFTf4nnnd_n: warning: the use of `mktemp' is dangerous, better use `mkstemp' or `mkdtemp'
/usr/lib/swift_static/linux/libFoundationEssentials.a(FoundationEssentials-1.o):FoundationEssentials-1.o:function $s20FoundationEssentials19createTemporaryFile33_FC9EC52B075D2ACCFF86F1C9F84293BELL2at6inPath6prefix7optionss5Int32V_SStSS_AA0Q5OrURLOSSAA4DataV14WritingOptionsVtKFTf4nnnd_n: warning: the use of `mktemp' is dangerous, better use `mkstemp' or `mkdtemp'
[496/497] Linking SuggestionGetFunction
Build of product 'SuggestionGetFunction' complete! (482.85s)
-------------------------------------------------------------------------
archiving "SuggestionGetFunction"
-------------------------------------------------------------------------
error: Error Domain=NSCocoaErrorDomain Code=513 "You don’t have permission."
make: *** [Makefile:53: build-single-product] Error 1
(Wild guess: maybe this is due to the Docker container running as root, so the build artefacts are owned by root? ¯\_(ツ)_/¯ )
Steps to reproduce
- fresh installation of Ubuntu 24.10
- install
makeandzip - install Swift 6.0.3 from tarball
- install the Docker engine using their installation docs
- clone my lambda repo
swift package archive --allow-network-connections docker
If possible, minimal yet complete reproducer code (or URL to code)
No response
What version of this project (swift-aws-lambda-runtime) are you using?
38cc01a
Swift version
Swift version 6.0.3 (swift-6.0.3-RELEASE) Target: aarch64-unknown-linux-gnu Linux heslop 6.11.0-1005-raspi #5-Ubuntu SMP PREEMPT_DYNAMIC Fri Nov 22 13:24:30 UTC 2024 aarch64 aarch64 aarch64 GNU/Linux
Amazon Linux 2 docker image version
SWIFT_PLATFORM=amazonlinux2, SWIFT_BRANCH=swift-6.0.3-release
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 18 (14 by maintainers)
Commits related to this issue
- [doc] update deployment guide (#455) Add a note in the deployment guide to inform Linux user they must have correct permissions to use docker on their system. ### Motivation: Build instructions fai... — committed to swift-server/swift-aws-lambda-runtime by sebsto 2 years ago
- Swallow resources copy errors to work around permissions bug https://github.com/swift-server/swift-aws-lambda-runtime/issues/449#issuecomment-2595978246 — committed to jsonfry/swift-aws-lambda-runtime by jsonfry 2 years ago
- temp workaround for issue #449 — committed to sebsto/swift-aws-lambda-runtime by sebsto 2 years ago
- [plugin] support for resources packaging on ubuntu (#467) When including resources in the package and packaging on Ubuntu, `FileManager` throws a FilePermission error. The docker daemon runs as root ... — committed to swift-server/swift-aws-lambda-runtime by sebsto 2 years ago
https://github.com/swift-server/swift-aws-lambda-runtime/pull/467 is now merged, I’m closing this. Thank you @mflint for having reported it and @jsonfry for the investigation.
@jsonfry I will not piggy back this change to 1.0.0, we’re close to tag a v2.0.0-alpha and we prefer to focus on this objective
You’re correct. I saw the exact same error on macOS when multiple build attempts from different users or systems. (Docker and native for example)
Can you try again from scratch (after having deleted
.buildandPackage.resolved?Is the error systematic ?