Enhanced Upstart User Sessions

Registered by James Hunt

Discuss requirements with Desktop Team and others on how the existing Upstart user sessions need to be enhanced to provide suitable facilities to the desktop.

= Key Questions =

* What needs to be stored in a "session"?
   (list of entities and data types)

* What interfaces are required to such sessions?

* Is there a 1-to-1 mapping between users and sessions?

* Can/should sessions persist?

* Will users be able to manipulate their own session(s)?

* What is the maximum amount of memory a session _could_ occupy?
  (Allowing an arbitrary large amount of data will impact the design).

= References =

* https://lists.ubuntu.com/archives/ubuntu-desktop/2012-October/003999.html
* https://blueprints.launchpad.net/ubuntu/+spec/desktop-q-upstart-session-requirements

Blueprint information

Status:
Started
Approver:
Steve Langasek
Priority:
High
Drafter:
James Hunt
Direction:
Needs approval
Assignee:
James Hunt
Definition:
Review
Series goal:
Accepted for raring
Implementation:
Started
Milestone target:
None
Started by
James Hunt

Related branches

Sprints

Whiteboard

Work Items below taken from https://blueprints.launchpad.net/ubuntu/+spec/desktop-q-upstart-session-requirements

Spec: https://wiki.ubuntu.com/FoundationsTeam/Specs/RaringUpstartUserSessions

= References =
Default environment after Xsession:
COMPIZ_CONFIG_PROFILE=ubuntu
DEFAULTS_PATH=/usr/share/gconf/ubuntu.default.path
DESKTOP_SESSION=ubuntu
DISPLAY=:0
GDMSESSION=ubuntu
GNOME_KEYRING_CONTROL=/run/user/stgraber/keyring-KMm2uD
GNOME_KEYRING_PID=2920
GTK_MODULES=overlay-scrollbar
HOME=/home/stgraber
KRB5CCNAME=FILE:/tmp/krb5cc_201105_zfWBWc
LANG=en_US.UTF-8
LANGUAGE=en_US:en
LOGNAME=stgraber
MANDATORY_PATH=/usr/share/gconf/ubuntu.mandatory.path
PATH=/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
PWD=/home/stgraber
SHELL=/bin/bash
SSH_AGENT_PID=2970
SSH_AUTH_SOCK=/tmp/ssh-7iVtx9gzkDc3/agent.2931
UBUNTU_MENUPROXY=libappmenu.so
USER=stgraber
XAUTHORITY=/home/stgraber/.Xauthority
XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/etc/xdg
XDG_DATA_DIRS=/usr/share/ubuntu:/usr/share/gnome:/usr/local/share/:/usr/share/
XDG_RUNTIME_DIR=/run/user/stgraber
XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
XDG_SESSION_COOKIE=97b247932ffdbd696893fd235043cb2d-1353823262.399051-1685576965
XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session1

--
the shutdown ordering of the user session is racy & hence the whoopsie reports.

(?)

Work Items

