In general, to remove a module installed on your system, use the following command:
$ sudo dnf module remove MODULE:STREAM/PROFILE
There is a situation when a specific package has been installed first, and then a module has been installed after that. Example:
$ sudo dnf install ruby $ sudo dnf module install ruby:2.6/default
In this case, running the
dnf module remove command would not remove the
ruby package, as DNF remembers that package has been explicitly installed.
To make the
ruby package uninstalled with the
dnf module remove command, run the following:
$ sudo dnf mark group ruby $ sudo dnf module remove ruby:2.6/default
That is because DNF remembers a reason why a package has been installed. There are three, sorted from the strongest:
Because modules use the group reason, which is weker than user used by the
dnf install command, the package stays on the system after running the
dnf module remove command. "Downgrading" it to group, however, makes the
dnf module remove remove it as well.