Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 407167 - sys-apps/openrc: localmount unmounts all local filesystems when switching or booting to runlevel 1
Summary: sys-apps/openrc: localmount unmounts all local filesystems when switching or ...
Status: CONFIRMED
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: openrc-0.10
  Show dependency tree
 
Reported: 2012-03-06 20:19 UTC by Alexey Prokopchuk
Modified: 2018-09-08 20:31 UTC (History)
0 users

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


Attachments
0001-rc-going-to-single-user-mode-is-not-shutting-down.patch (0001-rc-going-to-single-user-mode-is-not-shutting-down.patch,1.01 KB, patch)
2012-11-17 18:04 UTC, William Hubbs
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexey Prokopchuk 2012-03-06 20:19:11 UTC
I using Linux over 15 years, including Gentoo over 5 years, and before migration to baselayout2 never encountered such a problem. In Gentoo with baselayout1 and previously in Slackware, local filesystems were always mounted in single user runlevel. After migration to baselayout2 localmount service stops when switching to runlevel 1. When boot to runlevel 1, localmount first starts and then stops. Of course, I always can use 'mount -a' but why local filesystems unmounts, when in my opinion, should not be?

Reproducible: Always

Steps to Reproduce:
1. Boot or switch to single user runlevel

Actual Results:  
Local filesystems not mounted.

Expected Results:  
Mounted local filesystems when switch or boot to single user runlevel
Comment 1 William Hubbs gentoo-dev 2012-03-10 20:30:51 UTC
All,

should we only unmount when we are actually shutting down? It would be
easy to modify localmount to not unmount filesystems unless we were
actually going down.

Thoughts?
Comment 2 William Hubbs gentoo-dev 2012-03-10 20:40:46 UTC
After a bit more research, it seems that localmount in baselayout-1
never unmounts any filesystems.

So, I will  change OpenRC's localmount to behave likewise before the
weekend is out unless there is an objection.
Comment 3 Sergei Trofimovich (RETIRED) gentoo-dev 2012-03-20 11:36:35 UTC
(In reply to comment #2)
> After a bit more research, it seems that localmount in baselayout-1
> never unmounts any filesystems.
> 
> So, I will  change OpenRC's localmount to behave likewise before the
> weekend is out unless there is an objection.

Sounds good.
Comment 4 William Hubbs gentoo-dev 2012-03-26 15:22:18 UTC
The change I made was to unmount local file systems *only* when we are
shutting down. This is actually what baselayout-1 did.
The commit id for the change is 533813d.
Comment 5 Alexey Prokopchuk 2012-04-22 10:31:04 UTC
(In reply to comment #4)
> The change I made was to unmount local file systems *only* when we are
> shutting down. This is actually what baselayout-1 did.
> The commit id for the change is 533813d.

This change isn't affect openrc localmount behavior when switch or boot runlevel 1 because RC_GOINGDOWN is set to "YES" in case RC_LEVEL_SINGLE (see rc.c line 890).

I can try to figure out what would happen if don't touch RC_GOINGDOWN when going to RC_LEVEL_SINGLE, but I don't know yet what other effects may be due to this.
Comment 6 Alexey Prokopchuk 2012-05-28 13:26:39 UTC
If using 'rc single' instead of 'init 1', local filesystems still unmounts. As I said before, because RC_GOINGDOWN is set to "yes" when switching to single user runlevel. I think, need some another variable for checking local filesystems unmount condition.
Comment 7 Sergei Trofimovich (RETIRED) gentoo-dev 2012-11-16 08:37:23 UTC
Yeah, it does not make much sense for me as well:

src/rc.rc.c

>    if (newlevel &&
>       (strcmp(newlevel, RC_LEVEL_SHUTDOWN) == 0 ||
>          strcmp(newlevel, RC_LEVEL_SINGLE) == 0))
>   {
>           going_down = true;
>           if (!exists(RC_KRUNLEVEL))
>                   set_krunlevel(runlevel);
>           rc_runlevel_set(newlevel);
>           setenv("RC_RUNLEVEL", newlevel, 1);
>           setenv("RC_GOINGDOWN", "YES", 1);
>   } else {

Is SINGLE == SHUTDOWN? Looks like it always been that way.
I don't understand logic in file at all though :]
Comment 8 Alexander Vershilov (RETIRED) gentoo-dev 2012-11-16 09:00:57 UTC
Also there is other related problem: is that openrc tries to unmount lvm /usr that was mounted by lvm in initramfs and fails.
Comment 9 Alexander Vershilov (RETIRED) gentoo-dev 2012-11-16 14:26:52 UTC
solution with RC_GOINGDOWN seems correct if next things will be met:

1). change 
>          strcmp(newlevel, RC_LEVEL_SINGLE) == 0))
to
>          strcmp(newlevel, RC_LEVEL_REBOOT) == 0))

2). if stop command in localmount without RC_GOINGDOWN will be ignored
so in signle runlevel it localmount service will be marken as running (like modules and hwclock)

2). if it will be possible to force localmount stop (by setting env variable or such)

Other solution can be adding localunmount service to the shutdown phase, but it seems quite ugly.
Comment 10 William Hubbs gentoo-dev 2012-11-17 18:04:08 UTC
Created attachment 329738 [details, diff]
0001-rc-going-to-single-user-mode-is-not-shutting-down.patch

All,

this patch should take care of this.

@qnikst:
There is no RC_LEVEL_REBOOT, because we just have a shutdown runlevel.
Apply this patch and let me know if it works for you. If I don't hear
anything in 72 hours (by 19 nov), I will apply this to the tree.

Thanks,


William