From Mageia wiki
Jump to: navigation, search
Drakconf multiflag.png
Other languages
Deutsch ; English ; Español ; Français ; 简体中文 ;

Preamble

Now that Feature:Add DNF as Alternate Repository Manager is almost done, it is possible to start using it. Before starting using DNF, do read Warning about orphans mechanisms below, and have a search in our Bugzilla. At the end of this document there are links to manuals.

Install and Setup

  • install dnf: (it is normally installed by default)
urpmi dnf
  • If nonfree or tainted repositories are desired, they can be activated using dnf config-manager as shown with this example for 64 bit system (replace x86_64 with i586 for 32 bit):
dnf config-manager --set-enabled mageia-x86_64-nonfree updates-x86_64-nonfree
dnf config-manager --set-enabled mageia-x86_64-tainted updates-x86_64-tainted
  • 32-bit repositories are turned off by default on 64-bit x86. If you need them:
dnf config-manager --set-enabled mageia-i586 updates-i586

Repeat similarly (see previous example) if you also need nonfree and tainted.

  • For Cauldron, replace "mageia" with "cauldron" and "updates", "backports", etc. with "cauldron-updates", "cauldron-backports", etc respectively in the above commands.
  • If you wish to override the mirror selection with your preferred mirror, you can do so by editing the repository config files in /etc/yum.repos.d. Uncomment the "baseurl=" line and change the URL to point to your preferred mirror. This will automatically override the "metalink" and "mirrorlist" properties so that it will use the designated mirror. If you want, you can comment out the "metalink=" and "mirrorlist=" entries if you want, but that will eliminate the failover mechanism that occurs when the "primary" mirror isn't functioning.

Some commands to get started

As root:

  • dnf install ri-li installs ri-li
  • dnf reinstall ri-li reinstalls ri-li
  • dnf downgrade ri-li downgrades ri-li
  • dnf remove ri-li removes ri-li
  • dnf makecache refreshes the metadata (what is available in the repos)
  • dnf check-update --refresh refreshes the metadata and checks for new updates
  • dnf upgrade --refresh refreshes metadata and does all available updates
  • dnf upgrade --best forces attempts to select best available versions, which can help in determining dependency errors
  • dnf distro-sync --refresh refreshes the metadata and synchronizes the package set installed on the computer with versions in the repositories
  • dnf distro-sync --allowerasing --best will help to upgrade a package with changed major, like e.g. lib64clang3.8 to lib64clang3.9
  • dnf history list shows the install/remove/upgrade history list
  • dnf history info 12 shows what happened during item 12 from the history list
  • dnf shell invokes the interactive shell for doing multiple actions as one transaction
  • dnf install --enablerepo updates_testing-x86_64 caja installs a package (for caja) from a specific repository (updates_testing-x86_64)

As user (or root):

  • dnf help shows a help page
  • dnf search fax returns all packages with "fax" in the name or summary
  • dnf repolist shows last metadata check, the enabled repos and their size. First it downloads any yet not downloaded.

Short command variants of common commands

Starting with DNF 2.6.2, there are now short abbreviations for commonly used commands:
As root:

  • dnf in ri-li installs ri-li
  • dnf ri ri-li reinstalls ri-li
  • dnf dg ri-li downgrade ri-li
  • dnf rm ri-li removes ri-li
  • dnf mc refreshes the metadata (what is available on the repos)
  • dnf up does all available updates
  • dnf dsync synchronizes the package set installed on the computer with versions in the repositories
  • dnf sh invokes the interactive shell for doing multiple actions as one transaction

As user (or root):

  • dnf se fax returns all packages with "fax" in the name or summary

If you have a non-English system and need the output in English, then put LANGUAGE=C on the same line before the command.

Graphical interface

Install: dnf in dnfdragora

Launch: Mageia menu > Tools > System tools > dnfdragora. ( Or in terminal issue dnfdragora )

Quirk: mga#21453 - dnfdragora does not remember packages source selection.

Warning about orphans mechanisms

Mixing use of URPMI and DNF renders orphan mechanisms of both of them unreliable.

If you are going to use DNF, please switch to it as soon as possible after a fresh install.

Removing URPMI updater applet

Uninstall mgaonline.

DNF updater applet

Install dnfdragora-updater.

Upgrade Mageia release using DNF

You can upgrade Mageia in just a few steps. Note all commands must be run as root.

  1. Ensure you're fully up to date: dnf --refresh upgrade
  2. Install the system-upgrade plugin: dnf install 'dnf-command(system-upgrade)'
  3. Start it: dnf system-upgrade --releasever <targetversion> download --allowerasing. For example, to upgrade to Mageia 8, use 8 for <targetversion>.
    1. It will ask before downloading packages, and report how much space is required. If you do not have what it says plus a couple of hundred MB free space on /var partition (if /var is not separate but part of / partition, add another couple hundred MB), then either make enough space or add the option --downloaddir path_to_directory_with_free_space to this and the next system-upgrade commands. Also make sure / has additional room for the larger new programs. Note that maybe there needs to be room for not just one, but two kernels (see Extra kernel flavour below). Especially if you have a separate /boot partition, check there is enough room for that.
    2. When you know you have sufficient space, say yes to let it download. It will also dry run a transaction test.
  4. If the downloading and transaction test succeeded,
    1. Save your work, and close applications!
    2. Trigger the upgrade: dnf system-upgrade reboot
Warning!
/!\ NOTE: This immediately reboots your system! /!\

Now enjoy some beverage while looking at the bubbles on our boot splash - and above it, messages detailing what is happening. When done, it will reboot, allowing you enjoy your new Mageia.

Extra kernel flavour

DNF uses a different method to select kernel flavour than Mageia installer. This may result in that a system that was using the desktop kernel, can end up with both desktop and server installed after upgrade by DNF, and server being used. Easy fix: select at boot the desktop kernel, then uninstall server kernel. mga#28272

Setting up a container for a non-native architecture

Starting with DNF 2.6.2, it is now possible to build chroots or containers for foreign architectures.

The procedure for creating an ARMv7 chroot on an x86_64 system is as follows:

  1. Install qemu-user-static on the host system
  2. Restart systemd-binfmt.service to have new binary format information to take effect
  3. Create the directory of your foreign arch chroot. For example /var/lib/machines/mga8armv7hl
  4. Run DNF as root to create the installroot:
dnf --installroot=/var/lib/machines/mga8armv7hl --releasever=8 --forcearch=armv7hl --repofrompath=mga8rel,http://mirrors.kernel.org/mageia/distrib/8/armv7hl/media/core/release/ --repofrompath=mga8up,http://mirrors.kernel.org/mageia/distrib/8/armv7hl/media/core/updates/ --disablerepo=* --enablerepo=mga8rel --enablerepo=mga8up --setopt=install_weak_deps=False install basesystem-minimal-core dnf

Finally, test the chroot to see if a program runs. Here's a suggested command (run as root): chroot /var/lib/machines/mga8armv7hl /usr/bin/uname -r -m

Documentation