From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 154FC1FF15E for ; Mon, 22 Dec 2025 15:18:50 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 7E2B115CD6; Mon, 22 Dec 2025 15:19:40 +0100 (CET) From: "Max R. Carrara" To: pve-devel@lists.proxmox.com Date: Mon, 22 Dec 2025 15:18:58 +0100 Message-ID: <20251222141907.400926-1-m.carrara@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1766413129959 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.317 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_ASCII_DIVIDERS 0.8 Email that uses ascii formatting dividers and possible spam tricks KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH pve-manager v2 0/6] Fix #6816: Prevent ceph-exporter Daemon from Crashing on Startup - v2 X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" Fix #6816: Prevent ceph-exporter Daemon from Crashing on Startup - v2 ===================================================================== tl;dr: Stop ceph-exporter.service from ending up in a crash loop by handing it a custom keyring file and setting its group to `www-data`, similar to what we did for ceph-crash.service [0] before. This is a refresh of a somewhat older series that has been rebased, with the version guard in `debian/postinst` adapted. The description from the previous version is provided here again for the reader's convenience. Currently, the `ceph-exporter` daemon ends up in a short startup crash loop before ultimately failing to start at all, because it tries to access the keyring file at `/etc/pve/priv/ceph.client.admin.keyring`, for which it doesn't have the permissions to do so. Instead of giving it access to the admin ring, give it its own keyring located at `/etc/pve/ceph/ceph.client.exporter.keyring`. This file and its corresponding section in `/etc/pve/ceph.conf` is created when the first MON is created via the API. If the cluster has already been set up, a postinst hook creates the keyring file and adapts `/etc/pve/ceph.conf` instead. The core logic of all of this was already added for `ceph-crash` a while ago [0] and is reused throughout the series, with some alterations to the original code in order to make it a little more generic. Testing ------- Would appreciate if somebody could (smoke-)test this just to make sure I didn't miss anything. In particular, ceph-exporter should start working by itself if you upgrade pve-manager with this series applied on an existing Ceph cluster (with `ceph-exporter` installed, of course). The setup this series adds should also be done by the `pveceph` CLI for new installations; installing Ceph on a single node should be sufficient to test this. *Important:* If you don't want to rebuild Ceph in order to test this, you can override the systemd service for ceph-exporter as follows: 1. `mkdir -p /etc/systemd/system/ceph-exporter.service.d` 2. Create file `` with the following contents (inside ```): ``` [Service] Environment="CEPH_KEYRING=/etc/pve/ceph/ceph.client.exporter.keyring" ExecStart= ExecStart=/usr/bin/ceph-exporter -f --id exporter --setuser ceph --setgroup www-data ``` 3. `systemctl daemon-reload` 4. Install the pve-manager package from this series. See NOTE below. Also, ensure you have `ceph-exporter` actually installed, of course. Whether you install it before or after the above doesn't (shouldn't) really matter. Then, you should see the metrics become available at http://your.node.tld:9926/metrics. NOTE ---- Patch #03 adds a call to the helper in debian/postinst. The version check there should be adapted after / while applying the series. Right now, the version in the check is set to `9.1.5`. Previous Versions ----------------- v1: https://lore.proxmox.com/pve-devel/20250916172012.739807-1-m.carrara@proxmox.com/ References ---------- [0]: https://lore.proxmox.com/pve-devel/20240402145523.683008-11-m.carrara@proxmox.com/ Summary of Changes ------------------ pve-manager: Max R. Carrara (5): ceph: tools: add helper sub for creating or updating keyring files fix #6816: api: ceph: create 'client.exporter' w/ keyring fix #6816: bin: add pve-ceph-keyring helper and call it in postinst ceph: tools: simplify helper sub for crash keyring file bin: make pve-init-ceph-crash call pve-ceph-keyring PVE/API2/Ceph/MON.pm | 9 ++ PVE/Ceph/Tools.pm | 108 ++++++++++++--- bin/Makefile | 1 + bin/pve-ceph-keyring | 286 ++++++++++++++++++++++++++++++++++++++++ bin/pve-init-ceph-crash | 152 +-------------------- debian/postinst | 24 ++++ 6 files changed, 415 insertions(+), 165 deletions(-) create mode 100755 bin/pve-ceph-keyring ceph: Max R. Carrara (1): fix #6816: patches: make ceph-exporter use custom keyring ...orter-use-custom-keyring-and-set-gro.patch | 32 +++++++++++++++++++ patches/series | 1 + 2 files changed, 33 insertions(+) create mode 100644 patches/0042-systemd-ceph-exporter-use-custom-keyring-and-set-gro.patch -- 2.47.3 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel