今天想在ubuntu linux 上安装一个中文输入法,结果惹了一点麻烦:不知为何,apt-get系统瘫痪。所有的安装命令都报告:

Failed to stop snapd.autoimport.service: Unit snapd.autoimport.service not loaded.dpkg: error processing package snapd (--remove): subprocess installed pre-removal script returned error exit status 5Failed to get unit file state for snapd.refresh.timer: No such file or directorysnapd.refresh.timer is a disabled or a static unit, not starting it.Failed to get unit file state for snapd.autoimport.service: No such file or directorysnapd.autoimport.service is a disabled or a static unit, not starting it.Errors were encountered while processing: snapdE: Sub-process /usr/bin/dpkg returned an error code (1)

尝试修正snapd,报告依赖snap-confine新版本;安装snap-confine新版,又报告snapd无法使用。得,死循环。

谷歌找了一圈,没看到有效的办法,sudo apt-get -f install 也执行了,一样报告snapd错误。

sudo apt upgrade

正在读取软件包列表… 完成
正在分析软件包的依赖关系树
正在读取状态信息… 完成
您也许需要运行“apt-get -f install”来修正上面的错误。
下列软件包有未满足的依赖关系:
snapd : 依赖: snap-confine (= 2.23~14.04.2) 但是 2.22.2~14.04 已经安装
依赖: ubuntu-core-launcher (= 2.23~14.04.2) 但是 2.22.2~14.04 已经安装
E: 不能满足依赖关系。不妨试一下 -f 选项。

 

后来找到提示:

先删除已有的出错的snapd:

vim /var/lib/dpkg/info/snapd.prerm ,第二行加上 exit 0,就是骗过shell脚本。

再运行:dpkg –purge –force-all snapd 强制删除

然后检查:vim /etc/apt/sources.list ,注释掉所有的包含“trusty”的源,它是造成错误的根源,因为版本不同,这个是14版本,需要的是16版本。

再运行apt-get update,和 apt-get -f install 修复。

问题解决。

附:谷歌拼音for Linux 输入法的安装,转载的

 

安装只需简单的3个步骤,以下是详细安装过程:

1. 添加中文语言支持

从ubuntu右侧栏目单击齿轮按钮打开systemsetting,单击Language Support

图1

选择fcitx (这里我选择安装基于fcitx框架的输入法,所以选择fcitx), 单击install/Remove language

图2

选择Chinese(simplified)和Chinese(traditional)(这里我把繁体字也选上了),单击Apply,安装语言支持

图3

然后Restart重启,重启之后才会有效。

2. 使用命令行安装google pinyin

sudo apt-get install fcitx-googlepinyin

3.选择添加输入法

打开system setting,单击Text Entry

图4

单击左下角+号,添加输入法

图5

搜索栏目输入google,出现如下图Google Pinyin(Fcitx), 单击add

图6

安装完成,在屏幕右上角可以看到蓝色小g,就可以欢快的使用中文输入了!

(如果本安装教程有任何问题,欢迎留言反馈。)

 

 

职场人的学习方法
触动未来 - 说说VR和3D眼镜