DevTech101

DevTech101
1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 1.00 out of 5)
Loading...

The workaround below should fix the issue with the SMF Repositories-Setup going into maintenance.

Below is a workaround I used to address/fix the issue with the svc:/application/pkg/system-repository:default going in to maintenance. So I am to trying to install a zone on a fresh Solaris 11.4 server, by running the below.
zoneadm -z z1 install
The following ZFS file system(s) have been created:
    rpool/VARSHARE.zones/z1
Progress being logged to /var/log/zones/zoneadm.20180917T163026Z.z1.install
       Image: Preparing at /system/zones/z1/root.

Error Unable to enable svc:/application/pkg/system-repository:default, please enable the service manually.
zoneadm: zone 'z1': ERROR:installation failed: zone switching to configured state
The following ZFS file systems are being removed:
     /system/zones/z1/root.
Note: The Solaris server is behind a corporate proxy/firewall. By looking on the svc:/application/pkg/system-repository repository SMF service, I can see its in maintenance.
svcs svcs svc:/application/pkg/system-repository:default
STATE          STIME    FMRI
maintenance    12:35:55 svc:/application/pkg/system-repository:default
By trying to clear/enabled the SMF service it goes back into maintenance. The error below is whats displayed in the system-repository SMF error log.
[ 2018 Sep 17 12:57:53 Enabled. ]
[ 2018 Sep 17 12:57:53 Executing start method ("/lib/svc/method/svc-pkg-sysrepo start"). ]
Traceback (most recent call last):
  File "/usr/lib/pkg.sysrepo", line 934, in handle_errors
    __ret = func(*args, **kwargs)
  File "/usr/lib/pkg.sysrepo", line 914, in main_func
    http_proxy=http_proxy, https_proxy=https_proxy)
  File "/usr/lib/pkg.sysrepo", line 817, in refresh_conf
    http_timeout, api_inst.root)
  File "/usr/lib/pkg.sysrepo", line 476, in _get_publisher_info
    http_timeout)
  File "/usr/lib/pkg.sysrepo", line 231, in _follow_redirects
    http_timeout)
  File "/usr/lib/python2.7/urllib2.py", line 429, in open
    response = self._open(req, data)
  File "/usr/lib/python2.7/urllib2.py", line 447, in _open
    '_open', req)
  File "/usr/lib/python2.7/urllib2.py", line 407, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 1228, in http_open
    return self.do_open(httplib.HTTPConnection, req)
  File "/usr/lib/python2.7/urllib2.py", line 1201, in do_open
    r = h.getresponse(buffering=True)
  File "/usr/lib/python2.7/httplib.py", line 1121, in getresponse
    response.begin()
  File "/usr/lib/python2.7/httplib.py", line 438, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python2.7/httplib.py", line 394, in _read_status
    line = self.fp.readline(_MAXLINE + 1)
  File "/usr/lib/python2.7/socket.py", line 480, in readline
    data = self._sock.recv(self._rbufsize)
error: [Errno 131] Connection reset by peer


pkg.sysrepo: This is an internal error in pkg(7) version 0e78268bb251.  Please log a
Service Request about this issue including the information above and this
message.
pkg.sysrepo: failed to create Apache configuration
[ 2018 Sep 17 12:57:54 Method "start" exited with status 95. ]
Since I am behind a proxy/firewall, my system profile already sets an http(s)_proxy, like the below, so what else I can I try?
export http_proxy=http://my_proxy:1234
export https_proxy=http://my_proxy:1234
One more option to try is, the svc:/application/pkg/system-repository has their own proxy, like the below, lets try to set that.
svccfg -s svc:/application/pkg/system-repository:default listprop |grep prox
config/http_proxy                  astring     http://my_proxy:1234/
config/https_proxy                 astring     http://my_proxy:1234/
Now to the issue, it appears that setting the system-repository SMF proxy setting is not taking effect. Since I can see from the SMF output its using urlib2 to connect outside, I can try to below workaround. And here comes the workaround I used, I know its not idle but it worked for me. Add the below two lines to the pkg.sysrepo. Approximately line 912 in /usr/lib/pkg.sysrepo
# Add the below tow lines
        os.environ['http_proxy'] = "http://my_proxy:1234/"
        os.environ['https_proxy'] = "http://my_proxy:1234/"
# Add above the below line
        ret = refresh_conf(image_root=image_root, log_dir=log_dir,
...[snip]
            http_proxy=http_proxy, https_proxy=https_proxy)
Last issue a clear to SMF.
svcadm clear svc:/application/pkg/system-repository:default
And now its should just work. below is an example.
 
zoneadm -z z1 install
The following ZFS file system(s) have been created:
    rpool/VARSHARE/zones/z1
Progress being logged to /var/log/zones/zoneadm.20180917T173505Z.z1.install
       Image: Preparing at /system/zones/z1/root.

 Install Log: /system/volatile/install.6786/install_log
 AI Manifest: /tmp/manifest.xml.efQS0d
  SC Profile: /usr/share/auto_install/sc_profiles/enable_sci.xml
    Zonename: z1
Installation: Starting ...

        Creating IPS image
Startup linked: 1/1 done
        Installing packages from:
            solaris
                origin:  http://pkg.oracle.com/solaris/dev/
            localhosts12
                origin:  http://sfe.opencsw.org/localhosts12/
            solarisstudio
                origin:  http://pkg.oracle.com/solarisstudio/release/
DOWNLOAD                                PKGS         FILES    XFER (MB)   SPEED
database/mysql-57/library             43/472    8727/72087   48.4/540.4  899k/s
... [snip]
PHASE                                          ITEMS
Installing new actions                   97599/97599
Updating package state database                 Done 
Updating package cache                           0/0 
Updating image state                            Done 
Creating fast lookup database                   Done 
Updating package cache                           3/3 
Installation: Succeeded
 done.

        Done: Installation completed in 1048.136 seconds.
Note: The /usr/lib/pkg.sysrepo will most likely get blown-away once the system is refreshed or updated. You might also like – Articles related to Oracle Solaris 11.4/Solaris 12. Like what you’re reading? please provide feedback, any feedback is appreciated.
0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
%d bloggers like this: