Skip to the text
KDOS
Menu

Discover

Discover is Plasma’s software centre. On KDOS it is the one window where you find, install, remove and update software of every kind: native ports, boxed applications and packs from the catalogue, the boxes already on the machine, firmware, and the operating system itself.

KDOS builds Discover with three backends and no others:

There is no Flatpak, Snap, PackageKit or KNewStuff backend, and no online store to sign in to.

This chapter explains what each backend shows and where its answers come from, how a system update travels from Discover’s Update button to a confirmed boot of the new version, and what keeps Discover from reaching the network on its own. It is for anyone who wants to know what Discover is doing on a KDOS machine, who administers updates, or who is changing the backend or the daemon. Installing and using applications day to day is covered in Applications, and why KDOS uses Discover with its own backends rather than a software centre of its own is in Decisions.

What Discover shows

Every item in Discover (a resource, in Discover’s terms) carries an origin, which names the source it comes from. The origin is also what the source picker and the Install button name:

Origin Shown as What it lists Backend
kdos-packs KDOS packs The packs in the pack store, and each catalogue application whose pack is there KDOS
medium KDOS medium Packs and .ktar sets on the boot medium, /mnt/iso/packs, and each catalogue application whose pack is only there KDOS
kdos-store Debian, built in a box Catalogue applications with no pack anywhere, every set in the catalogue, and Debian desktop applications no catalogue row names; each is built into a box on request KDOS
kdos-boxes Boxes Boxes that none of the above accounts for KDOS
kdos-ports KDOS system Host software: the ports installed, and those the release’s signed binary host holds KDOS
kdos-ports-source KDOS, built on this computer Each port the binary host holds and the machine has not installed, built on this computer instead KDOS
local File A .ktar or .kpack opened from a file manager KDOS
the system The next KDOS release, for the two root slots sysupdate1
firmware Firmware updates for this machine’s devices fwupd

So a button reads “Install from KDOS packs”, “Install from KDOS medium” or “Install from Debian, built in a box”. One kind of kdos-store application is named differently: a deb row, which the catalogue builds from its publisher’s own .deb rather than from Debian (VSCodium is the one shipped). It keeps the kdos-store origin for the filter and the sidebar, but its button names the row’s publisher, the about row’s author or else the application’s name: “Install from VSCodium’s own package, built in a box”. No Debian component describes such an application, so its page takes its licence, author, homepage and description from the catalogue’s about row for it.

Settings KDOS gives Discover

/usr/share/kdos/xdg/discoverrc sets four things:

Search order

The KDOS backend ranks each search result itself, and a result takes the best rank it earns. Highest first:

Rank The result…
1 has the search term as its whole name
2 has a keyword or component name that is the whole term (for a term that names no category)
3 belongs to the category the term stands for, raised when its summary says a word for that category and again when its name holds the term
4 has a keyword that is the whole term, for a term that names a category, on a program outside that category
5 has a name that starts with the term
6 has a name that holds the term as a whole word
7 has a name that holds the term anywhere
8 has a package name that holds the term
9 has a keyword that holds the term
10 has a summary that holds the term

The terms that stand for a category are browser and web (WebBrowser), mail, email and e-mail (Email), office (Office), terminal (TerminalEmulator), editor (TextEditor), chat (InstantMessaging and Chat), music (Music and Audio), video (Video), and game and games (Game). So a search for “browser” lists the web browsers before AT-SPI Browser; “chrome” lists Chromium, whose keyword it is, before mkchromecast; “mail” lists the mail clients (KMail, Thunderbird, Claws Mail) ahead of the tools that only file themselves under Email, such as Account Wizard and KTnef; and “video” lists the video players and editors ahead of Qt V4L2 test Utility, which carries the keyword but files itself under AudioVideo alone.

Several rules decide what counts as a member of the category:

Some results are placed lower on purpose:

Discover adds its own relevance terms on top: one for how close the name is to the search, and one for a name that holds it. The backend scales its rank so that the rank always decides the order, and Discover’s name terms, then the name itself, only order results of the same rank. Within one rank, the binary host’s ports and packs list before a Debian build: the backend adds half a rank step to every result except a Debian package, more than Discover’s name terms and less than a step.

Ratings, the Home page and application pages

No source on KDOS has ratings or reviews. The discover port’s ratings-need-reviews.patch shows an application’s rating row and its Reviews section, with Write a Review, only for a resource whose backend has a reviews backend. The same patch leaves the Home page’s Highest-Rated Games and Highest-Rated Developer Tools rows empty when the current application backend has none. On KDOS the Home page is therefore Editor’s Choice alone: the seven catalogue applications in featured.json (KStars, Xournal++, GNU PSPP, Okteta, HexChat, Meld and GNOME Chess).

What a catalogue application’s page shows:

The featured entries are applications whose Debian data gives them an icon of their own or their category’s, an author, a licence and a description; and the colour wheel, KColorChooser’s own icon, is not one a featured card borrows. Two backend tests hold this: featuredIcons fails when an entry is not a catalogue application or would draw kcolorchooser or applications-other, and featuredComplete fails when its page would lack an author, a licence or a description.

The build of the discover port fails unless /usr/lib/qt6/plugins/discover/ holds exactly the fwupd and sysupdate1 backends, so a stock backend that appears or goes missing stops the build instead of changing what Discover offers.

