# How to change the "default" for a dnf module?

**URL:** <https://forums.rockylinux.org/t/how-to-change-the-default-for-a-dnf-module/4451>\
**Category:** Rocky Linux Help & Support\
**Created:** [November 2, 2021, 11:38pm UTC](https://forums.rockylinux.org/t/how-to-change-the-default-for-a-dnf-module/4451 "2021-11-02T23:38:26Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![SomervilleTom](https://avatars.discourse-cdn.com/v4/letter/s/8797f3/32.png) [@SomervilleTom](https://forums.rockylinux.org/u/SomervilleTom)\
**Post date:** [November 2, 2021, 11:38pm UTC](https://forums.rockylinux.org/t/how-to-change-the-default-for-a-dnf-module/4451/1 "2021-11-02T23:38:26Z")

</div>

I would like the “default” postgresql module that I use to be the current version 13 instead of the original version 10. I’ve found and applied the commands needed to enable version 13. Here is the current status of that module on my system:

```auto
dnf module list postgresql
Last metadata expiration check: 2:05:19 ago on Tue 02 Nov 2021 09:00:00 PM UTC.
Rocky Linux 8 - AppStream
Name Stream Profiles Summary                                      
postgresql 9.6 client, server [d] PostgreSQL server and client module          
postgresql 10 [d] client, server [d] PostgreSQL server and client module          
postgresql 12 client, server [d] PostgreSQL server and client module          
postgresql 13 [e] client, server [d] PostgreSQL server and client module          

Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled

```

I have looked all over the web trying to find a `dnf` command to change the default from version 10 to version 13 to no avail. Here’s what I’d like to be able to see in response to the above command:

```auto
dnf module list postgresql
Last metadata expiration check: 2:05:19 ago on Tue 02 Nov 2021 09:00:00 PM UTC.
Rocky Linux 8 - AppStream
Name Stream Profiles Summary                                      
postgresql 9.6 client, server [d] PostgreSQL server and client module          
postgresql 10 client, server [d] PostgreSQL server and client module          
postgresql 12 client, server [d] PostgreSQL server and client module          
postgresql 13 [d, e] client, server [d] PostgreSQL server and client module          

Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled

```

This is all because I want to install postgresql. Here’s what I happens when I try:

```auto
dnf install postgresql13 postgresql13-server
Last metadata expiration check: 2:40:12 ago on Tue 02 Nov 2021 09:00:00 PM UTC.
No match for argument: postgresql13
No match for argument: postgresql13-server
Error: Unable to find a match: postgresql13 postgresql13-server

```

I thought I understood `dnf`, and I clearly do not.

What am I missing?

---

<div class="post-metadata">

**Author:** ![jlehtone](https://avatars.discourse-cdn.com/v4/letter/j/e9a140/32.png) [@jlehtone](https://forums.rockylinux.org/u/jlehtone)\
**Post date:** [November 3, 2021, 8:16am UTC](https://forums.rockylinux.org/t/how-to-change-the-default-for-a-dnf-module/4451/2 "2021-11-03T08:16:25Z")

</div>

Lets see (this is from Alma, but should be close enough):

```auto
# dnf module list postg*
Last metadata expiration check: 0:19:24 ago on Wed 03 Nov 2021 09:35:31 AM EET.
AlmaLinux 8 - x86_64 - AppStream - SBL
Name Stream Profiles Summary                                      
postgresql 9.6 client, server [d] PostgreSQL server and client module          
postgresql 10 [d] client, server [d] PostgreSQL server and client module          
postgresql 12 client, server [d] PostgreSQL server and client module          
postgresql 13 client, server [d] PostgreSQL server and client module          

Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled

# dnf list postg*
Last metadata expiration check: 0:21:41 ago on Wed 03 Nov 2021 09:35:31 AM EET.
Available Packages
postgresql.x86_64 10.17-1.module_el8.4.0+2480+895597ab appstream
postgresql-contrib.x86_64 10.17-1.module_el8.4.0+2480+895597ab appstream
postgresql-docs.x86_64 10.17-1.module_el8.4.0+2480+895597ab appstream
postgresql-jdbc.noarch 42.2.3-3.el8_2 appstream
postgresql-jdbc-javadoc.noarch 42.2.3-3.el8_2 appstream
postgresql-odbc.x86_64 10.03.0000-2.el8 appstream
postgresql-odbc-tests.x86_64 10.03.0000-2.el8 appstream
postgresql-plperl.x86_64 10.17-1.module_el8.4.0+2480+895597ab appstream
postgresql-plpython3.x86_64 10.17-1.module_el8.4.0+2480+895597ab appstream
postgresql-pltcl.x86_64 10.17-1.module_el8.4.0+2480+895597ab appstream
postgresql-server.x86_64 10.17-1.module_el8.4.0+2480+895597ab appstream
postgresql-server-devel.x86_64 10.17-1.module_el8.4.0+2480+895597ab appstream
postgresql-static.x86_64 10.17-1.module_el8.4.0+2480+895597ab appstream
postgresql-test.x86_64 10.17-1.module_el8.4.0+2480+895597ab appstream
postgresql-test-rpm-macros.x86_64 10.17-1.module_el8.4.0+2480+895597ab appstream
postgresql-upgrade.x86_64 10.17-1.module_el8.4.0+2480+895597ab appstream
postgresql-upgrade-devel.x86_64 10.17-1.module_el8.4.0+2480+895597ab appstream

```

There we saw package ‘postgresql’. Lets switch to stream 13:

```auto
# dnf module enable postgresql:13
Last metadata expiration check: 0:22:12 ago on Wed 03 Nov 2021 09:35:31 AM EET.
Dependencies resolved.
===================================================================================================================
 Package Architecture Version Repository Size
===================================================================================================================
Enabling module streams:
 postgresql 13                                                          

Transaction Summary
===================================================================================================================

Is this ok [y/N]: y
Complete!

```

Red Hat instructions show additional commands: [Chapter&nbsp;6.&nbsp;Managing versions of Application Stream content Red Hat Enterprise Linux 8 | Red Hat Customer Portal](https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/installing_managing_and_removing_user-space_components/managing-versions-of-appstream-content_using-appstream#modular-dependencies-and-stream-changes_managing-versions-of-appstream-content)

What did we get?

```auto
# dnf module list postg*
Last metadata expiration check: 0:22:28 ago on Wed 03 Nov 2021 09:35:31 AM EET.
AlmaLinux 8 - x86_64 - AppStream - SBL
Name Stream Profiles Summary                                      
postgresql 9.6 client, server [d] PostgreSQL server and client module          
postgresql 10 [d] client, server [d] PostgreSQL server and client module          
postgresql 12 client, server [d] PostgreSQL server and client module          
postgresql 13 [e] client, server [d] PostgreSQL server and client module          

Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled

# dnf list postg*
Last metadata expiration check: 0:22:34 ago on Wed 03 Nov 2021 09:35:31 AM EET.
Available Packages
postgres-decoderbufs.x86_64 0.10.0-2.module_el8.4.0+2484+85259292 appstream
postgresql.x86_64 13.3-1.module_el8.4.0+2484+85259292 appstream
postgresql-contrib.x86_64 13.3-1.module_el8.4.0+2484+85259292 appstream
postgresql-docs.x86_64 13.3-1.module_el8.4.0+2484+85259292 appstream
postgresql-jdbc.noarch 42.2.3-3.el8_2 appstream
postgresql-jdbc-javadoc.noarch 42.2.3-3.el8_2 appstream
postgresql-odbc.x86_64 10.03.0000-2.el8 appstream
postgresql-odbc-tests.x86_64 10.03.0000-2.el8 appstream
postgresql-plperl.x86_64 13.3-1.module_el8.4.0+2484+85259292 appstream
postgresql-plpython3.x86_64 13.3-1.module_el8.4.0+2484+85259292 appstream
postgresql-pltcl.x86_64 13.3-1.module_el8.4.0+2484+85259292 appstream
postgresql-server.x86_64 13.3-1.module_el8.4.0+2484+85259292 appstream
postgresql-server-devel.x86_64 13.3-1.module_el8.4.0+2484+85259292 appstream
postgresql-static.x86_64 13.3-1.module_el8.4.0+2484+85259292 appstream
postgresql-test.x86_64 13.3-1.module_el8.4.0+2484+85259292 appstream
postgresql-test-rpm-macros.noarch 13.3-1.module_el8.4.0+2484+85259292 appstream
postgresql-upgrade.x86_64 13.3-1.module_el8.4.0+2484+85259292 appstream
postgresql-upgrade-devel.x86_64 13.3-1.module_el8.4.0+2484+85259292 appstream

```

We still see package ‘postgresql’ but now its version is not 10 any more.

The names of packages are same in every _stream_.

These streams have two profiles: ‘client’ and ‘server’. The latter is default. Profiles are lists of packages, like yum groups.

```auto
# dnf module info --profile postgresql:13
Last metadata expiration check: 0:35:43 ago on Wed 03 Nov 2021 09:35:31 AM EET.
Name : postgresql:13:8040020210411111349:9f9e2e7e:x86_64
client : postgresql
server : postgresql-server

Name : postgresql:13:8040020210610141046:522a0ee4:x86_64
client : postgresql
server : postgresql-server

```

Therefore,

```auto
dnf module install postgresql
// is same as
dnf install @postgresql
// and in practice same as
dnf install postgresql-server

```

---

<div class="post-metadata">

**Author:** ![SomervilleTom](https://avatars.discourse-cdn.com/v4/letter/s/8797f3/32.png) [@SomervilleTom](https://forums.rockylinux.org/u/SomervilleTom)\
**Post date:** [November 3, 2021, 12:44pm UTC](https://forums.rockylinux.org/t/how-to-change-the-default-for-a-dnf-module/4451/3 "2021-11-03T12:44:20Z")

</div>

I appreciate your attention to this, and it does indeed reflect my experience.

I was perhaps unclear about my concern. I call your attention to the result of `dnf module list postg*`, specifically the line associated with a `Stream` value of `10`:

```auto
postgresql 10 [d] client, server [d] PostgreSQL server and client module          

```

I’d like to focus our attention on the `[d]` attached to the `Stream` value in that row.

Each of us has successfully enabled and loaded v13 of `postgresql`. After doing that, so that v13 is the installed version on my system, I see the following in response to `dnf module list postg*`:

```auto
# dnf module list postg*
Last metadata expiration check: 2:51:10 ago on Wed 03 Nov 2021 09:52:15 AM UTC.
Rocky Linux 8 - AppStream
Name Stream Profiles Summary                                      
postgresql 9.6 client, server [d] PostgreSQL server and client module          
postgresql 10 [d] client, server [d] PostgreSQL server and client module          
postgresql 12 client, server [d] PostgreSQL server and client module          
postgresql 13 [e] client, server [d] PostgreSQL server and client module          

Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled

```

I think this is telling me that v13 is enabled and v10 is (still) the default.

How do I make v13 the default?

---

<div class="post-metadata">

**Author:** ![anemarkus](https://avatars.discourse-cdn.com/v4/letter/a/51bf81/32.png) [@anemarkus](https://forums.rockylinux.org/u/anemarkus)\
**Post date:** [November 3, 2021, 1:36pm UTC](https://forums.rockylinux.org/t/how-to-change-the-default-for-a-dnf-module/4451/4 "2021-11-03T13:36:25Z")

</div>

> [@SomervilleTom](#):
>
> How do I make v13 the default?

You dont and dont have to. There is only one stream enabled at a time. Before you can install packages from a stream you have to enable it. Think of a stream like a repository inside a repository. In your case you have postgresql:13 enabled and it does not matter anymore what the default stream is. Only packages from the enabled stream are visible, but the default stream is special.

Packages from the default stream are visible although no module stream is enabled, i.e. no postgresql stream is enabled but you can install packages from the default stream:

```auto
[root@test ~]# dnf module list postgresql
Updating Subscription Management repositories.
Last metadata expiration check: 0:29:10 ago on Wed 03 Nov 2021 13:59:53 CET.
Red Hat Enterprise Linux 8 for x86_64 - AppStream (RPMs)
Name Stream Profiles Summary                              
postgresql 9.6 client, server [d] PostgreSQL server and client module  
postgresql 10 [d] client, server [d] PostgreSQL server and client module  
postgresql 12 client, server [d] PostgreSQL server and client module  
postgresql 13 client, server [d] PostgreSQL server and client module  

Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled

```

you see, no stream is enabled, but you can install packages from the default stream (it will also enable the default postgresql:10 stream if you have a closer look):

```auto
[root@test ~]# dnf install postgresql-server
Updating Subscription Management repositories.
Last metadata expiration check: 0:29:29 ago on Wed 03 Nov 2021 13:59:53 CET.
Dependencies resolved.
================================================================================
 Package Arch Version Repository Size
================================================================================
Installing:
 postgresql-server x86_64 10.17-1.module+el8.4.0+11249+895597ab
                                         rhel-8-for-x86_64-appstream-rpms 5.1 M
Installing dependencies:
 libpq x86_64 13.3-1.el8_4 rhel-8-for-x86_64-appstream-rpms 197 k
 postgresql x86_64 10.17-1.module+el8.4.0+11249+895597ab
                                         rhel-8-for-x86_64-appstream-rpms 1.5 M
Enabling module streams:
 postgresql 10                                                   

Transaction Summary
================================================================================
Install 3 Packages

Total download size: 6.8 M
Installed size: 26 M
Is this ok [y/N]:

```

---

<div class="post-metadata">

**Author:** ![SomervilleTom](https://avatars.discourse-cdn.com/v4/letter/s/8797f3/32.png) [@SomervilleTom](https://forums.rockylinux.org/u/SomervilleTom)\
**Post date:** [November 3, 2021, 2:13pm UTC](https://forums.rockylinux.org/t/how-to-change-the-default-for-a-dnf-module/4451/5 "2021-11-03T14:13:29Z")

</div>

I appreciate your response, please bear with me while I try and come to terms with it.

> You dont and dont have to  
> In that case the tool should not include the “d” in its user interface.

SOMETHING makes a particular version the “default” version. I want to know what that something is. If it isn’t part of `dnf`, then so be it – but it is surely set someplace in the OS.

I understand how the module mechanism works. I mostly understand how `dnf` works.

If it is literally not possible to change the “default” version of a module, then I view that as a significant flaw in the system. I suspect that it’s possible, but not from `dnf`. In that case, my thought is to change `dnf` to permit it.

In any case, I’ve at least got v13 of postgresql installed now.

.

---

<div class="post-metadata">

**Author:** ![jlehtone](https://avatars.discourse-cdn.com/v4/letter/j/e9a140/32.png) [@jlehtone](https://forums.rockylinux.org/u/jlehtone)\
**Post date:** [November 3, 2021, 2:28pm UTC](https://forums.rockylinux.org/t/how-to-change-the-default-for-a-dnf-module/4451/6 "2021-11-03T14:28:34Z")

</div>

AFAIK, the modules/streams/profiles are part of repository metadata just like the yum groups. Not part of the tool (dnf) nor of the packages. (Although, it is the tool that reads and acts on the repository content.)

[Glossary :: Fedora Docs](https://docs.fedoraproject.org/en-US/modularity/glossary/) states:

> Default Module Stream is a [Module Stream](https://docs.fedoraproject.org/en-US/modularity/glossary/#_module_stream) pre-selected by the software distributor (such as Fedora or RHEL authorities) to be implicitly considered for package installation and dependency resolution and automatically enabled when packages from the stream are needed. One Module can only have zero or one Default Module Stream.

In other words, the default module stream is _implicitly enabled_ only when no stream is _explicitly enabled_.

You can mirror a repository and then rewrite module metadata, but what you achieve is same as with enabling the stream that you want as “default”.

---

<div class="post-metadata">

**Author:** ![SomervilleTom](https://avatars.discourse-cdn.com/v4/letter/s/8797f3/32.png) [@SomervilleTom](https://forums.rockylinux.org/u/SomervilleTom)\
**Post date:** [November 3, 2021, 2:53pm UTC](https://forums.rockylinux.org/t/how-to-change-the-default-for-a-dnf-module/4451/7 "2021-11-03T14:53:22Z")

</div>

Understood, I had already read the following as (emphasis mine):

> Default Module Stream is a [Module Stream](https://docs.fedoraproject.org/en-US/modularity/glossary/#_module_stream) **pre-selected by the software distributor** (such as Fedora or RHEL authorities)

I’m asking what mechanism the “software distributor” (in this case Rocky LInux I think) uses to “pre-select” the default module stream.

That must be embedded in the system someplace – where? How does someone with `root` access alter that?

The entire “module” system is, I think, a relatively new addition to CentOS, and I think it comes with `dnf` (I don’t remember a module mechanism in CentOS 7 and plain-old `yum`). I may be mistaken about that, I’m just saying that I don’t remember these issues in my several years of managing CentOS 7 systems.

If there is to be a “default”, then I suggest that the root user needs to be able to change that default. The case in point, here, is that v10 of postgresql is way out of date – at least by my read of current resources that use and depend on postgresql.

---

<div class="post-metadata">

**Author:** ![jlehtone](https://avatars.discourse-cdn.com/v4/letter/j/e9a140/32.png) [@jlehtone](https://forums.rockylinux.org/u/jlehtone)\
**Post date:** [November 3, 2021, 6:12pm UTC](https://forums.rockylinux.org/t/how-to-change-the-default-for-a-dnf-module/4451/8 "2021-11-03T18:12:25Z")

</div>

> [@SomervilleTom](#):
>
> I’m asking what mechanism the “software distributor” (in this case Rocky LInux I think) uses to “pre-select” the default module stream.
> 
> That must be embedded in the system someplace – where?

The root user is able to do `dnf module enable xxx:vers`. That stores into the system that “the default” in this system is _xxx:vers_ rather than whatever the repository offers _by default_.

Look DNF config in `/etc/dnf/modules.d/`

Consider that there were only one “marker”, not two: ‘default’ and ‘enabled’. Then the marker has to stored/installed into the system for user to change it and it is less clear what is repository marker and what is user’s customization. At least I’d guess that the rationale is something along those lines.

Streams in AppStream have lifecycle. See [Red Hat Enterprise Linux Application Streams Life Cycle - Red Hat Customer Portal](https://access.redhat.com/support/policy/updates/rhel8-app-streams-life-cycle)  
Example:

| Application Stream | Release Date | Retirement Date | Release |
| --- | --- | --- | --- |
| postgresql 13 | May 2021 | May 2026 | 8.4 |
| postgresql 12 | Feb 2020 | May 2029 | 8.1.1 |
| postgresql 10 | May 2019 | May 2024 | 8.0.0 |
| postgresql 9.6 | May 2019 | Nov 2021 | 8.0.0 |
| The 10 was the latest at the time of the release (May 2019). That explains why it was set as a default. | | | |

If the repository would now change the default, users of default would get their well validated install of postgresql upgraded to something. That is obviously not ok.  
It could be that when the 10 disappears in May 2024 then there will be no new default. No default at all.

---

<div class="post-metadata">

**Author:** ![SomervilleTom](https://avatars.discourse-cdn.com/v4/letter/s/8797f3/32.png) [@SomervilleTom](https://forums.rockylinux.org/u/SomervilleTom)\
**Post date:** [November 3, 2021, 6:24pm UTC](https://forums.rockylinux.org/t/how-to-change-the-default-for-a-dnf-module/4451/9 "2021-11-03T18:24:06Z")

</div>

Got it, and I appreciate your patience.

---

<div class="post-metadata">

**Author:** ![brian](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.rockylinux.org/brian/32/5777_2.png) [@brian](https://forums.rockylinux.org/u/brian)\
**Post date:** [August 25, 2023, 4:02am UTC](https://forums.rockylinux.org/t/how-to-change-the-default-for-a-dnf-module/4451/10 "2023-08-25T04:02:29Z")

</div>


