Allow --confdir to look for system jobs in more than one directory

Bug #1315060 reported by Chris Wayne
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
The Savilerow project
Fix Released
Undecided
Unassigned
upstart
Fix Released
Undecided
James Hunt
upstart (Ubuntu)
Fix Released
Critical
James Hunt
Utopic
Fix Released
Critical
James Hunt

Bug Description

A requirement from OEMs/Carriers for customization is to allow for customized upstart jobs/overrides. It seems that the best way to do this would be to allow --confdir to take multiple directories, so that we can include a directory under /custom.

As for session jobs, I assume we can just set /custom as an XDG_CONFIG_DIR, and have /custom/upstart with jobs there.

ProblemType: Bug
DistroRelease: Ubuntu 14.04
Package: upstart 1.12.1-0ubuntu4
ProcVersionSignature: Ubuntu 3.13.0-24.46-generic 3.13.9
Uname: Linux 3.13.0-24-generic x86_64
NonfreeKernelModules: fglrx
ApportVersion: 2.14.1-0ubuntu3
Architecture: amd64
CurrentDesktop: Unity
Date: Thu May 1 12:30:09 2014
InstallationDate: Installed on 2013-04-26 (370 days ago)
InstallationMedia: Ubuntu 13.04 "Raring Ringtail" - Release amd64 (20130424)
ProcKernelCmdline: BOOT_IMAGE=/boot/vmlinuz-3.13.0-24-generic root=UUID=610268d4-9acd-4bf8-a1a1-95c88b3ccf59 ro quiet splash vt.handoff=7
SourcePackage: upstart
UpgradeStatus: Upgraded to trusty on 2013-11-23 (158 days ago)
UpstartBugCategory: System
UpstartRunningSessionVersion: init (upstart 1.12.1)
UpstartRunningSystemVersion: init (upstart 1.12.1)

Related branches

Revision history for this message
Chris Wayne (cwayne) wrote :
Steve Langasek (vorlon)
Changed in upstart (Ubuntu Utopic):
importance: Undecided → Critical
assignee: nobody → James Hunt (jamesodhunt)
status: New → Triaged
milestone: none → ubuntu-14.06
Revision history for this message
Ted Gould (ted) wrote :

After discussion on the mailing list I'm -1 on this. I don't think having OEMs and carriers installing Upstart jobs is a good idea. It's an unstable interface and one that we expect to drop long term.

Revision history for this message
James Hunt (jamesodhunt) wrote :

We now have a branch in case this really is needed. It's a small change since Session Inits already support multiple --confdirs.

Note that the whole point of adding the --confdir option originally was to circumvent the standard /etc/init/ directory, specifically for testing. What this means is that with the new branch, if you want Upstart to read jobs from /etc/init/ and /custom/init/ say, you will have to specify *both* directories on the kernel command-line via the bootloader:

  --confdir /etc/init/ --confdir /custom/init/

Revision history for this message
James Hunt (jamesodhunt) wrote :

If custom system jobs need to be supported, the only realistic option atm is to create a sub-directory below /etc/init/ (say /etc/init/custom/). However, that doesn't help here since custom components need to be contained below /custom/.

Note that Upstart does _not_ honour sym links in /etc/init/ by design (rationale being that all jobs required to boot a system should be available in one known location at boot).

______

Note that there *is* a way to do what you want, but it's not really a practical proposition as you'll see: you could create an /etc/init/custom.conf job that runs a Session Init as root:

init --user --confdir /custom

However, there are major caveats to doing this:

1) You would need to join that upstart session to control or query the status of the custom jobs:

    http://upstart.ubuntu.com/cookbook/#joining-a-session

  In other words, start/stop/restart/initctl would not work unless you set UPSTART_SESSION first. This would all work, but could get very confusing.

2) You would need to create an XDG_RUNTIME_DIR for root so that the session init could create a session file to allow an admin to join the session.

3) You would need to specify an alternate log directory for the session init since you would be able to have a system job and a custom job with the same name and they would then overwrite each others log by default:

     --logdir /var/log/upstart/custom/

James Hunt (jamesodhunt)
Changed in upstart (Ubuntu Utopic):
status: Triaged → In Progress
Revision history for this message
James Hunt (jamesodhunt) wrote :

Discussed with slangasek who brought up a good point: it probably makes sense to introduce a '--append-confdir' or '--add-confdir' since that would:

a) Make it more difficult to make a device unbootable (with only --confdir, if you forget to add '--confdir /etc/init/', your device will likely not boot).

b) Minimise the required kernel command-line changes.

Revision history for this message
Dimitri John Ledkov (xnox) wrote :

For the migration plan from upstart -> systemd, we intended to run system upstart as pid2, with systemd as pid1.

For that to work, upstart should process and launch all of it's jobs as normal, apart from it should skip/set to manual all jobs that are handled by systemd.

To achieve that we were thinking for system upstart to support multiple --confdirs, and systemd would then start upstart with "/etc/init" and "/lib/systemd/upstart/" directories, with .override files either shipped or generated by systemd setting jobs to manual.

Thus regardless of the OEM requirements, we do need this functionality in upstart soon enough to unblock further work on systemd migration.

James Hunt (jamesodhunt)
Changed in upstart:
assignee: nobody → James Hunt (jamesodhunt)
status: New → Fix Committed
Chris Wayne (cwayne)
Changed in savilerow:
status: New → In Progress
Revision history for this message
Dimitri John Ledkov (xnox) wrote :
Changed in upstart:
status: Fix Committed → Fix Released
Changed in upstart (Ubuntu Utopic):
status: In Progress → Fix Committed
Revision history for this message
James Hunt (jamesodhunt) wrote :

Upstart 1.13 now provides _three_ options for full flexibility: --confdir=, --append-confdir= and --prepend-confdir=. All options can be specified multiple times. See the MP for details and examples and init(5) for the gory details:

    https://code.launchpad.net/~jamesodhunt/upstart/bug-1315060/+merge/218953

Changed in upstart (Ubuntu Utopic):
status: Fix Committed → Fix Released
Changed in savilerow:
status: In Progress → Fix Committed
status: Fix Committed → Fix Released
Mathew Hodson (mhodson)
Changed in upstart (Ubuntu Utopic):
milestone: ubuntu-14.06 → none
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.