Bug 1294257 - /dev/shm changes permission 777 to 755 after loading initramfs.
/dev/shm changes permission 777 to 755 after loading initramfs.
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: dracut (Show other bugs)
rawhide
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: systemd-maint
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-12-25 19:03 EST by Phea Duch
Modified: 2016-01-11 07:10 EST (History)
9 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-01-11 07:10:19 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
dmesg (69.07 KB, text/plain)
2015-12-25 19:03 EST, Phea Duch
no flags Details
dracut output (168.98 KB, text/plain)
2015-12-25 19:07 EST, Phea Duch
no flags Details
fstab (727 bytes, text/plain)
2015-12-25 19:09 EST, Phea Duch
no flags Details
dmesg (102.37 KB, text/plain)
2015-12-25 19:10 EST, Phea Duch
no flags Details
mtab (2.66 KB, text/plain)
2015-12-25 19:11 EST, Phea Duch
no flags Details

  None (edit)
Description Phea Duch 2015-12-25 19:03:23 EST
Created attachment 1109474 [details]
dmesg

Description of problem:

During the boot process the permissions for /dev/shm changes from 777 to 755 after loading initramfs.

Mounted /boot/efi.
Reached target Local File Systems.
drwxrwxrwt 2 root root 60 Dec 25 13:20 /dev/shm
drwxrwxrwt 2 root root 60 Dec 25 13:20 /dev/shm
Starting Import network configuration from initramfs...
drwxrwxrwt 2 root root 60 Dec 25 13:20 /dev/shm
drwxrwxrwt 2 root root 60 Dec 25 13:20 /dev/shm
drwxrwxrwt 2 root root 60 Dec 25 13:20 /dev/shm
Starting Restore /run/initramfs on shutdown...
Starting Preprocess NFS configuration...
Starting Tell Plymouth To Write Out Runtime Data...
Started Restore /run/initramfs on shutdown.
‘./dev/shm/lldpad.state’ -> ‘/dev/shm/lldpad.state’
drwxrwxrwt 2 root root 60 Dec 25 13:20 /dev/shm
drwxr-xr-t 2 root root 60 Dec 25 13:20 /dev/shm

Steps to Reproduce:
1. Boot machine
2.
3.

Actual results:
# ll -d /dev/shm
drwxr-xr-t 2 root root 60 Dec 25 13:20 /dev/shm

Expected results:
# ll -d /dev/shm
drwxrwxrwx 2 root root 60 Dec 25 13:20 /dev/shm

Additional info:

Initramfs state always loads /dev/shm with 755 and I am unsure where this gets set.
# ll -d /run/initramfs/state/dev/shm/
drwxr-xr-x 2 root root 60 Dec 25 13:20 /run/initramfs/state/dev/shm/

I have tried rebuilding initramfs with dracut -f but it doesn't affect /state/dev/shm.

# cat /proc/cmdline 
BOOT_IMAGE=/vmlinuz-4.4.0-0.rc6.git1.1.fc24.x86_64 root=/dev/mapper/fedora-root ro rd.lvm.lv=fedora/root rd.luks.uuid=luks-0ae4f23d-42c1-41d8-b6cc-ce1a7fbbff0c rd.lvm.lv=fedora/swap LANG=en_US.UTF-8
Comment 1 Phea Duch 2015-12-25 19:07 EST
Created attachment 1109475 [details]
dracut output
Comment 2 Phea Duch 2015-12-25 19:09 EST
Created attachment 1109476 [details]
fstab
Comment 3 Phea Duch 2015-12-25 19:10 EST
Created attachment 1109477 [details]
dmesg
Comment 4 Phea Duch 2015-12-25 19:11 EST
Created attachment 1109478 [details]
mtab
Comment 5 Zbigniew Jędrzejewski-Szmek 2015-12-25 20:46:38 EST
dracut-shutdown.service doesn't do anything during boot, the message from systemd is misleading. Most likely it's fedora-import-state.service that messes up /dev/shm. Does it help if you do 'systemctl mask fedora-import-state.service'?
Comment 6 Phea Duch 2015-12-25 22:26:32 EST
It is an issue in the dracut module 'fcoe'. Dracut debug was showing this:

///lib/dracut/hooks/cleanup/90-cleanup-fcoe.sh@7(source): mkdir -m 0755 -p /run/initramfs/state/dev/shm
///lib/dracut/hooks/cleanup/90-cleanup-fcoe.sh@8(source): cp /dev/shm/lldpad.state /run/initramfs/state/dev/shm/
///lib/dracut/hooks/cleanup/90-cleanup-fcoe.sh@9(source): echo 'files /dev/shm/lldpad.state'
‘./dev/shm/lldpad.state’ -> ‘/dev/shm/lldpad.state’

The code for the cleanup script looks ok to me:
# cat /lib/dracut/modules.d/95fcoe/cleanup-fcoe.sh
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

if [ -e /var/run/lldpad.pid ]; then
    lldpad -k
    mkdir -m 0755 -p /run/initramfs/state/dev/shm
    cp /dev/shm/lldpad.state /run/initramfs/state/dev/shm/ > /dev/null 2>&1
    echo "files /dev/shm/lldpad.state" >> /run/initramfs/rwtab
fi

-------------
The interesting part is that I am not running lldpad.service and no lldpad.pid exists, but the code still executes for some reason.

# systemctl -all | grep lldp
lldpad.service loaded inactive   dead            Link Layer Discovery 

My temporary solution is to add 'fcoe' and 'fcoe-uefi' as ignored modules to /etc/dracut.conf
Comment 7 Zbigniew Jędrzejewski-Szmek 2015-12-29 00:16:08 EST
The bug is really in fedora-readonly.service or maybe fedora-import-state.service from initscripts. But dracut should simply stop using those obsolete services.
Comment 9 Phea Duch 2016-01-10 19:08:00 EST
The latest dracut update has fixed the issue on my computer:

Version     : 044
Release     : 17.git20160108.fc24

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