-
Notifications
You must be signed in to change notification settings - Fork 54
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 is a tool for querying package repositories and installed packages. It allows you to search for packages, examine their metadata, dependencies, and relationships without installing or modifying them.
tdnf repoquery [OPTIONS] [PACKAGE_SPEC...]These options determine which packages to query:
-
--available- Query packages available in repositories (default behavior) -
--installed- Query only installed packages -
--userinstalled- Query only user-installed packages (not dependencies) -
--extras- Query packages installed but not available in any repository -
--upgrades- Query packages that have available upgrades -
--duplicates- Query packages with multiple versions installed
-
--arch ARCH- Limit query to specific architecture(s) -
--file FILE- Query packages that contain the specified file
These options find packages based on their dependency relationships:
-
--whatprovides CAPABILITY- Find packages that provide the specified capability -
--whatrequires CAPABILITY- Find packages that require the specified capability -
--whatobsoletes CAPABILITY- Find packages that obsolete the specified capability -
--whatconflicts CAPABILITY- Find packages that conflict with the specified capability -
--whatrecommends CAPABILITY- Find packages that recommend the specified capability -
--whatsuggests CAPABILITY- Find packages that suggest the specified capability -
--whatsupplements CAPABILITY- Find packages that supplement the specified capability -
--whatenhances CAPABILITY- Find packages that enhance the specified capability -
--whatdepends CAPABILITY- Find packages that have any dependency on the specified capability
These options control what information is displayed about the selected packages:
-
--list- List files contained in the package -
--changelogs- Show package changelog information -
--location- Show package download location/URL -
--source- Show source package information
-
--provides- Show what capabilities the package provides -
--requires- Show what the package requires -
--requires-pre- Show pre-installation requirements -
--obsoletes- Show what the package obsoletes -
--conflicts- Show what the package conflicts with -
--recommends- Show what the package recommends -
--suggests- Show what the package suggests -
--supplements- Show what the package supplements -
--enhances- Show what the package enhances -
--depends- Show all dependency information
-
--qf FORMATor--queryformat FORMAT- Use custom format string for output
When using --qf, you can use these format tags:
-
%{name}- Package name -
%{version}- Package version -
%{release}- Package release -
%{evr}- Epoch:Version-Release -
%{arch}- Package architecture
-
%{size}- Package size -
%{downloadsize}- Download size -
%{installsize}- Installed size
-
%{summary}- Package summary -
%{description}- Package description -
%{license}- Package license -
%{url}- Package homepage URL
-
%{sourcename}- Source package name -
%{sourcerpm}- Source RPM name
-
%{reponame}- Repository name -
%{location}- Package location/URL
-
%{provides}- What the package provides -
%{requires}- What the package requires -
%{obsoletes}- What the package obsoletes -
%{conflicts}- What the package conflicts with -
%{recommends}- What the package recommends -
%{suggests}- What the package suggests -
%{supplements}- What the package supplements -
%{enhances}- What the package enhances
##### List all available packages
tdnf repoquery
##### Query specific package
tdnf repoquery vim
##### Query installed packages only
tdnf repoquery --installed
##### Query packages available for upgrade
tdnf repoquery --upgrades##### Find what provides a specific file
tdnf repoquery --whatprovides /bin/bash
##### Find what requires a specific package
tdnf repoquery --whatrequires glibc
##### Show all dependencies of a package
tdnf repoquery --depends vim##### Find packages containing a specific file
tdnf repoquery --file /usr/bin/python3
##### Query packages for specific architecture
tdnf repoquery --arch x86_64##### Show package name and version
tdnf repoquery --qf "%{name}-%{version}" vim
##### Show detailed package information
tdnf repoquery --qf "Name: %{name}\nVersion: %{evr}\nArch: %{arch}\nRepo: %{reponame}\n" vim
##### Show package with its dependencies
tdnf repoquery --qf "%{name}: %{requires}" vim##### List files in a package
tdnf repoquery --list vim
##### Show package changelog
tdnf repoquery --changelogs vim
##### Show package download location
tdnf repoquery --location vim
##### Show what a package provides
tdnf repoquery --provides vim##### Find duplicate packages
tdnf repoquery --duplicates
##### Find orphaned packages (extras)
tdnf repoquery --extras
##### Find user-installed packages
tdnf repoquery --userinstalled
##### Combine options: find user-installed packages with upgrades available
tdnf repoquery --userinstalled --upgrades- Package specifications can include wildcards (e.g.,
vim*) - Multiple architectures can be specified with
--archby using the option multiple times - The
--qfoption supports escape sequences like\nfor newlines and\tfor tabs
-
tdnf search- Search for packages by name or description -
tdnf info- Show detailed information about specific packages -
tdnf list- List packages with basic information -
tdnf provides- Find packages that provide specific files or capabilities
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.