The KDOS backend

The kdos-discover port installs these files:

File What it is
/usr/lib/qt6/plugins/discover/kdos-backend.so The backend: the origins above
/usr/lib/qt6/plugins/discover-notifier/KdosNotifier.so The tray notifier for system updates (below)
/usr/bin/kdos-discover-catalog The catalogue writer (below): writes /usr/share/swcatalog/xml/kdos-ports.xml, the AppStream catalogue of the installed ports, from kpkg’s manifests; and, at the image build, kdos-debian-exclude.xml, which takes the Debian applications debian-exclude names out of the AppStream pool
/usr/libexec/kdos-discover/kdos-ports-helper The root step of installing host software prebuilt, and of removing it (below)
/usr/libexec/kdos-discover/kdos-ports-builder The root step of building host software on this computer and installing it
/usr/share/polkit-1/actions/io.kdos.ports.policy The polkit actions the two helpers run under

It also:

Where each answer comes from

The backend keeps no database of its own. Every answer comes from the tool that owns it, asked at each refresh, and Refresh on Discover’s Updates page is the same refresh.

Question Asked of
What the catalogue offers, and what is installed kdos-appbox catalogue
What each box is made of kdos-box list --json, a JSON array
What the pack store and the medium hold the kdos-packd socket
Which ports are installed kpkg list --json, each described by its kdos-ports.xml component
Which ports the binary host offers /var/lib/kdos/binhost/swcatalog/xml/kdos-binhost.xml, read again at every refresh
What the installer was asked for and could not install /var/lib/kdos/apps-pending
What a box is allowed kdos-box profile <box>, asked only when its page opens
A Debian application’s description and categories the DEP-11 catalogue, through libappstream

kpkg, the package manager, is the authority on which ports are installed; kdos-ports.xml only describes them. A package the catalogue names that kpkg list --json does not list (one taken off with kpkg remove, which leaves the catalogue as it was) is not installed, so the binary host’s catalogue offers it again. Only when kpkg does not answer, failing or printing no package list, does the catalogue’s own version stand for the installed one.

Runs in a box. An installed application’s page carries a “Runs in a box” group for each resource that has a box. It shows:

A link opens the box in System Settings’ Boxes page. An application that is not installed shows no box group, whatever box profile is left behind, and is not on the Boxes page. A store box is created with its container at install, so a box that kdos-box list reports as not created over its own image, image:kdos/<name>, is the profile an uninstall keeps: the backend counts it as no box, and offers the Debian application it belonged to for install again.

Ids and links. Each resource has an appstreamId of its own, because Discover’s lists keep only the first of several resources that share one. A host port has its component’s id; every other resource has an id made from its lane and its id under io.kdos., which no link names. Its link stays kdos-backend://<lane>/<id>, the form the featured list uses.

Categories. Beside the stock categories the backend adds:

Sets. Each page under Sets is one group of the box catalogue, named after it, such as Office set, and installs that group’s boxed applications. It runs kdos-appbox install <group>, which builds every member from Debian packages, or a deb row from its publisher’s own release, whatever packs the members have. So a set’s origin is kdos-store and its button reads “Install from Debian, built in a box”. Its notice says it builds the members one after another and needs a network connection, and names the publishers’ own .deb releases when a member is a deb row. Its author is KDOS, and its licences are those its members’ pages show, joined as (<one>) AND (<other>); a member with no licence of its own adds none, and a set none of whose members has one shows no licence.

The backend has no resource for a native group of ports, the /ports/groups lists that kdos update groups shows. A native group is installed with sudo kdos update install <group> or in the installer; Discover offers each of its ports only on its own page (Native groups).

appstream:// links. KRunner’s software results and other programs hand Discover appstream:// links. One opens the KDOS resource with that component id. For an application only Debian’s catalogue knows, it opens the catalogue row that application is, when there is one (see Debian applications), and otherwise the Debian lane’s resource. A link is answered once the backend has read the machine, and an appstream:// link once the AppStream pool has loaded as well, so Discover started on a link, or with its featured list cached, opens the application rather than “No entry”.

Installing and removing

An install or a removal is a list of argument vectors and kdos-packd requests, run as one transaction, one transaction at a time, with no shell.

What reaches the network. A catalogue row whose pack is already in the store or on the medium becomes a box over that pack, offline. Only a row with no pack anywhere is built by the store lane, which downloads from the Debian archive, and the resource says so before it starts. A step that downloads is refused before it starts whenever Qt’s network information reports anything but online, the same test as Discover’s own “Discover is Offline” sheet (a network with no route out, or NetworkManager with networking switched off, counts as offline). The reason given is “it needs a network connection, and this computer is offline”.

Data rows. A data row is offered only while its pack is in the store or on the medium: kdos-packd grafts a data pack where its program looks (graft and boxgraft rows), and a data row the store built would be an image nothing reads. One the store already built stays listed, so it can be removed.

Sizes. The size a store-lane row shows is an estimate: the catalogue’s size of the application, plus the measured size of each base and runtime row up its chain whose image this machine has not built yet, as kdos-appbox catalogue --chain reports them. A set counts each such row once, however many of its applications sit on it, and the notice says the size is an estimate that counts those rows. A size nobody knows, such as an installed host port’s, is not shown.

