前几天在虚拟机上安装ubuntu7.0464bit时,遇到了一个经典的bug:failedtowritecache.由fc-cache-fv命令导致的。
google之后找到了两个解决的方法,觉得很有必要记录一下
方法之一,比较简单,写了一个很简单的脚本,然后执行下就可以了,内容如下:
#!/bin/bash
#
#修正Ubuntu7.04fc-cachefailedtowritecache错误
#sudotouch/usr/share/fonts
sudotouch/usr/share/fonts/X11
sudotouch/usr/share/fonts/X11/100dpi
sudotouch/usr/share/fonts/X11/75dpi
sudotouch/usr/share/fonts/X11/Type1
sudotouch/usr/share/fonts/X11/encodings
sudotouch/usr/share/fonts/X11/encodings/large
sudotouch/usr/share/fonts/X11/misc
sudotouch/usr/share/fonts/X11/util
sudotouch/usr/share/fonts/truetype
sudotouch/usr/share/fonts/truetype/arphic
sudotouch/usr/share/fonts/truetype/baekmuk
sudotouch/usr/share/fonts/truetype/freefont
sudotouch/usr/share/fonts/truetype/kochi
sudotouch/usr/share/fonts/truetype/openoffice
sudotouch/usr/share/fonts/truetype/thai
sudotouch/usr/share/fonts/truetype/ttf-arabeyes
sudotouch/usr/share/fonts/truetype/ttf-bengali-fonts
sudotouch/usr/share/fonts/truetype/ttf-bitstream-vera
sudotouch/usr/share/fonts/truetype/ttf-dejavu
sudotouch/usr/share/fonts/truetype/ttf-devanagari-fonts
sudotouch/usr/share/fonts/truetype/ttf-gentium
sudotouch/usr/share/fonts/truetype/ttf-gujarati-fonts
sudotouch/usr/share/fonts/truetype/ttf-kannada-fonts
sudotouch/usr/share/fonts/truetype/ttf-lao
sudotouch/usr/share/fonts/truetype/ttf-malayalam-fonts
sudotouch/usr/share/fonts/truetype/ttf-mgopen
sudotouch/usr/share/fonts/truetype/ttf-oriya-fonts
sudotouch/usr/share/fonts/truetype/ttf-punjabi-fonts
sudotouch/usr/share/fonts/truetype/ttf-tamil-fonts
sudotouch/usr/share/fonts/truetype/ttf-telugu-fonts
sudotouch/usr/share/fonts/type1
sudotouch/usr/share/fonts/type1/gsfonts
sudotouch/usr/share/X11/fonts
sudotouch/usr/share/X11/fonts/100dpi
sudotouch/usr/share/X11/fonts/75dpi
sudotouch/usr/share/X11/fonts/Type1
sudotouch/usr/share/X11/fonts/encodings
sudotouch/usr/share/X11/fonts/encodings/large
sudotouch/usr/share/X11/fonts/misc
sudotouch/usr/share/X11/fonts/util
sudotouch/usr/local/share/fonts
sudotouch/var/lib/defoma/fontconfig.d
sudotouch/var/lib/defoma/fontconfig.d/A
sudotouch/var/lib/defoma/fontconfig.d/B
sudotouch/var/lib/defoma/fontconfig.d/C
sudotouch/var/lib/defoma/fontconfig.d/D
sudotouch/var/lib/defoma/fontconfig.d/E
sudotouch/var/lib/defoma/fontconfig.d/F
sudotouch/var/lib/defoma/fontconfig.d/G
sudotouch/var/lib/defoma/fontconfig.d/H
sudotouch/var/lib/defoma/fontconfig.d/J
sudotouch/var/lib/defoma/fontconfig.d/K
sudotouch/var/lib/defoma/fontconfig.d/L
sudotouch/var/lib/defoma/fontconfig.d/M
sudotouch/var/lib/defoma/fontconfig.d/N
sudotouch/var/lib/defoma/fontconfig.d/O
sudotouch/var/lib/defoma/fontconfig.d/P
sudotouch/var/lib/defoma/fontconfig.d/R
sudotouch/var/lib/defoma/fontconfig.d/S
sudotouch/var/lib/defoma/fontconfig.d/T
sudotouch/var/lib/defoma/fontconfig.d/U
sudotouch/var/lib/defoma/fontconfig.d/V
sudotouch/var/lib/defoma/fontconfig.d/a
sudotouch/var/lib/defoma/fontconfig.d/j
sudotouch/var/lib/defoma/fontconfig.d/m
sudotouch/var/lib/defoma/fontconfig.d/u
方法之二,很让我喜欢:
sudofc-cache-fv2>&1|grepfailed|cut-f1-d”:”|xargs-isudotouch{}&&sudofc-cache-fv
方法一比较的简单,当然也很实用
方法二充分利用了linux的命令,通过管道连接和一系列规则的运用,解决了问题。
相比较而言,我更喜欢第二个方法,shell真的很强大。最近就在翻一本学习bash的书,过段时间打算写几篇有关bash编程的日志,也算是自己学习的记录。
下载本文示例代码