【问题标题】:Package 'google-fluentd' has no installation candidate on Debian 10软件包“google-fluentd”在 Debian 10 上没有安装候选
【发布时间】:2021-10-20 13:45:47
【问题描述】:

尝试在 Debian 10 上安装 Google Logging Agent 时,我收到以下错误。

root@10e0e5d1d15d:/opt/app# sudo bash add-logging-agent-repo.sh --also-install
Hit:1 http://security.debian.org/debian-security buster/updates InRelease
Hit:2 http://deb.debian.org/debian buster InRelease
Hit:3 http://deb.debian.org/debian buster-updates InRelease
Hit:4 https://packages.cloud.google.com/apt google-cloud-logging-buster-all InRelease
Hit:5 https://deb.nodesource.com/node_16.x buster InRelease
Hit:6 https://packages.cloud.google.com/apt google-cloud-ops-agent-buster-all InRelease
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package google-fluentd is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'google-fluentd' has no installation candidate
[2021-10-20T13:41:30+0000] google-fluentd google-fluentd-catch-all-config installation failed.

我正在尝试将它安装在基于 python:3.6-buster 的 Docker 容器中。

我已经仔细检查了 Debian 的版本:

root@10e0e5d1d15d:/opt/app# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 10 (buster)
Release:    10
Codename:   buster

知道这里有什么问题吗?

Google 明确声明日志代理 here 支持 Debian 10。

尝试 2

因此,我浏览了故障排除指南并验证了凭据已正确安装在 VM 上。具体来说,服务帐户文件存在于/etc/google/auth/application_default_credentials.json,虽然不是必需的,但通过GOOGLE_APPLICATION_CREDENTIALS 在环境中设置。

此外,我已检查服务帐户是否具有正确的权限:Logs Writer & Monitoring Metrics Writer。