When it fails. The application’s page shows an error notice, “ was not installed: ” or “ was not removed: ”. It stays through the refresh after it, until the next install or removal of that resource starts. Discover’s own dialog says only “Please try again later”, with the same reason behind See Technical Details. The reason is the failed tool’s last standard-error lines, each a clause, joined with “; “.

Removing a boxed application stops the box first and then removes it, because a box stays up for a while after its application’s last window closes and kdos-box remove refuses a running one.

Removing a box of the kdos-boxes origin, one no application accounts for, asks first, before anything runs: “Remove the box ?”. The question says that the container goes, with every package installed in it, its profile and every launcher exported from it, and that the files in the home folder stay; for a box made over a pack, its writable layer, snapshots and private home in ~/.local/share/kdos/boxes/<name> stay too. Cancel leaves the box as it was; Proceed runs kdos-box stop and kdos-box remove <name> --purge. How a box is built and launched is in kdos-appbox, and the pack store in Packs and boxes.

Opening a set or pack file. A .ktar set or a .kpack opened from Dolphin, from the stick offer of kded-kdos or from KRunner’s medium rows opens in Discover through the hidden desktop entry, and the backend imports it offline and verifies every pack. A tar whose SELECTION names no application opens as a page that says “This file is not a KDOS set.”, and a file kdos-pack extract-meta cannot read opens as one that says “This file is not a KDOS pack, or it is damaged.”; neither installs anything.

Debian applications

The kdos-store origin lists Debian desktop applications from the DEP-11 (Debian’s AppStream) catalogue that the debian-dep11 port installs at /usr/share/swcatalog/yaml/debian-trixie-main.yml.gz, a dated snapshot of Debian trixie’s main. The catalogue holds thousands of applications, so the backend makes a resource for one only when a search or a category asks for it, or when its box exists.

Search. A search offers a Debian application only when every word of the query, case-folded, occurs in its name, its component id, its package name or one of its keywords. AppStream’s own search also matches summaries and descriptions, which over thousands of applications answers almost any query.

Install. Installing one runs kdos-appbox install deb:<package>, which builds a box named deb.<package> (each + in the package name spelled _); the backend reads that name back to tell the application is installed.

What is never offered in a box. A Debian application is left out of every search, category and appstream:// link when any of these holds:

  1. A host port is the same application by id. Its component id or desktop-id launchable matches a component of the installed ports’ catalogue kdos-ports.xml or of the binary host’s /var/lib/kdos/binhost/swcatalog/xml/kdos-binhost.xml, compared without a trailing .desktop. With the binary-host index fetched, LibreOffice and Filelight are therefore offered only natively.
  2. A host port is the same application by name and origin. It has the name of a desktop application in either catalogue, case-folded, in the session’s language, and either:

    Debian’s Schism Tracker (schism) is the schismtracker port and Debian’s MuseScore 3 (musescore3) the musescore port, and an appstream:// link to either opens the port. The same name alone is not enough, so GNOME Calculator is still offered in a box beside Kalk. The costs: a Debian build of another major version of a port’s program is not offered while the port is, and a pair whose name only one catalogue translates is not caught and is offered twice.

  3. A catalogue row covers it. A catalogue row names its package, or it has a catalogue application’s name, case-folded, and either the same homepage host as the row’s about homepage or a package stem that begins, or is begun by, the stem of one of the row’s packages. A row packs its program with what the program needs, and Debian may list the program by a package the row does not name, as supercollider-ide beside the app.sonicpi row’s supercollider; a search, a category and an appstream:// link all give the row instead. GNUstep’s Chess (chess.app) is a different program from the app.gnome-chess row of the same name and stays offered.
  4. /usr/share/kdos/discover/debian-exclude names its package, one package a line. Each is a program that cannot do its job from a box on KWin’s Wayland session, or whose job belongs to a Debian system:

A box already made for an excluded application stays listed, so it can be removed.

The image build also writes /usr/share/swcatalog/xml/kdos-debian-exclude.xml: a remove-component merge for each debian-exclude application whose id no host port has (a merge removes every component of its id, so Discover, GParted and Disks, which the host ships, keep theirs). It takes those applications out of every AppStream pool on the machine. KRunner’s software results read the pool directly, and without it would offer, as “Get …”, an application this lane refuses.

Text. A Debian application’s name, summary and description are libappstream’s pick for the session’s locale: its own locale (en_US, then en), else the catalogue’s untagged C text. That is whatever language the application’s desktop entry or metainfo gave its untagged key, so MystiQ Video Converter’s summary reads in Spanish in an English session (known gaps).

Icons. Debian’s icons and screenshots are not installed. A Debian application shows its stock icon when the host’s icon theme has it, otherwise the icon of its category, and no screenshot. KRunner’s and Kickoff’s “Get …” results show the same stock or category icon. Those results come from Plasma’s own Software Center runner, which follows Discover’s search rule above: it offers an application only when every word of the query occurs in its name, id, package or keywords. It offers none when an installed application or command is named exactly what was typed (KCalc for kcalc, the htop command for htop); a fuzzy application match (KCalc for galculator) does not hold it back.

A catalogue application with no AppStream icon shows its category’s icon too. Every catalogue category is a main desktop-entry category (AudioVideo, Development, Education, Game, Graphics, Network, Office, Science, Settings, System or Utility), and each has an icon. Once its box is installed, a catalogue application, a pack or a Debian application that would show its category’s icon shows instead the Icon= of the launcher kdos-appbox genlaunchers wrote for its box, the icon Kickoff draws it by. That icon is read from the user’s hicolor theme when the loaded icon theme has not seen it (installed VSCodium shows VSCodium’s). A pack’s own icon or a component’s stays.

Launch. Launch on a boxed application starts, through KIO, the launcher genlaunchers wrote for its box.

Host software

The kdos-ports origin lists the host software that is installed. Once kdos update fetch has put the release’s signed binary-host index and its catalogue in /var/lib/kdos/binhost (each taken where the release’s signed release index says, and kept only with the hash it gives), any port that catalogue lists can be installed, by either of two origins:

Origin Shown as Install runs, through pkexec polkit action
kdos-ports KDOS system kdos-ports-helper install <port>, which runs kdos update install --prebuilt <port> io.kdos.ports.install: an administrator’s password, kept for a while
kdos-ports-source KDOS, built on this computer kdos-ports-builder install <port>, which runs kdos update install --source <port> io.kdos.ports.build: an administrator’s password, asked every time

Where the install goes. The page of a port not installed says so. On an installed system it goes into this version of the system, and the next system update keeps it (or, built here, builds it again). On the live medium it goes into the live session: “It runs from memory and is gone when the machine restarts; install KDOS to keep it.” The backend knows it is on the live medium by the test kdos-bootctl makes: / is an overlay in /proc/mounts, or in the table $KDOS_MOUNTS names.

Part of the system, or removable

What is part of the system is decided by the world set. /var/lib/kdos/world lists the packages somebody installed on purpose. A package of the image has no line there, and kdos update install of a port the image already carries writes none.

The backend learns which is which at each refresh from kdos update removable --json, beside kpkg list --json; when that answer does not come, every port is treated as part of the system.

Removing a port goes in two steps:

  1. Remove runs kdos update remove --dry-run <port> as the user. It refuses without a password when the machine changed since the list was read. Its remove <port> line becomes Discover’s question, “Remove?”, with “ is removed from this computer. Discover can install it again.” When the dry run names N more remove <pkg> lines, it reads “ is removed from this computer, with N packages it brought that nothing else needs. Discover can install it again.” Output without the port’s line fails the removal before the password.
  2. Only a yes runs kdos-ports-helper remove <port> through pkexec, under io.kdos.ports.remove (an administrator’s password, kept for a while), which runs kdos update remove <port> and then the catalogue writer again.

kdos update remove refuses a port that is not in the world set or that an installed package needs. Otherwise it runs kpkg remove, which takes the port off the world set and the origin record too, so the next update does not bring it back. It also takes each package the install brought with it that nothing else installed needs, and the downloaded files of every package not installed leave the binhost cache (see Removing a port). Both resources of an installed port offer Remove and remove the same package by the same steps; one not installed has nothing to remove.

How a port is listed

A port is one resource per package, listed by its best component. The order of preference is:

  1. a desktop application, then a console application, then any other kind;
  2. one from the package’s own metainfo (with a description) before one read from a bare desktop entry;
  3. one with an icon;
  4. the shortest name;
  5. the first in the catalogue.

A suite is named by its face. When the package’s shortest-named application is a bare desktop entry whose name begins the chosen component’s name, as LibreOffice’s start centre “LibreOffice” begins “LibreOffice Base”, the port takes that entry’s name, icon and launchable, and the chosen metainfo’s licence, developer, categories and links. Its description is written for the suite: “The suite holds:” and then each of the package’s metainfo applications in catalogue order, by its name less the suite’s and its summary (“Writer: …”, “Calc: …”), since any one application’s description would describe that application under the suite’s name. The entry’s own summary is not repeated in it, because Discover shows the summary as the heading above the description. LibreOffice is therefore listed as “LibreOffice”, with The Document Foundation, MPL-2.0 and a page that lists each application the package ships metainfo for (Writer, Calc, Impress, Draw and Base), not as one of its applications. Any other bare entry leaves the chosen component as it is, so a package’s minor tool never names it. An appstream:// link to another of its components, such as LibreOffice Writer, opens the same port, and a search finds the port by the name or a keyword of any of its package’s components, so “writer” lists LibreOffice.

How the catalogue writer fills gaps. kdos-discover-catalog repairs a component in these ways:

Author. The author comes only from a metainfo file the package installs: its developer’s name, else its project group (a KDE module’s <project_group>KDE</project_group> reads “KDE”). A recipe names no author, and a port without either shows “Unknown author”. A port whose source carries no metainfo writes its own in build.sh when Discover should name its developer, as LibreWolf’s does with usr/share/metainfo/librewolf.metainfo.xml under the id librewolf.desktop.

Where it is filed. The component’s AppStream kind sets where Discover lists the port: addon under Add-ons, desktop-application (or no kind) under Applications, and a console application or any other kind under Application Support, as a technical package. A desktop application with no category at all is filed under Other, so the All Applications page, which matches by category, lists it and a search finds it.

