Bug 1218399

Summary: YaST Software Repositories adds new repo URL as service
Product: [openSUSE] openSUSE Tumbleweed Reporter: Frank Krüger <fkrueger>
Component: YaST2Assignee: Ladislav Slezák <lslezak>
Status: RESOLVED FIXED QA Contact: Jiri Srain <jsrain>
Severity: Normal    
Priority: P2 - High CC: fkrueger, jpupava, jreidinger, lslezak, mendres82, opensuse, zypp-maintainers
Version: Current   
Target Milestone: ---   
Hardware: x86-64   
OS: Other   
URL: https://trello.com/c/0IfDlkF5
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: yast2 adding repo
bsc#1218399_add_repo_url_steps_1-4
y2logs
y2log add repo url
Screenshot: Adding a repo as URL
Screenshot: After adding, the repo shows up as service
y2log from one "yast2 repositories" run (with Y2DEBUG=1 ZYPP_FULLLOG=1)
Add Repo URL

Description Frank Krüger 2023-12-26 09:48:07 UTC
Given TW20231222 with yast2-packager-5.0.1-1.1.x86_64, adding a new repo with its URL saves it as service not as repo. Using "zypper ar" works just fine. After a restart of yast's software repos an error message claims that 'repoindex.xml' was not found on the medium, even though it exists:

