ORCA SBC/Package management with apt-get

From DAVE Developer's Wiki
< ORCA SBC
Revision as of 16:35, 27 February 2024 by U0009 (talk | contribs) (Created page with "{{:DESK-MX8M-L/Development/Package management with apt-get}} Category:ORCA SBC")

(diff) ← Older revision | Approved revision (diff) | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
History
Issue Date Notes
2024/02/27 DESK-MX8-L-4.0.0 update



Package management with apt-get[edit | edit source]

Since NXP BSP 5.4.24 Yocto release, apt-get has been added as a package manager for installing packages in the DUT (target machine).

As reported by NXP official documentation:

The default package management with Yocto Project is rpm. The i.MX distro now enables debian as the package management. This can be easily turned off by add PACKAGE_CLASSES_* set to package_rpm to the local.conf (or creating a custom distro without the debian package feed PACKAGE_CLASSES = "package_rpm".
With the addition of the debian package feed, a sources.list can be added /etc/apt that links in Debian's package feed. This allows users to install packages not provided in the image without having to add them to a yocto image. Because this package feed is not generated by the i.MX Yocto build process, there is no guarantee each package will work with the right dependencies but it allows simpler tools to be provided. Software that is complex and has more dependencies on specific versions might have issues with an external package feed.

apt-get performs runtime package management of .deb packages. In order to use apt-get for runtime package management, you must perform an initial setup on the target machine for cases where the PACKAGE_FEED_* variables were not set as part of the image that is running on the target.

In principle, the adoption of the Debian package management should allow to use prebuilt package archives available for Debian distributions. However, close attention should be paid when mixing packages of different distributions. For instance, Debian packages installed on a Yocto file system could not work. Even worse, they could interfere with existing packages and make these unusable.

This Application Note (AN) describes a way to apply the approach illustrated here to a Yocto distribution that makes use of Debian packetization. In other words, a local archive of Yocto-generated, prebuilt .deb packages is used in combination with the well known apt-get utility.

apt-get[edit | edit source]

The following instructions detail how to use apt-get for installing packages with Yocto repositories created by DAVE's build system for DESK-MX8M-L.

Configuring apt for SBC-ORCA[edit | edit source]

Edit the file /etc/apt/apt.conf like this:

root@desk-mx8mp:~# cat /etc/apt/apt.conf
APT::Architecture "arm64";
APT::Get::AllowUnauthenticated "true";
Acquire::Languages "none";

Edit the file /etc/apt/sources.list.d/debian-10.list like this:

root@desk-mx8mp:~# cat /etc/apt/sources.list.d/debian-10.list
deb [trusted=yes] http://yocto.dave.eu/desk-mx8m-l-4.0.0/ all/
deb [trusted=yes] http://yocto.dave.eu/desk-mx8m-l-4.0.0/ armv8a/
deb [trusted=yes] http://yocto.dave.eu/desk-mx8m-l-4.0.0/ armv8a-mx8mp/
deb [trusted=yes] http://yocto.dave.eu/desk-mx8m-l-4.0.0/ desk_mx8mp/

Execute the following commands in order to re-create the apt cache based on the new server's list:

rm -rf /var/lib/apt/lists/*
apt-get clean
apt-get update
root@desk-mx8mp:~# rm -rf /var/lib/apt/lists/*
root@desk-mx8mp:~# apt-get clean
root@desk-mx8mp:~# apt-get update
Ign:1 http://yocto.dave.eu/desk-mx8m-l-4.0.0 all/ InRelease
Ign:2 http://yocto.dave.eu/desk-mx8m-l-4.0.0 armv8a-mx8mp/ InRelease
Ign:3 http://yocto.dave.eu/desk-mx8m-l-4.0.0 desk_mx8mp/ InRelease
Get:4 http://yocto.dave.eu/desk-mx8m-l-4.0.0 all/ Release [1215 B]
Get:5 http://yocto.dave.eu/desk-mx8m-l-4.0.0 armv8a-mx8mp/ Release [1224 B]
Get:6 http://yocto.dave.eu/desk-mx8m-l-4.0.0 desk_mx8mp/ Release [1222 B]
Ign:7 http://yocto.dave.eu/desk-mx8m-l-4.0.0 all/ Release.gpg
Ign:8 http://yocto.dave.eu/desk-mx8m-l-4.0.0 armv8a-mx8mp/ Release.gpg
Ign:9 http://yocto.dave.eu/desk-mx8m-l-4.0.0 desk_mx8mp/ Release.gpg
Get:10 http://yocto.dave.eu/desk-mx8m-l-4.0.0 all/ Packages [174 kB]
Get:11 http://yocto.dave.eu/desk-mx8m-l-4.0.0 armv8a-mx8mp/ Packages [308 kB]
Get:12 http://yocto.dave.eu/desk-mx8m-l-4.0.0 desk_mx8mp/ Packages [263 kB]
Fetched 749 kB in 1s (866 kB/s)
Reading package lists... Done
W: Conflicting distribution: http://yocto.dave.eu/desk-mx8m-l-4.0.0 all/ Release (expected all/ but got )
W: Conflicting distribution: http://yocto.dave.eu/desk-mx8m-l-4.0.0 armv8a-mx8mp/ Release (expected armv8a-mx8mp/ but got )
W: Conflicting distribution: http://yocto.dave.eu/desk-mx8m-l-4.0.0 desk_mx8mp/ Release (expected desk_mx8mp/ but got )

Then, modify the cached package list due to the proper DAVE's server configuration:

sed -i 's/\.\//all\//g' /var/lib/apt/lists/yocto.dave.eu_desk-mx8m-l-4.0.0_all_Packages
sed -i 's/\.\//armv8a\//g' /var/lib/apt/lists/yocto.dave.eu_desk-mx8m-l-4.0.0_armv8a_Packages
sed -i 's/\.\//armv8a-mx8mp\//g' /var/lib/apt/lists/yocto.dave.eu_desk-mx8m-l-4.0.0_armv8a-mx8mp_Packages
sed -i 's/\.\//desk%5fmx8mp\//g' /var/lib/apt/lists/yocto.dave.eu_desk-mx8m-l-4.0.0_desk%5fmx8mp_Packages

Configuring apt for SBCX-Mito8MMini[edit | edit source]

Edit the file /etc/apt/apt.conf like this:

root@desk-mx8mm:~# cat /etc/apt/apt.conf
APT::Architecture "arm64";
APT::Get::AllowUnauthenticated "true";
Acquire::Languages "none";

Edit the file /etc/apt/sources.list.d/debian-10.list like this:

root@desk-mx8mm:~# cat /etc/apt/sources.list.d/debian-10.list
deb [trusted=yes] http://yocto.dave.eu/desk-mx8m-l-4.0.0/ all/
deb [trusted=yes] http://yocto.dave.eu/desk-mx8m-l-4.0.0/ armv8a/
deb [trusted=yes] http://yocto.dave.eu/desk-mx8m-l-4.0.0/ armv8a-mx8mm/
deb [trusted=yes] http://yocto.dave.eu/desk-mx8m-l-4.0.0/ desk_mx8mm/

Execute the following commands in order to re-create the apt cache based on the new server's list:

rm -rf /var/lib/apt/lists/*
apt-get clean
apt-get update
root@desk-mx8mm:~# rm -rf /var/lib/apt/lists/*
root@desk-mx8mm:~# apt-get clean
root@desk-mx8mm:~# apt-get update
Ign:1 http://yocto.dave.eu/desk-mx8m-l-4.0.0 all/ InRelease
Ign:2 http://yocto.dave.eu/desk-mx8m-l-4.0.0 armv8a-mx8mm/ InRelease
Ign:3 http://yocto.dave.eu/desk-mx8m-l-4.0.0 desk_mx8mm/ InRelease
Get:4 http://yocto.dave.eu/desk-mx8m-l-4.0.0 all/ Release [1215 B]
Get:5 http://yocto.dave.eu/desk-mx8m-l-4.0.0 armv8a-mx8mm/ Release [1224 B]
Get:6 http://yocto.dave.eu/desk-mx8m-l-4.0.0 desk_mx8mm/ Release [1222 B]
Ign:7 http://yocto.dave.eu/desk-mx8m-l-4.0.0 all/ Release.gpg
Ign:8 http://yocto.dave.eu/desk-mx8m-l-4.0.0 armv8a-mx8mm/ Release.gpg
Ign:9 http://yocto.dave.eu/desk-mx8m-l-4.0.0 desk_mx8mm/ Release.gpg
Get:10 http://yocto.dave.eu/desk-mx8m-l-4.0.0 all/ Packages [174 kB]
Get:11 http://yocto.dave.eu/desk-mx8m-l-4.0.0 armv8a-mx8mm/ Packages [304 kB]
Get:12 http://yocto.dave.eu/desk-mx8m-l-4.0.0 desk_mx8mm/ Packages [259 kB]
Fetched 740 kB in 1s (714 kB/s)
Reading package lists... Done
W: Conflicting distribution: http://yocto.dave.eu/desk-mx8m-l-4.0.0 all/ Release (expected all/ but got )
W: Conflicting distribution: http://yocto.dave.eu/desk-mx8m-l-4.0.0 armv8a/ Release (expected armv8a/ but got )
W: Conflicting distribution: http://yocto.dave.eu/desk-mx8m-l-4.0.0 armv8a-mx8mm/ Release (expected armv8a-mx8mm/ but got )
W: Conflicting distribution: http://yocto.dave.eu/desk-mx8m-l-4.0.0 desk_mx8mm/ Release (expected desk_mx8mm/ but got )

Then, modify the cached package list due to the proper DAVE's server configuration:

sed -i 's/\.\//all\//g' /var/lib/apt/lists/yocto.dave.eu_desk-mx8m-l-4.0.0_all_Packages
sed -i 's/\.\//armv8a\//g' /var/lib/apt/lists/yocto.dave.eu_desk-mx8m-l-4.0.0_armv8a_Packages
sed -i 's/\.\//armv8a-mx8mm\//g' /var/lib/apt/lists/yocto.dave.eu_desk-mx8m-l-4.0.0_armv8a-mx8mm_Packages
sed -i 's/\.\//desk%5fmx8mm\//g' /var/lib/apt/lists/yocto.dave.eu_desk-mx8m-l-4.0.0_desk%5fmx8mm_Packages

Installing packages on target[edit | edit source]

We assume that 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.


The target is finally ready to install new packages. The following example shows for instance the installation of graphviz:

root@desk-mx8mp:~# apt-get install graphviz
Reading package lists... Done
Building dependency tree... Done
The following NEW packages will be installed:
  graphviz
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 2094 kB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://yocto.dave.eu/desk-mx8m-l-4.0.0 armv8a-mx8mp/ graphviz 2.50.0-r0 [2094 kB]
Fetched 2094 kB in 1s (1913 kB/s)
Selecting previously unselected package graphviz.
(Reading database ... 81414 files and directories currently installed.)
Preparing to unpack .../graphviz_2.50.0-r0_arm64.deb ...
Unpacking graphviz (2.50.0-r0) ...
Setting up graphviz (2.50.0-r0) ...

Other useful apt commands[edit | edit source]

List of configured software repositories[edit | edit source]

As shown before, the target is configured for accessing the Yocto repositories as listed in the /etc/apt/sources.list.d apt configuration directory:

root@desk-mx8mp:~# cat /etc/apt/sources.list.d/debian-10.list
deb [trusted=yes] http://yocto.dave.eu/desk-mx8m-l-4.0.0/ all/
deb [trusted=yes] http://yocto.dave.eu/desk-mx8m-l-4.0.0/ armv8a-mx8mp/
deb [trusted=yes] http://yocto.dave.eu/desk-mx8m-l-4.0.0/ desk_mx8mp/

Search for packages[edit | edit source]

To search for an available package into the current configured channels use apt-cache search

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

root@desk-mx8mp:~# apt-cache search vim
vim - Vi IMproved - enhanced vi editor
vim-common - Vi IMproved - enhanced vi editor
vim-help - Vi IMproved - enhanced vi editor
vim-syntax - Vi IMproved - enhanced vi editor
vim-tutor - Vi IMproved - enhanced vi editor
vim-vimrc - Vi IMproved - enhanced vi editor

List of installed packages[edit | edit source]

User can see the list of installed packages with dpkg --get-selections | sed 's:install$::' (sed removes the install string from the output list)

acl
acl-dev
adwaita-icon-theme-symbolic
alsa-conf
alsa-state
alsa-states
alsa-tools
alsa-utils
alsa-utils-aconnect
alsa-utils-alsactl
alsa-utils-alsaloop
alsa-utils-alsamixer
alsa-utils-alsatplg
...
[snip]
...
volatile-binds-dev
wayland
wayland-dev
which
which-dev
wireless-regdb-static
wireless-tools
wpa-supplicant
wpa-supplicant-cli
wpa-supplicant-passphrase
xinetd
xz
xz-dev