google-cloud-platform - GCP METADATA OSCONFIG:TRUE 导致 yum check-update 失败 repo not found
问题描述
使用 Debian 9 Stretch 上 GCP 中的新操作系统修补功能>>
将项目元数据 enable-osconfig 设置为 true 并将 enable-guest-attributes 设置为 true 后,GCP Logging 显示以下错误日志:-
Error Applying yum changes, attempt 1, retrying in 1s: error running yum with args ["check-update" "--assumeyes"]: exit status 1, stdout: There are no enabled repos. Run "yum repolist all" to see the repos you have. You can enable repos with yum-config-manager --enable <repo>
having Run "yum repolist all" the response is repolist: 0
it appears that yum cannot find the repo that OSCONFIG metadata has attempted to add
Log entry: Writing repo file /etc/yum.repos.d/google_osconfig_managed.repo with updated contents
我现在如何解决错误并让 yum-config-manager 引用并安装这个显然存在的 repo(如上)?
我尝试了以下变化:
yum -config-manager --enable /etc/yum.repos.d/google_osconfig_managed.repo
但奇怪的是无济于事的是:
CRITICAL:yum.cli:Config Error: Error accessing file for config file:///home/accounts/onfig-manager
有任何想法吗?甚至 REPO 的 URL 也可能有帮助?!
ps 我需要确切的语法,因为我对 BASH 并不熟悉
解决方案
我注意到您正在混合操作系统;对于 Debian 9 Stretch,首先通过运行此命令 [0] 安装代理,然后您需要添加 debian 存储库 [1],然后如果您不使用“Google 提供的图像”,则需要导入谷歌云公钥 [2]。最后,验证代理是否在您的实例中运行 [3]:
[0]
sudo apt update
sudo apt -y install google-osconfig-agent
[1]
sudo su -c "echo 'deb http://packages.cloud.google.com/apt \ google-compute-engine-stretch-stable main'> /etc/apt/sources.list.d/google-compute-engine.list"
[2]
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | \ sudo apt-key add -
[3]
systemctl status google-osconfig-agent
注意:yum 用于 CentOS/RedHat 操作系统。Yoy 可以在GCP 官方文档中查看详细信息和“操作方法”指南
推荐阅读
- python - 从文本和数字数据字典创建网络 - 训练 GNN
- sql - PostgreSQL 用 RETURNING 慢速插入单行(在生产中花费 500 毫秒)
- css - 子 div 大于父 div
- quarkus - 从 Kafka 消费时 JPA 事务成功后的确认消息
- informatica - Informatica Cloud 目标文件列顺序
- karate - 请告知空手道框架中的哪些功能在合同测试中扮演 Pact 经纪人的类似角色
- apache-kafka - Kafka 连接到只读提交的消息
- python - 该类只接受 1 个参数,但给出了 4 个
- amazon-web-services - AWS CloudFront 响应 307 临时重定向
- bash - 从子脚本中捕获 bash 错误