Bug 1294257

Summary: /dev/shm changes permission 777 to 755 after loading initramfs.
Product: [Fedora] Fedora Reporter: Phea Duch <phea.duch>
Component: dracutAssignee: systemd-maint
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: dracut-maint-list, harald, johannbg, jonathan, lnykryn, msekleta, s, systemd-maint, zbyszek
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-01-11 12:10:19 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
dmesg
none
dracut output
none
fstab
none
dmesg
none
mtab none

Description Phea Duch 2015-12-26 00:03:23 UTC
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-26 00:07:22 UTC
Created attachment 1109475 [details]
dracut output

Comment 2 Phea Duch 2015-12-26 00:09:57 UTC
Created attachment 1109476 [details]
fstab

Comment 3 Phea Duch 2015-12-26 00:10:24 UTC
Created attachment 1109477 [details]
dmesg

Comment 4 Phea Duch 2015-12-26 00:11:07 UTC
Created attachment 1109478 [details]
mtab

Comment 5 Zbigniew Jędrzejewski-Szmek 2015-12-26 01:46:38 UTC
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-26 03:26:32 UTC
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 05:16:08 UTC
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-11 00:08:00 UTC
The latest dracut update has fixed the issue on my computer:

Version     : 044
Release     : 17.git20160108.fc24