Gitlab Debian包装创建许可拒绝

发布于 2025-02-02 20:26:35 字数 4376 浏览 1 评论 0原文

我正在尝试在这里使用该指南 https://about.gitlab.com/blog/2016/10/12/automated-debian-package-build-with-with-with-gitlab-ci/ 从我的Python源代码创建.deb文件。

实际上,我正在使用指南中报告的相同配置:

setup.sh

#!/bin/sh

# requirements
apt-get update
echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
apt-get -y install git dh-make build-essential autoconf autotools-dev devscripts build-essential lintian pandoc

dockerfile

FROM debian:bullseye
ADD  setup.sh /opt/
RUN  /bin/bash /opt/setup.sh

,在同一文件夹中,我运行了Docker build命令。

它拉出图像,复制.sh文件,但随后失败了:

Unpacking libpipeline1:amd64 (1.5.3-1) ...
Selecting previously unselected package man-db.
Preparing to unpack .../man-db_2.9.4-2_amd64.deb ...
Unpacking man-db (2.9.4-2) ...
Setting up python3.9-minimal (3.9.2-1) ...
Traceback (most recent call last):
  File "/usr/lib/python3.9/py_compile.py", line 215, in <module>
    sys.exit(main())
  File "/usr/lib/python3.9/py_compile.py", line 207, in main
    compile(filename, doraise=True)
  File "/usr/lib/python3.9/py_compile.py", line 172, in compile
    importlib._bootstrap_external._write_atomic(cfile, bytecode, mode)
  File "<frozen importlib._bootstrap_external>", line 126, in _write_atomic
PermissionError: [Errno 13] Permission denied: '/usr/lib/python3.9/__pycache__/__future__.cpython-39.pyc.140449203814672'
dpkg: error processing package python3.9-minimal (--configure):
 installed python3.9-minimal package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 python3.9-minimal
E: Sub-process /usr/bin/dpkg returned an error code (1)
The command '/bin/sh -c /bin/bash /opt/setup.sh' returned a non-zero code: 100

我应该是root用户,我更改了debian版本,但没有解决这个问题。

你有什么建议吗? 谢谢

编辑 我还试图将Docker映像更改为:Python:3-Bullseye在许多“许可拒绝”之后遇到以下错误

Setting up devscripts (2.21.3+deb11u1) ...
[Errno 13] Permission denied: '/usr/lib/python3/dist-packages/devscripts/__pycache__/__init__.cpython-39.pyc.139821270137264'
[Errno 13] Permission denied: '/usr/lib/python3/dist-packages/devscripts/__pycache__/control.cpython-39.pyc.139821270137264'
[Errno 13] Permission denied: '/usr/lib/python3/dist-packages/devscripts/__pycache__/logger.cpython-39.pyc.139821270137264'
[Errno 13] Permission denied: '/usr/lib/python3/dist-packages/devscripts/test/__pycache__/__init__.cpython-39.pyc.139821269580080'
[Errno 13] Permission denied: '/usr/lib/python3/dist-packages/devscripts/test/__pycache__/test_flake8.cpython-39.pyc.139821269580080'
[Errno 13] Permission denied: '/usr/lib/python3/dist-packages/devscripts/test/__pycache__/test_help.cpython-39.pyc.139821269580080'
[Errno 13] Permission denied: '/usr/lib/python3/dist-packages/devscripts/test/__pycache__/test_logger.cpython-39.pyc.139821269580368'
[Errno 13] Permission denied: '/usr/lib/python3/dist-packages/devscripts/test/__pycache__/test_pylint.cpython-39.pyc.139821269580368'
dpkg: error processing package devscripts (--configure):
 installed devscripts package post-installation script subprocess returned error exit status 1
Setting up libxml-parser-perl:amd64 (2.46-2) ...
Setting up libxml-sax-expat-perl (0.51-1) ...
update-perl-sax-parsers: Registering Perl SAX parser XML::SAX::Expat with priority 50...
update-perl-sax-parsers: Updating overall Perl SAX parser modules info file...
Replacing config file /etc/perl/XML/SAX/ParserDetails.ini with new version
Setting up libsoap-lite-perl (1.27-1) ...
Setting up libxmlrpc-lite-perl (0.717-4) ...
Processing triggers for libc-bin (2.31-13+deb11u3) ...
Errors were encountered while processing:
 python3-pkg-resources
 python3-xdg
 dput
 python3-six
 python3-chardet
 python3-gpg
 python3-certifi
 python3-debian
 python3-requests
 python3-idna
 python3-urllib3
 python3-unidiff
 python3-magic
 python3-apt
 devscripts
E: Sub-process /usr/bin/dpkg returned an error code (1)
The command '/bin/sh -c /bin/bash /opt/setup.sh' returned a non-zero code: 100

I am trying to use the guide here https://about.gitlab.com/blog/2016/10/12/automated-debian-package-build-with-gitlab-ci/
to create a .deb file from my python source code.

I am actually using the same configuration reported on the guide:

setup.sh

#!/bin/sh

# requirements
apt-get update
echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
apt-get -y install git dh-make build-essential autoconf autotools-dev devscripts build-essential lintian pandoc

Dockerfile

FROM debian:bullseye
ADD  setup.sh /opt/
RUN  /bin/bash /opt/setup.sh

and, in the same folder I run the docker build command.

It pulls the image, copy the .sh file, but then it fails with:

Unpacking libpipeline1:amd64 (1.5.3-1) ...
Selecting previously unselected package man-db.
Preparing to unpack .../man-db_2.9.4-2_amd64.deb ...
Unpacking man-db (2.9.4-2) ...
Setting up python3.9-minimal (3.9.2-1) ...
Traceback (most recent call last):
  File "/usr/lib/python3.9/py_compile.py", line 215, in <module>
    sys.exit(main())
  File "/usr/lib/python3.9/py_compile.py", line 207, in main
    compile(filename, doraise=True)
  File "/usr/lib/python3.9/py_compile.py", line 172, in compile
    importlib._bootstrap_external._write_atomic(cfile, bytecode, mode)
  File "<frozen importlib._bootstrap_external>", line 126, in _write_atomic
PermissionError: [Errno 13] Permission denied: '/usr/lib/python3.9/__pycache__/__future__.cpython-39.pyc.140449203814672'
dpkg: error processing package python3.9-minimal (--configure):
 installed python3.9-minimal package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 python3.9-minimal
E: Sub-process /usr/bin/dpkg returned an error code (1)
The command '/bin/sh -c /bin/bash /opt/setup.sh' returned a non-zero code: 100

I am supposed to be the root user, I changed the debian version, but nothing solved this issue.

Do you have any suggestion?
Thanks

EDIT
I also tried to change the docker image to: python:3-bullseye getting the following error, after many "permission denied"

Setting up devscripts (2.21.3+deb11u1) ...
[Errno 13] Permission denied: '/usr/lib/python3/dist-packages/devscripts/__pycache__/__init__.cpython-39.pyc.139821270137264'
[Errno 13] Permission denied: '/usr/lib/python3/dist-packages/devscripts/__pycache__/control.cpython-39.pyc.139821270137264'
[Errno 13] Permission denied: '/usr/lib/python3/dist-packages/devscripts/__pycache__/logger.cpython-39.pyc.139821270137264'
[Errno 13] Permission denied: '/usr/lib/python3/dist-packages/devscripts/test/__pycache__/__init__.cpython-39.pyc.139821269580080'
[Errno 13] Permission denied: '/usr/lib/python3/dist-packages/devscripts/test/__pycache__/test_flake8.cpython-39.pyc.139821269580080'
[Errno 13] Permission denied: '/usr/lib/python3/dist-packages/devscripts/test/__pycache__/test_help.cpython-39.pyc.139821269580080'
[Errno 13] Permission denied: '/usr/lib/python3/dist-packages/devscripts/test/__pycache__/test_logger.cpython-39.pyc.139821269580368'
[Errno 13] Permission denied: '/usr/lib/python3/dist-packages/devscripts/test/__pycache__/test_pylint.cpython-39.pyc.139821269580368'
dpkg: error processing package devscripts (--configure):
 installed devscripts package post-installation script subprocess returned error exit status 1
Setting up libxml-parser-perl:amd64 (2.46-2) ...
Setting up libxml-sax-expat-perl (0.51-1) ...
update-perl-sax-parsers: Registering Perl SAX parser XML::SAX::Expat with priority 50...
update-perl-sax-parsers: Updating overall Perl SAX parser modules info file...
Replacing config file /etc/perl/XML/SAX/ParserDetails.ini with new version
Setting up libsoap-lite-perl (1.27-1) ...
Setting up libxmlrpc-lite-perl (0.717-4) ...
Processing triggers for libc-bin (2.31-13+deb11u3) ...
Errors were encountered while processing:
 python3-pkg-resources
 python3-xdg
 dput
 python3-six
 python3-chardet
 python3-gpg
 python3-certifi
 python3-debian
 python3-requests
 python3-idna
 python3-urllib3
 python3-unidiff
 python3-magic
 python3-apt
 devscripts
E: Sub-process /usr/bin/dpkg returned an error code (1)
The command '/bin/sh -c /bin/bash /opt/setup.sh' returned a non-zero code: 100

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

半夏半凉 2025-02-09 20:26:35

到一天结束时,我解决了问题:我只是重新安装了Docker,一切都直接进行了

By the end of the day I solved the problem: I just reinstalled docker and everything went straightforward

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文