Leap 16.0: How to enable PackageKit-Offline-Updates?

Dear all!

I run openSUSE Leap 16.0.

I have installed:

gunnersson@tulicube:~> zypper se -si packagekit
Repository-Daten werden geladen...
Installierte Pakete werden gelesen...

S  | Name                           | Type  | Version          | Arch   | Repository
---+--------------------------------+-------+------------------+--------+---------------------------
i  | cockpit-packagekit             | Paket | 364-160000.1.1   | noarch | openSUSE-Distribution-Leap
i  | libpackagekit-glib2-18         | Paket | 1.2.8-160000.5.1 | x86_64 | openSUSE-Distribution-Leap
i+ | PackageKit                     | Paket | 1.2.8-160000.5.1 | x86_64 | openSUSE-Distribution-Leap
i  | PackageKit-backend-zypp        | Paket | 1.2.8-160000.5.1 | x86_64 | openSUSE-Distribution-Leap
i  | PackageKit-branding-openSUSE   | Paket | 42.1-lp160.3.1   | noarch | openSUSE-Distribution-Leap
i  | PackageKit-lang                | Paket | 1.2.8-160000.5.1 | noarch | openSUSE-Distribution-Leap
i  | typelib-1_0-PackageKitGlib-1_0 | Paket | 1.2.8-160000.5.1 | x86_64 | openSUSE-Distribution-Leap

    Hinweis: Für eine erweiterte Suche inkl. nicht momentan aktivierter Remote-Ressourcen bitte
    'zypper search-packages' verwenden.
gunnersson@tulicube:~> 

How do I get PackageKit-Offline-Updates working? How do I enable it?

I have:

gunnersson@tulicube:~> systemctl list-unit-files | grep -i packagekit
packagekit-background.service                static          -
packagekit-offline-update.service            static          -
packagekit.service                           static          -
packagekit-background.timer                  disabled        disabled
gunnersson@tulicube:~> 

but that seems to not be sufficient.

TIA!

Which DE are we talking about?
Please be aware that it is still zypper taking care of the actual updating. PackageKit is just the “in the middle” which is getting used by f.e. Discover and GNOME Software.

It’s Xfce (Wayland).

But why does this matter? I would guess PackageKit-Offline-Update is about a service or daemon? I would like to use it instead of https://software.opensuse.org/package/os-update which performs online only. I have had running that in the past: mostly successfully but sometimes crashing my desktop (due to the online update of some components relating…).

Then, I suggest you look at setting up transactional-update, I guess that your aim is more that then using Packagekit in some intermediate way.

In addition to the regular install I now have:

/usr/local/share/PackageKit/packagekit-background.sh
gunnersson@tulicube:~> cat /usr/local/share/PackageKit/packagekit-background.sh 
#!/bin/bash
# Copyright (C) 2008 Richard Hughes <richard@hughsie.com>
#
# Some material taken from yum-cron, Copyright 2007 Alec Habig <ahabig@umn.edu>
#
# Licensed under the GNU General Public License Version 2
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.

## Type:    yesno
## Default: no
#
# Run the cron job.
#
ENABLED=yes

## Type:    yesno
## Default: no
#
# Check if updates are available, instead of installing.
#
CHECK_ONLY=no

## Type:    yesno
## Default: no
#
# Trigger updates, so they will be installed on reboot.
#
UPDATE_OFFLINE=yes

## Type:    string
## Default: ""
#
# If MAILTO is set, the mail command is used to deliver PackageKit output.
# By default MAILTO is unset, so crond mails the output by itself.
#
MAILTO=""

## Type:    string
## Default: ""
#
# You may set SYSTEM_NAME if you want your PackageKit emails tagged differently.
# Default is output of hostname command.
#
SYSTEM_NAME=""

## Type:    integer
## Default: 3600
#
# Update checks will sleep random time before contacting the servers to
# avoid hammering them with thousands of request at the same time - this
# is the maximum sleep time (in seconds) for the random wait period.
#
SLEEP_MAX=60

# are we disabled?
if [ "$ENABLED" = "no" ]; then
	exit 0
fi

# set default for SYSTEM_NAME
[ -z "$SYSTEM_NAME" ] && SYSTEM_NAME=$(hostname)

PKTMP=$(mktemp /var/run/packagekit-cron.XXXXXX)
PKCON_OPTIONS="--background --noninteractive --plain"
if [ "$UPDATE_OFFLINE" = "yes" ]; then
	ONLY_DOWNLOAD="--only-download"
else
	ONLY_DOWNLOAD=""
fi

# wait a random amount of time to avoid hammering the servers
[ -z "$SLEEP_MAX" ] && SLEEP_MAX=$RANDOM
sleep $(( $RANDOM % $SLEEP_MAX + 1 ))

# do action
if [ "$CHECK_ONLY" = "yes" ]; then
	pkcon $PKCON_OPTIONS get-updates &> $PKTMP
	PKCON_RETVAL=$?
else
	pkcon $PKCON_OPTIONS $ONLY_DOWNLOAD update &> $PKTMP
	PKCON_RETVAL=$?
	if [ $PKCON_RETVAL -eq 0 -a "$UPDATE_OFFLINE" = "yes" ]; then
		pkcon $PKCON_OPTIONS offline-trigger &> $PKTMP
	fi
fi

# this is when seomthing useful was done
if [ $PKCON_RETVAL -ne 5 ]; then
	# send email
	if [ -n "$MAILTO" ]; then
		mail -Ssendwait -s "System updates available: $SYSTEM_NAME" $MAILTO < $PKTMP
	else
		# default behavior is to use cron's internal mailing of output from cron-script
		cat $PKTMP
	fi
fi

rm -f $PKTMP

gunnersson@tulicube:~> 
/etc/systemd/system/packagekit-background.service.d/override.conf
gunnersson@tulicube:~> cat /etc/systemd/system/packagekit-background.service.d/override.conf 
[Service]
ExecStart=
ExecStart=/usr/local/share/PackageKit/packagekit-background.sh
gunnersson@tulicube:~> 

This way, it actually seems to work (properly).

I just wonder that updating is done at a new boot-up, not at the last shutdown (as I expected, before). But obviously this is intended behaviour. I would have found it better the other way: finishing the machine, i.e. just leaving it after initiating shutdown, is more “comfortable” than waiting at boot time.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.