7

修复 macOS 中 Cisco Anyconnect 报的奇怪Bug

 2 years ago
source link: https://wocai.de/post/2021/12/%E4%BF%AE%E5%A4%8D-macos-%E4%B8%AD-cisco-anyconnect-%E6%8A%A5%E7%9A%84%E5%A5%87%E6%80%AAbug/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

这几天用系统软件优化了下电脑,结果登不上公司的 Anyconnect 了。经过一些搜索,找到了问题。

解决问题 #

我使用的 Anyconnect 版本是 4.9.0 也比较新(最新版是 4.10.0 ),点开软件之后,Anyconnect 并不能自动链接,提示错误如下:

The VPN service is not available

然后我用 Sensei 卸载了 Anyconnect 之后重新安装,在安装过程中会报错,提示 安装失败。

起初我通过搜索,以为是之前 Anyconnect 卸载不够干净,有残留的文件或者设置没有清除掉,参照这篇文章,执行了一遍命令,但是并没有产生效果。

然后我搜到了这篇思科官方的文章,点进去一看,和我遇到的问题一模一样。

文章中主要操作的命令只有一条:

launchctl load /Library/LaunchDaemons/com.cisco.anyconnect.vpnagentd.plist

按照帖子中其他人的回复,你还可以尝试一下:

`sudo launchctl unload /Library/LaunchDaemons/com.cisco.anyconnect.vpnagentd.plist`
`sudo launchctl load /Library/LaunchDaemons/com.cisco.anyconnect.vpnagentd.plist`

其实含义很相似,就是用 launchctl 命令重新启动 Anyconnect 的自启服务,运行之后果然就能正常连接使用了。

launchctl 是啥 #

launchctl 其实是 macOS 系统中用来管理系统定时服务的命令,可以简单理解为开机自启动。

/Library/LaunchDaemons 文件夹中的服务和系统一起启动执行,Anyconnect 需要的服务就是在这个阶段启动的。

/Library/LaunchAgents 和用户登录一起执行。

可以尝试 launchctl list 查看本机中一共有多少自启的服务,如果有一些服务对应的软件不需要自启动,甚至是软件已经卸载了,在这里都可以看到。

研究到这里,我大概明白应该是之前在 Sensei 中清理系统的时候,手滑直接把 Anyconnect 的自启给删掉了,导致没法正常使用,只要这个服务启动起来就好了。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK