问题描述
每当我启动 Azure Cloud shell 时,它都会崩溃并显示以下错误。任何想法如何摆脱这个错误。任何帮助表示赞赏。
Requesting a Cloud Shell.Succeeded.
Connecting terminal...
Unhandled exception. System.TypeInitializationException: The type initializer for 'System.Management.Automation.Configuration.PowerShellConfig' threw an exception.
---> System.TypeInitializationException: The type initializer for 'System.Management.Automation.Platform' threw an exception.
---> System.IO.IOException: Bad message
at System.IO.FileSystem.CreateDirectory(String fullPath)
at System.IO.Directory.CreateDirectory(String path)
at System.Management.Automation.Platform.SelectProductNameForDirectory(XDG_Type dirpath) in /PowerShell/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs:line 343
at System.Management.Automation.Platform..cctor() in /PowerShell/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs:line 145
--- End of inner exception stack trace ---
at System.Management.Automation.Configuration.PowerShellConfig..ctor() in /PowerShell/src/System.Management.Automation/engine/PSConfiguration.cs:line 91
at System.Management.Automation.Configuration.PowerShellConfig..cctor() in /PowerShell/src/System.Management.Automation/engine/PSConfiguration.cs:line 57
--- End of inner exception stack trace ---
at System.Management.Automation.Utils.GetPolicySettingFromConfigFile[T](ConfigScope[] preferenceOrder) in /PowerShell/src/System.Management.Automation/engine/Utils.cs:line 784
at System.Management.Automation.Utils.GetPolicySetting[T](ConfigScope[] preferenceOrder) in /PowerShell/src/System.Management.Automation/engine/Utils.cs:line 760
at Microsoft.PowerShell.CommandLineParameterParser.GetConfigurationNameFromGroupPolicy() in /PowerShell/src/Microsoft.PowerShell.ConsoleHost/host/msh/CommandLineParameterParser.cs:line 578
at Microsoft.PowerShell.ConsoleHost.ParseCommandLine(String[] args) in /PowerShell/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs:line 289
at Microsoft.PowerShell.UnmanagedPSEntry.Start(String[] args,Int32 argc) in /PowerShell/src/Microsoft.PowerShell.ConsoleHost/host/msh/ManagedEntrance.cs:line 82
at Microsoft.PowerShell.ManagedPSEntry.Main(String[] args) in /PowerShell/src/powershell/Program.cs:line 71
Aborted (core dumped)
解决方法
这可能是您的个人资料中的某些内容或损坏的云驱动器映像。要“恢复出厂设置”您的 cloudshell,请执行以下操作:
- 导航到用于 cloudshell 存储的资源组
- 导航到此资源组中的存储帐户
- 导航到“文件共享”,您应该会看到一个名为“cloudshellshare”的共享。
- 删除此共享。
- 重启/启动 cloudshell。这应该会给工厂带来新鲜的云壳。