Icons. A port the binary host offers carries its icon in the binhost’s catalogue, base64 in the custom value KDOS::IconData, never over 32 KiB. The writer takes the icon its metainfo names, else the Icon= of the desktop entry it launches, whichever package installs that entry, looking in this order: the hicolor theme at 64x64, then 48x48, then scalable, then a larger PNG scaled to 64x64, then a smaller one, then /usr/share/pixmaps. Discover writes it to ~/.cache/kdos-discover/icons and draws it, so an application not yet installed shows its own icon. An installed application whose stock icon the loaded icon theme does not find, as for one Discover has just installed, is drawn from that icon’s file in hicolor or /usr/share/pixmaps.

A port whose icon the theme does not have and that carries none (for instance one whose only icon is an SVG over 32 KiB in its own uninstalled package) shows:

Kind Icon
Console application utilities-terminal
Add-on preferences-plugin
Application its first category’s icon
Generic component, such as libfprint or pcscd its category’s icon, else application-x-sharedlib
Service its category’s icon, else preferences-system-services
Driver or firmware its category’s icon, else hwinfo
Font its category’s icon, else preferences-desktop-font

The Graphics category’s icon is kcolorchooser, KColorChooser’s colour wheel, in breeze and breeze-dark alike: Breeze’s applications-graphics is a plain sphere and image-x-generic a file-type placeholder, and either reads as a missing icon in a list.

Prebuilt or built here

Each port the binary host holds is two resources with one AppStream id, installed or not: kdos-backend://port/<id> and kdos-backend://port-source/<id>. Discover lists one application and offers both origins in its source picker. The built-here twin of an installed port carries the port’s state, installed version, notice and Remove, and a list leaves it out, so an installed port is one row, “KDOS system”. Both twins stay because Discover’s application page keeps the most sources it has seen while it is open: a twin that left with the install would leave the page, after a removal, with one source, no source picker and an “Install from KDOS system” button.

The origin Discover opens follows install = in /etc/kdos/update.conf, the route that System Settings › System Versions sets and kdos update install takes at a terminal. Under install = source it is the built-here resource, otherwise the prebuilt one. Discover keeps one resource per AppStream id in a list, and which of two equal ones survives is not a backend’s to decide, so a search or a category lists only the preferred one, or the binary host’s once the port is installed. The application’s link answers both, preferred first; Discover opens the first resource a link answers and fills the source picker from the same link. A list browsed by origin lists every resource of that origin. The file is read at every search, so a change on the settings page shows in the next list.

The two routes:

Either route records each package’s route in /var/lib/kdos/origin, so the next update takes it the same way, and adds the port to /var/lib/kdos/world so the next update keeps it; then the helper writes kdos-ports.xml again. Both routes download, and each resource says so. The routes are described in The kdos command.

Why two helper programs. Both helpers check the port’s name and replace the environment with a fixed PATH and the C locale before they run anything. They are programs of their own because pkexec’s grant names a program and its first argument, never the rest, and granting /usr/bin/kdos would grant every subcommand. They are two programs, one source compiled twice, because pkexec matches the polkit action by the program’s path and its first argument. A prebuilt install and a build both take the verb install, so only the path can tell them apart, and a password kept from a prebuilt install must not cover a build that runs a recipe’s build.sh as root. Each of the prebuilt helper’s actions names its verb, install or remove, since an action naming the path alone would match either. The image’s own copy of kdos-ports.xml is written by the build, over the finished tree.

What Install asks, and how it can be stopped

Discover says what an install will do before it asks for the password. Install first runs kdos update install --dry-run --prebuilt <port> (or --source) as the user, which needs no root. Its total line becomes the text of Discover’s confirmation dialog, titled “Install?”. Every confirmation text opens with the program’s name in bold, “: “, since the dialog is narrow and elides a long title where its text wraps.

The total line counts every prebuilt package and, in bytes, only the files not already in the binhost cache /var/lib/kdos/binhost (and of a cut download only the rest). The cache keeps every package it downloaded until a removal clears those not installed. After the name, the text reads:

Route Text
Prebuilt “Installs N packages; downloads (size).” or, with nothing to download, “Installs N packages, already downloaded.”
Built here “Builds N packages here and installs M prebuilt, downloading (size); building can take hours.” (or “and installs M prebuilt, already downloaded”), with the packages built here named

The number and unit of the size never split across lines. The total also counts the <pkg> dev <file> <bytes> lines, each restoring the development files of a package already installed so a build here finds its headers. Those are said apart, “and restores the development files of K installed packages”; M is the prebuilt count without them, and the size stays the whole download.

Progress. Proceed runs the helper through pkexec, which asks for the password. The install’s status then reads:

Cancelling.

A dry run that refuses, such as a prebuilt install the binary host does not cover, ends the install there with the dry run’s reason, before any password. The reader of the dry run’s output is the model library’s parseInstallPreview, tested over fixture outputs.

The backend reads kdos-ports.xml and kdos-binhost.xml itself at every refresh rather than through the AppStream pool, because the pool keys every component of the system catalogue by an id with the origin os: org.kde.kate from the ports and from Debian’s catalogue would be one component, whichever loaded last.

Locked to one Discover release

libdiscover is private: Discover installs no header and promises no binary interface, and both plugin interfaces carry Discover’s full version in their identifier (org.kde.discover.6.8.2.AbstractResourcesBackendFactory). Discover skips a plugin whose identifier differs with nothing but a debug line, so a stale build vanishes from Discover without an error.

