背景
本来Crunch Bang安装完成后,提供了一个安装google-chrome的脚本,可以顺利完成chrom的安装,但是这次装完后,运行脚本安装Google-chrome,一直报错,一开始以为是地址被墙了或地址失败下载不到包,于是改为手动下载安装包安装,安装信息如下:
janl@janl-studio:~$ wget https://dl.google.com/linux/direct/google-chrome-stable_current_i386.deb --2015-07-15 14:47:02-- https://dl.google.com/linux/direct/google-chrome-stable_current_i386.deb Resolving dl.google.com (dl.google.com)... 203.208.49.168, 203.208.49.160, 203.208.49.163, ... Connecting to dl.google.com (dl.google.com)|203.208.49.168|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 46750820 (45M) [application/x-debian-package] Saving to: `google-chrome-stable_current_i386.deb' 100%[======================================>] 46,750,820 947K/s in 48s 2015-07-15 14:47:55 (958 KB/s) - `google-chrome-stable_current_i386.deb' saved [46750820/46750820]
下载完成,开如安装:
janl@janl-studio:~/tools$ sudo dpkg -i ./google-chrome-stable_current_i386.deb [sudo] password for janl: (Reading database ... 87769 files and directories currently installed.) Unpacking google-chrome-stable (from .../google-chrome-stable_current_i386.deb) ... dpkg: error processing ./google-chrome-stable_current_i386.deb (--install): cannot copy extracted data for './opt/google/chrome/chrome' to '/opt/google/chrome/chrome.dpkg-new': failed to write (No space left on device) dpkg-deb: error: subprocess paste was killed by signal (Broken pipe) Processing triggers for desktop-file-utils ... Processing triggers for man-db ... Processing triggers for menu ... Errors were encountered while processing: ./google-chrome-stable_current_i386.deb
仔细看了一下错误信息原来是/opt空间不够, 汗。。。。
看来是受安装服务器的引响,把/挂载点留的空间太少了。。。。。。
然后就想,是不是脚本安装没有显示错误信息是不是也是这个原因啊,查看安装脚本,脚本找了半天才找到,原来在这:
先找到主菜单的定义文件:
janl@janl-studio:/etc/skel/.config/openbox$ ls autostart menu.xml rc.xml
menu.xml文件就是主菜单的定义文件了。(百度了半天才找到)
看看它的内容,找找安装脚本在哪里:整个wwwbrowsers的子菜单指向了一个叫cb-x-www-browser-pipemenu
<menu id="network" label="Network"> <menu execute="cb-x-www-browser-pipemenu" id="wwwbrowsers" label="WWW Browsers"/>
这是个可执行文件,在/usr/bin下。
看看它怎么写的
if ! sudo apt-get install -y google-chrome-stable; then clear echo "" echo " There was a problem installing Google Chrome." echo "" echo " Hit any key to try again, or \"q\" to quit..." read -n1 a if [ "$a" = "q" ] || [ "$a" = "Q" ]; then clear exit 0 else cb-x-www-browser-pipemenu --install-google-chrome exit 0 fi else clear echo "" echo " Google Chrome has been installed successfully." echo "" echo " Hit any key to exit..." read -n1 a exit 0 fi
前面还有一部分代码是验证网络和添加apt源的,关键就是一句:
sudo apt-get install -y google-chrome-stable
执行后,结果一样,原来google-chrome要安装在/opt下,/挂载点分的空间太少了,但是/usr下空间有很多。那就装在/usr下吧。
janl@janl-studio:~/tools$ sudo dpkg -i --instdir=/usr/local/chrome ./google-chrome-stable_current_i386.deb (Reading database ... 87769 files and directories currently installed.) Unpacking google-chrome-stable (from .../google-chrome-stable_current_i386.deb) ... dpkg: error processing ./google-chrome-stable_current_i386.deb (--install): error creating directory `.': No such file or directory dpkg-deb: error: subprocess paste was killed by signal (Broken pipe) dpkg (subprocess): admindir must be inside instdir for dpkg to work properly dpkg: error while cleaning up: subprocess new post-removal script returned error exit status 2 Errors were encountered while processing: ./google-chrome-stable_current_i386.deb janl@janl-studio:~/tools$ sudo dpkg -i --instdir=/usr/local/chrome google-chrome-stable_current_i386.deb (Reading database ... 87769 files and directories currently installed.) Preparing to replace google-chrome-stable 43.0.2357.134-1 (using google-chrome-stable_current_i386.deb) ... Unpacking replacement google-chrome-stable ... dpkg: error processing google-chrome-stable_current_i386.deb (--install): error creating directory `.': No such file or directory dpkg-deb: error: subprocess paste was killed by signal (Broken pipe) dpkg (subprocess): admindir must be inside instdir for dpkg to work properly dpkg: error while cleaning up: subprocess new post-removal script returned error exit status 2 Errors were encountered while processing: google-chrome-stable_current_i386.deb janl@janl-studio:~/tools$ sudo dpkg -i --instdir=/usr/local/chrome google-chrome-stable_current_i386.deb (Reading database ... 87769 files and directories currently installed.) Preparing to replace google-chrome-stable 43.0.2357.134-1 (using google-chrome-stable_current_i386.deb) ... Unpacking replacement google-chrome-stable ... Setting up google-chrome-stable (43.0.2357.134-1) ... dpkg (subprocess): admindir must be inside instdir for dpkg to work properly dpkg: error processing google-chrome-stable (--install): subprocess installed post-installation script returned error exit status 2 Processing triggers for desktop-file-utils ... dpkg (subprocess): admindir must be inside instdir for dpkg to work properly dpkg: error processing desktop-file-utils (--install): subprocess installed post-installation script returned error exit status 2 Processing triggers for man-db ... dpkg (subprocess): admindir must be inside instdir for dpkg to work properly dpkg: error processing man-db (--install): subprocess installed post-installation script returned error exit status 2 Processing triggers for menu ... dpkg (subprocess): admindir must be inside instdir for dpkg to work properly dpkg: error processing menu (--install): subprocess installed post-installation script returned error exit status 2 Errors were encountered while processing: google-chrome-stable desktop-file-utils man-db menu
报了很多错误,要求指定admindir,这个我没指定,先不管了,试试能不能用。
试了一下可以运行,这样把可执行文件做个连接放到/usr/bin就行了。
janl@janl-studio:/usr/local/chrome/opt/google$ sudo ln -s /usr/local/chrome/opt/google/chrome/google-chrome /usr/bin/
这样试一下,菜单变过来了,可以运行了。终于可以运行了。