GCP METADATA OSCONFIG:TRUE导致yum检查更新到失败的仓库

问题描述

在Debian 9 Stretch上的GCP中具有新的OS Patching功能>>

GCP日志记录已将项目元数据enable-osconfig的设置添加为true,并将enable-guest-attributes设置为true,显示以下错误日志:-

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引用并安装这个明显存在的存储库(如上所述)?

我尝试了:

的变体
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也可能有帮助?!

p.s。我需要确切的语法,因为我对BASH不太了解

解决方法

我注意到您正在混合操作系统;对于Debian 9 Stretch,首先通过运行此命令[0]安装代理,然后将需要添加debian存储库[1],然后,如果不使用“ Google提供的映像”,则需要导入Google Cloud公钥[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 OS。 Yoy可以在GCP official documentation

中查看详细信息和“操作方法”指南