The discover port therefore copies libdiscover’s headers to /usr/include/discover, and kdos-discover refuses to configure against any Discover but the version it names. Every Discover release, point releases included, rebuilds the backend, and its tests run again against the new headers.

Nothing downloads on its own

Opening Discover asks the release server for one thing: its signed indexes (the tree, the binary-host index and the image manifest, or the binary-host index alone on a machine with one root slot), at most once an hour, through the same CheckNew call that Refresh makes (below). It downloads no package and no source. Each of Discover’s own paths to the network is closed:

Path Closed by
The Home page’s featured list, from autoconfig.kde.org /usr/share/discover/featuredurlrc points at /usr/share/kdos/discover/featured.json on the machine
Application ratings from odrs.gnome.org, fetched at every start whose cache is a day old odrs-offline.patch adds [Software] FetchOdrsRatings, which discoverrc sets to false; the Most Popular list is not shown
Firmware metadata, refreshed for every enabled download remote at each start fwupd’s LVFS remote is installed switched off (Firmware)
Screenshots Only a screenshot that is a file on the machine is shown
KNewStuff add-ons from store.kde.org The KNewStuff backend is not built, and ghns=false in kdeglobals turns off every Get New download: the settings pages show no Get New button, the wallpaper dialog’s Get New Plugins is greyed, and Add Widgets’ Get New menu holds only Install Widget From Local File

Everything else that reaches the network is something a person starts: a store-lane box, a host port from the binary host or the sources of one built here, a firmware install, and a system update. Principles states the rule.

System updates

An operating-system update on KDOS is a whole release written into the root slot that is not running, then booted on trial (a trial boot); the running system is never changed. Discover shows the update through its SystemdSysupdate backend, built with -DBUILD_SystemdSysupdateBackend=ON, which talks to org.freedesktop.sysupdate1 on the system bus. kdos-sysupdated owns that name.

The discover port’s sysupdate-errors.patch makes the backend show an error reply to GetVersion or CheckNew, such as a daemon that cannot be reached, as a message that lists no update; upstream’s backend would list an update to a version named after the error. The update itself, and the three ways a slot can be filled, are described in Packaging; this section is how Discover drives it.

kdos-sysupdated

kdos-sysupdated is a root daemon, written in C on basu (the sd-bus library KDOS uses), at /usr/sbin/kdos-sysupdated. It serves the part of systemd’s sysupdate1 interface that Discover 6.8.2 calls:

Object Members
Manager ListTargets (one target, host), ListJobs, ListAppStream, the signal JobRemoved
Target GetVersion, GetAppStream, CheckNew, List, Describe, Vacuum, Acquire, Install
Job Id, Type, Offline, Progress, Cancel

Discover decides the backend is usable by pinging the name, so that needs no patch. The daemon also serves io.kdos.Slots1 for the System Versions page and the notifier: the slots, the armed trial, the update channel, the install route and the job in progress, and the calls Try, CancelTry, SetChannel, SetInstallRoute and Bless.

It does no update work itself. Every check, download and install is a kdos update run, and every boot decision a kdos-bootctl run, each started with an argument vector and read through a progress pipe while the bus keeps answering. kdos update and kdos-bootctl are in The kdos command.

Discover does The daemon runs
Opens, and lists the system GetVersion, the running version and its slot, such as 0.2.14 (slot A); the AppStream file /run/kdos/sysupdate/io.kdos.system.metainfo.xml
Checks for an update CheckNew, which answers from /var/lib/kdos/update.json, the document kdos update check writes
Update, the long part, with progress Acquire: kdos update apply --acquire --mount --progress 3
Update, the short part Install: kdos update apply --arm --mount --progress 3, then a restart is offered
Cancel Job.Cancel on an acquire, which stops its child before the slot is armed; an install is the short arm of a slot already filled and is not cancelled

Acquire does the work. Discover shows progress only for Acquire, so all the work is there: the download, writing or installing into the inactive slot, and checking it. Install is the quick part: it carries this machine’s configuration into the slot, records its version, puts its kernel on the ESP (the EFI system partition) and runs kdos-bootctl try.

An interrupted slot is marked incomplete. Before its first write into the slot, every lane runs kdos-bootctl unfill <slot>, and only the arm’s deploy clears that mark. A slot whose acquire stopped writing, cancelled or failed, is therefore incomplete in the boot state:

Errors reach the person. Acquire is answered only once kdos update has said verified or refused. Discover shows a failed job as nothing more than “failed”, so an index or image manifest no trusted key signed, a package the binary host does not cover, or a slot that cannot be mounted reaches the person as the call’s error, with its reason under the details of Discover’s “Update Issue” sheet; only an update that can go ahead becomes a job. A refused or failed update leaves nothing pending: the restart is offered only after Install ends with status 0, and the update stays listed on the Updates page, ready to try again (update-failed-stays-listed.patch).

Nothing is offered during a trial. While the running boot is itself a trial of the other slot, the slot an update would fill is the confirmed way back, so CheckNew answers empty and Acquire is refused until the trial is confirmed or rolled back.

Checking for an update needs no password in the active session; acquiring and installing one asks for an administrator’s password, kept for a few minutes. Every polkit action, the daemon’s options and exit statuses, and how it is started are in The daemons.

Checking for an update

