Bug 22516 - Does not start /run/initramfs/shutdown
Summary: Does not start /run/initramfs/shutdown
Status: RESOLVED FIXED
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: 6
Hardware: All Linux
Priority: Normal critical
Target Milestone: ---
Assignee: Base system maintainers
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-02-03 23:25 CET by Alex Kotov
Modified: 2024-04-25 08:06 CEST (History)
3 users (show)

See Also:
Source RPM: systemd
CVE:
Status comment:


Attachments
screenshot (263.19 KB, application/octet-stream)
2018-02-03 23:28 CET, Alex Kotov
Details
4.4.111-1.mga5-dracut-038 (160.88 KB, image/jpeg)
2018-02-03 23:29 CET, Alex Kotov
Details
4.14.13-desktop-1.mga6-dracut-044 (178.19 KB, image/jpeg)
2018-02-03 23:31 CET, Alex Kotov
Details
print_req_error-kernel-4.14.13-Mageia6 (49.81 KB, image/jpeg)
2018-02-03 23:31 CET, Alex Kotov
Details

Description Alex Kotov 2018-02-03 23:25:01 CET
Hello.

The reason was revealed on VirtualBox 5.2.6

Steps to Reproduce:
1. Put them in the beginning of the file /usr/lib/dracut/modules.d/99shutdown/shutdown.sh
echo "SHUTDOWN RUNNING!"
echo "PRESS ENTER..."
read a
2. dracut -f
3. touch /run/initramfs/.need_shutdown; shutdown -H now

Mageia-5, for example kernel 4.4.111-1.mga5, dracut 038
(screenshot 4.4.111-1.mga5-dracut-038)
Works great!

Mageia-6, for example kernel 4.14.13-desktop-1.mga6, dracut 044
(screenshot 4.14.13-desktop-1.mga6-dracut-044)
Does not start /run/initramfs/shutdown

I'm Doing a live usb stick with persistence, otherwise I would not have paid attention to this fact (screenshot print_req_error-kernel-4.14.13-Mageia6).

My method definition is too simple or wrong? Thank you...
Comment 1 Alex Kotov 2018-02-03 23:28:49 CET
Created attachment 9938 [details]
screenshot
Comment 2 Alex Kotov 2018-02-03 23:29:37 CET
Created attachment 9939 [details]
4.4.111-1.mga5-dracut-038
Comment 3 Alex Kotov 2018-02-03 23:31:06 CET
Created attachment 9940 [details]
4.14.13-desktop-1.mga6-dracut-044
Comment 4 Alex Kotov 2018-02-03 23:31:48 CET
Created attachment 9941 [details]
print_req_error-kernel-4.14.13-Mageia6
Marja Van Waes 2018-02-04 12:17:48 CET

CC: (none) => marja11, ngompa13
Source RPM: (none) => systemd
Assignee: bugsquad => basesystem

Comment 5 Martin Whitaker 2018-10-21 19:43:52 CEST
The reason is that from dracut 042 onwards, /run gets mounted with the noexec option. systemd-shutdown only pivots back to the initramfs if /run/initramfs/shutdown exists and is executable.

I have opened an issue about this upstream (https://github.com/dracutdevs/dracut/issues/481).

You can work around this by creating a script in /usr/lib/systemd/system-shutdown with the following contents:

#!/bin/sh
mount -o remount,exec /run

CC: (none) => mageia

Comment 6 Alex Kotov 2018-10-24 09:46:45 CEST
Thank you, Martin.
Comment 7 Alex Kotov 2019-04-08 10:24:05 CEST
(In reply to Martin Whitaker from comment #5)
> The reason is that from dracut 042 onwards, /run gets mounted with the
> noexec option. systemd-shutdown only pivots back to the initramfs if
> /run/initramfs/shutdown exists and is executable.
> 
> I have opened an issue about this upstream
> (https://github.com/dracutdevs/dracut/issues/481).
> 
> You can work around this by creating a script in
> /usr/lib/systemd/system-shutdown with the following contents:
> 
> #!/bin/sh
> mount -o remount,exec /run

Hello, Martin. I am very grateful to You for dealing with this problem. I am writing to inform You about current results on this issue. Currently using Mageia-7-beta2 (Kernel v5.0.7-2, systemd v241, dracut v042). Now remounting the flash drive and unmounting partitions is successful, as e2fsck says-that is no mistakes, it's all clear. However, I use "mount -o remount,exec /run" in the file "/usr/lib/dracut/modules.d/90mgalive/mgalive-shutdown.sh". I don't know how this is correct, but works for me That's the way.

I noticed that in Mageia-7-beta2 "/usr/lib/dracut/modules.d/90mgalive/mgalive-root.sh" modification which I use to make my initrd for saving flash drives. In the new version of this script state the specific command unmounting distrib, overlay, media, earlier this nebylo. I only have add my "save.img" and everything worked. I have a questions: will the current situation and reliable unmounting in the future? Should I close this issue or is it still in the process of being resolved? Thanks.

Separately thank for subject https://github.com/dracutdevs/dracut/issues/481 I would very much like to join You in discussing this issue, but I feel that this topic is difficult for me and I will only interfere there. :(

With respect,
Alex

p.s. Sorry for the online English translation...
Comment 8 Martin Whitaker 2019-04-08 21:05:52 CEST
As I was warned in the upstream bug report, my original fix stopped working with the update to systemd 241. So instead I have added the remount command to /usr/lib/dracut/dracut-initramfs-restore. So if you have dracut-046-11.mga7 installed, you should not need to add your own remount command. This works fine on the forthcoming beta3 Live ISOs. Please could you test that it also works for you.
Comment 9 Alex Kotov 2019-04-09 12:22:28 CEST
Hello, Martin. In the previous post, I made a typo because it was dracut v046-11, not 042, sorry. For testing and as a visual confirmation, I collected a completely fresh Assembly for the flash drive. The system language is English, archive size 1,3GB: https://drive.google.com/open?id=1t1_oxC6hwCOkCQxyZXFavwefVAO4KxNl I confirm, with Your last changes everything works perfectly.

The bug was really complicated. Thank You for your help and decision.

With respect,
Alex

Resolution: (none) => FIXED
Status: NEW => RESOLVED

Comment 10 Mageia Robot 2024-04-25 08:06:32 CEST
commit 1ed60d25874839c7cc477210754ffd752c2cd797
Author: Thomas Backlund <tmb@...>
Date:   Sat Oct 19 19:27:20 2013 +0100

    Updated to eject CD and pause on shutdown.
    
    Signed-off-by: Martin Whitaker <mageia@martin-whitaker.me.uk>
    - origin:
      https://svnweb.mageia.org/packages/cauldron/dracut/current/SOURCES/0511-mgalive-A-module-to-mount-Mageia-Live-media.patch?r1=1231609&r2=1326566
    - enable pivot back to dracut on shutdown (mga#22516)
      o see also upstream issue #481
    - fix shutdown umount retry loop (upstream issue #483)
    - mgalive: ensure overlay filesystems are cleanly unmounted on shutdown
    - mgalive: eject optical media and pause on shutdown
---
 Commit Link:
   https://gitweb.mageia.org/software/mageia-dracut-conf/commit/?id=1ed60d25874839c7cc477210754ffd752c2cd797

Note You need to log in before you can comment on or make changes to this bug.