"Bei der Wiederherstellung der Repository-Konfiguration sind Fehler aufgetreten.
Fehler beim Aktualisieren des Dienstes service_1 (https://download.opensuse.org/history/20231201/tumbleweed/repo/oss/): Datei './repo/repoindex.xml' auf Medium 'https://download.opensuse.org/history/20231201/tumbleweed/repo/oss/?cookies=0' nicht gefunden". Any idea?
Comment 1 garry fielding 2023-12-26 21:22:50 UTC
I had the same issue - with yast trying to add a new repo request as a service - after completing a fresh install using the 22122023 snapshot.  As a sort term solution I reinstalled the previous version of libzypp (1.1.x86_64.rpm) - which is still in the Main OSS repo - and locked this.
Comment 2 Josef Reidinger 2023-12-27 09:31:03 UTC
Lada - my wild guess is that it is caused by your latest change that fix saving services at https://github.com/yast/yast-packager/blob/master/package/yast2-packager.changes#L4
Comment 3 Ladislav Slezák 2024-01-08 12:00:30 UTC
I'm unable to reproduce the problem using openSUSE-Tumbleweed-DVD-x86_64-Snapshot20240103-Media.iso.

I was able to add these repositories without any problem:
https://download.opensuse.org/repositories/YaST:/Head/openSUSE_Tumbleweed/
https://download.opensuse.org/history/20231208/tumbleweed/repo/oss/

Please try it again in the latest TW snapshot. If you can still reproduce the problem then describe the exact steps what did you do. And also attach the YaST logs (https://en.opensuse.org/openSUSE:Report_a_YaST_bug).
Comment 4 Ladislav Slezák 2024-01-08 12:01:47 UTC
(In reply to Ladislav Slezák from comment #3)
> I'm unable to reproduce the problem using
> openSUSE-Tumbleweed-DVD-x86_64-Snapshot20240103-Media.iso.

BTW that version still contains yast2-packager-5.0.1-1.1.x86_64...
Comment 5 garry fielding 2024-01-08 17:11:01 UTC
Thanks for posting.

A bit strange!  I have this issue as per post 1.  

I am now using a (further) fresh install of tumbleweed based on the snapshot of the 23122023 updated daily since.  I had the same issue, on install, of being unable to add repos by using yast.  As before, I installed the previous version of  libzypp (version 17.31.25-1.1.x86_64.rpm), then locked this and this workaround worked fine.

As you suggested, I have just updated libzypp to the latest version (17.31.27-1.1.x86_64.rpm) and again am unable to add repos to yeast using zast.  As a test, I removed packman and tried to add this back.  Again yast tried to add this as a a 'service' rather than as a 'repo'. 

I will submit my Yast2 logs
Comment 6 garry fielding 2024-01-08 17:15:05 UTC
Created attachment 871704 [details]
yast2 adding repo
Comment 7 Frank Krüger 2024-01-08 18:31:53 UTC
Created attachment 871707 [details]
bsc#1218399_add_repo_url_steps_1-4

I am still observing this issue with current TW20240107. Please find attached the steps to add the repos's url, which shows up as service instead.
Comment 8 Frank Krüger 2024-01-08 18:45:56 UTC
(In reply to garry fielding from comment #6)
> Created attachment 871704 [details]
> yast2 adding repo

Unfortunately, your attachment exists only as link (i.e. /home/garry/zypper.tar.gz).
Comment 9 garry fielding 2024-01-13 11:50:30 UTC
Frank and Josef - do you still have this issue of yast not being able to add repos?  

I do.  

I see that yesterday's snapshot (11012024) has a new version of 'libzypp' (17.31.38-1.1.x86_64.rpm) but this has not changed the behaviour.  I have tried installing a number of different snapshots but no difference.

I can't understand why we are affected but other users do not appear to have this problem!
Comment 10 Frank Krüger 2024-01-13 12:05:53 UTC
(In reply to garry fielding from comment #9)
> Frank and Josef - do you still have this issue of yast not being able to add
> repos?  
> 
> I do.  
> 
> I see that yesterday's snapshot (11012024) has a new version of 'libzypp'
> (17.31.38-1.1.x86_64.rpm) but this has not changed the behaviour.  I have
> tried installing a number of different snapshots but no difference.
> 
> I can't understand why we are affected but other users do not appear to have
> this problem!

Issue still exists with TW20240111. I am sure other users are also affected, but don't notice.
Comment 11 garry fielding 2024-01-13 12:20:07 UTC
"Issue still exists with TW20240111. I am sure other users are also affected, but don't notice"

That is a good point, as I suppose if you just use 'zypper dup' or 'zypper up' to an existing system you are not adding any repos to your system (and do not come across the problem).
Comment 12 hui 2024-01-13 18:48:38 UTC
Created attachment 871857 [details]
y2logs

- Open YaST software
- Repositories
- Add repo via URL

Result: The repo does not show up as repo but as service

Reproducable here on several machines with openSUSE Tumbleweed 20240111
Comment 13 Endres 2024-01-13 20:45:02 UTC
(In reply to garry fielding from comment #9)
> Frank and Josef - do you still have this issue of yast not being able to add
> repos?  
> 
> I do.  
> 
> I see that yesterday's snapshot (11012024) has a new version of 'libzypp'
> (17.31.38-1.1.x86_64.rpm) but this has not changed the behaviour.  I have
> tried installing a number of different snapshots but no difference.
> 
> I can't understand why we are affected but other users do not appear to have
> this problem!

I can confirm this problem as well. However, until now I thought it was a problem on my side, since I need to get into YAST again after some abstinence from openSUSE.

Adding a repository using the zypper ar command worked though.
Comment 14 Frank Krüger 2024-01-14 10:01:56 UTC
Created attachment 871859 [details]
y2log add repo url

(In reply to Ladislav Slezák from comment #3)
> I'm unable to reproduce the problem using
> openSUSE-Tumbleweed-DVD-x86_64-Snapshot20240103-Media.iso.
> 
> I was able to add these repositories without any problem:
> https://download.opensuse.org/repositories/YaST:/Head/openSUSE_Tumbleweed/
> https://download.opensuse.org/history/20231208/tumbleweed/repo/oss/
> 
> Please try it again in the latest TW snapshot. If you can still reproduce
> the problem then describe the exact steps what did you do. And also attach
> the YaST logs (https://en.opensuse.org/openSUSE:Report_a_YaST_bug).

Is there any news from your side? Anyway, I have attached - in addition to the logs provided in comment #12 - the logs when the YaST:Head repo (as an example) is added erroneously as service.
Comment 15 Frank Krüger 2024-01-14 15:32:25 UTC
Since I have no experience with "bisecting" of YaST packages, could someone from the YaST team please provide yast2-packager with the revert of commit https://github.com/yast/yast-packager/pull/642? Thx.
Comment 16 Stefan Hundhammer 2024-01-17 09:37:41 UTC
Moving to our Trello task queue.
Comment 17 Stefan Hundhammer 2024-01-17 09:43:22 UTC
Frank, if you would really like to try that, it's as simple as applying the reverse diff (i.e. 'diff -r') of that one file 'repositories.rb' and copying it again to its location below /usr/share/YaST2, in this case 

/usr/share/YaST2/lib/packager/clients/repositories.rb

Since it's interpreted Ruby, no further steps are necessary in this case.
Comment 18 Stefan Hundhammer 2024-01-17 16:32:13 UTC
I can confirm that it's easy to reproduce, both on the latest TW and on Leap 15.5 + YaST:Head.

I used

https://download.opensuse.org/repositories/home:/shundhammer:/qdirstat-stable/openSUSE_Tumbleweed/

on TW and

https://download.opensuse.org/repositories/home:/shundhammer:/qdirstat-stable/15.5/

on Leap 15.5.
Comment 19 Stefan Hundhammer 2024-01-17 16:59:53 UTC
It happens every time when I use "yast2 repositories" (as root, of course), then "Add" -> "Specify URL..." or "https:".

I went back with yast2-packager from the master branch to the SLE-15-SP5 branch and even to the SLE-15-SP4 branch; no change.

What my TW and my Leap 15.5 + YaST:Head have in common are very similar libzypp versions:

TW:    libzypp-17.31.28-1.1.x86_64

Leap:  libzypp-17.31.27-150400.3.49.1.x86_64


Adding the same repo with "zypper ar" works normally; I don't see a service in "yast2 repositories" afterwards.
Comment 20 Stefan Hundhammer 2024-01-17 17:00:29 UTC
Created attachment 871951 [details]
Screenshot: Adding a repo as URL
Comment 21 Stefan Hundhammer 2024-01-17 17:00:53 UTC
Created attachment 871952 [details]
Screenshot: After adding, the repo shows up as service
Comment 22 Michael Andres 2024-01-18 09:24:44 UTC
From the ZYPP POV it's just important whether YAST calls RepoManager::addRepository or RepoManager::addService. So the yast.log would tell more than the Screenshot does.

If you created the right kind thing, you should be able to figure out what YAST refers to in order to classify it as a Service.

If you compare `zypper lr` and `zypper ls` you find that standalone Repos are also listed in `ls`. They are seen as a trivial service providing just the one repo.
Comment 23 Stefan Hundhammer 2024-01-18 12:24:41 UTC
Created attachment 871979 [details]
y2log from one "yast2 repositories" run (with Y2DEBUG=1 ZYPP_FULLLOG=1)
Comment 24 Stefan Hundhammer 2024-01-18 12:25:15 UTC
> 2024-01-18 13:19:12 <1> balrog(9062) [Ruby]
>   packager/repositories_include.rb(add_service):484
>   Added new service:
>   {
>     "alias"=>"service", "autorefresh"=>true,
>     "enabled"=>true, "raw_name"=>"HuHa-02",
>     "url"=>"https://download.opensuse.org/repositories/home:/shundhammer:/qdirstat-stable/15.5/"
>   }
Comment 25 Ladislav Slezák 2024-01-18 12:48:14 UTC
I found the problem, when adding a repository YaST runs probing to test whether the entered URL points to a service or to a repository:

  [Pkg] ServiceManager.cc(Probe):304 Detected service type: N/A


If the probing result is not "NONE" YaST thinks the URL points to a service:

  if !service_type.nil? && service_type != "NONE"

(https://github.com/yast/yast-packager/blob/6b52df96c60a33449d915f741c3df3f497012738/src/lib/packager/clients/repositories.rb#L2036)


The problem is that libzypp recently changed the "NONE" string to "N/A".

I'll fix it on the pkg-bindings side, I already did another fix related to this libzypp change (https://github.com/yast/yast-pkg-bindings/pull/183/files#diff-b34819e5e9a292462cddc1725ba58267c30fdbf92a0aaf718c9d25ba478b80e8R123).
Comment 26 Michael Andres 2024-01-18 14:42:17 UTC
(In reply to Ladislav Slezák from comment #25)
> 
> The problem is that libzypp recently changed the "NONE" string to "N/A".
> 

The libzypp RepoType is an enum. 

There are indeed several string representations valid for each enum type (and in fact more than your conversion table knows about). If you want/need to refer to fix strings rather than the enum values, you could let libzypp convert your string into the enum value. The you don't need to know all the stings zypp knows.


std::string PkgFunctions::zypp2yastType(const std::string &type)
{
  try {
    zypp::RepoType zypptype { type };
    switch ( zypptype.toEnum() ) 
    {
      case zypp::RepoType::NONE_e:        return "NONE";
      case zypp::RepoType::RPMMD_e:       return "rpm-md";
      case zypp::RepoType::YAST2_e:       return "yast2";
      case zypp::RepoType::RPMPLAINDIR_e: return "plaindir";
    }
    // Here: Zypp introduced a new enum value
    // gcc should have warned about the unhandled enum in switch
    return "YastWordForSomeTypeYastDoesNotKnowYet";
  }
  catch ( const RepoUnknownTypeException & ex ) {
    ...type string is unknown to zypp
    return "YastWordForSomethingZyppDoesNotRecognizeAsType";
  }
}
Comment 27 Michael Andres 2024-01-18 14:44:13 UTC
And the libzypp ServiceType is an enum too.
Comment 28 Ladislav Slezák 2024-01-18 15:20:34 UTC
Thanks for the hint! Using enums is much better and I can enable treating warnings as errors. Then the package build fails if libzypp adds something new.
Comment 29 Ladislav Slezák 2024-01-19 08:25:57 UTC
*** Bug 1218859 has been marked as a duplicate of this bug. ***
Comment 30 Ladislav Slezák 2024-01-19 09:14:10 UTC
Fixed in yast2-pkg-bindings-5.0.4 (https://github.com/yast/yast-pkg-bindings/pull/184, https://build.opensuse.org/request/show/1139878)
Comment 32 garry fielding 2024-01-19 15:43:33 UTC
Tested the fix on my system and it works fine.
Comment 37 Stefan Hundhammer 2024-01-24 14:17:58 UTC
*** Bug 1218770 has been marked as a duplicate of this bug. ***
Comment 38 Maintenance Automation 2024-01-24 20:30:01 UTC
SUSE-RU-2024:0222-1: An update that has two fixes can now be installed.

Category: recommended (moderate)
Bug References: 1218399, 1218977
Sources used:
SUSE Linux Enterprise Server 15 SP2 (src): yast2-pkg-bindings-4.2.17-150200.3.22.1
SUSE Linux Enterprise High Performance Computing 15 SP2 LTSS 15-SP2 (src): yast2-pkg-bindings-4.2.17-150200.3.22.1
SUSE Linux Enterprise Server 15 SP2 LTSS 15-SP2 (src): yast2-pkg-bindings-4.2.17-150200.3.22.1
SUSE Linux Enterprise Server for SAP Applications 15 SP2 (src): yast2-pkg-bindings-4.2.17-150200.3.22.1

NOTE: This line indicates an update has been released for the listed product(s). At times this might be only a partial fix. If you have questions please reach out to maintenance coordination.
Comment 39 Maintenance Automation 2024-01-24 20:30:03 UTC
SUSE-RU-2024:0221-1: An update that has two fixes can now be installed.

Category: recommended (moderate)
Bug References: 1218399, 1218977
Sources used:
openSUSE Leap 15.3 (src): yast2-pkg-bindings-devel-doc-4.3.13-150300.3.6.1, yast2-pkg-bindings-4.3.13-150300.3.6.1
SUSE Linux Enterprise Server 15 SP3 (src): yast2-pkg-bindings-4.3.13-150300.3.6.1
SUSE Linux Enterprise High Performance Computing LTSS 15 SP3 (src): yast2-pkg-bindings-4.3.13-150300.3.6.1
SUSE Linux Enterprise Server 15 SP3 LTSS 15-SP3 (src): yast2-pkg-bindings-4.3.13-150300.3.6.1
SUSE Linux Enterprise Server for SAP Applications 15 SP3 (src): yast2-pkg-bindings-4.3.13-150300.3.6.1
SUSE Enterprise Storage 7.1 (src): yast2-pkg-bindings-4.3.13-150300.3.6.1

NOTE: This line indicates an update has been released for the listed product(s). At times this might be only a partial fix. If you have questions please reach out to maintenance coordination.
Comment 40 Maintenance Automation 2024-01-24 20:30:05 UTC
SUSE-RU-2024:0220-1: An update that has two fixes can now be installed.

Category: recommended (moderate)
Bug References: 1218399, 1218977
Sources used:
openSUSE Leap 15.5 (src): yast2-pkg-bindings-devel-doc-4.5.3-150500.3.3.1, yast2-pkg-bindings-4.5.3-150500.3.3.1
SUSE Linux Enterprise High Performance Computing 15 SP5 (src): yast2-pkg-bindings-4.5.3-150500.3.3.1
SUSE Linux Enterprise Server 15 SP5 (src): yast2-pkg-bindings-4.5.3-150500.3.3.1
SUSE Linux Enterprise Server for SAP Applications 15 SP5 (src): yast2-pkg-bindings-4.5.3-150500.3.3.1
SUSE Linux Enterprise Desktop 15 SP5 (src): yast2-pkg-bindings-4.5.3-150500.3.3.1
Basesystem Module 15-SP5 (src): yast2-pkg-bindings-4.5.3-150500.3.3.1

NOTE: This line indicates an update has been released for the listed product(s). At times this might be only a partial fix. If you have questions please reach out to maintenance coordination.
Comment 41 Maintenance Automation 2024-01-25 16:30:01 UTC
SUSE-RU-2024:0235-1: An update that has two fixes can now be installed.

Category: recommended (moderate)
Bug References: 1218399, 1218977
Sources used:
openSUSE Leap 15.4 (src): yast2-pkg-bindings-devel-doc-4.4.7-150400.3.9.1, yast2-pkg-bindings-4.4.7-150400.3.9.1
SUSE Linux Enterprise High Performance Computing 15 SP4 (src): yast2-pkg-bindings-4.4.7-150400.3.9.1
SUSE Linux Enterprise Server 15 SP4 (src): yast2-pkg-bindings-4.4.7-150400.3.9.1
SUSE Manager Server 4.3 (src): yast2-pkg-bindings-4.4.7-150400.3.9.1
SUSE Linux Enterprise Server for SAP Applications 15 SP4 (src): yast2-pkg-bindings-4.4.7-150400.3.9.1
SUSE Linux Enterprise Desktop 15 SP4 (src): yast2-pkg-bindings-4.4.7-150400.3.9.1
SUSE Manager Retail Branch Server 4.3 (src): yast2-pkg-bindings-4.4.7-150400.3.9.1
SUSE Manager Proxy 4.3 (src): yast2-pkg-bindings-4.4.7-150400.3.9.1
SUSE Linux Enterprise High Performance Computing ESPOS 15 SP4 (src): yast2-pkg-bindings-4.4.7-150400.3.9.1
SUSE Linux Enterprise High Performance Computing LTSS 15 SP4 (src): yast2-pkg-bindings-4.4.7-150400.3.9.1
SUSE Linux Enterprise Desktop 15 SP4 LTSS 15-SP4 (src): yast2-pkg-bindings-4.4.7-150400.3.9.1
SUSE Linux Enterprise Server 15 SP4 LTSS 15-SP4 (src): yast2-pkg-bindings-4.4.7-150400.3.9.1

NOTE: This line indicates an update has been released for the listed product(s). At times this might be only a partial fix. If you have questions please reach out to maintenance coordination.
Comment 42 Frank Krüger 2024-04-07 08:00:13 UTC
Created attachment 874112 [details]
Add Repo URL
Comment 43 Frank Krüger 2024-04-07 08:01:16 UTC
Groundhog Day! Given TW20240404 with libzypp-17.32.2-1.1.x86_64 and yast2-packager-5.0.5-1.1.x86_64, adding a new repo with its URL via YaST saves it as service not as repo. Using "zypper ar" from the commandline works just fine.
Comment 44 Frank Krüger 2024-04-07 08:09:14 UTC
The issue is back.
Comment 45 Frank Krüger 2024-04-07 09:17:37 UTC
(In reply to Frank Krüger from comment #43)
> Groundhog Day! Given TW20240404 with libzypp-17.32.2-1.1.x86_64 and
> yast2-packager-5.0.5-1.1.x86_64, adding a new repo with its URL via YaST
> saves it as service not as repo. Using "zypper ar" from the commandline
> works just fine.
Works again, sorry for the noise.