On a machine with two root slots. The nightly timer runs kdos update check --out /var/lib/kdos/update.json, which reads only the recipe tree, binary-host index and image manifest already on the machine. CheckNew, which Discover calls when it opens and when a person presses Refresh on its Updates page, fetches the signed tree and the release index, and through that index the binary-host index and image manifest, at most once an hour, then answers from the document. A fetch that found no network does not count toward the hour, so the first Refresh once the machine is online asks again at once. A document belongs to the root that wrote it, because /var/lib/kdos is in each slot: one whose installed version is not the running one offers nothing, and the daemon rewrites it at start without downloading.

On a machine with one root (the live medium, or an install with one root), CheckNew instead runs kdos update fetch --binhost-only, at most once per --refresh-after (an hour). That fetches only the release’s signed binary-host index into /var/lib/kdos/binhost, and CheckNew answers empty when it ends: there is no slot to install a system update into, so Discover reports the system up to date.

What is offered is what apply will take. kdos update check offers one of two things:

A slot image carries the base system alone, so the packages installed on purpose follow it into the slot from the same release’s binary host, and an image is refused before the slot is written when that binary host does not cover one of them that came prebuilt. Either offer is made only beside the cached release index that names it, which is where apply downloads every file from. A machine with a package the binary host does not match is told so before any slot is touched.

What the update page says

The AppStream file. The file on /run is regenerated whenever update.json changes; the copy in /usr/share/kdos/update/ is the fallback, which names the system and offers nothing. The discover port’s sysupdate-appstream-after-check.patch makes the backend ask GetVersion and CheckNew before it fetches a target’s AppStream, and fetch it only for a target that offers a version. So the file it reads is the one the check behind that offer wrote, and the first session that finds an update already shows its size, the signed text and the release notes. A target that offers nothing, or whose GetVersion or CheckNew failed, has its AppStream left unread.

The signed text, which Discover shows above the release notes, begins “Signed by (ed25519 …), verified on this machine”. It then says whether the update is the signed system image or the release’s packages, names the packages it changes, and gives its size, “to copy” when that lane’s origin is a directory or a file:// URL (such as a USB stick) and “to download” otherwise. The origin is the update document’s image for the image and its binhost for packages, set by the image = and binhost = lines of /etc/kdos/update.conf, else the release’s https defaults; the tree’s channel does not decide it.

The release notes after it are the new tree’s RELEASE file, turned from Markdown into AppStream’s description markup: a # heading becomes a paragraph of its own, a run of - items a bulleted list, and backticks are dropped, so no Markdown mark reaches the page.

Licence and size. The component carries <project_license>MIT</project_license> beside its CC0-1.0 metadata licence, which More Info’s Licenses field shows as MIT through the discover port’s sysupdate-licenses.patch; upstream’s sysupdate resource hands the page bare strings, which it shows as nothing. The offered release carries its size as the download size of an artifact, which the backend reads through sysupdate-size.patch, so the Updates list and its total show it. Only an update document with no size leaves the field out of the page, since localhost:3129, the size service Discover asks then, has nothing listening.

Warnings. When the update document records a problem, the KDOS backend puts a warning above the Updates page’s list. It names where the failed step looked and adds what failed (the document’s detail) in brackets, such as “Updates could not be fetched from file:///mnt/bh. (file:///mnt/bh/kdos-ports.tar.xz could not be downloaded)”. Without the warning the page would say “Up to date” about a release nothing could read. The next check with no problem takes it away; the backend reads the document at each refresh, and a change to /var/lib/kdos starts one.

Where the warning says the step looked:

The tool’s words follow the sentence in brackets only when they add something: never for a no-network code, whose sentence already says it, and never when they name the URL the sentence names, so the URL is said once. A binary host at /root/bh that publishes nothing reads “No package index is published at file:///root/bh.” with no detail after it.

How a network failure is recorded:

Condition Code and words
A name that did not resolve, or a refused or timed-out connection on a machine with no default route no-network
A server that refused the connection or did not answer while a default route exists fetch-failed: “the server at <host:port> did not answer”
A server that answered, then sent less than 1024 bytes a second for 60 seconds fetch-failed: “the download from <host:port> stalled: less than 1024 bytes a second arrived for 60 seconds”

The second row reads on the page as “The release’s package index could not be fetched from https://10.0.2.2:18999. (the server at 10.0.2.2:18999 did not answer)”.

Each code kdos update check reports has its sentence:

A bare no-network or fetch-failed may be the fetch’s or the apply’s, so its sentence fits either. Two problems are not said:

Restart, trial and confirmation

After Install the other slot is armed for one trial boot. A new version is kept only when that boot is confirmed (“blessed”, in KDOS’s term — see bless) by two marks under /run/kdos/bless/, both regular files owned by root:

Mark Written when
userspace The end of rcS: every service started
graphical A Plasma session answered on the bus for a minute (kdos-notice --bless calls io.kdos.Slots1.Bless), or the login screen stayed up for a minute on a machine SDDM does not log in automatically

When both exist, kdos-sysupdated runs kdos-bootctl mark-good once and writes /run/kdos/bless/confirmed. Either mark alone confirms nothing: a system that boots to a desktop that crashes is the failure a trial exists to catch. polkit grants io.kdos.slots.bless to the active local session alone, with no password.

