DESK-XZ7-L-AN-0006: Package Management with Yocto and DNF

From DAVE Developer's Wiki
Revision as of 08:07, 2 February 2024 by U0007 (talk | contribs) (Created page with "{{InfoBoxTop}} {{AppliesToBORA_AN}} {{AppliesToBORA_Xpress_AN}} {{AppliesToBORA_Lite_AN}} {{InfoBoxBottom}} {{ImportantMessage|text=This application note has been validated u...")

(diff) ← Older revision | Approved revision (diff) | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Info Box


200px-Emblem-important.svg.png

This application note has been validated using the kit version in the History table.

History[edit | edit source]

Date Development Kit version
Feb 2024 DESK-XZ7-L 1.0.1

Introduction[edit | edit source]

Since Pyro (2.3) Yocto release, DNF is the default package manager for installing packages in the DUT (target machine).

The Dandified Packaging Tool (DNF) performs runtime package management of RPM packages.

This application note details how to use DNF for installing packages with a Yocto based root file system

DNF[edit | edit source]

DNF is a software package manager that installs, updates, and removes packages on RPM-based Linux distributions. It automatically computes dependencies and determines the actions required to install packages. DNF also makes it easier to maintain groups of machines, eliminating the need to manually update each one using rpm. Introduced in Fedora 18, it has been the default package manager since Fedora 22.

More information can be found on Fedora's wiki DNF page

Pre-configured repositories[edit | edit source]

It is possible to add and configure DNF repositories using additional .repo files: it is recommended to define individual repositories in new or existing .repo files in the /etc/yum.repos.d/ directory.

More information about configuring DNF repositories can be found in the nConfiguring DNF and DNF_Repositories Fedora's page.

Here below is the original configuration defined by Petalinux root file system for the package repositories:

root@bora:~# ls -la /etc/yum.repos.d
total 24
drwxr-xr-x  2 root root 4096 Jan 30 15:15 .
drwxr-xr-x 52 root root 4096 Jan 30 15:18 ..
-rw-r--r--  1 root root 4606 Mar  9  2018 oe-remote-repo-sswreleases-rel-v2021.2-generic-rpm.repo
-rw-r--r--  1 root root 5086 Mar  9  2018 oe-remote-repo-sswreleases-rel-v2021.2-generic-updates-rpm.repo
root@bora:~# 

Installing packages on target[edit | edit source]

We assume that the network interface has been already configured for Internet access. In any case, a simple network configuration can be done according to the How to configure the network interfaces wiki page:

root@bora:~# cat /etc/systemd/network/XXXXXX-eth0.network
[Match]
Name=eth0

# Prevent the interface loading if the kernel boots from nfs
KernelCommandLine=!nfsroot

[Network]
Address=192.168.0.89
Gateway=192.168.0.254
DNS=192.168.0.1
root@bora:~#

Then, for installing a package, it is enough to invoke dnf with the install parameter, for example:

root@desk-mx6ul-axelulite:~# dnf install .........

Search for packages[edit | edit source]

To search for an available package in the current configured channels use dnf repoquery

Please note that this will show all packages, it's usually more useful to give it a pattern, e.g.:


List of installed packages[edit | edit source]

User can see the list of installed packages with dnf repoquery --installed

root@desk-mx6ul-axelulite:~# dnf repoquery --installed

DNF activity history[edit | edit source]

User can see the activity on packages with dnf history

root@desk-mx6ul-axelulite:~# dnf history
ID     | Command line                                                                                                     | Date and time    | Action(s)      | Altered
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
     4 | install lighttpd                                                                                                 | 2022-04-13 09:09 | Install        |    6 EE
     3 | -v --rpmverbosity=info -y -c /home/jenkins/workspace/workspace/DESK-MX6UL-L-3.x.x_Yocto/yocto/build-fb/tmp/work/ | 2022-02-16 16:19 | Removed        |    1 E<
     2 | -v --rpmverbosity=info -y -c /home/jenkins/workspace/workspace/DESK-MX6UL-L-3.x.x_Yocto/yocto/build-fb/tmp/work/ | 2022-02-16 16:19 | Install        |   16 >
     1 | -v --rpmverbosity=info -y -c /home/jenkins/workspace/workspace/DESK-MX6UL-L-3.x.x_Yocto/yocto/build-fb/tmp/work/ | 2022-02-16 16:14 | Install        | 1593 EE
root@desk-mx6ul-axelulite:~#

References[edit | edit source]