Bug 38393

Summary: System setup copies all setup packages
Product: UCS Reporter: Stefan Gohmann <gohmann>
Component: System setupAssignee: Erik Damrose <damrose>
Status: CLOSED FIXED QA Contact: Alexander Kläser <klaeser>
Severity: normal    
Priority: P5 CC: damrose, walkenhorst
Version: UCS 4.0   
Target Milestone: UCS 4.0-1-errata   
Hardware: Other   
OS: Linux   
What kind of report is it?: --- What type of bug is this?: ---
Who will be affected by this bug?: --- How will those affected feel about the bug?: ---
User Pain: Enterprise Customer affected?:
School Customer affected?: ISV affected?:
Waiting Support: Flags outvoted (downgraded) after PO Review:
Ticket number: Bug group (optional):
Max CVSS v3 score:
Attachments: system_setup_packages.diff

Description Stefan Gohmann univentionstaff 2015-04-30 08:17:34 CEST
Created attachment 6863 [details]
system_setup_packages.diff

Due to Bug #27935 the setup code copies all Debian packages from the local repository into the local cache otherwise the online repository is preferred. Depending on the performance it took several minutes.

Either we should disable the online repository during the setup or we should create links. See attached patch.
Comment 1 Erik Damrose univentionstaff 2015-04-30 09:40:07 CEST
*** Bug 38189 has been marked as a duplicate of this bug. ***
Comment 2 Erik Damrose univentionstaff 2015-05-05 13:51:44 CEST
Patch applied, slightly modified to include error logging.

r60407 univention-system-setup 8.1.66-37.878.201505051342
r60408 2015-05-05-univention-system-setup.yaml
Comment 3 Alexander Kläser univentionstaff 2015-05-05 16:55:51 CEST
When running the script standalone, I obtain the following error:

-------------------- 8< --------------------
=== 05_role/10role (2015-05-05 16:53:00) ===
__NAME__:05_role/10role Einrichten der Systemrolle
__STEPS__:300
__MSG__:Vorbereiten der Paketlisten (das kann einen Moment dauern)...
__ERR__:'RoleScript' object has no attribute 'logger'
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/univention/management/console/modules/setup/setup_script.py", line 304, in run
    success = self.inner_run()
  File "/usr/lib/univention-system-setup/scripts/05_role/10role", line 62, in inner_run
    self.logger.error('Error while creating hardlink to /var/cache/univention-system-setup/packages: %s' % e)
AttributeError: 'RoleScript' object has no attribute 'logger'
-------------------- 8< --------------------
Comment 4 Erik Damrose univentionstaff 2015-05-05 17:26:22 CEST
Print errors because no logger is available (caller will log to setup.log anyways)

r60426 univention-system-setup 8.1.66-39.880.201505051712
Comment 5 Alexander Kläser univentionstaff 2015-05-05 18:06:40 CEST
I could provoke the following error:

-------------------- 8< --------------------
__MSG__:Vorbereiten der Paketlisten...
Error while creating hardlink to /var/cache/univention-system-setup/packages: [Errno 17] Die Datei existiert bereits
Error while creating hardlink to /var/cache/univention-system-setup/packages: [Errno 17] Die Datei existiert bereits
__ERR__:`/var/cache/univention-system-setup/packages/libqtruby4shared2_4.8.4-1.2.201403150104_amd64.deb` and `/var/cache/apt/archives/libqtruby4shared2_4.8.4-1.2.201403150104_amd64.deb` are the same file
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/univention/management/console/modules/setup/setup_script.py", line 304, in run
    success = self.inner_run()
  File "/usr/lib/univention-system-setup/scripts/05_role/10role", line 64, in inner_run
    shutil.copy(filename, '/var/cache/apt/archives/')
  File "/usr/lib/python2.7/shutil.py", line 119, in copy
    copyfile(src, dst)
  File "/usr/lib/python2.7/shutil.py", line 69, in copyfile
    raise Error("`%s` and `%s` are the same file" % (src, dst))
Error: `/var/cache/univention-system-setup/packages/libqtruby4shared2_4.8.4-1.2.201403150104_amd64.deb` and `/var/cache/apt/archives/libqtruby4shared2_4.8.4-1.2.201403150104_amd64.deb` are the same file
-------------------- 8< --------------------
Comment 6 Alexander Kläser univentionstaff 2015-05-05 18:08:48 CEST
Can you change the error message to be more informative? Currently, this line is printed for each failure:

> Error while creating hardlink to /var/cache/univention-system-setup/packages: [Errno 17] Die Datei existiert bereits
Comment 7 Alexander Kläser univentionstaff 2015-05-05 18:24:33 CEST
IOError is raised if not enough space is available on the disk:
-------------------- 8< --------------------
=== 05_role/10role (2015-05-05 18:22:45) ===
__NAME__:05_role/10role Einrichten der Systemrolle
__STEPS__:300
__MSG__:Vorbereiten der Paketlisten...
Error while creating hardlink to /var/cache/univention-system-setup/packages: [Errno 18] Ungültiger Link über Gerätegrenzen hinweg
Error while creating hardlink to /var/cache/univention-system-setup/packages: [Errno 18] Ungültiger Link über Gerätegrenzen hinweg
Error while creating hardlink to /var/cache/univention-system-setup/packages: [Errno 18] Ungültiger Link über Gerätegrenzen hinweg
Error while creating hardlink to /var/cache/univention-system-setup/packages: [Errno 18] Ungültiger Link über Gerätegrenzen hinweg
Error while creating hardlink to /var/cache/univention-system-setup/packages: [Errno 18] Ungültiger Link über Gerätegrenzen hinweg
Error while creating hardlink to /var/cache/univention-system-setup/packages: [Errno 18] Ungültiger Link über Gerätegrenzen hinweg
__ERR__:[Errno 28] Auf dem Gerät ist kein Speicherplatz mehr verfügbar
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/univention/management/console/modules/setup/setup_script.py", line 304, in run
    success = self.inner_run()
  File "/usr/lib/univention-system-setup/scripts/05_role/10role", line 64, in inner_run
    shutil.copy(filename, '/var/cache/apt/archives/')
  File "/usr/lib/python2.7/shutil.py", line 119, in copy
    copyfile(src, dst)
  File "/usr/lib/python2.7/shutil.py", line 84, in copyfile
    copyfileobj(fsrc, fdst)
  File "/usr/lib/python2.7/shutil.py", line 52, in copyfileobj
    fdst.write(buf)
IOError: [Errno 28] Auf dem Gerät ist kein Speicherplatz mehr verfügbar
-------------------- 8< --------------------

... well, that might be a difficult error to recover from :) .
Comment 8 Erik Damrose univentionstaff 2015-05-06 11:48:50 CEST
The errors you found are now catched as well. Log output has been improved. I found an instance in which pam-auth-update required user interaction, i added --force as a parameter to avoid that.

r60449 univention-system-setup 8.1.66-40.881.201505061139
r60451 2015-05-05-univention-system-setup.yaml
Comment 9 Alexander Kläser univentionstaff 2015-05-06 16:49:04 CEST
The error handling looks fine now.

Changes: OK
YAML file: OK
Comment 10 Janek Walkenhorst univentionstaff 2015-05-07 17:43:20 CEST
<http://errata.univention.de/ucs/4.0/190.html>