Work items for ubuntu-13.04-month-2:
[stgraber] init: Allow Upstart to run as a non-priv user (part 1): add --user option: DONE
[stgraber] init: Allow Upstart to run as a non-priv user (part 2): call prctl(PR_SET_CHILD_SUBREAPER). Emit an event if prctl not supported for current kernel and write error to stderr: DONE
[stgraber] Ensure 'init --session' still works as it currently does (required for testing upstart as PID 1, but running as a non-root user): DONE
[xnox] Resolve autopkgtest issues (branches to merge are in bug 1075976): DONE
[xnox] Add ability for user jobs to be searched for in multiple directories (command line and/or environment variables: ~/.init *and* /etc/xdg/init/ for example) (to merge): DONE
[xnox] Ensure that when run with --user, conf loaded from ${XDG_CONFIG_HOME:.config}/upstart/, then ${XDG_CONFIG_DIRS:/etc/xdg} (to merge) : DONE
[xnox] init: Allow override files to apply to any conf directory (for example /etc/xdg/init) (branch https://code.launchpad.net/~xnox/upstart/overrides/+merge/141914): DONE
[stgraber] init: Add "EventEmitted" D-Bus signal: DONE
[stgraber] init: Add "Restarted" D-Bus signal (should be emitted in main.c after successful call to state_read() on restart): DONE

Work items for ubuntu-13.04-month-3:
[jamesodhunt] initctl: add 'initctl set-env' command: DONE
[jamesodhunt] initctl: add 'initctl get-env' command: DONE
[jamesodhunt] initctl: tests for environment verbs: DONE
[jamesodhunt] initctl: add --all and --user options: DONE
[stgraber] jobs: Write a dbus and gnome-session job, doing the session bus init and spawning gnome-session once ready: DONE
[stgraber] Xsession: Update Xsession scripts to start upstart: DONE
[stgraber] PPA: Setup test PPA installable on raring including the various user sessions branches and Xsession changes (ppa:stgraber/foundation-build): DONE
[xnox] Handle user logs under XDG_CACHE_DIR/upstart similar to /var/log/upstart (branch https://code.launchpad.net/~xnox/upstart/user-log-dir/+merge/143091 ) : DONE

Work items for ubuntu-13.04-month-4:
[stgraber] init: Allow Upstart to re-exec as a non-priv user: DONE
[stgraber] Make Upstart call initgroups() when running as PID 1 (in init/job_process.c:job_process_spawn()): DONE
[jamesodhunt] Remove existing user session code: DONE
[jamesodhunt] init: Create session files in XDG_RUNTIME_DIR: DONE
[jamesodhunt] initctl: add list-sessions command: DONE
[jamesodhunt] init: Add ability to handle ':sys:' and ':user:' events: DONE
[jamesodhunt] Write event+job tests for new system events syntax: DONE
[jamesodhunt] Write event tests for new user events syntax: DONE
[jamesodhunt] Write job tests for new user events syntax: DONE
[jamesodhunt] init: Implement quiescent mode for shutdown: DONE
[jamesodhunt] initctl: Implement 'initctl shutdown' for shutdown: DONE
[jamesodhunt] init: Implement timer handlers for shutdown: DONE
[jamesodhunt] init: Implement shutdown algorithm: DONE
[jamesodhunt] Test session shutdown: DONE
[jamesodhunt] Write upstart-file-bridge create_handler: DONE
[jamesodhunt] Write upstart-file-bridge modify_handler: DONE
[jamesodhunt] Write upstart-file-bridge job_remove_file: DONE
[jamesodhunt] Write upstart-file-bridge delete_handler: DONE
[jamesodhunt] Test upstart-file-bridge as root: DONE
[jamesodhunt] Test upstart-file-bridge as non-root user: DONE
[jamesodhunt] Write upstart-file-bridge documentation and conf files (system+Session Init): DONE

Work items for ubuntu-13.04-feature-freeze:
[jamesodhunt] init: Ensure Session Inits re-exec when PID 1 does by implementing 'initctl reexec' command: DONE
[xnox] Write tests for multiple confdir directory support: DONE
[xnox] Write tests for override files in alternative confdir directory: DONE
[stgraber] Land the changes in Ubuntu: DONE

Work items for ubuntu-13.04-beta-2:
[jamesodhunt] Write autopkgtest tests for upstart-file-bridge: DONE
[jamesodhunt] Write autopkgtest tests for Session Init re-exec: DONE
[jamesodhunt] Write autopkgtest tests for Session Init re-exec on PID 1 re-exec: DONE
[jamesodhunt] Update Cookbook for Enhanced User Sessions: DONE

Work items:
[seb128] replace update-notifier with upstart jobs (requires upstart-time-bridge): BLOCKED
[stgraber] Prototype an upstart-dconf-bridge: DONE
[vorlon] create a pam_upstart module that starts the Session Init by spawning 'init --user' with the users full PAM environment: TODO