如何禁用 Google Chrome 自动更新 (macOS, Linux, Windows)

Posted by sysin on 2022-09-03
Estimated Reading Time 12 Minutes
Words 2.7k In Total
更新日期:Sat Sep 03 2022 20:20:00 GMT+0800,阅读量:

请访问原文链接:如何禁用 Google Chrome 自动更新 (macOS, Linux, Windows),查看最新版。原创作品,转载请保留出处。

作者主页:sysin.org


无耻抄袭者 Yu Tao 请远离本站!!!

禁用浏览器自动更新系列文章:

不同于 Firefox 官方提供了禁用自动更新的配置功能,Google Chrome 及基于其开源版本 Chromium 实现的衍生浏览器【国外各种(Microsoft Edge 等),国产各种……】不仅没有禁用自动更新的配置,而且是强制自动更新如同病毒病毒肆虐一般难以控制,非常不尊重用户。即使我们使用变通方法屏蔽了自动更新,它们竟然还会不停的提示软件已经过期。

适用的版本

本文写作时以 Chrome 88 版本为例,验证到 105 版本可用,不排除新版本将来可能有所变更。

如果方法失效,欢迎反馈,笔者将及时修正和更新,谢谢!

Google Chrome for Mac

Chrome for Mac 如何自动更新?

通过以下进程:

1
2
3
4
~/Library/Google/GoogleSoftwareUpdate/GoogleSoftwareUpdate.bundle/Contents/Helpers/GoogleSoftwareUpdateAgent.app
~/Library/Google/GoogleSoftwareUpdate/GoogleSoftwareUpdate.bundle/Contents/Helpers/GoogleSoftwareUpdateAgent.app via ~/Library/Google/GoogleSoftwareUpdate/GoogleSoftwareUpdate.bundle/Contents/Helpers/ksfetch
/Applications/Google Chrome.app via ~/Library/Google/GoogleSoftwareUpdate/GoogleSoftwareUpdate.bundle/Contents/Helpers/ksfetch
~/Library/Google/GoogleSoftwareUpdate/GoogleSoftwareUpdate.bundle/Contents/Helpers/ksfetch

访问 Google 相关域名检测并下载更新。

1
2
tools.google.com #主要 (sysin)
update.googleapis.com #某些版本适用

解决方案:

  • 删除进程并禁止重新生成
  • hosts 屏蔽相关域名
  • 屏蔽进程网络访问

禁用自动更新一般步骤

(1) 删除和设置权限

打开终端执行如下命令:

1
2
3
4
5
6
7
8
9
10
# 删除更新程序
rm -rf ~/Library/Google/GoogleSoftwareUpdate/GoogleSoftwareUpdate.bundle

# 将更新程序目录设置为系统级别只读
sudo chflags schg ~/Library/Google/GoogleSoftwareUpdate
#要恢复:sudo chflags noschg ~/Library/Google/GoogleSoftwareUpdate

# 如果是全新系统或者新建的用户,未运行 Chrome,可以手动创建上述文件夹再设置为只读
mkdir -p ~/Library/Google/GoogleSoftwareUpdate
sudo chflags schg ~/Library/Google/GoogleSoftwareUpdate

(2) 编辑 hosts 文件,添加如下内容:

手动编辑,打开终端,执行:sudo vi /etc/hosts,或者使用 SwitchHosts(免费软件),添加如下条目:

1
2
127.0.0.1 update.googleapis.com
127.0.0.1 tools.google.com

以上两步任意一个已经可以屏蔽自动更新,同时操作更加保险。

(3) 或者(或同时)使用防火墙软件屏蔽:

该项操作可选。

推荐 Little Snitch,这是一个商业软件。

分别新建规则,屏蔽以下进程访问网络:

1
2
3
4
~/Library/Google/GoogleSoftwareUpdate/GoogleSoftwareUpdate.bundle/Contents/Helpers/GoogleSoftwareUpdateAgent.app
~/Library/Google/GoogleSoftwareUpdate/GoogleSoftwareUpdate.bundle/Contents/Helpers/GoogleSoftwareUpdateAgent.app via ~/Library/Google/GoogleSoftwareUpdate/GoogleSoftwareUpdate.bundle/Contents/Helpers/ksfetch
/Applications/Google Chrome.app via ~/Library/Google/GoogleSoftwareUpdate/GoogleSoftwareUpdate.bundle/Contents/Helpers/ksfetch
~/Library/Google/GoogleSoftwareUpdate/GoogleSoftwareUpdate.bundle/Contents/Helpers/ksfetch

Process Name:上述进程名
Deny Outgoing Connections
To: Any Server

效果图:

disable-chrome-auto-update-mac

部署策略

Chrome 使用 com.google.Keystone.plist 来控制更新,也可以通过 MDM 部署。

根据官方文档,如果不使用 MDM,则保存在 /Library/Managed Preferences/ 目录下,打开终端执行命令:

1
2
3
sudo mkdir /Library/Managed\ Preferences
sudo defaults write /Library/Managed\ Preferences/com.google.Keystone updatePolicies -dict UpdateDefault -int 3
sudo defaults write /Library/Managed\ Preferences/com.google.Keystone updatePolicies -dict-add ComponentUpdatesEnabled -bool false

不过单机测试无效!该方式仅限企业环境,个人用户请忽略。

Google Chrome for Linux

官方发行的 deb 和 rpm 包是不带更新功能的,通过第三方 repo 安装的 Chrome 通常会通过软件包管理进行更新。

通过软件包管理禁用自动更新

Linux 软件更新通常依赖于系统级别的包管理机制(例如 apt 和 yum),我们可以手动来控制是否更新。

Chrome 稳定版在 Linux 中的软件包名称为:google-chrome-stable

在 Debian 及衍生系统中禁用 Chrome 更新:

1
2
3
sudo apt-mark hold google-chrome-stable
# 恢复
#sudo apt-mark unhold google-chrome-stable

在 Redhat 及衍生系统中禁用 Chrome 更新:

1
2
3
echo 'exclude=google-chrome-stable' >> /etc/yum.conf
# 恢复
#编辑 /etc/yum.conf 删除 exclude=google-chrome-stable

通过策略禁用更新

以下直接引用官方文档,有兴趣可以自行测试。

Step 1: Turn off Chrome browser updates

To stop Chrome browser auto-updating, take one of the following actions:

  • Create an empty repository before installing Chrome browser:
      `$ sudo touch /etc/default/google-chrome`
    
  • Add the following line to /etc/default/google-chrome:
      `repo_add_once=false`
    

Step 2: Turn off Chrome browser component updates (Optional)

Applies only to Chrome browser components.

Even if you turn off automatic updates for Chrome browser, browser components won’t automatically stop updating, including Widevine DRM (for encrypted media) and the Chrome updater recovery component. If you want to stop these components from updating, disable the Chrome ComponentUpdatesEnabled policy.

Using your preferred JSON file editor:

  1. In your etc/opt/chrome/policies/managed folder, create a JSON file and name it component_update.json.
  2. Add the following setting to the JSON file to turn off component updates:

    1
    2
    3
    {
    "ComponentUpdatesEnabled": "false"
    }
  3. Deploy the update to your users.

Google Chrome for Windows

Chrome for Windows 如何自动更新?

本文写作时以 Chrome 88 版本为例,100 版本测试任务计划名称有所变化,现在已经验证到 105 版本可用,不排除新版本将来可能有所变更。

Chrome 在 Windows 平台同时发布三个个版本,分别是:

  • 系统版(为所有用户安装)即 Windows System Setup,安装在 Program Files 文件夹下,需要管理员权限安装;
  • 企业版与上述系统版安装路径和权限要求是一样的,区别在于不是 exe 文件而是 msi 格式的安装包,msi 格式可以用于组策略部署;
  • 用户版即 Windows User Setup,安装在 Users 文件夹下,不需要管理员权限,普通用户就可以安装。

用户版不带自动更新程序,解压后是一个 7z 文件,即绿色版。

1
2
用户版主程序安装路径:
C:\Users\<用户名>\AppData\Local\Google\Chrome\Application\chrome.exe

系统版或者企业版使用以下方法进行自动更新

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
更新服务:
Google 更新服务 (gupdate)
Google 更新服务 (gupdatem)
Google Chrome Elevation Service (GoogleChromeElevationService)

任务计划:
GoogleUpdateTaskMachineCore
GoogleUpdateTaskMachineUA

新版的任务计划名称有所变化,原有名称都加上了随机字符串,例如:
GoogleUpdateTaskMachineCore{8A32A951-669F-4A7C-A7D0-F4169A5E59F0}
GoogleUpdateTaskMachineCore{8A32A951-669F-4A7C-A7D0-F4169A5E59F0}

主程序安装路径:
x64
C:\Program Files\Google\Chrome\Application\chrome.exe
x86
C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

更新程序 GoogleUpdate.exe 路径:
x64 和 x86 版本相同
C:\Program Files (x86)\Google\Update\GoogleUpdate.exe

根据上述路径,手动禁用或者删除即可禁用自动更新,即分别禁用或删除以下:

  • 更新服务
  • 任务计划
  • 删除更新程序(整个 Update 文件夹)

使用 PowerShell 禁用更新

打开 Windows PowerShell 直接复制以下脚本运行一下更加方便:

或者将脚本保存为 disable-chrome-auto-update.ps1 文件,右键点击 “使用 PowerShell 运行” 即可快速完成。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
if ([Environment]::Is64BitOperatingSystem -eq "True") {
#Write-Host "64-bit OS"
$PF=${env:ProgramFiles(x86)}
}
else {
#Write-Host "32-bit OS"
$PF=$env:ProgramFiles
}

if ($(Test-Path "$env:ProgramFiles\Google\Chrome\Application\chrome.exe") -eq "true") {
# 结束进程
taskkill /im chrome.exe /f
taskkill /im GoogleUpdate.exe /f
# Google Chrome 更新服务 (sysin)
#这里也可以使用 sc.exe stop "service name"
Stop-Service -Name "gupdate"
Stop-Service -Name "gupdatem"
Stop-Service -Name "GoogleChromeElevationService"
# Windows 10 默认 PS 版本 5.1 没有 Remove-Service 命令
# This cmdlet was added in PS v6. See https://docs.microsoft.com/en-us/powershell/scripting/whats-new/what-s-new-in-powershell-core-60?view=powershell-6#cmdlet-updates.
#Remove-Service -Name "gupdate"
#Remove-Service -Name "gupdatem"
#Remove-Service -Name "GoogleChromeElevationService"
# sc 在 PowerShell 中是 Set-Content 别名,所以要使用 sc.exe 否则执行后无任何效果
sc.exe delete "gupdate"
sc.exe delete "gupdatem"
sc.exe delete "GoogleChromeElevationService"
# 任务计划企业版
#schtasks.exe /Delete /TN \GoogleUpdateBrowserReplacementTask /F
#schtasks.exe /Delete /TN \GoogleUpdateTaskMachineCore /F
#schtasks.exe /Delete /TN \GoogleUpdateTaskMachineUA /F
Get-ScheduledTask -taskname GoogleUpdate* | Unregister-ScheduledTask -Confirm: $false
# 移除更新程序
Remove-Item "$PF\Google\Update\" -Recurse -Force
Write-Output "Disable Google Chrome Enterprise x64 Auto Update Successful!"
}
elseif ($(Test-Path "${env:ProgramFiles(x86)}\Google\Chrome\Application\chrome.exe") -eq "true") {
# 结束进程
taskkill /im chrome.exe /f
taskkill /im GoogleUpdate.exe /f
# 删除 Google Chrome 更新服务
#这里也可以使用 sc.exe stop "service name"
Stop-Service -Name "gupdate"
Stop-Service -Name "gupdatem"
Stop-Service -Name "GoogleChromeElevationService"
# Windows 10 默认 PS 版本 5.1 没有 Remove-Service 命令,糟糕!
# This cmdlet was added in PS v6. See https://docs.microsoft.com/en-us/powershell/scripting/whats-new/what-s-new-in-powershell-core-60?view=powershell-6#cmdlet-updates.
#Remove-Service -Name "gupdate"
#Remove-Service -Name "gupdatem"
#Remove-Service -Name "GoogleChromeElevationService"
# sc 在 PowerShell 中是 Set-Content 别名,所以要使用 sc.exe 否则执行后无任何效果
sc.exe delete "gupdate"
sc.exe delete "gupdatem"
sc.exe delete "GoogleChromeElevationService"
# 删除任务计划
#schtasks.exe /Delete /TN \GoogleUpdateBrowserReplacementTask /F
#schtasks.exe /Delete /TN \GoogleUpdateTaskMachineCore /F
#schtasks.exe /Delete /TN \GoogleUpdateTaskMachineUA /F
Get-ScheduledTask -taskname GoogleUpdate* | Unregister-ScheduledTask -Confirm: $false
# 移除更新程序
Remove-Item "$PF\Google\Update\" -Recurse -Force
Write-Output "Disable Google Chrome Enterprise x86 Auto Update Successful!"
}
else {
Write-Output "No Google Chrome Enterprise Installation Detected!"
}

组策略配置更新(仅适用于域客户端)

下载 administrative template,通过组策略部署,该方式适合企业域管理员,不再赘述。

下载 Chrome

Chrome 100 存档

Chrome 105 存档

Google Chrome 策略配置

Google Chrome 下载

备注:Chrome 内置多国语言界面。

Chrome macOS 最新稳定版固定下载地址

Chrome for macOS for Intel chip (已停止更新)

Chrome for macOS for Apple chip & Intel chip

Chrome Linux 最新稳定版固定下载地址

Chrome for Linux – deb

Chrome for Linux – rpm

Chrome Windows 最新版(3 种)下载地址

附录

相关下载

相关文章


捐助本站 ❤️ Donate

点击访问官方网站


文章用于推荐和分享优秀的软件产品及其相关技术,所有软件默认提供官方原版(免费版或试用版),免费分享。对于部分产品笔者加入了自己的理解和分析,方便学习和测试使用。任何内容若侵犯了您的版权,请联系作者删除。如果您喜欢这篇文章或者觉得它对您有所帮助,或者发现有不当之处,欢迎您发表评论,也欢迎您分享这个网站,或者赞赏一下作者,谢谢!

支付宝赞赏 微信赞赏

赞赏一下


☑️ 评论恢复,欢迎留言❗️
敬请注册!点击 “登录” - “用户注册”(已知不支持 21.cn/189.cn 邮箱)。请勿使用联合登录(已关闭)