Project

General

Profile

Bug #10978

rc.initial tries to execute rc.local.running even if it doesn't exist, and even if it is already running.

Added by alzee bum 6 months ago. Updated 6 months ago.

Status:
Resolved
Priority:
Normal
Category:
Console Menu
Target version:
Start date:
10/15/2020
Due date:
% Done:

100%

Estimated time:
Affected Version:
Affected Architecture:
Release Notes:
Default

Description

See code here: https://github.com/pfsense/pfsense/blob/master/src/etc/rc.initial#L33

Lines 33-46 check for rc.local and if it exists, try to execute it as well as rc.local.running if rc.local is not currently running. If rc.local is currently running, then rc.local.running is executed.

This results in an error on the console every time you log in if rc.local is present and rc.local.running is not, as well as executing the rc.local every time you log in via SSH -- instead of just once at boot as would be expected on a BSD based system. This point should probably be reported as a separate bug, I only just discovered the behavior while filling out this report.

Associated revisions

Revision 449fdf25 (diff)
Added by Renato Botelho 6 months ago

Fix #10978: Run rc.local and rc.local.running

Fix the logic used to detect if rc.local and/or rc.local.running are or
not running and execute them only when it's needed

History

#1 Updated by Renato Botelho 6 months ago

  • Category set to Console Menu
  • Status changed from New to Feedback
  • Assignee set to Renato Botelho
  • Target version set to 2.5.0

#2 Updated by Renato Botelho 6 months ago

  • % Done changed from 0 to 100

#3 Updated by alzee bum 6 months ago

Renato Botelho wrote:

Applied in changeset 449fdf250171616d4865bfd5c865c64035e14496.

Thanks Renato, that looks like it will work.

Should I open a different PR regarding .profile and rc.initial (and thus rc.local) being executed every time you log in on the console? I don't know why this is the case, but from a purely BSD perspective, its not what anyone would reasonably expect rc.local to do.

#4 Updated by Renato Botelho 6 months ago

  • Status changed from Feedback to Resolved

alzee bum wrote:

Renato Botelho wrote:

Applied in changeset 449fdf250171616d4865bfd5c865c64035e14496.

Thanks Renato, that looks like it will work.

Should I open a different PR regarding .profile and rc.initial (and thus rc.local) being executed every time you log in on the console? I don't know why this is the case, but from a purely BSD perspective, its not what anyone would reasonably expect rc.local to do.

To be honest with you I just realized it happens after you mentioned. There must be some historical reasons and we will need to figure it out. Please open a different bug for this one.

#5 Updated by Jim Pingle 6 months ago

.profile is expected to be executed at each login, which it is.

.profile runs rc.initial during an interactive session for admin/root to present the menu, which is also expected.

I don't recall why rc.initial tries to run rc.local, though. At least not the way pfSense is currently running.

In the past I think it might have been set that way because rc.initial runs when the menu is displayed on the console at the end of the boot process, so it was a way to let users run custom commands at boot. Probably before we had things like shellcmd and so on.

It's probably safe to kill, but does need its own separate issue.

#6 Updated by alzee bum 6 months ago

I did create another issue for it a few days ago as requested.

https://redmine.pfsense.org/issues/10980

Also available in: Atom PDF