尽管如此,当我运行命令时(在文档中指定以验证身份验证范围 (https://cloud.google.com/logging/docs/agent/logging/authorization):

curl --silent --connect-timeout 1 -f -H "Metadata-Flavor: Google" http://169.254.169.254/computeMetadata/v1/instance/service-accounts/default/scopes

它什么也不返回。一个空的结果。不知道为什么?

当我尝试使用 --verbose 标志安装代理时,我收到以下错误:

Hit:2 http://deb.debian.org/debian bullseye InRelease
Hit:3 http://deb.debian.org/debian bullseye-updates InRelease
Ign:4 https://packages.cloud.google.com/apt google-cloud-logging-bullseye-all InRelease
Err:5 https://packages.cloud.google.com/apt google-cloud-logging-bullseye-all Release
  404  Not Found [IP: 142.250.179.238 443]
Reading package lists... Done
E: The repository 'https://packages.cloud.google.com/apt google-cloud-logging-bullseye-all Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
+ refresh_failed apt debian
+ local REPO_TYPE=apt
+ local OS_FAMILY=debian
+ fail 'Could not refresh the google-cloud-logging apt repositories.
Please check your network connectivity and make sure you are running a supported
debian distribution. See https://cloud.google.com/logging/docs/agent/#agent-os-list
for a list of supported platforms.'
++ date +%Y-%m-%dT%H:%M:%S%z
+ echo '[2021-10-22T11:29:28+0000] Could not refresh the google-cloud-logging apt repositories.
Please check your network connectivity and make sure you are running a supported
debian distribution. See https://cloud.google.com/logging/docs/agent/#agent-os-list
for a list of supported platforms.'
[2021-10-22T11:29:28+0000] Could not refresh the google-cloud-logging apt repositories.
Please check your network connectivity and make sure you are running a supported
debian distribution. See https://cloud.google.com/logging/docs/agent/#agent-os-list
for a list of supported platforms.
+ exit 1

尝试 3

运行以下命令:

docker run -ti python:3.6-buster bash
curl -sSO https://dl.google.com/cloudagents/add-logging-agent-repo.sh && bash add-logging-agent-repo.sh --also-install --verbose

输出:

root@9b078fd9d2a7:/# curl -sSO https://dl.google.com/cloudagents/add-logging-agent-repo.sh && bash add-logging-agent-repo.sh --also-install --verbose
Enable verbose logging.
+ REPO_HOST=packages.cloud.google.com
+ AGENT_DOCS_URL=https://cloud.google.com/logging/docs/agent
+ AGENT_SUPPORTED_URL=https://cloud.google.com/logging/docs/agent/#agent-os-list
+ AGENT_PACKAGE=google-fluentd
+ [[ -z '' ]]
+ [[ '' == *true* ]]
+ ADDITIONAL_PACKAGES=('google-fluentd-catch-all-config')
+ declare -a ADDITIONAL_PACKAGES
+ [[ -f /etc/os-release ]]
+ . /etc/os-release
++ PRETTY_NAME='Debian GNU/Linux 10 (buster)'
++ NAME='Debian GNU/Linux'
++ VERSION_ID=10
++ VERSION='10 (buster)'
++ VERSION_CODENAME=buster
++ ID=debian
++ HOME_URL=https://www.debian.org/
++ SUPPORT_URL=https://www.debian.org/support
++ BUG_REPORT_URL=https://bugs.debian.org/
+ main --also-install --verbose
+ case "${ID:-}" in
+ handle_debian
+ EXTRA_OPTS=()
+ declare -a EXTRA_OPTS
+ [[ true == \t\r\u\e ]]
+ EXTRA_OPTS+=(-oDebug::pkgAcquire::Worker=1)
+ [[ add-repo also-install == *add-repo* ]]
+ resolve_version
+ [[ latest == \l\a\t\e\s\t ]]
+ AGENT_VERSION=
+ add_repo
+ [[ -n '' ]]
+ lsb_release -v
+ apt-get update
Get:1 http://deb.debian.org/debian buster InRelease [122 kB]
Get:2 http://security.debian.org/debian-security buster/updates InRelease [65.4 kB]
Get:3 http://deb.debian.org/debian buster-updates InRelease [51.9 kB]
Get:4 http://security.debian.org/debian-security buster/updates/main arm64 Packages [303 kB]
Get:5 http://deb.debian.org/debian buster/main arm64 Packages [7735 kB]
Get:6 http://deb.debian.org/debian buster-updates/main arm64 Packages [14.5 kB]
Fetched 8291 kB in 3s (3264 kB/s)
Reading package lists... Done
+ apt-get -y install lsb-release
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  distro-info-data
Suggested packages:
  lsb
The following NEW packages will be installed:
  distro-info-data lsb-release
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 34.4 kB of archives.
After this operation, 80.9 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian buster/main arm64 distro-info-data all 0.41+deb10u4 [6880 B]
Get:2 http://deb.debian.org/debian buster/main arm64 lsb-release all 10.2019051400 [27.5 kB]
Fetched 34.4 kB in 0s (739 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package distro-info-data.
(Reading database ... 24586 files and directories currently installed.)
Preparing to unpack .../distro-info-data_0.41+deb10u4_all.deb ...
Unpacking distro-info-data (0.41+deb10u4) ...
Selecting previously unselected package lsb-release.
Preparing to unpack .../lsb-release_10.2019051400_all.deb ...
Unpacking lsb-release (10.2019051400) ...
Setting up distro-info-data (0.41+deb10u4) ...
Setting up lsb-release (10.2019051400) ...
+ CHANGED=1
++ grep -o '^[a-z][a-z]'
++ dpkg -l apt-transport-https
+ [[ un == \i\i ]]
+ apt-get update
Hit:1 http://security.debian.org/debian-security buster/updates InRelease
Hit:2 http://deb.debian.org/debian buster InRelease
Hit:3 http://deb.debian.org/debian buster-updates InRelease
Reading package lists... Done
+ apt-get -y install apt-transport-https
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  apt-transport-https
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 149 kB of archives.
After this operation, 156 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian buster/main arm64 apt-transport-https all 1.8.2.3 [149 kB]
Fetched 149 kB in 0s (3157 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package apt-transport-https.
(Reading database ... 24604 files and directories currently installed.)
Preparing to unpack .../apt-transport-https_1.8.2.3_all.deb ...
Unpacking apt-transport-https (1.8.2.3) ...
Setting up apt-transport-https (1.8.2.3) ...
+ CHANGED=1
++ dpkg -l ca-certificates
++ grep -o '^[a-z][a-z]'
+ [[ ii == \i\i ]]
++ lsb_release -sc
+ local CODENAME=buster
+ local REPO_NAME=google-cloud-logging-buster-all
+ local 'REPO_DATA=deb https://packages.cloud.google.com/apt google-cloud-logging-buster-all main'
+ cmp -s - /etc/apt/sources.list.d/google-cloud-logging.list
+ echo 'Adding agent repository for debian.'
Adding agent repository for debian.
+ tee /etc/apt/sources.list.d/google-cloud-logging.list
deb https://packages.cloud.google.com/apt google-cloud-logging-buster-all main
+ apt-key add -
+ curl --connect-timeout 5 -s -f https://packages.cloud.google.com/apt/doc/apt-key.gpg
OK
+ CHANGED=1
+ [[ add-repo also-install == *also-install* ]]
+ install_agent
+ apt-get update
Hit:1 http://security.debian.org/debian-security buster/updates InRelease
Hit:2 http://deb.debian.org/debian buster InRelease
Hit:3 http://deb.debian.org/debian buster-updates InRelease
Get:4 https://packages.cloud.google.com/apt google-cloud-logging-buster-all InRelease [5494 B]
Ign:5 https://packages.cloud.google.com/apt google-cloud-logging-buster-all/main arm64 Packages
Get:5 https://packages.cloud.google.com/apt google-cloud-logging-buster-all/main arm64 Packages [615 B]
Fetched 6109 B in 2s (2561 B/s)
Reading package lists... Done
+ expected_version_installed
++ dpkg -l google-fluentd google-fluentd-catch-all-config
++ grep -o '^[a-z][a-z]'
++ sort -u
+ [[ dp == \i\i ]]
+ return
+ [[ -n '' ]]
+ apt-get -y --allow-downgrades install google-fluentd google-fluentd-catch-all-config
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package google-fluentd is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'google-fluentd' has no installation candidate
+ fail 'google-fluentd google-fluentd-catch-all-config installation failed.'
++ date +%Y-%m-%dT%H:%M:%S%z
+ echo '[2021-10-22T13:15:51+0000] google-fluentd google-fluentd-catch-all-config installation failed.'
[2021-10-22T13:15:51+0000] google-fluentd google-fluentd-catch-all-config installation failed.
+ exit 1

【问题讨论】:

    标签: docker debian fluentd google-cloud-logging


    【解决方案1】:

    只需按照文档中的说明再次尝试运行映像并从头开始install the agent这似乎是一个简单的故障。

    如果您遇到任何困难,请尝试完成fluentd troubleshooting guide 中的步骤(非常有帮助)。

    要从头开始安装代理,您需要运行两个命令:

    curl -sSO https://dl.google.com/cloudagents/add-logging-agent-repo.sh
    sudo bash add-logging-agent-repo.sh --also-install
    

    这个will install the latest version of the agent

    如果您仍然无法在此映像上安装代理,您可以尝试运行带有 --verbose 标志的 add-logging-agent-repo.sh 脚​​本以获取更多信息(请更新您的问题,我会尝试回答)。

    这是我的做法(没有任何问题)供您参考:

    所以 - 我创建了一个运行 Container Optimized OS 81 的新 GCE VM 实例。

    创建后我登录并运行docker run -ti python:3.6-buster bash

    我明白了

    Status: Downloaded newer image for python:3.6-buster
    root@7ad208076c02:/#
    

    快速检查是否安装了fluentd:

    root@7ad208076c02:/# service google-fluentd status
    google-fluentd: unrecognized service
    root@7ad208076c02:/# ps ax
        PID TTY      STAT   TIME COMMAND
          1 pts/0    Ss     0:00 bash
         10 pts/0    R+     0:00 ps ax
    

    不是(很明显,因为它是 python 图像)。

    那就安装吧:

    root@7ad208076c02:/# curl -sSO https://dl.google.com/cloudagents/add-logging-agent-repo.sh
    root@7ad208076c02:/# bash add-logging-agent-repo.sh --also-install
    
    Fetched 8469 kB in 2s (4114 kB/s)                       
    Reading package lists... Done
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    The following additional packages will be installed:
      distro-info-data
    Suggested packages:
      lsb
    The following NEW packages will be installed:
      distro-info-data lsb-release
    0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
    Need to get 34.4 kB of archives.
    After this operation, 80.9 kB of additional disk space will be used.
    Get:1 http://deb.debian.org/debian buster/main amd64 distro-info-data all 0.41+deb10u4 [6880 B]
    Get:2 http://deb.debian.org/debian buster/main amd64 lsb-release all 10.2019051400 [27.5 kB]
    Fetched 34.4 kB in 0s (827 kB/s)  
    ....
    ....
    ....
    
    Setting up google-fluentd-catch-all-config (0.8.0) ...
    google-fluentd google-fluentd-catch-all-config installation succeeded.
    
    

    现在开始并检查服务:

    root@7ad208076c02:/# service google-fluentd start
    [ ok ing google-fluentd 1.9.3: [....] google-fluentd.
    root@7ad208076c02:/# ps ax | grep fluentd
        PID TTY      STAT   TIME COMMAND
      1562 ?        Sl     0:00 /opt/google-fluentd/embedded/bin/ruby /usr/sbin/google-fluentd --log /var/log/googl
      1565 ?        Sl     0:01 /opt/google-fluentd/embedded/bin/ruby -Eascii-8bit:ascii-8bit /usr/sbin/google-flue
    

    【讨论】:

    • 感谢您的详细回复。我注意到您在 GCE VM 实例中运行了一个 docker 容器。这是必要的吗?在部署到 AWS 环境之前,我试图在本地运行它只是为了进行测试。
    • 出于测试目的,我在 GCE 中运行它,但继续在本地运行它 - 它仍然是相同的图像,因此您应该(理论上)得到相同的结果。
    • 嘿,我已经按照您的建议编辑了答案以使用详细标志运行,并且还执行了故障排除指南中的步骤。这次的失败略有不同(在本地运行)。
    • 请使用docker run -ti python:3.6-buster bash 启动一个新容器,并在它启动时在其中运行curl -sSO https://dl.google.com/cloudagents/add-logging-agent-repo.sh && bash add-logging-agent-repo.sh --also-install --verbose 并将整个输出粘贴到您的问题中。目前完全不清楚为什么会这样?
    • 好的,我现在刚刚添加了输出。
    猜你喜欢
    • 2011-01-04
    • 1970-01-01
    • 2016-10-08
    • 2012-02-15
    • 2013-09-28
    • 1970-01-01
    • 2018-08-09
    • 2018-05-25
    • 1970-01-01
    相关资源
    最近更新 更多