From 152608efa497bb9f474d3ef0078ad0b3e18ec883 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Andr=C3=A9?= Date: Thu, 25 Jun 2026 14:50:55 +0200 Subject: [PATCH] Fix Ceph OSD not starting after reboot with loop device The ceph-osd-losetup service sets up the loop device backing the Ceph OSD, but after a reboot two things can go wrong: 1. LVM scans run before the loop device is ready, so the vg_ceph logical volumes (data, db) are never activated. The OSD fails with: 'failed to open /dev/vg_ceph/data: No such file or directory' 2. Ceph services can start before the losetup service completes, racing against the loop device setup. Fix both by adding: - ExecStartPost=vgchange -ay vg_ceph to activate the LVs after the loop device is attached - Before=ceph.target to ensure correct ordering with all Ceph daemons --- playbooks/prepare_host.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/playbooks/prepare_host.yaml b/playbooks/prepare_host.yaml index 6331c53..534fdda 100644 --- a/playbooks/prepare_host.yaml +++ b/playbooks/prepare_host.yaml @@ -249,9 +249,11 @@ [Unit] Description=Ceph OSD losetup After=syslog.target + Before=ceph.target [Service] Type=oneshot ExecStart=/bin/bash -c '/sbin/losetup /dev/loop1 || /sbin/losetup --direct-io=on /dev/loop1 /var/lib/ceph-osd.img' + ExecStartPost=/sbin/vgchange -ay vg_ceph ExecStop=/sbin/losetup -d /dev/loop1 RemainAfterExit=yes [Install]