-
Notifications
You must be signed in to change notification settings - Fork 49
Commands
Remove a package with its dependencies. This is similar to the erase
/remove
command, but will also remove packages that are no longer needed for this package, regardless of the clean_requirements_on_remove
option.
Only for tdnf >= 3.4.0:
autoremove
without any arguments will remove all unneeded automatically installed packages.
This command resolves dependencies by using the local RPMs to help check RPMs for quality assurance before publishing them. To check RPMs with this command, you must create a local directory and place your RPMs in it. The command, which includes no options, takes the path to the local directory containing the RPMs as its argument. The command does not, however, recursively parse directories; it checks the RPMs only in the directory that you specify. For example, after creating a directory named /tmp/myrpms
and placing your RPMs in it, you can run the following command to check them:
tdnf check-local /tmp/myrpms
Checking all packages from: /tmp/myrpms
Found 10 packages
Check completed without issues
This is the logic:
- read all packages from the directory and create a temporary internal repository
- resolve all packages to install all of them (without actually installing)
This will detect internal consistencies, for example conflicting packages, or conflicts with currently installed packages, and dependencies that cannot be satisfied from current configured repositories.
This command checks for updates to packages. It takes no arguments. The tdnf list updates
command performs the same function. Here is an example of the check update
command:
tdnf check-update
rpm-devel.x86_64 4.11.2-8.ph1 photon
yum.noarch 3.4.3-3.ph1 photon
This command cleans up temporary files, data, and metadata.
For tdnf
< 3.4.0 only enabled repositories will be cleaned. For tdnf
>= 3.4.0 all configured repositories will be cleaned.
It takes sub commands:
cleans up everything
tdnf clean all
Cleaning repos: photon photon-extras photon-updates lightwave
Cleaning up everything
The following sub commands are only implemented in tdnf
>= 3.4.0:
Cleans up downlopaded metadata from the repositories
Cleans up generated metadata from libsolv.
Removed downloaded packages from the cache.
Removed downloaded keys from the cache.
Removes the cache expiry marker. This will trigger a download of metadata on the next action that needs them.
This command synchronizes the machine's RPMs with the latest version of all the packages in the repository. Abridged example:
tdnf distro-sync
Upgrading:
zookeeper x86_64 3.4.8-2.ph1 3.38 M
yum noarch 3.4.3-3.ph1 4.18 M
Total installed size: 113.01 M
Reinstalling:
zlib-devel x86_64 1.2.8-2.ph1 244.25 k
zlib x86_64 1.2.8-2.ph1 103.93 k
yum-metadata-parser x86_64 1.1.4-1.ph1 57.10 k
Total installed size: 1.75 G
Obsoleting:
tftp x86_64 5.2-3.ph1 32.99 k
Total installed size: 32.99 k
Is this ok [y/N]:
This command downgrades the package that you specify as an argument to the next lower package version. Example:
tdnf downgrade boost
Downgrading:
boost x86_64 1.56.0-2.ph1 8.20 M
Total installed size: 8.20 M
Is this ok [y/N]:y
Downloading:
boost 2591470 100%
Testing transaction
Running transaction
Complete!
To downgrade to a version lower than the next one, you must specify it by name, epoch, version, and release, all properly hyphenated. Example:
tdnf downgrade boost-1.56.0-2.ph1
downgrade
without arguments will attempt to downgrade all packages.
This command removes the package that you specify as an argument. Example:
tdnf erase vim
Removing:
vim x86_64 7.4-4.ph1 1.94 M
Total installed size: 1.94 M
Is this ok [y/N]:
You can also erase multiple packages:
tdnf erase docker cloud-init
When removing a package, tdnf by default does not remove dependencies that are no longer used if they were was installed by tdnf as a dependency. You can modify the dependency removal by changing the clean_requirements_on_remove
option in /etc/tdnf/tdnf.conf
to true
, or use the autoremove command.
Note: only available for tdnf
>= 3.4.0
Every transaction (commands that install, update or remove packages) will be recorded in a database. The transactions can be rolled back to a past state, or a range of transactions can be undone or redone.
There are five sub commands to the new history
command:
This will initialize the history database, and should be called just after tdnf is installed. Any altering command (install
, erase
, etc) will also initialize the database if it isn't already.
If called when the database is already initialized, this will add a transaction if any package has been added or removed by another application (rpm command) since the last time a transaction was recorded. Otherwise this will have no effect.
The subcommands init
and update
are the same, but this may change in the future.
This lists the history. Also, the command history
without any sub command will do the same. It understands these options:
--info
will list the history in more detail, including packages that were added/removed
--reverse
will list the history in reverse order
--from <id>
and --to <id>
will list a range of transaction ids.
Example output:
# tdnf history
ID cmd line date/time +added / -removed
1 (set) Thu May 05 2022 19:14 +152 / -0
2 -y install less Thu May 05 2022 19:14 +1 / -0
3 -y install lsof Thu May 05 2022 19:18 +2 / -0
# tdnf history --info --from 2 --to 3
ID cmd line date/time +added / -removed
2 -y install less Thu May 05 2022 19:14 +1 / -0
added: less-551-2.ph4.aarch64
3 -y install lsof Thu May 05 2022 19:18 +2 / -0
added: libtirpc-1.2.6-2.ph4.aarch64, lsof-4.91-1.ph4.aarch64
This will revert to a previous state. The desired state must be specified with --to
. Example:
# tdnf history rollback --to 49
Upgrading:
curl-devel aarch64 7.82.0-3.ph4 photon-updates 885.16k 906404
curl aarch64 7.82.0-3.ph4 photon-updates 256.73k 262896
...
Total installed size: 3.52M 3688748
Is this ok [y/N]: y
Downloading:
curl-devel 793306 100%
curl 148725 100%
...
Testing transaction
Running transaction
Installing/Updating: rpm-libs-4.16.1.3-9.ph4.aarch64
Installing/Updating: rpm-4.16.1.3-9.ph4.aarch64
...
Complete!
This reverts a transaction. The parameter --from
is mandatory, and the specified transaction will be reverted. Optionally, with the parameter --to
a range can be specified. Note that the range is inclusive - for example if the range is given as 2 to 4, the actions done in 2,3 and 4 will be undone.
Similar to undo
, but the actions will be done again.
The history commands to change history deal with the total deltas between the start and target states. For each range of transactions, the intermediate states are irrelevant. For example, if one transaction installs a package and another removes it, the installed state of that package from start to end will be the same. Therefore any history command across that range will not reinstall or remove that package. If intermediate states are desired, each transaction needs to be executed one by one.
If a package cannot be found, tdnf
will fail with an error message. For example, when rolling back to a state before an update, the installed packages may no longer be available in the repository. In that case, it may be possible to revert by enabling additional repositories. Example:
# tdnf history rollback --to 1
The following packages could not be resolved:
curl-libs-7.82.0-1.ph4.aarch64
rpm-libs-4.16.1.3-7.ph4.aarch64
...
The package(s) may have been moved out of the enabled repositories since the
last time they were installed. You may be able to resolve this by enabling
additional repositories.
Error(1011) : No matching packages
tdnf --enablerepo=photon history rollback --to 1
Downgrading:
curl-devel aarch64 7.82.0-1.ph4 photon 885.16k 906404
rpm-build aarch64 4.16.1.3-7.ph4 photon 434.00k 444418
...
Total installed size: 4.26M 4463905
Removing:
wget aarch64 1.21.3-1.ph4 @System 3.02M 3168291
tdnf-test-cleanreq-required aarch64 1.0.1-3 @System 0.00b 0
lsof aarch64 4.91-1.ph4 @System 202.36k 207218
libtirpc aarch64 1.2.6-2.ph4 @System 193.33k 197970
gdb aarch64 10.1-2.ph4 @System 12.60M 13214814
Total installed size: 16.01M 16788293
Is this ok [y/N]:
tdnf
will keep track of its own transactions. However, packages may be removed or added with other tools, like rpm
. In this case, the next time tdnf
does a transaction this will be detected and recorded as a pseudo transaction:
# tdnf history --info --from 49 --to 49
ID cmd line date/time. +added / -removed
49 (unknown) Thu May 05 2022 23:38 +1 / -0
added: gdb-10.1-2.ph4.aarch64
For the actions undo
and redo
, it may be necessary to install additional dependencies, not just the packages that were changed in a transaction. For example, if a transaction that installed a single package (which was later removed) is redone, but in the meantime one of its dependencies was removed, the dependencies will be attempted to be installed again.
This is not an issue for rollback
because the entire set of packages will be restored (assuming that dependencies were satisfied at that state).
This command displays information about packages. It takes the same arguments as the list command, but displays more information. Examples:
tdnf info ruby
tdnf info obsoletes
tdnf info upgrades
This command takes the name of a package as its argument. It then installs the package and its dependencies. Examples:
tdnf install kubernetes
You can also install multiple packages:
tdnf install python-curses lsof audit gettext chkconfig ntsysv bindutils
wget gawk irqbalance lvm2 cifs-utils c-ares distrib-compat
This command lists the packages of the package that you specify as the argument. The command can take one of the following arguments: all
, available
, installed
, extras
, obsoletes
, recent
, upgrades
. These can also be given as options, for example --upgrades
.
tdnf list updates
The list of packages might be long. To more easily view it, you can pipe it to a pager, for example less
:
tdnf list --all | less
This command updates the cached binary metadata for all known repositories. Example:
tdnf makecache
Refreshing metadata for: 'VMware Lightwave 1.0(x86_64)'
Refreshing metadata for: 'VMware Photon Linux 1.0(x86_64)Updates'
Refreshing metadata for: 'VMware Photon Extras 1.0(x86_64)'
Refreshing metadata for: 'VMware Photon Linux 1.0(x86_64)'
Metadata cache created.
Only for tdnf >= 3.4.0.
Mark one or more packages as auto installed (remove) or unmark as auto installed (install), which means it is user-installed. This will be used to determine if this package will be removed on autoinstall.
This command finds the packages that provide the package that you supply as an argument. Examples:
tdnf provides docker
docker-1.11.0-1.ph1.x86_64 : Docker
Repo : photon
docker-1.11.0-1.ph1.x86_64 : Docker
Repo : @System
This command reinstalls the packages that you specify. If some packages are unavailable or not installed, the command fails. Example:
tdnf reinstall docker kubernetes
Reinstalling:
kubernetes x86_64 1.1.8-1.ph1 152.95 M
docker x86_64 1.11.0-1.ph1 57.20 M
Total installed size: 210.15 M
The repoquery
command allows you to query packages from the repositories and installed packages with different criteria and output options. It can take multiple package specs as arguments. Examples:
$ tdnf repoquery vim
vim-8.2.4925-1.ph4.aarch64
vim-8.2.1361-1.ph4.aarch64
$ tdnf repoquery vim*
vim-8.2.4925-1.ph4.aarch64
vim-8.2.1361-1.ph4.aarch64
vim-extra-8.2.4925-1.ph4.aarch64
vim-extra-8.2.1361-1.ph4.aarch64
$ tdnf repoquery --installed vim
vim-8.2.4925-1.ph4.aarch64
$ tdnf repoquery --requires vim
ld-linux-aarch64.so.1()(64bit)
ld-linux-aarch64.so.1(GLIBC_2.17)(64bit)
libc.so.6(GLIBC_2.17)(64bit)
...
There are two groups of options: "select" and "query" options. The former filters the list of packages, the latter controls what is displayed.
Select architecture. Can be given multiple times.
Show available packages, that is packages that are in the repositories.
Show duplicate installed packages.
Show packages that are installed but not in any repositories.
Show packages that own the specified file.
Show installed packages
Only for tdnf >= 3.4.0.
Show user installed packages.
--whatdepends, --whatenhances, --whatobsoletes, --whatprovides, --whatrecommends, whatrequires, --whatsuggests, --whatsupplements capability
Show packages that have the specified dependency on capability
. Example:
$ tdnf repoquery --whatrequires vim
minimal-0.1-6.ph4.aarch64
vim-extra-8.2.4925-1.ph4.aarch64
minimal-0.1-4.ph4.aarch64
By default the selected packages will be listed. The output can be changed with these options:
List all files of selected packages.
--depends, --enhances, --obsoletes, --provides, --recommends, requires, requires-pre, --suggests, --supplements
List specified dependencies.
Show the source package name.
This synchronizes a remote repository with a local one. By default, all packages will be downloaded to a local directory, unless they already exist. Optionally, metadata will be downloaded as well.
The command understands these options:
remove old package that are not part of the repository any more
download metadata as well. The directory can be used as a repository after download.
check the gpg signature. If invalid, the package will be deleted.
no subdirectory with the repo name will be created. This option is only valid if there is more than one repository configured. It is also incompatible with the --delete
option to prevent accidentally deleting unrelated packages.
instead of downloading, the URLs of all files will be printed to stdout
.
by default, files will be downloaded relative to the current directory. With this option another directory can be specified.
download metadata to another directory
download specific architectures (can be given repeatedly)
download only source packages, same as --arch src
. Incompatible with the --arch
option.
download latest versions only
Same as erase.
This command searches for the attributes of packages. The argument can be the names of packages, as this example testifies:
tdnf search docker kubernetes
docker : Docker
docker : Docker
docker-debuginfo : Debug information for package docker
docker : Docker
kubernetes : Kubernetes cluster management
kubernetes : Kubernetes cluster management
kubernetes-debuginfo : Debug information for package kubernetes
kubernetes : Kubernetes cluster management
The argument of the search command can also be a keyword or a combination of keywords and packages:
tdnf search terminal bash
rubygem-terminal-table : Simple, feature rich ascii table generation library
ncurses : Libraries for terminal handling of character screens
mingetty : A minimal getty program for virtual terminals
ncurses : Libraries for terminal handling of character screens
ncurses : Libraries for terminal handling of character screens
bash : Bourne-Again SHell
bash-lang : Additional language files for bash
bash-lang : Additional language files for bash
bash : Bourne-Again SHell
bash-debuginfo : Debug information for package bash
bash : Bourne-Again SHell
bash-lang : Additional language files for bash
This command upgrades the package or packages that you specify to an available higher version that tdnf can resolve. If the package is already the latest version, the command returns Nothing to do
. Example:
tdnf update boost
Upgrading:
boost x86_64 1.60.0-1.ph1 8.11 M
Total installed size: 8.11 M
Is this ok [y/N]:y
Downloading:
boost 2785950 100%
Testing transaction
Running transaction
Complete!
You can also run the update
command with the refresh
option to update the cached metadata with the latest information from the repositories. The following example refreshes the metadata and then checks for a new version of tdnf but does not find one, so tdnf takes no action:
tdnf update tdnf --refresh
Refreshing metadata for: 'VMware Lightwave 1.0(x86_64)'
Refreshing metadata for: 'VMware Photon Linux 1.0(x86_64)Updates'
Refreshing metadata for: 'VMware Photon Extras 1.0(x86_64)'
Refreshing metadata for: 'VMware Photon Linux 1.0(x86_64)'
Nothing to do.
update
without arguments will upgrade all packages.
Display info about security updates. tdnf updateinfo
will just show the number of security notices. Use the options --list
or --info
to show more information.
Examples:
root [ / ]# tdnf updateinfo
Refreshing metadata for: 'VMware Photon Linux 5.0 (aarch64) Updates'
photon-updates 3570 100%
photon-updates 573850 100%
photon-updates 2354807 100%
photon-updates 5998 100%
photon-updates 256331 100%
5 Security notice(s)
root [ / ]# tdnf updateinfo --list
patch:PHSA-2024-5.0-0342 Security nss-libs-3.78-9.ph5.aarch64.rpm
patch:PHSA-2024-5.0-0355 Security krb5-1.20.2-4.ph5.aarch64.rpm
patch:PHSA-2024-5.0-0364 Security expat-libs-2.6.0-3.ph5.aarch64.rpm
patch:PHSA-2024-5.0-0345 Security curl-libs-8.7.1-3.ph5.aarch64.rpm
patch:PHSA-2024-5.0-0345 Security curl-8.7.1-3.ph5.aarch64.rpm
root [ / ]# tdnf updateinfo --info
Name : nss-libs-3.78-9.ph5.aarch64.rpm
Update ID : patch:PHSA-2024-5.0-0342
Type : Security
Updated : Wed Aug 7 19:29:41 2024
Needs Reboot: 0
...
An alias for update
, see above.
This command upgrades to the version of the package that you specify. Example:
tdnf upgrade-to ruby2.3
The commands and options of tdnf are, at present, a subset of those of dnf. For more help with tdnf commands, see the DNF documentation.