我的机器是 Ubuntu 16.04。
尝试升级 Mono 后,我面临依赖问题。
sudo apt-get install mono-complete
Building dependency tree
Reading state information... Done
mono-complete is already the newest version (6.0.0.313-0xamarin3+ubuntu1604b1).
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
mono-complete : Depends: ca-certificates-mono (= 6.0.0.313-0xamarin3+ubuntu1604b1) but 4.8.1.0-0xamarin1 is to be installed
mono-devel : Depends: ca-certificates-mono (= 6.0.0.313-0xamarin3+ubuntu1604b1) but 4.8.1.0-0xamarin1 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
sudo apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
libio-string-perl libmono-corlib4.0-cil libmono-system-runtime-interopservices-runtimeinformation4.0-cil libnunit-cil-dev libnunit-console-runner2.6.3-cil libnunit-core-interfaces2.6.3-cil libnunit-core2.6.3-cil libnunit-framework2.6.3-cil libnunit-mocks2.6.3-cil
libnunit-util2.6.3-cil libtimedate-perl
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
ca-certificates-mono
The following packages will be upgraded:
ca-certificates-mono
1 upgraded, 0 newly installed, 0 to remove and 275 not upgraded.
161 not fully installed or removed.
Need to get 0 B/31.1 kB of archives.
After this operation, 24.6 kB disk space will be freed.
Do you want to continue? [Y/n] y
Setting up mono-gac (6.0.0.313-0xamarin3+ubuntu1604b1) ...
* Installing 1 assembly from libglade2.0-cil into Mono
Unhandled Exception:
System.DllNotFoundException: System.Native
at (wrapper managed-to-native) Interop+Sys.Stat(byte&,Interop/Sys/FileStatus&)
at Interop+Sys.Stat (System.ReadOnlySpan`1[T] path, Interop+Sys+FileStatus& output) [0x00028] in <81342d83acda4c5590ec19c7afdf26b9>:0
at System.IO.FileSystem.FileExists (System.ReadOnlySpan`1[T] fullPath, System.Int32 fileType, Interop+ErrorInfo& errorInfo) [0x00007] in <81342d83acda4c5590ec19c7afdf26b9>:0
at System.IO.FileSystem.FileExists (System.ReadOnlySpan`1[T] fullPath) [0x00006] in <81342d83acda4c5590ec19c7afdf26b9>:0
at System.IO.File.Exists (System.String path) [0x00043] in <81342d83acda4c5590ec19c7afdf26b9>:0
at Mono.Tools.Driver.LoadConfig (System.Boolean quiet) [0x00028] in <23529d1919fc4cdeb9723008e6dfcc48>:0
at Mono.Tools.Driver.Main (System.String[] args) [0x00351] in <23529d1919fc4cdeb9723008e6dfcc48>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.DllNotFoundException: System.Native
at (wrapper managed-to-native) Interop+Sys.Stat(byte&,Interop/Sys/FileStatus&)
at Interop+Sys.Stat (System.ReadOnlySpan`1[T] path, Interop+Sys+FileStatus& output) [0x00028] in <81342d83acda4c5590ec19c7afdf26b9>:0
at System.IO.FileSystem.FileExists (System.ReadOnlySpan`1[T] fullPath, System.Int32 fileType, Interop+ErrorInfo& errorInfo) [0x00007] in <81342d83acda4c5590ec19c7afdf26b9>:0
at System.IO.FileSystem.FileExists (System.ReadOnlySpan`1[T] fullPath) [0x00006] in <81342d83acda4c5590ec19c7afdf26b9>:0
at System.IO.File.Exists (System.String path) [0x00043] in <81342d83acda4c5590ec19c7afdf26b9>:0
at Mono.Tools.Driver.LoadConfig (System.Boolean quiet) [0x00028] in <23529d1919fc4cdeb9723008e6dfcc48>:0
at Mono.Tools.Driver.Main (System.String[] args) [0x00351] in <23529d1919fc4cdeb9723008e6dfcc48>:0
E: installing Assembly /usr/lib/cli/glade-sharp-2.0/glade-sharp.dll failed
E: Installation of libglade2.0-cil with /usr/share/cli-common/runtimes.d/mono failed
* Installing 1 assembly from libglib2.0-cil into Mono
Unhandled Exception:
System.DllNotFoundException: System.Native
at (wrapper managed-to-native) Interop+Sys.Stat(byte&,Interop/Sys/FileStatus&)
at Interop+Sys.Stat (System.ReadOnlySpan`1[T] path, Interop+Sys+FileStatus& output) [0x00028] in <81342d83acda4c5590ec19c7afdf26b9>:0
at System.IO.FileSystem.FileExists (System.ReadOnlySpan`1[T] fullPath, System.Int32 fileType, Interop+ErrorInfo& errorInfo) [0x00007] in <81342d83acda4c5590ec19c7afdf26b9>:0
at System.IO.FileSystem.FileExists (System.ReadOnlySpan`1[T] fullPath) [0x00006] in <81342d83acda4c5590ec19c7afdf26b9>:0
at System.IO.File.Exists (System.String path) [0x00043] in <81342d83acda4c5590ec19c7afdf26b9>:0
at Mono.Tools.Driver.LoadConfig (System.Boolean quiet) [0x00028] in <23529d1919fc4cdeb9723008e6dfcc48>:0
at Mono.Tools.Driver.Main (System.String[] args) [0x00351] in <23529d1919fc4cdeb9723008e6dfcc48>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.DllNotFoundException: System.Native
at (wrapper managed-to-native) Interop+Sys.Stat(byte&,Interop/Sys/FileStatus&)
at Interop+Sys.Stat (System.ReadOnlySpan`1[T] path, Interop+Sys+FileStatus& output) [0x00028] in <81342d83acda4c5590ec19c7afdf26b9>:0
at System.IO.FileSystem.FileExists (System.ReadOnlySpan`1[T] fullPath, System.Int32 fileType, Interop+ErrorInfo& errorInfo) [0x00007] in <81342d83acda4c5590ec19c7afdf26b9>:0
at System.IO.FileSystem.FileExists (System.ReadOnlySpan`1[T] fullPath) [0x00006] in <81342d83acda4c5590ec19c7afdf26b9>:0
at System.IO.File.Exists (System.String path) [0x00043] in <81342d83acda4c5590ec19c7afdf26b9>:0
at Mono.Tools.Driver.LoadConfig (System.Boolean quiet) [0x00028] in <23529d1919fc4cdeb9723008e6dfcc48>:0
at Mono.Tools.Driver.Main (System.String[] args) [0x00351] in <23529d1919fc4cdeb9723008e6dfcc48>:0
E: installing Assembly /usr/lib/cli/glib-sharp-2.0/glib-sharp.dll failed
E: Installation of libglib2.0-cil with /usr/share/cli-common/runtimes.d/mono failed
* Installing 5 assemblies from libgtk2.0-cil into Mono
...
...
Unhandled Exception:
System.DllNotFoundException: System.Native
at (wrapper managed-to-native) Interop+Sys.Stat(byte&,Interop/Sys/FileStatus&)
at Interop+Sys.Stat (System.ReadOnlySpan`1[T] path, Interop+Sys+FileStatus& output) [0x00028] in <81342d83acda4c5590ec19c7afdf26b9>:0
at System.IO.FileSystem.FileExists (System.ReadOnlySpan`1[T] fullPath, System.Int32 fileType, Interop+ErrorInfo& errorInfo) [0x00007] in <81342d83acda4c5590ec19c7afdf26b9>:0
at System.IO.FileSystem.FileExists (System.ReadOnlySpan`1[T] fullPath) [0x00006] in <81342d83acda4c5590ec19c7afdf26b9>:0
at System.IO.File.Exists (System.String path) [0x00043] in <81342d83acda4c5590ec19c7afdf26b9>:0
at Mono.Tools.Driver.LoadConfig (System.Boolean quiet) [0x00028] in <23529d1919fc4cdeb9723008e6dfcc48>:0
at Mono.Tools.Driver.Main (System.String[] args) [0x00351] in <23529d1919fc4cdeb9723008e6dfcc48>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.DllNotFoundException: System.Native
at (wrapper managed-to-native) Interop+Sys.Stat(byte&,Interop/Sys/FileStatus&)
at Interop+Sys.Stat (System.ReadOnlySpan`1[T] path, Interop+Sys+FileStatus& output) [0x00028] in <81342d83acda4c5590ec19c7afdf26b9>:0
at System.IO.FileSystem.FileExists (System.ReadOnlySpan`1[T] fullPath, System.Int32 fileType, Interop+ErrorInfo& errorInfo) [0x00007] in <81342d83acda4c5590ec19c7afdf26b9>:0
at System.IO.FileSystem.FileExists (System.ReadOnlySpan`1[T] fullPath) [0x00006] in <81342d83acda4c5590ec19c7afdf26b9>:0
at System.IO.File.Exists (System.String path) [0x00043] in <81342d83acda4c5590ec19c7afdf26b9>:0
at Mono.Tools.Driver.LoadConfig (System.Boolean quiet) [0x00028] in <23529d1919fc4cdeb9723008e6dfcc48>:0
at Mono.Tools.Driver.Main (System.String[] args) [0x00351] in <23529d1919fc4cdeb9723008e6dfcc48>:0
E: installing Assembly /usr/share/cli-common/policies.d/libgtk2.0-cil/policy.2.8.pango-sharp.dll failed
E: Installation of policy.2.8.pango-sharp with /usr/share/cli-common/runtimes.d/mono failed
dpkg: error processing package mono-gac (--configure):
subprocess installed post-installation script returned error exit status 29
dpkg: dependency problems prevent configuration of mono-runtime-common:
mono-runtime-common depends on mono-gac (= 6.0.0.313-0xamarin3+ubuntu1604b1); however:
Package mono-gac is not configured yet.
dpkg: error processing package mono-runtime-common (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
mono-gac
mono-runtime-common
E: Sub-process /usr/bin/dpkg returned an error code (1)
当我输入时出现同样的错误
sudo apt-get install ca-certificates-mono
或者
apt-get -f install
也无法删除 ca-certificates-mono
sudo apt-get remove ca-certificates-mono
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
mono-complete : Depends: ca-certificates-mono (= 6.0.0.313-0xamarin3+ubuntu1604b1) but it is not going to be installed
mono-devel : Depends: ca-certificates-mono (= 6.0.0.313-0xamarin3+ubuntu1604b1) but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
稍后我使用命令删除 ca-certificates-mono
sudo dpkg --force-all -P ca-certificates-mono
经过这次尝试apt-get install -f
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
ca-certificates-mono
The following NEW packages will be installed:
ca-certificates-mono
0 upgraded, 1 newly installed, 0 to remove and 275 not upgraded.
160 not fully installed or removed.
Need to get 0 B/31.1 kB of archives.
After this operation, 85.0 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up mono-gac (6.0.0.313-0xamarin3+ubuntu1604b1) ...
* Installing 1 assembly from libglade2.0-cil into Mono
Unhandled Exception:
System.DllNotFoundException: System.Native
at (wrapper managed-to-native) Interop+Sys.Stat(byte&,Interop/Sys/FileStatus&)
at Interop+Sys.Stat (System.ReadOnlySpan`1[T] path, Interop+Sys+FileStatus& output) [0x00028] in <81342d83acda4c5590ec19c7afdf26b9>:0
at System.IO.FileSystem.FileExists (System.ReadOnlySpan`1[T] fullPath, System.Int32 fileType, Interop+ErrorInfo& errorInfo) [0x00007] in <81342d83acda4c5590ec19c7afdf26b9>:0
at System.IO.FileSystem.FileExists (System.ReadOnlySpan`1[T] fullPath) [0x00006] in <81342d83acda4c5590ec19c7afdf26b9>:0
at System.IO.File.Exists (System.String path) [0x00043] in <81342d83acda4c5590ec19c7afdf26b9>:0
at Mono.Tools.Driver.LoadConfig (System.Boolean quiet) [0x00028] in <23529d1919fc4cdeb9723008e6dfcc48>:0
at Mono.Tools.Driver.Main (System.String[] args) [0x00351] in <23529d1919fc4cdeb9723008e6dfcc48>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.DllNotFoundException: System.Native
at (wrapper managed-to-native) Interop+Sys.Stat(byte&,Interop/Sys/FileStatus&)
at Interop+Sys.Stat (System.ReadOnlySpan`1[T] path, Interop+Sys+FileStatus& output) [0x00028] in <81342d83acda4c5590ec19c7afdf26b9>:0
at System.IO.FileSystem.FileExists (System.ReadOnlySpan`1[T] fullPath, System.Int32 fileType, Interop+ErrorInfo& errorInfo) [0x00007] in <81342d83acda4c5590ec19c7afdf26b9>:0
at System.IO.FileSystem.FileExists (System.ReadOnlySpan`1[T] fullPath) [0x00006] in <81342d83acda4c5590ec19c7afdf26b9>:0
at System.IO.File.Exists (System.String path) [0x00043] in <81342d83acda4c5590ec19c7afdf26b9>:0
at Mono.Tools.Driver.LoadConfig (System.Boolean quiet) [0x00028] in <23529d1919fc4cdeb9723008e6dfcc48>:0
at Mono.Tools.Driver.Main (System.String[] args) [0x00351] in <23529d1919fc4cdeb9723008e6dfcc48>:0
E: installing Assembly /usr/lib/cli/glade-sharp-2.0/glade-sharp.dll failed
E: Installation of libglade2.0-cil with /usr/share/cli-common/runtimes.d/mono failed
* Installing 1 assembly from libglib2.0-cil into Mono
Unhandled Exception:
System.DllNotFoundException: System.Native
at (wrapper managed-to-native) Interop+Sys.Stat(byte&,Interop/Sys/FileStatus&)
at Interop+Sys.Stat (System.ReadOnlySpan`1[T] path, Interop+Sys+FileStatus& output) [0x00028] in <81342d83acda4c5590ec19c7afdf26b9>:0
at System.IO.FileSystem.FileExists (System.ReadOnlySpan`1[T] fullPath, System.Int32 fileType, Interop+ErrorInfo& errorInfo) [0x00007] in <81342d83acda4c5590ec19c7afdf26b9>:0
at System.IO.FileSystem.FileExists (System.ReadOnlySpan`1[T] fullPath) [0x00006] in <81342d83acda4c5590ec19c7afdf26b9>:0
at System.IO.File.Exists (System.String path) [0x00043] in <81342d83acda4c5590ec19c7afdf26b9>:0
at Mono.Tools.Driver.LoadConfig (System.Boolean quiet) [0x00028] in <23529d1919fc4cdeb9723008e6dfcc48>:0
at Mono.Tools.Driver.Main (System.String[] args) [0x00351] in <23529d1919fc4cdeb9723008e6dfcc48>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.DllNotFoundException: System.Native
at (wrapper managed-to-native) Interop+Sys.Stat(byte&,Interop/Sys/FileStatus&)
at Interop+Sys.Stat (System.ReadOnlySpan`1[T] path, Interop+Sys+FileStatus& output) [0x00028] in <81342d83acda4c5590ec19c7afdf26b9>:0
at System.IO.FileSystem.FileExists (System.ReadOnlySpan`1[T] fullPath, System.Int32 fileType, Interop+ErrorInfo& errorInfo) [0x00007] in <81342d83acda4c5590ec19c7afdf26b9>:0
at System.IO.FileSystem.FileExists (System.ReadOnlySpan`1[T] fullPath) [0x00006] in <81342d83acda4c5590ec19c7afdf26b9>:0
at System.IO.File.Exists (System.String path) [0x00043] in <81342d83acda4c5590ec19c7afdf26b9>:0
at Mono.Tools.Driver.LoadConfig (System.Boolean quiet) [0x00028] in <23529d1919fc4cdeb9723008e6dfcc48>:0
at Mono.Tools.Driver.Main (System.String[] args) [0x00351] in <23529d1919fc4cdeb9723008e6dfcc48>:0
E: installing Assembly /usr/lib/cli/glib-sharp-2.0/glib-sharp.dll failed
E: Installation of libglib2.0-cil with /usr/share/cli-common/runtimes.d/mono failed
* Installing 5 assemblies from libgtk2.0-cil into Mono
所以现在我没有 ca-certificates-mono,并且由于一些 Mono 问题我无法安装它。
答案1
Mono 项目 gitter 聊天室的好心人帮助我修复了这个错误。
mv /etc/mono/config.dpkg-new /etc/mono/config
进而
apt install ca-certificates-mono
解决了这个错误。