]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
shutdown: don't attempt to detach DM volume backing /usr/
authorLennart Poettering <lennart@poettering.net>
Fri, 2 Jun 2023 09:08:07 +0000 (11:08 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 2 Jun 2023 13:56:06 +0000 (15:56 +0200)
Since we run off /usr/ it makes no sense to attempt to try to detach any
DM device backing it. Hence skip it just like we skip detaching the DM
device backing the root fs.

Addresses: https://github.com/systemd/systemd/issues/27682#issuecomment-1573328188

src/shutdown/detach-dm.c

index bfb591ede5fec2eaeb00709fbf8f08bfd457adf1..71be74377d536bc8e949dac43bc5351e21f82f5e 100644 (file)
@@ -121,15 +121,18 @@ static int delete_dm(DeviceMapper *m) {
 
 static int dm_points_list_detach(DeviceMapper **head, bool *changed, bool last_try) {
         int n_failed = 0, r;
-        dev_t rootdev = 0;
+        dev_t rootdev = 0, usrdev = 0;
 
         assert(head);
         assert(changed);
 
         (void) get_block_device("/", &rootdev);
+        (void) get_block_device("/usr", &usrdev);
 
         LIST_FOREACH(device_mapper, m, *head) {
-                if (major(rootdev) != 0 && rootdev == m->devnum) {
+                if ((major(rootdev) != 0 && rootdev == m->devnum) ||
+                    (major(usrdev) != 0 && usrdev == m->devnum)) {
+                        log_debug("Not detaching DM %s that backs the OS itself, skipping.", m->path);
                         n_failed ++;
                         continue;
                 }