Using plymouth to install updates at startup time

Ray Strode halfline at gmail.com
Sun Jun 3 07:08:54 PDT 2012


Hi,

On Sun, Jun 3, 2012 at 9:20 AM, Richard Hughes <hughsient at gmail.com> wrote:
> I'm the PackageKit dude, and I've been implementing
> http://freedesktop.org/wiki/Software/systemd/OSUpgrade to be able to
> have a GNOME 3.6 UI that looks like the mockups:
> https://live.gnome.org/GnomeOS/Design/Whiteboards/SoftwareUpdates
>
> What works now?
>  * gnome-settings-daemon will automatically prepare the transaction
> using PackageKit which in turns creates a
> /var/lib/PackageKit/prepared-update file when ready
>  * if /var/lib/PackageKit/prepared-update exists then gnome-shell will
> show a "Restart and install updates" option, that if clicked will call
> pkexec pk-trigger-offline-update which creates /system-update and the
> session is rebooted
>  * On next boot, if /system-update exists, then the systemd generator
> starts system-update.target which in turn starts
> packagekit-offline-update.service, which in turn makes PackageKit run
> the prepared update transaction. On error, /system-update is removed,
> and on success both /system-update and
> /var/lib/PackageKit/prepared-update are removed.
cool.

> So, how does this affect plymouth?
>
> * Plymouth seems to be started already by the time that
> system-update.target is started, I assume in --mode=boot
Oh right, the initrd already started it presumably.  Though, you'll
want to make sure it still gets started on systems that don't have
initrds too:

(see for instance,
http://www.harald-hoyer.de/personal/blog/fedora-17-boot-optimization-from-15-to-3-seconds
and http://freedesktop.org/wiki/Software/systemd/Optimizations for
examples of people booting without initrds)

> * I want to show a package icon (or something) with a widget that
> fills up as the transactions are processed (0 to 100%)
> * I want to show a message after the updates are applied like
> "Rebooting after installing updates"
Makes sense.

> Now, for the second point, Ray tells me I should create a "plymouthd
> --mode=updates"
Well, I had assumed there wouldn't be a reboot, but instead a

systemctl isolate system-update.target

If you're doing a full reboot, then's no reason to quit the running
plymouth, so I'd say let's nix the updates mode idea.

> and then I figured I should send it messages of
> completion possibly using "plymouth update-progress
> --value=$percentage" or similar
You could hack it like some distros hack fsck by having the splash
plugin look for and act on specific milestone markers,

e.g. plymouth update --status=system-update-25%

and then feed it in that way.   I think a better approach, though, is
a new set of commands specific for this operation.  Maybe something
like:

# turn off accounting of boot-duration so we don't message up splash
progress bar updates for subsequent runs
# then notify splash plugin a system update is about to start
plymouth system-update --start
plymouth display-message --text="Peparing to install updates"

# Feed it progress
plymouth hide-message --text="Preparing to install updates"
plymouth system-update --progress=0.0
plymouth system-update --progress=0.23
plymouth system-update --progress=0.52
plymouth system-update --progress=0.99

plymouth display-message --text="Updates installed, rebooting..."

# tell splash update is finished and do a
# plymouth deactivate under the covers
plymouth system-update --end

reboot

You'll have to be careful on the systemd side to make sure it doesn't
try to kill plymouth, or start a new plymouth during the shutdown
part.

> For the third point I probably want to do "plymouthd --mode=shutdown"
> and set a message using "plymouth display-message --text=foo"
I think since plymouthd is already running we should avoid starting a
new plymouthd

> I'm kinda unsure how to change the "mode" of plymouthd -- do I have to
> do something in systemd with service files and split up the existing
> code, or can I do this from a "plymouth" command line invocation?
There's not currently a way to change the mode at runtime.  Though,
that's another way we could approach this problem.

plymouth change-mode --updates
plymouth display-message --text="Preparing to install updates..."
plymouth system-update --progress=0.0
plymouth system-update --progress=0.23
plymouth system-update --progress=0.52
plymouth system-update --progress=1.0
plymouth change-mode --shutdown
plymouth display-message --text="Updates installed, rebooting..."

etc.  I kind of like that better.  Either way, we're going to need to
write some code, I guess. plymouth isn't ready as-is.

Make sense?  Which way do you like better?

--Ray


More information about the plymouth mailing list