<html><head></head><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px"><div id="yiv5089200066"><div id="yui_3_16_0_ym19_1_1469348224593_2955"><div style="color:#000;background-color:#fff;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px;" id="yui_3_16_0_ym19_1_1469348224593_2954"><div id="yiv5089200066yui_3_16_0_ym19_1_1469267776340_4957">sorry for top-replying, yahoo web client is braindead.</div><div id="yiv5089200066yui_3_16_0_ym19_1_1469267776340_4958"><br clear="none"></div><div id="yiv5089200066yui_3_16_0_ym19_1_1469267776340_4959">This is how I got around this:</div><div id="yiv5089200066yui_3_16_0_ym19_1_1469267776340_4959"><br clear="none"></div><div id="yiv5089200066yui_3_16_0_ym19_1_1469267776340_4989">diff -Naurw systemd-230.original/src/core/shutdown.c systemd-230/src/core/shutdown.c </div><div id="yiv5089200066yui_3_16_0_ym19_1_1469267776340_4990">--- systemd-230.original/src/core/shutdown.c<span id="yiv5089200066yui_3_16_0_ym19_1_1469267776340_4991" style="white-space:pre-wrap;">    </span>2016-05-22 01:31:29.000000000 +0300</div><div id="yiv5089200066yui_3_16_0_ym19_1_1469267776340_4992">+++ systemd-230/src/core/shutdown.c<span id="yiv5089200066yui_3_16_0_ym19_1_1469267776340_4993" style="white-space:pre-wrap;">        </span>2016-07-23 13:17:58.008983291 +0300</div><div id="yiv5089200066yui_3_16_0_ym19_1_1469267776340_4994">@@ -272,6 +272,10 @@</div><div id="yiv5089200066yui_3_16_0_ym19_1_1469267776340_4995">                                 log_error_errno(r, "Failed to detach loop devices: %m");</div><div id="yiv5089200066yui_3_16_0_ym19_1_1469267776340_4996">                 }</div><div id="yiv5089200066yui_3_16_0_ym19_1_1469267776340_4997"> </div><div id="yiv5089200066yui_3_16_0_ym19_1_1469267776340_4998">+                if (!in_container && !in_initrd() &&</div><div id="yiv5089200066yui_3_16_0_ym19_1_1469267776340_4999">+                    access("/run/initramfs/shutdown", X_OK) == 0) {</div><div id="yiv5089200066yui_3_16_0_ym19_1_1469267776340_5000">+                        log_info("Keeping all DM devices attached for easy access in the initramfs", r);</div><div id="yiv5089200066yui_3_16_0_ym19_1_1469267776340_5001">+                } else {</div><div id="yiv5089200066yui_3_16_0_ym19_1_1469267776340_5002">                 if (need_dm_detach) {</div><div id="yiv5089200066yui_3_16_0_ym19_1_1469267776340_5003">                         log_info("Detaching DM devices.");</div><div id="yiv5089200066yui_3_16_0_ym19_1_1469267776340_5004">                         r = dm_detach_all(&changed);</div><div id="yiv5089200066yui_3_16_0_ym19_1_1469267776340_5005">@@ -283,6 +287,7 @@</div><div id="yiv5089200066yui_3_16_0_ym19_1_1469267776340_5006">                         else</div><div id="yiv5089200066yui_3_16_0_ym19_1_1469267776340_5007">                                 log_error_errno(r, "Failed to detach DM devices: %m");</div><div id="yiv5089200066yui_3_16_0_ym19_1_1469267776340_5008">                 }</div><div id="yiv5089200066yui_3_16_0_ym19_1_1469267776340_5009">+                }</div><div id="yiv5089200066yui_3_16_0_ym19_1_1469267776340_5010"> </div><div id="yiv5089200066yui_3_16_0_ym19_1_1469267776340_5011">                 if (!need_umount && !need_swapoff && !need_loop_detach && !need_dm_detach) {</div><div dir="ltr" id="yiv5089200066yui_3_16_0_ym19_1_1469267776340_5012">                         if (retries > 0)</div><div dir="ltr" id="yiv5089200066yui_3_16_0_ym19_1_1469267776340_5012"><br clear="none"></div><div dir="ltr" id="yiv5089200066yui_3_16_0_ym19_1_1469267776340_5012"><br clear="none"></div><div dir="ltr" id="yiv5089200066yui_3_16_0_ym19_1_1469267776340_5012">Judging by your response, this is unlikely to be accepted, so I have to maintain it myself, but as long as it does what I need, that's fine.</div><div dir="ltr" id="yiv5089200066yui_3_16_0_ym19_1_1469267776340_5012"><br clear="none"></div><div dir="ltr" id="yiv5089200066yui_3_16_0_ym19_1_1469267776340_5012">Thanks,</div><div dir="ltr" id="yiv5089200066yui_3_16_0_ym19_1_1469267776340_5012">IvanK.</div><div dir="ltr" id="yiv5089200066yui_3_16_0_ym19_1_1469267776340_5012"><br clear="none"></div><div dir="ltr" id="yiv5089200066yui_3_16_0_ym19_1_1469267776340_5012"><br clear="none"></div><div class="qtdSeparateBR"><br><br></div><div class="yiv5089200066yqt3395557409" id="yiv5089200066yqt79639"><div id="yui_3_16_0_ym19_1_1469348224593_2956"> <div id="yiv5089200066yui_3_16_0_ym19_1_1469267776340_3563" style="font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px;"> <div id="yiv5089200066yui_3_16_0_ym19_1_1469267776340_3562" style="font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px;"> <div dir="ltr" id="yiv5089200066yui_3_16_0_ym19_1_1469267776340_3569"><font id="yiv5089200066yui_3_16_0_ym19_1_1469267776340_3568" size="2" face="Arial"> On Friday, July 22, 2016 9:28 PM, Lennart Poettering <lennart@poettering.net> wrote:<br clear="none"></font></div> <blockquote id="yiv5089200066yui_3_16_0_ym19_1_1469267776340_3566" style="border-left:2px solid rgb(16, 16, 255);margin-left:5px;margin-top:5px;padding-left:5px;"> <br clear="none"><br clear="none"> <div class="yiv5089200066y_msg_container" id="yiv5089200066yui_3_16_0_ym19_1_1469267776340_3565">On Fri, 22.07.16 17:24, Ivan Kabaivanov (<a rel="nofollow" shape="rect" id="yiv5089200066yui_3_16_0_ym19_1_1469267776340_3567" ymailto="mailto:chepati@yahoo.com" target="_blank" href="mailto:chepati@yahoo.com">chepati@yahoo.com</a>) wrote:<div class="yiv5089200066qtdSeparateBR" id="yui_3_16_0_ym19_1_1469348224593_2957"><br clear="none"><br clear="none"></div><div class="yiv5089200066yqt0505371670" id="yiv5089200066yqtfd66688"><br clear="none"><br clear="none">> Hi,<br clear="none">> I'm running LFS (Linux From Scratch) with systemd-230, compiled from source.  I have three LUKS-encrypted devices:<br clear="none">> /dev/mapper/swap/dev/mapper/root/dev/mapper/home<br clear="none">> I want to drop into initramfs and do some maintenance work, for which I require all three of these encrypted devices to remain active.<br clear="none">> I create /run/initramfs with a populated and working initramfs.  I create /run/initramfs/shutdown with permissions 0755 and the following content:<br clear="none">> #/bin/shexec busybox sh<br clear="none">> When I issue the shutdown command I get dropped into the initramfs and I get the busybox shell.  Howerver, only /dev/mapper/root (my / ) remains active.  /dev/mapper/swap and /dev/mapper/home point to non-existent /dev/dm-* block devices.<br clear="none">> Manually trying cryptsetup open /dev/sdaN label just hangs without activating the device.<br clear="none">> I'm guessing systemd goes on a killing spree and kills all the crypt processes, except the ones associated with / (/oldroot in the initramfs).<br clear="none">> Is there a way to tell systemd to keep the encrypted devices active, even if it unmounts their filesystems?</div><br clear="none"><br clear="none">No, this is currently not available. The killing spree will try to<br clear="none">unmount everything it can, detach all loopbacks it can, and<br clear="none">disassemble all DM devices it can (of which LUKS is one type). You are<br clear="none">shutting down after all...<br clear="none"><br clear="none">Lennart<br clear="none"><br clear="none">-- <br clear="none">Lennart Poettering, Red Hat</div> </blockquote> </div> </div>  </div></div></div></div></div></div></body></html>