Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 493442 - sys-apps/openrc-0.12.4 - /etc/initd./root is run after init scripts trying to write to /
Summary: sys-apps/openrc-0.12.4 - /etc/initd./root is run after init scripts trying to...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: OpenRC (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: OpenRC Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 481182
  Show dependency tree
 
Reported: 2013-12-06 14:19 UTC by Petre Rodan
Modified: 2013-12-09 08:23 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
openrc.png (openrc.png,56.53 KB, image/png)
2013-12-06 15:49 UTC, Petre Rodan
Details
rc.log for the second scenario (rc.log,3.80 KB, text/plain)
2013-12-06 15:50 UTC, Petre Rodan
Details
bootmisc.patch (bootmisc.patch,240 bytes, patch)
2013-12-07 07:33 UTC, Petre Rodan
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Petre Rodan 2013-12-06 14:19:31 UTC
if /tmp is not a separate partition the box that has openrc-0.12.4 will be unable to boot.

although the 'root' init.d script is part of the 'boot' runlevel it is started much too late during the init process. 'bootmisc' however is started soon. and bootmisc runs /usr/bin/mktemp.

mktemp needs write permissions to '/tmp', but '/tmp' ('/' really) is readonly at this stage. the boot process will be incomplete - no network interfaces, no services that depend on net, etc. in one word it will fail.

if I try then to start any init script (including /etc/init/boot) I get the 'already starting' error. I am not sure how is that script supposed to be queued to be started at a later date. init 3 is long started, I logged into the machine via a console and openrc is supposed to run stuff serialized. so the likelihood of that script starting by itself in the near future is null.

so to conclude:
 1- if /tmp is not a separate partition then server fails to start 80% of the services (flawed init script ordering)
 2- if a user wants to have a script started, it should start without veto rights from a random all knowing AI (flawed idea that the user has to be an idiot) 

nyleve.dtc ~ # rc-update show boot
             bootmisc | boot
        device-mapper | boot
              fix_eth | boot
                 fsck | boot
             hostname | boot
              hwclock | boot
              keymaps | boot
           localmount | boot
             loopback | boot
                  lvm | boot
              modules | boot
               net.lo | boot
               procfs | boot
                 root | boot
                 swap | boot
            swapfiles | boot
               sysctl | boot
       tmpfiles.setup | boot
              urandom | boot

possible 'fix':
if I add a tmpfs filesystem to be mounted as '/tmp' in fstab and reboot I get a few screens worth of cannot remove 'rm: cannot remove /tmp/tmp.JHRTUYRYTRY/run/udev/data/foo: Read-only file system', but the server will have all services running.

can you please remove this openrc version from the stable tree and we both pretend it never happened?

thanks,
peter
Comment 1 Jeroen Roovers (RETIRED) gentoo-dev 2013-12-06 14:43:37 UTC
(In reply to Petre Rodan from comment #0)
> if /tmp is not a separate partition the box that has openrc-0.12.4 will be
> unable to boot.

I have exactly zero systems with /tmp as a separate partition. All of them run fine.

> although the 'root' init.d script is part of the 'boot' runlevel it is
> started much too late during the init process. 'bootmisc' however is started
> soon. and bootmisc runs /usr/bin/mktemp.

So that might be the real problem. Why would anything run before /etc/init.d/root?

> so to conclude:
>  1- if /tmp is not a separate partition then server fails to start 80% of
> the services (flawed init script ordering)

Unconfirmed.

>  2- if a user wants to have a script started, it should start without veto
> rights from a random all knowing AI (flawed idea that the user has to be an
> idiot) 

Now you're just trolling.

> nyleve.dtc ~ # rc-update show boot
> can you please remove this openrc version from the stable tree and we both
> pretend it never happened?

Again, do not troll, kthx.

Please set rc_logger="YES" and rc_log_path=/var/log/rc.log in /etc/rc.conf and attach rc.log to this bug report.
Comment 2 Jeroen Roovers (RETIRED) gentoo-dev 2013-12-06 14:44:34 UTC
Also, tell us why fix_eth is in the boot runlevel and what it actually does.
Comment 3 Petre Rodan 2013-12-06 15:49:52 UTC
Created attachment 364712 [details]
openrc.png


the rc log is empty in the scenario in which /tmp is not a separate partition.

so attached you'll find the next best thing: a gimp stitched capture of the ipmi remote console output.
Comment 4 Petre Rodan 2013-12-06 15:50:54 UTC
Created attachment 364714 [details]
rc.log for the second scenario

rc.log for when I added a tmpfs /tmp into fstab.
Comment 5 Jeroen Roovers (RETIRED) gentoo-dev 2013-12-06 16:02:54 UTC
I am pretty certain this has nothing to do with how you mount /tmp or if it is part of the root filesystem - it comes down to the order in which the boot level init scripts are run.
Comment 6 Petre Rodan 2013-12-06 16:07:40 UTC
(In reply to Jeroen Roovers from comment #1)
> > although the 'root' init.d script is part of the 'boot' runlevel it is
> > started much too late during the init process. 'bootmisc' however is started
> > soon. and bootmisc runs /usr/bin/mktemp.
> 
> So that might be the real problem. Why would anything run before
> /etc/init.d/root?

it would be nice to know.

> > so to conclude:
> >  1- if /tmp is not a separate partition then server fails to start 80% of
> > the services (flawed init script ordering)
> 
> Unconfirmed.
> 
> >  2- if a user wants to have a script started, it should start without veto
> > rights from a random all knowing AI (flawed idea that the user has to be an
> > idiot) 
> 
> Now you're just trolling.

sorry if it sounds like trolling, but when I run something in a console the last thing I expect is to be denied by a broken error-checking function.

broken because the reason why service starting is denied ('already starting' when that action will never actually happen).

how do I overwrite this AI?

> > nyleve.dtc ~ # rc-update show boot
> > can you please remove this openrc version from the stable tree and we both
> > pretend it never happened?

now THAT is trolling. 
maybe.

> Please set rc_logger="YES" and rc_log_path=/var/log/rc.log in /etc/rc.conf
> and attach rc.log to this bug report.

did that, but in the first case the log could not be created - see png capture.
fopen /run/openrc/rc.log failed

then I added the tmpfs /tmp and the log was filled (attachment #2 [details]).

> Also, tell us why fix_eth is in the boot runlevel and what it actually does.

----------- 8< ------------------
#!/sbin/runscript

depend() {
    before net
}

start() {
    ebegin "Fixing eth order"
    /local/adm/bin/fix_eth_order.sh -eo # [1]
    eend $?
}

stop() {
    :
}
----------- 8< ------------------

[1] https://github.com/rodan/fix_eth_order

I had this in 'boot' because adding it in 'default' it ended up running after net for some unknown reason. (tested with an older openrc)

but anyhow I removed it temporarily to see if that fixes something. it did not.
Comment 7 Thomas Deutschmann (RETIRED) gentoo-dev 2013-12-07 00:38:25 UTC
Remove net.lo from boot, see bug 490750.

Please show us your fstab. If "/tmp" isn't listed in fstab, please tell us how you mount/create "/tmp".

What kind of system do you have? I am missing some default services like mtab and termencoding, is it some kind of container?
Comment 8 Petre Rodan 2013-12-07 07:33:53 UTC
Created attachment 364768 [details, diff]
bootmisc.patch

> Remove net.lo from boot, see bug 490750.

removed net.lo from boot. thanks for the hint. no change to the bug at hand tho.

> Please show us your fstab. If "/tmp" isn't listed in fstab, please tell us how you mount/create "/tmp".

for the original scenario of this bug report:
 # grep -c '/tmp' /etc/fstab 
0

> What kind of system do you have? I am missing some default services like mtab and termencoding, is it some kind of container?

it's a server like any other. no xen, pv or anything fancy.
/etc/mtab is a symlink so no need to run the mtab init script. I see now it verifies if it's a link or not, but why to run a useless script anyhow?
I removed all font/keymapping/encoding stuff since I'm happy with the defaults as far as the local consoles are concerned.

current rc-update:
# rc-update 
             bootmisc | boot                                          
                devfs |                                        sysinit
        device-mapper | boot                                          
                dmesg |                                        sysinit
       ekey-egd-linux |      default                                  
                fcron |      default                                  
                 fsck | boot                                          
             hostname | boot                                          
              hwclock | boot                                          
            killprocs |                        shutdown               
                local |      default nonetwork                        
           localmount | boot                                          
             loopback | boot                                          
                  lvm | boot                                          
              modules | boot                                          
             mount-ro |                        shutdown               
             net.eth0 |      default                                  
             netmount |      default                                  
           ntp-client |      default                                  
                 ntpd |      default                                  
              postfix |      default                                  
               procfs | boot                                          
                 root | boot                                          
            savecache |                        shutdown               
            shorewall |      default                                  
           shorewall6 |      default                                  
               svscan |      default                                  
                 swap | boot                                          
            swapfiles | boot                                          
               sysctl | boot                                          
                sysfs |                                        sysinit
            syslog-ng |      default                                  
         tmpfiles.dev |                                        sysinit
       tmpfiles.setup | boot                                          
                 udev |                                        sysinit
           udev-mount |                                        sysinit
              urandom | boot                                          
             watchdog |      default                                  


attached is a patch that fixes both scenarios.

why is that needed you might ask?
because bootmisc needs a rw /. and it gets it only if 'root' has already started.

why does it work for me without the patch?
because it probably gets pulled in via a different route. a route I am not using. and since gentoo is all about options, please support mine too by adding this patch into the next iteration of openrc.
Comment 9 William Hubbs gentoo-dev 2013-12-07 21:47:34 UTC
I'm curious, what is the setting of rc_parallel in /etc/rc.conf?
Also, I would like you to try a test for me. In /etc/conf.d/bootmisc, add
this line:

rc_after="root"

Let me know if this takes care of the issue.
Comment 10 William Hubbs gentoo-dev 2013-12-08 17:59:04 UTC
Ok, never mind my test request, that does exactly the same thing as your
patch.
I will apply your patch to Master.
Comment 11 William Hubbs gentoo-dev 2013-12-08 18:57:29 UTC
This is applied in commit 235f94c and will be included in OpenRC-0.13.
Comment 12 Petre Rodan 2013-12-09 08:23:53 UTC
(In reply to William Hubbs from comment #9)
> I'm curious, what is the setting of rc_parallel in /etc/rc.conf?

rc_parallel="NO"

> This is applied in commit 235f94c and will be included in OpenRC-0.13.

thanks.