How to edit repositories for dnf in Cooker

cooker
repos
dnf
Tags: #<Tag:0x00007ff2c15c52b8> #<Tag:0x00007ff2c15c5060> #<Tag:0x00007ff2c15c4d90>

(Ben Bullard) #1

Currently this will apply to Cooker installations and for Lx 4 ALPHA/BETA until repos are split and we then have Lx 4.0 repos.

Among the changes is switching from urpmi/rpm5.org to dnr/rpm.org. For most of us users we don’t need to be concerned about the rpm part that is just different versions of rpm and maintained by different people, this will affect developers but users likely won’t notice anything different. The change from urpmi to dnf will be noticed by users as the commands will be different. Users can find most anything they need with ‘dnf --help’. For more information ‘man dnf’ should do it.

Anyway currently the repos as installed are not quite logical and what a user should have so we need to edit the repos. They are located in the directory ‘/etc/yum.repos.d’. You can use whatever is your preferred text editor, for this demo I’ll use ‘nano’ which is simple and easy enough for the average Linux Monkey. :monkey:

Here is what we see as of 2018-11-25:

$ ls -lh /etc/yum.repos.d
total 40K
-rw-r--r-- 1 live vboxsf 1.7K Nov 24 07:52 cooker-contrib-i686.repo
-rw-r--r-- 1 live vboxsf 1.7K Nov 24 07:52 cooker-contrib-x86_64.repo
-rw-r--r-- 1 live vboxsf  860 Nov 24 07:52 cooker-contrib-x86_64-source.repo
-rw-r--r-- 1 live vboxsf 1.6K Nov 24 07:52 cooker-i686.repo
-rw-r--r-- 1 live vboxsf 1.7K Nov 24 07:52 cooker-nonfree-i686.repo
-rw-r--r-- 1 live vboxsf 1.7K Nov 25 11:12 cooker-nonfree-x86_64.repo
-rw-r--r-- 1 live vboxsf  866 Nov 24 07:52 cooker-nonfree-x86_64-source.repo
-rw-r--r-- 1 live vboxsf 1.7K Nov 24 07:52 cooker-restricted-i686.repo
-rw-r--r-- 1 live vboxsf 1.8K Nov 24 07:52 cooker-restricted-x86_64.repo
-rw-r--r-- 1 live vboxsf  887 Nov 24 07:52 cooker-restricted-x86_64-source.repo
-rw-r--r-- 1 live vboxsf 1.6K Nov 24 07:52 cooker-x86_64.repo
-rw-r--r-- 1 live vboxsf  797 Nov 24 07:52 cooker-x86_64-source.repo
-rw-r--r-- 1 root root   1.7K Nov 24 07:52 openmandriva-contrib-i686.repo
-rw-r--r-- 1 root root   1.8K Nov 24 07:52 openmandriva-contrib-x86_64.repo
-rw-r--r-- 1 root root    881 Nov 24 07:52 openmandriva-contrib-x86_64-source.repo
-rw-r--r-- 1 root root   1.6K Nov 24 07:52 openmandriva-i686.repo
-rw-r--r-- 1 root root   1.7K Nov 24 07:52 openmandriva-nonfree-i686.repo
-rw-r--r-- 1 root root   1.8K Nov 24 07:52 openmandriva-nonfree-x86_64.repo
-rw-r--r-- 1 root root    887 Nov 24 07:52 openmandriva-nonfree-x86_64-source.repo
-rw-r--r-- 1 root root   1.8K Nov 24 07:52 openmandriva-restricted-i686.repo
-rw-r--r-- 1 root root   1.8K Nov 24 07:52 openmandriva-restricted-x86_64.repo
-rw-r--r-- 1 root root    908 Nov 24 07:52 openmandriva-restricted-x86_64-source.repo
-rw-r--r-- 1 root root   1.6K Nov 24 07:52 openmandriva-x86_64.repo
-rw-r--r-- 1 root root    818 Nov 24 07:52 openmandriva-x86_64-source.repo

Why so many? Devs in their infinite wisdom have included both Cooker and Lx 4 repos even though Lx 4 repos do not exist yet. Also there are source repos and i686 repos for both Cooker and Lx 4. Users will only need i686 for installing 32 bit software and most users will never use source repos.

Next if I run ‘dnf --refresh upgrade’ the command for system upgrade I will see these enabled:

# dnf --refresh upgrade
OpenMandriva Cooker - x86_64 - Nonfree - Test Updates                                                                                                        1.1 kB/s | 1.5 kB     00:01    
OpenMandriva Cooker - x86_64 - Nonfree - Test Updates - Debug                                                                                                1.1 kB/s | 1.5 kB     00:01    
OpenMandriva Cooker - x86_64 - Nonfree - Updates                                                                                                             1.1 kB/s | 1.5 kB     00:01    
OpenMandriva Cooker - x86_64 - Nonfree - Updates - Debug                                                                                                     1.1 kB/s | 1.5 kB     00:01    
OpenMandriva Cooker - x86_64 - Nonfree                                                                                                                       1.1 kB/s | 1.5 kB     00:01    
OpenMandriva Cooker - x86_64 - Nonfree - Debug                                                                                                               1.1 kB/s | 1.5 kB     00:01    
OpenMandriva Cooker - x86_64 - Updates                                                                                                                       1.1 kB/s | 1.5 kB     00:01    
OpenMandriva Cooker - x86_64                                                                                                                                 1.1 kB/s | 1.5 kB     00:01    
OpenMandriva Cooker - x86_64                                                                                                                                 1.9 MB/s |  14 MB     00:06    
OpenMandriva 4.0 - x86_64                                                                                                                                    127  B/s | 169  B     00:01    
OpenMandriva 4.0 - x86_64 - Updates

So we see we have a lot of non-free stuff enabled and no contrib or restricted, not so good. Also we have ’ OpenMandriva 4.0 - x86_64’ and ‘OpenMandriva 4.0 - x86_64 - Updates’ enabled even though those do not exist. So lets disable those.

The way the repos are organized is that there is one file each for main, contrib, non-free, and restricted per arch. The main ones do not say main they will just say the arch so the file ‘openmandriva-x86_64.repo’ is for everything Lx 4 main including release, updates, testing and debug repos. So we need to edit that file to disable main release and main updates.

# nano /etc/yum.repos.d/openmandriva-x86_64.repo

and we have:

To disable the release and updates repos we change for each ‘enabled=1’ to ‘enabled=0’ so the file now looks like:

Next I’m going to edit the 4 x86_64 repos so that the release repo is enabled and all others are disabled. Why? Users don’t need updates or testing because they are empty. No one needs debug repos unless they are debugging something. If you want to confirm just copy and paste some of the URL’s for the files to your browser and see for yourself. There are 4 files to edit:

/etc/yum.repos.d/cooker-x86_64.repo
/etc/yum.repos.d/cooker-contrib-x86_64.repo
/etc/yum.repos.d/cooker-nonfree-x86_64.repo

Optional:

/etc/yum.repos.d/cooker-restricted-x86_64.repo

You want all of them to have for the release repo (the first one in each list, read the URL) to say ‘enabled=1’ and everything else to say ‘enabled=0’. I’ll post screen shots of the ‘/etc/yum.repos.d/cooker-nonfree-x86_64.repo’ before and after as it is the one that will have the most changes.

Before everything says ‘enabled=1’:

After only the release repos will say ‘enabled=1’ all others now say ‘enabled=0’:

Once you get in to this and actually read what is in the files, most importantly what is in the URL’s this will all start to make sense.

Here’s hoping this helps some of you and does not confuse people.

:see_no_evil::hear_no_evil::speak_no_evil:

Remember: In Cooker you do not need any ‘updates’ repos. Why? They are empty. Nothing in them. (This is the opposite for any Official release like Lx 3 or Lx 4, for those updates repos are essential to update your system.) Testing repos are rarely used in Cooker and generally can be ignored unless prompted by a developer regarding a specific issue. Debug repos are only needed if prompted by a developer for debugging a Bug.

Note: It would be great if any of you see any errors or any way to make this better to let me know or post here. :flushed:


(rugyada) #2

Great how-to! :+1:

Thank you @ben79


(Ben Bullard) #3

Now the result of the above exercise is that when I run ‘dnf --refresh upgrade’ I will see only the 4 x86_64 release repos which will look like:

If you see the words debug, testing, or updates in any listed repos then you have something enabled that you don’t need (normally) and should disable.

If you need to install something that is 32 bit software and there are missing dependencies you will need to enable the release repo only of i686 repo:

cooker-i686.repo

and maybe even the release repo of one or more of the other 3 i686 repos:

cooker-contrib-i686.repo
cooker-nonfree-i686.repo
cooker-restricted-i686.repo

Generally it is considered “best practice” in OM Lx to keep i686 repos disabled on x86_64 systems and only enable if you really need them to install or update 32-bit software. Most users won’t need any 32-bit software. Remember that anything that isn’t developed for 64-bit now a days is about 10-15 years behind the times. I would be very wary of any developers that far behind.


(rugyada) #4


(Ben Bullard) #5

What do the various repos mean, why do they exist? I need to get developers to confirm but my understanding is this:

Main: opensource and OpenMandriva maintained
Non-free : not-opensource OpenMandriva can’t change code so can’t really maintain
Contrib: opensource and OM Community maintained
Restricted: opensource mostly OpenMandriva maintained but some package here may have legal/patent issues in some countries.

It is known that our community maintained contrib repo is not at all well maintained at this time. Frankly there are a lot of packages that won’t install or won’t work. Anything that does work users are welcome to use.

:monkey_face: