标签 Linux 下的文章

trying to overwrite `/usr/bin/keditfiletype’, which is also in package kcontrol

因为前几天硬盘出现故障,老是进不了windows,没办法,开始不知道,傻傻的以为是系统问题,就安装了debian 5.02,也就是最新的debian/linux稳定版lenny。结果安装的时候也提示install failed , 昨天跑到街上买了根sata数据线,结果机子尽然可以用了,难道真的是数据线的问题? 不过可以用就行了,不怕找不到娱乐工具了。我安装的是debian 5.02 amd64的基本系统,以前一直用gnome,现在想换换胃口就安装了kde,主要是被kde4的华丽丽的界面给征服鸟。找任意一个编辑器把一下内容写入/etc/apt/sources.list ,我电信的,这个源是中国科大的,贼快哦。

deb http://211.86.156.210/debian/ unstable main non-free contrib
deb http://211.86.156.210/debian-multimedia/ unstable main
deb http://211.86.156.210/debian-security/ testing/updates main

debian 和 debian-multimedia 库都是用的unstable版本,因为只有unstable的kde版本才是最新的4.3 ,debian-security用来打安全补丁。

运行

apt-get update  
apt-get install x-window-system kde  
apt-get dist-upgrade 

直接startx kde4.3就安装好了。

--------------------华丽丽分割现---------------

其实本来安装是没有这样的顺利的,本来开始用的是mirrors.163.com这个源,但是在apt-get dist-upgrade后,出现了下面的错误:

Preparing to replace kdebase-runtime 4:4.2.4-2 (using .../kdebase-runtime_4%3a4.3.0-1_amd64.deb) ...
Unpacking replacement kdebase-runtime ...
dpkg: error processing /var/cache/apt/archives/kdebase-runtime_4%3a4.3.0-1_i386.deb (--unpack):
 trying to overwrite `/usr/bin/keditfiletype', which is also in package kcontrol

看字面意思来解释,应该是kdebase-runtime_4:4.3.0-1_amd64.deb这个包和之前安装的kcontrol发生了冲突。google了半天,发现这个是个bug:http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=540009

修复的方法是:

cd /var/lib/dpkg/info
rm -rf kdebase-runtime.*
rm -rf kcontrol.*
apt-get -f install

然后换成科大的源,重新下载安装。 查看了kdebase-runtime_4.3.0-2的changlog,这个bug已经修正了:

+++ Changes by Modestas Vainius:
  • Merge kdebase-runtime-data-common to kdebase-runtime-data.
  • Merge kdebase-runtime-bin-kde4 to kdebase-runtime.
  • kdebase-runtime conflicts with kcontrol. (Closes: <a class="buglink" href="http://bugs.debian.org/540009">#540009</a>).
  • Urgency medium due to RC bugfix.
  • Add build depend on libslp-dev.

我后来查看了mirrors.163.com的套件库,已经修正的包是存在的:

kdebase-runtime_4.3.0-2_amd64.deb 06-Aug-2009 00:03 2466466

但是我们用apt-get update 下载下来163的包索引文件:

Packages.bz2 05-Aug-2009 16:15 6028664

并没有及时的更新,日期是8月5日生成不信可以抓下来bzip2 -d -v Packages.bz2 然后 less Packages 搜索Filename: pool/main/k/kdebase-runtime 发现版本还是4.3.0-1。

Packages.bz2 11-Aug-2009 22:27 5.8M

上面这个是科大的,8月11日生成,这个:Wed, 05 Aug 2009 13:30:30 +0200 是bug修复的日期,可见及时更新Packages包索引是多么的重要啊。

enter image description here

ls命令加入配色

打开/root/.bashrc (假设你修改root的bash环境)  :

# ~/.bashrc: executed by bash(1) for non-login shells.

export PS1='\h:\w\$ '
umask 022

You may uncomment the following lines if you want `ls' to be colorized:

#export LS_OPTIONS='--color=auto'
#eval "dircolors"
#alias ls='ls $LS_OPTIONS'
#alias ll='ls $LS_OPTIONS -l'
#alias l='ls $LS_OPTIONS -lA'

Some more alias to avoid making mistakes:

alias rm='rm -i'

alias cp='cp -i'

alias mv='mv -i'

将蓝色那几行前面的#都去掉,红色的字体看得懂,就知道咋整。

ls命令加入配色

修改debian默认locale为en_US.UTF-8


安装系统的时候用graphic mode安装,没有装桌面,locale装了zh_CN.UTF-8进text mode发现全部是乱码。
dpkg --reconfigure locales 勾选en_US.UTF-8 , 修改/etc/default/locale 为:

LANG="en_US.UTF-8"
LANGUAGE="en_US:en"


然后重启机子,乱码消失。

体验安装Debian Lenny

需要软件:
Vmware Workstation 6.5.1 (到Verycd下载
debian-500-amd64-DVD-1.iso (推荐个快的镜像
安装并打开Vmware Workstation,Help->About Wmware Workstation看看版本:

File->New->Virtual Machine->Typical->Installer disk image file(iso)指定为Debian-500-amd64-DVD-1.iso所在位置->Next->Linux->Version选择Other Linux 2.6.x kernel 64-bit(因为我是64位的机子:))->Virtual machine name:debian5 ->Location:D:\vmdebian5 ->Next->Maximum disk size:10GB->Next->Finish。这样我们的虚拟机就配置好了。

重启动按ESC,启动设备选择CD-ROM,这就我们就进了debian的安装界面了:

有Install和Graphical Install两种安装模式,机子猥琐点的就Install,牛X点的就Graphical Install , 我自认为4200+还不是很猥琐,且适合我这种newbie。

很久没有玩Lin,发现自己落后了,debian的界面真TM让人倍感亲切啊~Holy Awesome~~语言选择 简体中文 -> 继续 -> Choose Language(中文) ->继续 ->键盘布局(美国英语) -> 然后系统自动探测和挂载CD-ROM,查看里面的套件库(repository)  -> 主机名(刚才看了电影Sex Drive,就叫stiff-cock吧) ->继续 -> 域名(localdomain) -> 继续->这个时候系统正在获取服务器时间,由我校的网络情况来看,直接点“取消”-> 接下来是比较关键的分区了,选择“手动”用Diskdruid来分区,貌似没有必要用LVM(Logical Volume Management),如果不是用来做服务器的话。->继续。

选中SCSI1那个,继续,是否创建新的分区表(是) -> 继续 -> 选中空闲空间 继续, 具体的分区方法不讲了,我分了2个区:1GB的Swap和剩下所有分区作为根分区(Ext3 FS),如图:

“分区设定结束并将写入磁盘” ->继续 ->“将改动写入磁盘(是)” ->继续 ,根据我的经验来看,10GB的主分区也不显得多,因为所有debian的套件加起来有4.5个4.37左右的大小,也就是4.5 X 4.37 约=20GB ,囧~ 以后不出意外不会进X-Window,除非有时间研究gtk~ (废话一句,现在俺在学MFC),

接下来设置root的密码和自己创建一个普通用户和密码,一般我都这样设置:
username: root   password:x
username:tps     password:x
有些人觉得不安全,我觉得无所谓,反正都是做实验用,被黑了那是RPWT。

接下来问你时候扫描其他的CD/DVD媒介来安装,如果你就Debian-500-amd64-DVD-2.iso到Debian-500-amd64-DVD-5.iso 就一个一个的加载进去吧,

我就点否了,继续 ,接下来问俺们是否使用网络镜像,饿,Drcom的朋友直接“否” 继续 ->接下来点虚拟机的网卡托盘,Disconnect掉,否则会循环询问“是否用网络镜像”-> 接下来询问“是否参加软件包流行度调查?”->“否”,继续。

接下来选择要安装的软件,默认“桌面环境”和“标准系统” 已经勾选,我再添加个“Web服务器” “SQL数据库” ,免得以后安装apache,mysql麻烦。

接下来就是不长不短的安装时间,以安装套件数量而定。我突然发现左下角有个屏幕截图按钮。挺方便那些做安装教程,和安装的时候碰到问题的人。在安装的过程中,我吃上了“阿明菊花香瓜子”,比恰恰的烂瓜子少,且颗粒饱满,推荐食用,不要记错牌子哦,不是“菊爆香瓜子”哈~

好了安装的尾声叫我们是否GRUB安装到MBR,习惯性的我喜欢用GRUB引导其他系统,所以选“是”,重启动,来到登陆界面:

只能用普通用户登陆,要获得root权限,自己sudo,su

进来了:

为了达到更好的显示效果,需安装Vmware Tools,VM->Install Vmware Tools,然后Guest OS以CD的形式自动挂载到/media/cdrom0

Alt+F2 输入gnome-terminal
$cd /media/cdrom
$ cp *.tar.gz /home/tps/
$cd /home/tps
$tar zxvf *.tar.gz
$su 输入root密码

apt-get -y install binutils kernel-package  linux-headers-2.6.26-1-amd64

./vmware-tools-distrib/vmware-install.pl

接下来运行Vmware公司为咋们提供的傻瓜perl安装脚本,一路敲Enter,输入yes

当出现"What is the location of the directory of C header files that match your running kernel?" 输入/usr/src/linux-headers-2.6.26-1-amd64/include/
(kernel版本可以通过uname -a得到),接下来到了这样的提示:

None of the pre-built vmmemctl modules for VMware Tools is suitable for your
running kernel.  Do you want this program to try to build the vmmemctl module
for your system (you need to have a C compiler installed on your system)?
[yes]

Using compiler "/usr/bin/gcc". Use environment variable CC to override.

Your kernel was built with "gcc" version "4.1.3", while you are trying to use
"/usr/bin/gcc" version "4.3.2". This configuration is not recommended and
VMware Tools may crash if you'll continue. Please try to use exactly same
compiler as one used for building your kernel. Do you want to go with compiler
"/usr/bin/gcc" version "4.3.2" anyway? [no]

大概意思就是说没有找到适合俺们2.6.26-1-amd64内核的vmmemctl模块,需要自己编译,但是编译内核的gcc版本必须要和编译这个模块的版本符合,2.6.26-1-amd64用的是gcc 4.1.3编译的,而当前系统默认使用4.3.2,因为/usr/bin/gcc 是/usr/bin/gcc-4.3的软链接:
stiff-cock:/usr/bin# file /usr/bin/gcc
/usr/bin/gcc: symbolic link to `gcc-4.3'

在这里找到解决办法:
http://yuanfarn.blogspot.com/2008/10/debian-testing-on-vmware-workstation.html

所以不要使用4.3强制编译,因为我尝试了,会出现两个make的错误,所以运行这个先定义CC变量:
#CC=/usr/bin/gcc-4.1 ./vmware-tools-distrib/vmware-install.pl

接下来自动编译vmmemctl ,vmhgfs,vmxnet modules,然后更新initramfs:
update-initramfs: Generating /boot/initrd.img-2.6.26-1-amd64
然后系统再编译了一个叫vmblock.o的非内核模块~

然后:
[EXPERIMENTAL] The VMware FileSystem Sync Driver (vmsync) is a new feature that
creates backups of virtual machines. Please refer to the VMware Knowledge Base
for more details on this capability. Do you wish to enable this feature?
[yes]

Vmware文件系统同步驱动,实验性的东西,可以尝试,yes~
接下来vmci,vsock。

None of the pre-built vsock modules for VMware Tools is suitable for your
running kernel.  Do you want this program to try to build the vsock module for
your system (you need to have a C compiler installed on your system)? [yes]

Extracting the sources of the vsock module.

Building the vsock module.

Using 2.6.x kernel build system.
make: Entering directory /tmp/vmware-config0/vsock-only'<br /> make -C /lib/modules/2.6.26-1-amd64/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. modules<br /> make[1]: Entering directory/usr/src/linux-headers-2.6.26-1-amd64'
CC [M]  /tmp/vmware-config0/vsock-only/linux/af_vsock.o
CC [M]  /tmp/vmware-config0/vsock-only/linux/driverLog.o
CC [M]  /tmp/vmware-config0/vsock-only/linux/util.o
CC [M]  /tmp/vmware-config0/vsock-only/linux/vsockAddr.o
LD [M]  /tmp/vmware-config0/vsock-only/vsock.o
Building modules, stage 2.
MODPOST 1 modules
WARNING: "VMCIDatagram_CreateHnd" [/tmp/vmware-config0/vsock-only/vsock.ko] undefined!
WARNING: "VMCIDatagram_DestroyHnd" [/tmp/vmware-config0/vsock-only/vsock.ko] undefined!
WARNING: "VMCIEvent_Subscribe" [/tmp/vmware-config0/vsock-only/vsock.ko] undefined!
WARNING: "VMCI_DeviceGet" [/tmp/vmware-config0/vsock-only/vsock.ko] undefined!
WARNING: "VMCIMemcpyFromQueueV" [/tmp/vmware-config0/vsock-only/vsock.ko] undefined!
WARNING: "VMCIQueuePair_Detach" [/tmp/vmware-config0/vsock-only/vsock.ko] undefined!
WARNING: "VMCI_GetContextID" [/tmp/vmware-config0/vsock-only/vsock.ko] undefined!
WARNING: "VMCIDatagram_Send" [/tmp/vmware-config0/vsock-only/vsock.ko] undefined!
WARNING: "VMCIQueuePair_Alloc" [/tmp/vmware-config0/vsock-only/vsock.ko] undefined!
WARNING: "VMCIEvent_Unsubscribe" [/tmp/vmware-config0/vsock-only/vsock.ko] undefined!
WARNING: "VMCIMemcpyToQueueV" [/tmp/vmware-config0/vsock-only/vsock.ko] undefined!
CC      /tmp/vmware-config0/vsock-only/vsock.mod.o
LD [M]  /tmp/vmware-config0/vsock-only/vsock.ko
make1: Leaving directory /usr/src/linux-headers-2.6.26-1-amd64'<br /> cp -f vsock.ko ./../vsock.o<br /> make: Leaving directory/tmp/vmware-config0/vsock-only'
Unable to make a vsock module that can be loaded in the running kernel:
insmod: error inserting '/tmp/vmware-config0/vsock.o': -1 Unknown symbol in module

There is probably a slight difference in the kernel configuration between the
set of C header files you specified and your running kernel.  You may want to
rebuild a kernel based on that directory, or specify another directory.

The VM communication interface socket family is used in conjunction with the VM
communication interface to provide a new communication path among guests and
host.  The rest of this software provided by VMware Tools is designed to work
independently of this feature.  If you wish to have the VSOCK feature  you can
install the driver by running vmware-config-tools.pl again after making sure
that gcc, binutils, make and the kernel sources for your running kernel are
installed on your machine. These packages are available on your distribution's
installation CD.
[ Press the Enter key to continue.]

接下来选择分辨率"[19]   1440x900"(19寸宽屏最佳resolution)
然后自动重启动X,使用这个config:"/tmp/vmware-config1/XF86ConfigLog.5435"

打开Iceweasel ,字体默认sans-serif 改为WenQuanYi Bitmap,效果(1400x900):

然后重启动一下机子,点VM->Setting ->Option ->Shared Folders(Always Enable) ->Add一个 ,
Name:share
Host path:D:\vmdebian5\share
然后在debian里面sudo mount -t vmhgfs .host:/  /mnt/hgfs/
D:\vmdebian5\share和/mnt/hgfs/就是同一个目录~可以用来在Host OS和Guest OS中传文件,同步文件~

为了对Debian GNU/Linux 5.0 有更加深入的了解,翻译了一下这个:
http://debian.org/News/2009/20090214