Bug 1017610

Summary: During Initialize software manager - YAST not able to create repository from external USB diskdrive
Product: [openSUSE] openSUSE Distribution Reporter: Richard Bos <richard.bos>
Component: InstallationAssignee: Ladislav Slezák <lslezak>
Status: RESOLVED INVALID QA Contact: Jiri Srain <jsrain>
Severity: Major    
Priority: P5 - None CC: ma, matwey.kornilov, richard.bos, schubi
Version: Leap 42.2   
Target Milestone: ---   
Hardware: x86-64   
OS: openSUSE 42.2   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: Screenshot with details
y2log during installation with external DVD station
debug src files and logs from debug session

Description Richard Bos 2016-12-30 13:58:58 UTC
Created attachment 708105 [details]
Screenshot with details

System with no CD/DVD drive.  For this reason an external disk drive is used.

openSUSE Leap 42.2 starts succesfully, until the YAST starts to probe the system
 to create a repository.

See attached screenshot for details.

It makes installing openSUSE a challenge instead of fun...
Comment 2 Richard Bos 2017-01-04 12:36:26 UTC
Created attachment 708496 [details]
y2log during installation with external DVD station

For the error look for the string TSST, that is part of external DVD station name:

First encounter, with an unexpected character:
2017-01-04 06:10:21 <1> install(3179) [Ruby] modules/InstURL.rb:160 Using install URL: cd:/?devices=/dev/disk/by-id/usb-TSSTcorp_CDDVDW_SE-208AB_RL6X853-0:0

With '%':
017-01-04 06:10:22 <1> install(3179) [Pkg] Source_Create.cc(createManagedSource):199 Probing source type: 'cd:///%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00?devices=/dev/disk/by-id/usb-TSSTcorp_CDDVDW_SE-208AB_RL6X853-0:0'

Hope this helps to locate the culprit.
Comment 3 Arvin Schnell 2017-01-09 11:11:33 UTC
Could be a problem in yast2-pkg-bindings. Reassigning to maintainer.
Comment 4 Richard Bos 2017-01-09 20:10:04 UTC
What about:

From the logfile:
2017-01-04 06:10:21 <1> install(3179) [Ruby] modules/InstURL.rb:113 Option ssl_verify: nil
2017-01-04 06:10:21 <1> install(3179) [Ruby] modules/InstURL.rb:160 Using install URL: cd:/?devices=/dev/disk/by-id/usb-TSSTcorp_CDDVDW_SE-208AB_RL6X853-0:0


# locate InstURL.rb
/usr/share/YaST2/modules/InstURL.rb

# grep -n ^ /usr/share/YaST2/modules/InstURL.rb | grep ^160
160:      log.info "Using install URL: #{URL.HidePassword(@installInf2Url)}"

# vi +160 /usr/share/YaST2/modules/InstURL.rb

Just above that line the url gets an "?" is that OK?
119     def RewriteCDUrl(url)
120       tokens = URL.Parse(url)
121       new_url = ""
122       if Ops.get_string(tokens, "scheme", "") == "cd" ||
123           Ops.get_string(tokens, "scheme", "") == "dvd"
124         Builtins.y2milestone("Old options: %1", GetURLOptions(url))
125         pos = Builtins.findfirstof(url, "?")
126         if pos != nil
127           new_options = GetDevicesOption()
128           new_url = Builtins.substring(url, 0, pos)
129           if Ops.greater_than(Builtins.size(new_options), 0)
130             new_url = Ops.add(Ops.add(new_url, "?"), GetDevicesOption())
131           else
132             new_url = url
133           end
134         end
135       else
136         new_url = url
137       end
138       new_url
139     end
Comment 5 Arvin Schnell 2017-01-11 06:18:40 UTC
*** Bug 1019191 has been marked as a duplicate of this bug. ***
Comment 6 Richard Bos 2017-01-13 21:31:15 UTC
Is the problem located in this function:
https://github.com/yast/yast-pkg-bindings/blob/master/src/Source_Create.cc


As the URL changes here according the log:

