apt error: update-binfmts: warning: unable…

Ich habe den Fehler beim upgrade eines Containers von ubuntu-zesty auf ubuntu-artful bekommen:

root@container:~# apt upgrade
Paketlisten werden gelesen... Fertig
Abhängigkeitsbaum wird aufgebaut.
Statusinformationen werden eingelesen.... Fertig
Probieren Sie »apt --fix-broken install«, um dies zu korrigieren.
Die folgenden Pakete haben unerfüllte Abhängigkeiten:
 python3.5-minimal : Hängt ab von: libpython3.5-minimal (= 3.5.3-1ubuntu0~17.04.2) ist aber nicht installierbar
                     Empfiehlt: python3.5 ist aber nicht installierbar
E: Unerfüllte Abhängigkeiten. Versuchen Sie »apt --fix-broken install« ohne Angabe eines Pakets (oder geben Sie eine Lösung an).

Englisch:

root@container:~# apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 python3.5-minimal : Depends: libpython3.5-minimal (= 3.5.3-1ubuntu0~17.04.2) but it is not installable
                     Recommends: python3.5 but it is not installable
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

Der Versuch den Fehler mittels „apt –fix-broken install“ zu lösen ergab folgendes:

root@container:~# apt --fix-broken install
Paketlisten werden gelesen... Fertig
Abhängigkeitsbaum wird aufgebaut.
Statusinformationen werden eingelesen.... Fertig
Abhängigkeiten werden korrigiert ... Fertig
Die folgenden Pakete werden ENTFERNT:
  python3.5-minimal
0 aktualisiert, 0 neu installiert, 1 zu entfernen und 0 nicht aktualisiert.
Nach dieser Operation werden 9.639 kB Plattenplatz freigegeben.
Möchten Sie fortfahren? [J/n] j
(Lese Datenbank ... 56173 Dateien und Verzeichnisse sind derzeit installiert.)
Entfernen von python3.5-minimal (3.5.3-1ubuntu0~17.04.2) ...
Unlinking and removing bytecode for runtime python3.5
E: py3clean:65: cannot find magic tag for Python 3.5: python3.5 -c 'import imp; print(imp.get_tag())' failed with status code 134
update-binfmts: warning: unable to open /proc/sys/fs/binfmt_misc/python3.5 for writing: Permission denied
update-binfmts: warning: unable to disable binary format python3.5
update-binfmts: exiting due to previous errors
dpkg: Fehler beim Bearbeiten des Paketes python3.5-minimal (--remove):
 Unterprozess installiertes pre-removal-Skript gab den Fehlerwert 2 zurück
Fehler traten auf beim Bearbeiten von:
 python3.5-minimal
E: Sub-process /usr/bin/dpkg returned an error code (1)

Englisch:

root@container:~# apt --fix-broken install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following packages will be REMOVED:
  python3.5-minimal
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 9639 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 56173 files and directories currently installed.)
Removing python3.5-minimal (3.5.3-1ubuntu0~17.04.2) ...
Unlinking and removing bytecode for runtime python3.5
E: py3clean:65: cannot find magic tag for Python 3.5: python3.5 -c 'import imp; print(imp.get_tag())' failed with status code 134
update-binfmts: warning: unable to open /proc/sys/fs/binfmt_misc/python3.5 for writing: Permission denied
update-binfmts: warning: unable to disable binary format python3.5
update-binfmts: exiting due to previous errors
dpkg: error processing package python3.5-minimal (--remove):
 subprocess installed pre-removal script returned error exit status 2
Errors were encountered while processing:
 python3.5-minimal
E: Sub-process /usr/bin/dpkg returned an error code (1)

Um das Problem zu lösen müsst ihr im Pfad „/var/lib/dpkg/info/“ das Skript bearbeiten welches den Fehler verursacht bei mir ist es „/var/lib/dpkg/info/python3.5-minimal.prerm“. Die Lösung funktioniert auch für andere Pakete/Programme.

Kommentiert den Teil aus welcher das Problem verursacht, bei mir:

root@container:~# vim /var/lib/dpkg/info/python3.5-minimal.prerm

Den folgenden Abschnitt auskommentieren, aus:

if which update-binfmts >/dev/null; then
            update-binfmts --package python3.5 --remove python3.5 /usr/bin/python3.5
fi

macht ihr das:

#if which update-binfmts >/dev/null; then
#            update-binfmts --package python3.5 --remove python3.5 /usr/bin/python3.5
#fi