2

我正在构建一个 docker 映像,并且我正在尝试使用 gpg 签名对构建期间生成的包进行签名。这是我的环境变量:

yocto@edef5a9c44a0:~/build$ gpg --list-keys
/home/yocto/.gnupg/pubring.kbx
------------------------------
pub   rsa3072 2020-12-14 [SC] [expires: 2025-12-13]
      1A5EE69728AEC73E061665949FFC6A5AD2F1126C
uid           [ultimate] xxxxxxxx (yyyyyyyy) <zzzzzzzz@zzzzzzzz>
sub   rsa3072 2020-12-14 [E] [expires: 2025-12-13]

这是我的密钥 ID <9FFC6A5AD2F1126C> 这是我要添加到我的机器配置中的行

# Package manager configs 
PACKAGE_CLASSES = "package_ipk"
EXTRA_IMAGE_FEATURES = "package-management"
IMAGE_INSTALL_append = " opkg "

# Package manager signature 
INHERIT += "sign_ipk" 
#OPKG_KEYRING_KEYS ?= "9FFC6A5AD2F1126C"
IPK_GPG_NAME = "9FFC6A5AD2F1126C"
IPK_GPG_PASSPHRASE_FILE = "/home/yocto/passphrase.txt"
INHERIT += "sign_package_feed"
PACKAGE_FEED_GPG_NAME = "9FFC6A5AD2F1126C"
PACKAGE_FEED_GPG_PASSPHRASE_FILE = "/home/yocto/passphrase.txt"

在“/home/yocto/passphrase.txt”中,我包含了我的秘密密码。我确实使用以下内容在 yocto env 中导出了我的密钥:

$ gpg --output rpm-feed.gpg --export <id>

我一直有这个错误:gpg:签名失败:无法分配内存

日志文件:

yocto@edef5a9c44a0:~/build$ cat /home/yocto/build/tmp/work/cortexa9hf-neon-poky-linux-gnueabi/python3/3.5.3-r1.0/temp/log.do_package_write_ipk.51190 
DEBUG: Executing python function sstate_task_prefunc
DEBUG: Python function sstate_task_prefunc finished
DEBUG: Executing python function extend_recipe_sysroot
NOTE: Direct dependencies are ['virtual:native:/home/yocto/poky/meta/recipes-devtools/pseudo/pseudo_1.8.2.bb:do_populate_sysroot', 'virtual:native:/home/yocto/poky/meta/recipes-devtools/opkg-utils/opkg-utils_0.3.5.bb:do_populate_sysroot']
NOTE: Installed into sysroot: []
NOTE: Skipping as already exists in sysroot: ['pseudo-native', 'opkg-utils-native', 'quilt-native']
DEBUG: Python function extend_recipe_sysroot finished
DEBUG: Executing python function do_package_write_ipk
DEBUG: Executing python function read_subpackage_metadata
DEBUG: Python function read_subpackage_metadata finished
DEBUG: Executing python function do_package_ipk
DEBUG: Signing ipk: /home/yocto/build/tmp/work/cortexa9hf-neon-poky-linux-gnueabi/python3/3.5.3-r1.0/deploy-ipks/cortexa9hf-neon/python3-man_3.5.3-r1.0_cortexa9hf-neon.ipk
DEBUG: Signing ipk: /home/yocto/build/tmp/work/cortexa9hf-neon-poky-linux-gnueabi/python3/3.5.3-r1.0/deploy-ipks/cortexa9hf-neon/python3-xmlrpc_3.5.3-r1.0_cortexa9hf-neon.ipk
DEBUG: Signing ipk: /home/yocto/build/tmp/work/cortexa9hf-neon-poky-linux-gnueabi/python3/3.5.3-r1.0/deploy-ipks/cortexa9hf-neon/python3-xml_3.5.3-r1.0_cortexa9hf-neon.ipk
DEBUG: Signing ipk: /home/yocto/build/tmp/work/cortexa9hf-neon-poky-linux-gnueabi/python3/3.5.3-r1.0/deploy-ipks/cortexa9hf-neon/python3-typing_3.5.3-r1.0_cortexa9hf-neon.ipk
DEBUG: Signing ipk: /home/yocto/build/tmp/work/cortexa9hf-neon-poky-linux-gnueabi/python3/3.5.3-r1.0/deploy-ipks/cortexa9hf-neon/python3-unixadmin_3.5.3-r1.0_cortexa9hf-neon.ipk
DEBUG: Signing ipk: /home/yocto/build/tmp/work/cortexa9hf-neon-poky-linux-gnueabi/python3/3.5.3-r1.0/deploy-ipks/cortexa9hf-neon/python3-modules_3.5.3-r1.0_cortexa9hf-neon.ipk
DEBUG: Signing ipk: /home/yocto/build/tmp/work/cortexa9hf-neon-poky-linux-gnueabi/python3/3.5.3-r1.0/deploy-ipks/cortexa9hf-neon/python3-unittest_3.5.3-r1.0_cortexa9hf-neon.ipk
DEBUG: Signing ipk: /home/yocto/build/tmp/work/cortexa9hf-neon-poky-linux-gnueabi/python3/3.5.3-r1.0/deploy-ipks/cortexa9hf-neon/python3-misc_3.5.3-r1.0_cortexa9hf-neon.ipk
DEBUG: Python function do_package_ipk finished
DEBUG: Python function do_package_write_ipk finished
ERROR: Function failed: GPG exited with code 2: gpg: signing failed: Cannot allocate memory
gpg: signing failed: Cannot allocate memory

这是有关内存的输出,我不明白它无法分配的内存!

yocto@edef5a9c44a0:~/build$ df -h 
Bestandssysteem Grootte Gebruikt Besch Geb% Aangekoppeld op
overlay            297G      83G  200G  30% /
tmpfs               64M        0   64M   0% /dev
tmpfs              7,7G        0  7,7G   0% /sys/fs/cgroup
shm                 64M        0   64M   0% /dev/shm
/dev/nvme0n1p5     297G      83G  200G  30% /home/yocto
tmpfs              7,7G        0  7,7G   0% /proc/asound
tmpfs              7,7G        0  7,7G   0% /proc/acpi
tmpfs              7,7G        0  7,7G   0% /proc/scsi
tmpfs              7,7G        0  7,7G   0% /sys/firmware
4

1 回答 1

1

我设法通过以下方法避免了内存不足的问题:我将此选项添加auto-expand-secmem 0x30000到我的.gnupg/gpg-agent.conf文件中。我一开始就没有它!所以我创建了:vim .gnupg/gpg-agent.conf 并添加了该选项。据我了解,这个 gpg 代理正在分配某种 ram 内存以便他开始签署文件,这个内存分配将取决于您的环境正在运行的内核数量。我希望我没有弄错这里!我还在学习这个!因此我面临一个新的错误:| gpg: skipped "9FFC6A5AD2F1126C": No secret key | gpg: signing failed: No secret key

于 2020-12-24T13:12:11.177 回答