2017-01-04 06:10:22 <1> install(3179) [Pkg] Source_Create.cc(createManagedSource):158 Original URL: cd:///?devices=/dev/disk/by-id/usb-TSSTcorp_CDDVDW_SE-208AB_RL6X853-0:0, product directory: .
........
2017-01-04 06:10:22 <1> install(3179) [Pkg] Source_Create.cc(createManagedSource):199 Probing source type: 'cd:///%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00?devices=/dev/disk/by-id/usb-TSSTcorp_CDDVDW_SE-208AB_RL6X853-0:0'



150:PkgFunctions::createManagedSource( const zypp::Url & url_r,
151:                 const zypp::Pathname & path_r,
152:                 const std::string& type,
153:                 const std::string &alias_r,
154:                 PkgProgress &progress,
155:                 const zypp::ProgressData::ReceiverFnc & progressrcv)
156:{
157:    // parse URL
158:    y2milestone ("Original URL: %s, product directory: %s", url_r.asString().c_str(), path_r.asString().c_str());
159:
160:    // #158850#c17, if the URL contains an alias, we use that
161:    zypp::Url url;
162:
163:    std::string alias = removeAlias(url_r, url);
164:    y2milestone("Alias from URL: '%s'", alias.c_str());
165:
166:    // repository type
167:    zypp::repo::RepoType repotype;
168:    zypp::RepoManager* repomanager = CreateRepoManager();
169:
170:    const bool do_probing = type.empty();
171:
172:    if (!do_probing)
173:    {
174:    try
175:    {
176:        // do conversion from the Yast type ("YaST", "YUM", "Plaindir")
177:        // to libzypp type ("yast", "yum", "plaindir")
178:        repotype = repotype.parse(yast2zyppType(type));
179:    }
180:    catch (zypp::repo::RepoUnknownTypeException &e)
181:    {
182:        y2warning("Unknown source type '%s'", type.c_str());
183:    }
184:    }
185:
186:    // the type is not specified or is wrong, autoprobe the type 
187:    if (repotype == zypp::repo::RepoType::NONE)
188:    {
189:        zypp::Url probe_url(url_r);
190:
191:    if (!path_r.asString().empty())
192:    {
193:        zypp::Pathname pth(probe_url.getPathName());
194:        pth /= path_r;
195:
196:        probe_url.setPathName(pth.asString());
197:    }
198:
199:    y2milestone("Probing source type: '%s'", probe_url.asString().c_str());


Somewhere between line 159 - 199 the URL gets a null string...
Comment 7 Richard Bos 2017-01-14 15:47:25 UTC
Is it possible to debug the code from the previous comment, if so; how?
Comment 8 Richard Bos 2017-01-15 10:58:57 UTC
Created attachment 710127 [details]
debug src files and logs from debug session

I've been doing some debugging and the culprit seems to be in lines:
193:        zypp::Pathname pth(probe_url.getPathName());
194:        pth /= path_r;
195:
196:        probe_url.setPathName(pth.asString());

I added DEBUG statements (like DEBUG A6.1) to lines 160 - 199, see file src/Source_Create.cc-20170115_044600.

The result of that can be seen in corresponding log log/y2log-20170115_044600.

2017-01-15 04:46:53 <1> install(7713) [Pkg] Source_Create.cc(createManagedSource):204 DEBUG A6.1: cd:///?devices=/dev/disk/by-id/usb-TSSTcorp_CDDVDW_SE-208AB_RL6X853-0:0
2017-01-15 04:46:53 <1> install(7713) [Pkg] Source_Create.cc(createManagedSource):206 DEBUG A6.2: cd:///%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00?devices=/dev/disk/by-id/usb-TSSTcorp_CDDVDW_SE-208AB_RL6X853-0:0

Something between A6.1 and A6.2 is clearly adding the zero's...., this is:
        if (!path_r.asString().empty())
        {
            y2milestone("DEBUG A6");
            zypp::Pathname pth(probe_url.getPathName());
      ????? pth /= path_r;

            y2milestone("DEBUG A6.1: %s", probe_url.asString().c_str() );
      >>>>> probe_url.setPathName(pth.asString());
            y2milestone("DEBUG A6.2: %s", probe_url.asString().c_str() );


In my next attempt I uncommented "probe_url.setPathName(pth.asString())", this resulted in another (internal) error message...., see log log/y2log-20170115_045400.

The error message shown on the screen: 'No base product found'.  In the log this is:
yast/wfm.rb:229 Client call failed with 'No base product found' and backtrace ["/mounts/mp_0001/usr/share/YaST2/modules/Product.rb:117:in `FindBaseProducts'"


I hope that is sufficient information to provide a fix...
Comment 9 Richard Bos 2017-01-15 11:39:21 UTC
Don't wait long with providing a modification to the source, in case you
would like to involve me for testing the modification, please.

At the moment I know and have the means to test the modification.  Some weeks
from now, that may have been gone, that would be a pity.
Comment 10 Matwey Kornilov 2017-01-23 18:26:38 UTC
Dear All,

I wonder two things.
Why this issue is drawn so little attention? The release installation image is broken by essence.
How could this be avoided in QA?
Comment 11 Richard Bos 2017-01-28 09:44:05 UTC
Does anyone have an idea or is willing to investigate this?
Comment 12 Ladislav Slezák 2017-02-03 12:12:11 UTC
(In reply to Richard Bos from comment #8)
> Something between A6.1 and A6.2 is clearly adding the zero's...., this is:
>         if (!path_r.asString().empty())
>         {
>             y2milestone("DEBUG A6");
>             zypp::Pathname pth(probe_url.getPathName());
>       ????? pth /= path_r;
> 
>             y2milestone("DEBUG A6.1: %s", probe_url.asString().c_str() );

Michael, any idea why this correct URL:

2017-01-15 04:46:53 <1> install(7713) [Pkg]
Source_Create.cc(createManagedSource):204 DEBUG A6.1:
cd:///?devices=/dev/disk/by-id/usb-TSSTcorp_CDDVDW_SE-208AB_RL6X853-0:0

>       >>>>> probe_url.setPathName(pth.asString());
>             y2milestone("DEBUG A6.2: %s", probe_url.asString().c_str() );

Is tuned into invalid one here???

2017-01-15 04:46:53 <1> install(7713) [Pkg]
Source_Create.cc(createManagedSource):206 DEBUG A6.2:
cd:///%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00?devices=/dev/
disk/by-id/usb-TSSTcorp_CDDVDW_SE-208AB_RL6X853-0:0
Comment 13 Ladislav Slezák 2017-02-03 12:13:24 UTC
Moreover the log contains these errors:

2017-01-15 04:53:58 <1> install(9911) [zypp++] ExternalProgram.cc(start_program):249 Executing 'repo2solv.sh' '-o' '/var/cache/zypp/solv/cd-bb576bd9/solv' '-X' '/var/cache/zypp/raw/cd-bb576bd
9/'
2017-01-15 04:53:58 <1> install(9911) [zypp++] ExternalProgram.cc(start_program):412 pid 10357 launched
2017-01-15 04:53:58 <2> install(9911) [zypp] RepoManager.cc(buildCache):1357   find: '*': No such file or directory

2017-01-15 04:53:58 <1> install(9911) [Pkg] Source_Resolvables.cc(LoadResolvablesFrom):152 Pool size at end: 0 (loaded 0 resolvables)

2017-01-15 04:54:00 <1> install(9911) [zypp] SATResolver.cc(problems):1121 nothing provides requested glibc


The repository is either empty or libzypp could not read the data. Could you double check the disk content? If add the disk repository in an installed system, can you see the packages from it?
Comment 14 Richard Bos 2017-02-03 13:07:14 UTC
(In reply to Ladislav Slezák from comment #13)

Ladislav, thanks for looking into this.

> The repository is either empty or libzypp could not read the data. Could you
> double check the disk content? If add the disk repository in an installed
> system, can you see the packages from it?

# LANG=C sha256sum -c openSUSE-Leap-42.2-DVD-x86_64.iso.sha256 
openSUSE-Leap-42.2-DVD-x86_64.iso: OK

Selected a random package:

openSUSE-Leap-42.2-DVD-x86_64028/suse/x86_64> rpm -qip $( ls | head -431 | tail -1 )
Name        : g3utils
Version     : 1.1.36
....
The g3utils are included in the mgetty source package.
Distribution: openSUSE Leap 42.2


Medium seems OK to me.  Besides that the problem is reported by more people.
https://bugzilla.suse.com/show_bug.cgi?id=1017610#c10
Comment 15 Michael Andres 2017-02-03 13:37:41 UTC
(In reply to Ladislav Slezák from comment #12)
> Michael, any idea why this correct URL:
> ...
> Is tuned into invalid one here???

And only if an USB drive is in use? 
Well, one line in the log actually caught my eye:

> 2017-01-04 06:10:22 <1> install(3179) 
> [Pkg] Source_Create.cc(createManagedSource):158
> Original URL: 
> cd:///?devices=/dev/disk/by-id/usb-TSSTcorp_CDDVDW_SE-208AB_RL6X853-0:0, 
> product directory: ./
>                   ^^^

You are printing a zypp::Pathname here. Pathnames are normalized and do not contain trailing '/'es. What you are printing here is a relative pathname (./path) with an invisible name (but it's not an empty string):

  Pathname("")   --> ""
  Pathname(" ")  --> "./ "

The product directory looks fishy to me.
Comment 16 Richard Bos 2017-02-03 13:50:58 UTC
This is a DVD/CD station less computer.  As such it can be installed with an external USB DVD/CD drive, only (did not test a USB stick).

> Original URL: 
> cd:///?devices=/dev/disk/by-id/usb-TSSTcorp_CDDVDW_SE-208AB_RL6X853-0:0, 
> product directory: ./

What product path do you expect at this point? ".", "/", just empty?

> 157:    // parse URL
> 158:    y2milestone ("Original URL: %s, product directory: %s", url_r.asString().c_str(), path_r.asString().c_str());

Any suggestion for testing? For example by setting the path_r shown above to something expected?  Something else?  If so, let me know how please.
Comment 17 Michael Andres 2017-02-03 13:55:28 UTC
@Richard: Could you please attach the /media.1/products file from the medium. AFAIK this is there the ptoduct dirs are read from.
Comment 18 Michael Andres 2017-02-03 14:10:08 UTC
(In reply to Richard Bos from comment #16)
> What product path do you expect at this point? ".", "/", just empty?

JFYI: /media.1/products is expected to list the repositories located on the medium.
'/PATH PRODUTNAME' pairs, one per line. Most media contain just one Like  "/ SLES12 12-0".
Comment 19 Richard Bos 2017-02-03 15:33:37 UTC
(In reply to Michael Andres from comment #17)
> @Richard: Could you please attach the /media.1/products file from the
> medium. AFAIK this is there the ptoduct dirs are read from.

I can, but I just discovered that some parts of the DVD are not readable.

One of them is the products file.  
-r--r--r-- 1 richard users 18  9 nov 11:36 products

> od -x products
0000000 0000 0000 0000 0000 0000 0000 0000 0000
0000020 0000
0000022

The same is valid for rpms in the noarch directory:
-r--r--r-- 3 richard users 57964  8 okt 03:37 zypper-log-1.13.10-1.3.noarch.rpm

noarch> rpm -qip zypper-log-1.13.10-1.3.noarch.rpm
fout: zypper-log-1.13.10-1.3.noarch.rpm: not an rpm package (or package manifest)


When I mount the iso image (the file not the DVD), the files are readable.
selene:/mnt/media.1 # cat products
/ openSUSE 42.2-0

It looks like the DVD (or perhaps the external DV station) is not good.

I'll look into this, the coming days.
Comment 20 Ladislav Slezák 2017-02-03 15:43:11 UTC
Oh, zeroes in "products" file...

BTW if you boot the DVD there is "More ..." -> "Check Installation Media" menu item which checks the DVD medium checksum.

To check the ISO medium before burning it you can run "checkmedia image.iso" command.

I'm closing the bug as this is either a HW or medium problem, the "products" content in the ISO ("/ openSUSE 42.2-0") is correct.