The login screen counts only where nobody has logged in this boot and SDDM logs nobody in automatically, so a login screen that came back because a session crashed never confirms the slot that crashed it. On such a machine the login screen is the graphical check, and a desktop that fails only after a login is kept; System Settings › System Versions › Start This Version Next Time on the other slot is the way back from it. A machine whose inittab starts no display manager needs only the first mark.

A trial that is never confirmed uses up its attempts, and the next boot falls back to the slot that worked; kdos-notice then says “Your last update didn’t start”. How the slots are chosen at boot is in Boot and init.

The update notifier

Discover’s tray notifier loads only discover-notifier plugins, and its sysupdate1 backend ships none, so KdosNotifier.so is what puts a system update in the system tray. It has three answers:

Answer Read from
An update is available io.kdos.Slots1’s State field offer; update.json’s offer when the daemon does not answer
It is a security update The offer closes at least one finding of kdos cve --json: the finding’s port is among the update’s packages, at or past its fixed version
A restart is needed A staged update: State’s rebootRequired, a slot armed and not yet booted, holding a version newer than the running one (State’s version while its phase is armed, against the running slot’s version from ListSlots), followed both ways; kdos-bootctl status --json and its slots when the daemon does not answer

It never calls CheckNew, which may fetch, so the tray never reaches the network.

Progress in the tray. State reports a job only for an update the daemon runs, one a sysupdate1 client asked for; kdos update apply at a shell runs in place and reports none.

The answer is taken when the job begins and kept for its length, and one update leaves one entry in the notification history. State does not say which client started a job, so a job another sysupdate1 client starts while a Discover window stands idle has no progress entry. A boot on trial is not the tray’s to announce: kdos-notice posts that notice (The Plasma shell).

A version switch is not an update. A slot armed at the running version or an older one, as “Start This Version Next Time” on the System Versions page arms it, is a switch between versions, not a pending restart. Discover would otherwise answer it with “The system needs to be restarted for the updates to take effect”, for an update that does not exist. System Versions and kdos-notice’s trial notice speak for that switch.

The restart notification. When an update arms a slot, Discover’s notifier posts the persistent “Restart is required” notification, the UpdateRestart event of the discoverabstractnotifier component, once. It is shown, and sent once, only through the discover port’s notifyrc-update-restart.patch. Upstream builds it with KNotification::event(), which queues a send of its own before Discover sends it again; posts it as a default event, which KNotification looks up in plasma_workspace, whose notifyrc has no such event; and misspells the event’s group in its own notifyrc. KNotification shows nothing for an event its component does not declare.

Its two buttons, “Restart” and “Shut Down”, open the logout prompt’s restart and shut-down pages. The update is already staged in the other slot, so neither installs anything; the discover port’s notifier-restart-labels.patch gives them those labels in place of upstream’s “Update and Restart” and “Update and Shut Down”.

The restart follows the slot both ways. The notifier reports when the staged update comes or goes, and the discover port’s notifier-reboot-clears.patch makes Discover follow it. An open Discover window’s sysupdate1 backend reads io.kdos.Slots1’s State when it starts and follows it after.

How often it speaks. /usr/share/kdos/xdg/PlasmaDiscoverUpdates sets UseUnattendedUpdates=false and RequiredNotificationInterval=86400: an update is never installed unasked, and the “updates available” notification comes at most once a day. On the live medium, /usr/share/kdos/xdg-live/PlasmaDiscoverUpdates sets the interval to -1, and Discover’s notifier then shows neither the notification nor the tray icon for an available update, which could not be kept there; the icon still appears while an update job runs or a restart is pending.

Firmware

Firmware comes from fwupd through Discover’s stock fwupd backend. fwupd’s LVFS (Linux Vendor Firmware Service) remote is installed switched off, and firmware is listed from the kdos-snapshot local remote instead: the LVFS metadata as it stood when the release was cut, its signature checked when the release was made, installed by the fwupd-snapshot port under /usr/share/fwupd/remotes.d/kdos-snapshot/.

So Discover’s Updates page and fwupdmgr get-updates list the firmware that applies to this machine with no network, and installing an update fetches its cabinet file from the LVFS, a download the person started. The list is as current as the release. fwupdmgr enable-remote lvfs turns the live LVFS on, after which it outranks the snapshot and Discover refreshes its metadata at every start.

Updating from a terminal

Discover is one face of kdos update; the command is the other. It does everything Discover does, and two things more:

Every lane ends in the same armed trial and the same confirmation. See The kdos command.

Testing it

kdos-sysupdated --session --root <dir> serves both its names on the session bus with every file it reads and writes under a fixture root, and Discover started with DISCOVER_TEST_SYSUPDATE=1 looks for sysupdate1 on the session bus, so the whole flow can be driven without root.

testing/selftest.sh runs the daemon that way over fixture slots and compares its introspection byte for byte with the org.freedesktop.sysupdate1.xml vendored from Discover 6.8.2 and with the io.kdos.Slots1 contract. The sysupdate1 interface is not stable upstream, so every Discover release replaces the vendored copy. The backend’s and the notifier’s tests read fixtures of every tool’s real output and run under testing/plasmatest.sh in the development container.

See also


Part IV — Programs, chapter 24. Previous: 23. KDOS settings pages · Contents · Next: 25. kdos-appbox