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
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?
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.
(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.
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.
(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.
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.
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 :]
Also there is other related problem: is that openrc tries to unmount lvm /usr that was mounted by lvm in initramfs and fails.
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.
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