Requirements for desktop Upstart

Registered by Ted Gould on 2012-05-08

Figure out the most important use-cases for using Upstart in the desktop session and what requirements this puts on Upstart to verify whether it can start to be used for the desktop session in 12.10.

Blueprint information

Status:
Not started
Approver:
Didier Roche
Priority:
Low
Drafter:
Sebastien Bacher
Direction:
Needs approval
Assignee:
James Hunt
Definition:
Approved
Series goal:
Accepted for quantal
Implementation:
Deferred
Milestone target:
milestone icon ubuntu-12.10-beta-1

Related branches

Sprints

Whiteboard

2012-11-06, jamesodhunt: carried across work items that are still relevant to raring blueprint https://blueprints.launchpad.net/ubuntu/+spec/foundations-r-upstart-user-session-enhancements.

2012-09-13, didrocks: will not likely to happen for quantal, let's defer that for the r release

2012-05-16, seb128: the work here mostly depends from what happens on upstart, we will replace update-notifier if the features we need are added to upstart

Session notes:

Upstart on the desktop:
- Not immediately required (for 12.10), but would like to work towards more Upstart features from the desktop session
- Look at bootchart and optimise session process startup (currently linear, CPU not maxed out)
Use cases:
- Don't start any app indicators before indicator app service starts (indicators currently started by gnome-session, but app service started by Unity panel service)
- Don't show the panel until it is stable
- Replace update-notifier and other small daemons and use upstart events instead
- Run migration scripts before the service being migrated starts, e.g NetworkManager
- Printer connections etc, i.e. stop gnome-settings-daemon from listening for udev events and have upstart generate events from those udev events instead
- Jobs are specified in /etc, and need to detect user preferences
  - Need to be able to disable some of the jobs
- Need to support different jobs for different flavours
- xsession.d / gnome-session need to start job chain by generating an upstart event
- Need to support /etc/xdg jobs
- Result being gnome-session is started by upstart and doesn't spawn any child processes
- Some jobs will be conditional on user preferences (e.g. gsettings keys)
- How would upstart handle a case where a user job requires network access, but the network event occurred before the session started?
What we need:
1. Upstart needs to be able to run jobs in the user session
2. We need to trigger upstart from gnome-session or /etc/xsession.d
3a. Job triggered by system d-bus signal
3b. Job triggered by file change
3c. Job triggered on time event
4. Define a standard set of high-level Upstart events for the desktop
5. Replace update-notifier for 12.10

18 may 2012 (jamesodhunt): I discussed this plan with Scott and vorlon (independently) and the outcome was conclusive: running multiple instances of Upstart isn't optimal. It makes much more sense to empower PID 1 with the ability to start a PAM session for the user jobs. It would also be difficult to retain expected semantics with the required "upstart-upstart-bridge" we'd need with the multi-instance design (to bridge system level events down to the user). The concerns around the process tree for a user session can be mitigated by adding cgroups support to Upstart allowing all processes in the users session to be listed.

(?)

Work Items

Work items:
[seb128] replace update-notifier with upstart jobs: POSTPONED
[jamesodhunt] Make jobs namespaced by user/chroot (currently job names are unique system-wide): TODO
[jamesodhunt] Add initctl option to include namespace details: TODO
[jamesodhunt] Modify initctl behaviour when run as non-root to display namespaced jobs by default: TODO
[jamesodhunt] write CreateSession(env) D-Bus method to prime an Upstart user session with an environment: TODO
[jamesodhunt] create a pam_upstart module to call CreateSession(env) on user login to ensure user jobs get the correct environment: TODO
[jamesodhunt] Modify upstart to run a login shell for user sessions: TODO
[jamesodhunt] Allow users preferred shell to run user jobs (?): TODO
[jamesodhunt] Make upstart create cgroups for jobs: TODO
[jamesodhunt] Write an upstart-dbus-bridge: TODO
[stgraber] (and/or desrt?) Write an upstart-gsettings-bridge (not using upstart for session yet): POSTPONED
[jamesodhunt] Determine "least kludgy" method of having inotify support recursive watches: TODO
[jamesodhunt] Finish upstart-file-bridge (inotify version): INPROGRESS
[jamesodhunt] Create an upstart-time-bridge based on Scotts temporal events code: TODO
[jamesodhunt] Get user job logging code audited by the security team: TODO
[jamesodhunt] Set supplementary group for user jobs (bug 812870): TODO
[jamesodhunt] Finish tests for upstart user job logging and land: TODO
[jamesodhunt] Add ability for user jobs to be searched for in multiple directories (~/.init *and* /etc/xdg/init/): TODO
[jamesodhunt] Add ability for user jobs to disable selective jobs in /etc/xdg/init/: TODO

Dependency tree

* Blueprints in grey have been implemented.