From: Lennart Poettering Date: Fri, 2 Jun 2023 09:08:07 +0000 (+0200) Subject: shutdown: don't attempt to detach DM volume backing /usr/ X-Git-Tag: v254-rc1~299^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=31d346206cef3c6b280495fa93310f9790f9ef02;p=thirdparty%2Fsystemd.git shutdown: don't attempt to detach DM volume backing /usr/ 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 --- diff --git a/src/shutdown/detach-dm.c b/src/shutdown/detach-dm.c index bfb591ede5f..71be74377d5 100644 --- a/src/shutdown/detach-dm.c +++ b/src/shutdown/detach-dm.c @@ -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; }