[{"data":1,"prerenderedAt":133},["ShallowReactive",2],{"post-2022-01-01-pacman-gpgme-error-no-data-zh":3,"surround-2022-01-01-pacman-gpgme-error-no-data-zh":119,"randomIndex/2022/01/01/pacman-gpgme-error-no-data/":131,"language-switch-/2022/01/01/pacman-gpgme-error-no-data/-en":132},{"title":4,"date":5,"path":6,"tags":7,"body":9,"description":30},"pacman更新时遇到「GPGME 错误：无数据」","2022-01-01 23:42:09","/2022/01/01/pacman-gpgme-error-no-data",[8],"Archlinux",{"type":10,"value":11,"toc":113},"minimark",[12,16,20,31,34,40,43,49,52,55,66,78,85,88,94,107],[13,14,15],"h2",{"id":15},"情景再现",[17,18,19],"p",{},"当初是使用 pacman 更新时遇上了「GPGME 错误：无数据」的问题，我尝试复现了下，大概是下面这样的情况。",[21,22,27],"pre",{"className":23,"code":25,"language":26},[24],"language-text","[zhullyb@Archlinux ~]$ sudo pacman -Syu\n错误：GPGME 错误：无数据\n错误：GPGME 错误：无数据\n错误：GPGME 错误：无数据\n:: 正在同步软件包数据库...\n core                                137.6 KiB   598 KiB/s 00:00 [------------------------------------] 100%\n extra                              1566.0 KiB  6.12 MiB/s 00:00 [------------------------------------] 100%\n community                             6.0 MiB  20.6 MiB/s 00:00 [------------------------------------] 100%\n错误：GPGME 错误：无数据\n错误：GPGME 错误：无数据\n错误：GPGME 错误：无数据\n错误：未能同步所有数据库（无效或已损坏的数据库 (PGP 签名)）\n","text",[28,29,25],"code",{"__ignoreMap":30},"",[17,32,33],{},"英文版的提示应该是长成下面这个样子",[21,35,38],{"className":36,"code":37,"language":26},[24],"[zhullyb@Archlinux ~]$ sudo pacman -Syu\nerror: GPGME error: No data\nerror: GPGME error: No data\nerror: GPGME error: No data\n:: Synchronizing package databases...\n core                                137.6 KiB   574 KiB/s 00:00 [------------------------------------] 100%\n extra                              1566.0 KiB  5.66 MiB/s 00:00 [------------------------------------] 100%\n community                             6.0 MiB  18.1 MiB/s 00:00 [------------------------------------] 100%\nerror: GPGME error: No data\nerror: GPGME error: No data\nerror: GPGME error: No data\nerror: failed to synchronize all databases (invalid or corrupted database (PGP signature))\n",[28,39,37],{"__ignoreMap":30},[13,41,42],{"id":42},"解决方案",[21,44,47],{"className":45,"code":46,"language":26},[24],"sudo rm /var/lib/pacman/sync/*.sig\n",[28,48,46],{"__ignoreMap":30},[17,50,51],{},"很简单，就这一条命令就够了。",[13,53,54],{"id":54},"问题原因",[17,56,57,58,61,62,65],{},"pacman在更新数据库文件时也会尝试下载",[28,59,60],{},"$repo.db.sig","，这里的",[28,63,64],{},"$repo","可以是 core、extra、community、archlinuxcn 等仓库名。",[17,67,68,69,73,74,77],{},"但是无论是官方源还是 archlinuxcn 源，",[70,71,72],"strong",{},"大多数源的数据库文件","都不会被签名，也就",[70,75,76],{},"不会存在 .db.sig 文件","。",[17,79,80,81,84],{},"pacman 尝试下载时这些数据库文件的签名文件时，镜像站就会返回 ",[70,82,83],{},"404 的 http 状态码","告诉pacman: “你个傻叉，神他妈没有这个文件！”",[17,86,87],{},"pacman 挨了一顿骂，也就善罢甘休，没有再动这个念头，所以我们每次更新也都相安无事。",[17,89,90,91,77],{},"而出现这种错误的情况大多是发生在 校园网、酒店免费 WIFI 这种",[70,92,93],{},"需要登陆以后才能上网的网络环境",[17,95,96,97,100,101,103,104,106],{},"因为 pacman 尝试下载 ",[28,98,99],{},".db.sig"," 文件时被登陆网页劫持了（这点你们应该深有感受，如果你在这种网络环境下没有登陆，你无论访问什么网页都会被重定向到登录界面，http 的状态码此时是200，不是404）。从没见过 ",[28,102,99],{},"的 pacman 此时两眼放光，由于没有挨骂，他就迅速地把登录界面当成是",[28,105,99],{},"下载下来了。",[17,108,109,110,112],{},"下载下来以后，pacman 激动地摆弄起 ",[28,111,99],{},"，甚至发现里面没有自己期待已久的 GPG签名数据并开始报错时仍然不愿意撒手，因此此时无论再怎么同步源码、再怎么 Syyu 也不会有效果，必须人工干预。",{"title":30,"searchDepth":114,"depth":114,"links":115},2,[116,117,118],{"id":15,"depth":114,"text":15},{"id":42,"depth":114,"text":42},{"id":54,"depth":114,"text":54},[120,126],{"title":121,"path":122,"stem":123,"date":124,"lang":125,"children":-1},"在Fedora搭建jekyll环境——dnf module","/2022/01/12/dnf-module-in-setting-up-the-jekyll","posts/zh/dnf-module-in-setting-up-the-jekyll","2022-01-12 22:11:42","zh-CN",{"title":127,"path":128,"stem":129,"date":130,"lang":125,"children":-1},"Cutefish的前世今生","/2021/12/12/the-history-of-cutefish","posts/zh/the-history-of-cutefish","2021-12-12 00:10:34",3,null,1777565052632]