如何修复Azure Cloud Shell启动时出现的core dump核心转储错误?
问题现象
每次启动Azure Cloud Shell时,会话请求成功、连接终端阶段程序直接崩溃,翻译后的核心报错堆栈如下:
未处理异常。System.TypeInitializationException: “System.Management.Automation.Configuration.PowerShellConfig”的类型初始化程序引发异常。 ---> System.TypeInitializationException: “System.Management.Automation.Platform”的类型初始化程序引发异常。 ---> System.IO.IOException: 错误的消息 位于 System.IO.FileSystem.CreateDirectory(String fullPath) 位于 System.IO.Directory.CreateDirectory(String path) 位于 System.Management.Automation.Platform.SelectProductNameForDirectory(XDG_Type dirpath) 对应代码位置:/PowerShell/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs 第343行 位于 System.Management.Automation.Platform..cctor() 对应代码位置:/PowerShell/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs 第145行 --- 内部异常堆栈结束 --- 位于 System.Management.Automation.Configuration.PowerShellConfig..ctor() 对应代码位置:/PowerShell/src/System.Management.Automation/engine/PSConfiguration.cs 第91行 位于 System.Management.Automation.Configuration.PowerShellConfig..cctor() 对应代码位置:/PowerShell/src/System.Management.Automation/engine/PSConfiguration.cs 第57行 --- 内部异常堆栈结束 --- 位于 System.Management.Automation.Utils.GetPolicySettingFromConfigFile[T](ConfigScope[] preferenceOrder) 对应代码位置:/PowerShell/src/System.Management.Automation/engine/Utils.cs 第784行 位于 System.Management.Automation.Utils.GetPolicySetting[T](ConfigScope[] preferenceOrder) 对应代码位置:/PowerShell/src/System.Management.Automation/engine/Utils.cs 第760行 位于 Microsoft.PowerShell.CommandLineParameterParser.GetConfigurationNameFromGroupPolicy() 对应代码位置:/PowerShell/src/Microsoft.PowerShell.ConsoleHost/host/msh/CommandLineParameterParser.cs 第578行 位于 Microsoft.PowerShell.ConsoleHost.ParseCommandLine(String[] args) 对应代码位置:/PowerShell/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs 第289行 位于 Microsoft.PowerShell.UnmanagedPSEntry.Start(String[] args, Int32 argc) 对应代码位置:/PowerShell/src/Microsoft.PowerShell.ConsoleHost/host/msh/ManagedEntrance.cs 第82行 位于 Microsoft.PowerShell.ManagedPSEntry.Main(String[] args) 对应代码位置:/PowerShell/src/powershell/Program.cs 第71行 已中止(核心转储)
根因说明
报错触发点为PowerShell初始化阶段创建用户配置目录时触发IO错误(Bad message)。Azure Cloud Shell启动时会自动挂载关联的Azure文件共享到用户主目录作为持久化存储,该共享一旦出现权限篡改、元数据损坏、配额耗尽,就会直接导致目录创建失败,中断PowerShell初始化流程。
操作解决方案
按优先级从高到低执行:
- 重置Cloud Shell用户配置
- 打开Azure门户Cloud Shell的选择面板,点击「设置」按钮
- 进入「用户设置」->「重置用户设置」,确认操作后等待系统自动重建关联的文件共享与权限配置
- 重启Cloud Shell验证是否恢复
- 手动排查存储状态
- 进入Cloud Shell关联的系统资源组,找到名称带
cloudshell后缀的存储账户 - 检查存储账户防火墙配置、访问密钥是否被修改,确认已开启「允许受信任的Microsoft服务访问此存储账户」选项
- 检查对应文件共享的配额使用量,若已耗尽则扩容后重试
- 进入Cloud Shell关联的系统资源组,找到名称带
- 切换Shell类型验证
启动Cloud Shell时优先选择Bash环境,若Bash可正常启动,则确认为PowerShell用户配置残留损坏,通过上述重置操作即可修复,无需手动修改系统文件。
内容的提问来源于stack exchange,提问作者Dennis om
相关产品推荐
相关产品推荐

