解决思路:大致就是,把启动的link文件,加上指定的运行参数
- chrome
- chromium
一、解决chrome不能启动问题
1. 找到chrome桌面启动文件
root@adam-Latitude-3480:~# cd /usr/share/applications/
root@adam-Latitude-3480:/usr/share/applications# ll | grep chrome
-rw-r--r-- 1 root root 8435 5月 13 22:22 google-chrome.desktop
root@adam-Latitude-3480:/usr/share/applications# gedit google-chrome.desktop &
[Desktop Entry]
Exec=/usr/bin/google-chrome-stable %U
找到执行文件位置/usr/bin/google-chrome-stable
2. 修改执行文件命令
root@adam-Latitude-3480:/usr/share/applications# gedit /usr/bin/google-chrome-stable
找到 exec -a "$0" "$HERE/chrome" "$@"
改为 exec -a "$0" "$HERE/chrome" "$@" --user-data-dir --no-sandbox
# Note: exec -a below is a bashism.
#exec -a "$0" "$HERE/chrome" "$@"
exec -a "$0" "$HERE/chrome" "$@" --user-data-dir --no-sandbox
#exec -a "$0" "$HERE/chrome" "$@" --user-data-dir "/root/.config/google-chrome"
二、解决chromium不能启动问题
同上
1. 找桌面文件 中的 执行文件位置
root@adam-Latitude-3480:/usr/share/applications# ll | grep chromium
-rw-r--r-- 1 root root 12559 6月 2 2017 chromium-browser.desktop
root@adam-Latitude-3480:/usr/share/applications# gedit chromium-browser.desktop
[Desktop Entry]
Version=1.0
Exec=chromium-browser %U
2. 搜索执行文件
这里exec执行的文件没有写路径,使用whereis
命令搜索
root@adam-Latitude-3480:/usr/share/applications# whereis chromium-browser
但是搜到的结果如下,有好多
chromium-browser: /usr/bin/chromium-browser /usr/lib/chromium-browser /etc/chromium-browser /usr/share/chromium-browser /usr/share/man/man1/chromium-browser.1.gz
3. 修改执行文件
这里我们只要改 /usr/bin
下的
root@adam-Latitude-3480:/usr/share/applications# gedit /usr/bin/chromium-browser &
找到exec,
这里exec匹配的只有一行执行语句,
if [ $want_temp_profile -eq 0 ] ; then
exec $LIBDIR/$APPNAME $CHROMIUM_FLAGS "$@"
else
# we can't exec here as we need to clean-up the temporary profile
$LIBDIR/$APPNAME $CHROMIUM_FLAGS "$@"
rm -rf $TEMP_PROFILE
fi
但是exec后面的命令 $LIBDIR/$APPNAME $CHROMIUM_FLAGS "$@"
有两行,
但第2个匹配文本的注释说:该行不会执行(#we can’t exec here)
所以我们把参数 --no-sandbox --user-data-dir
加到第一个匹配文本后面
if [ $want_temp_profile -eq 0 ] ; then
exec $LIBDIR/$APPNAME $CHROMIUM_FLAGS "$@" --no-sandbox --user-data-dir
else
# we can't exec here as we need to clean-up the temporary profile
$LIBDIR/$APPNAME $CHROMIUM_FLAGS "$@"
rm -rf $TEMP_PROFILE
fi
如果为了稳妥,可以在第二行命令上加上参数
done!
❤
码字不易
,整理费时
;
copy之前
,请双手合十
。