树莓派论坛

 找回密码
 立即注册

一句话搞定Xbian的SSH中文环境

ihipop 发表于 2012-8-11 16:22:00 | 显示全部楼层 |阅读模式
可能是Xbian的BUG 使用update-locale没法更新系统语言 导致SSH上去是英文
下面假设你是全新安装的xbian
  1. #非必须 如果你需要另外安装X桌面 请去掉下面两行的命令里面开头的#号
  2. #apt-get update
  3. #apt-get install ttf-wqy-microhei ttf-wqy-zenhei
  4. #生成并且设置locale
  5. cat <<EOF >/etc/locale.gen
  6. en_US.UTF-8 UTF-8
  7. #zh_CN GB2312
  8. #zh_CN.GB18030 GB18030
  9. #zh_CN.GBK GBK
  10. zh_CN.UTF-8 UTF-8
  11. #zh_TW BIG5
  12. EOF
  13. dpkg-reconfigure -f noninteractive locales
  14. update-locale LANG=zh_CN.UTF-8
  15. cat <<EOF >/etc/profile.d/user_lang_env.sh
  16. #!/bin/sh
  17. [ -f /etc/default/locale ] && . /etc/default/locale
  18. [ -n "$LANG" ] && export LANG=$LANG
  19. EOF
  20. reboot
复制代码

Screenshot20120811162720.jpg
dteui 发表于 2012-8-11 18:20:18 | 显示全部楼层
新手不会啊,能不能详细一点
dteui 发表于 2012-8-11 18:20:44 | 显示全部楼层
新手不会啊,能不能详细一点
x-magic 发表于 2012-8-12 15:42:43 | 显示全部楼层

回 dteui 的帖子

dteui:新手不会啊,能不能详细一点 (2012-08-11 18:20) 
LZ写得已经够详细了,请先复习Linux基础知识
xile 发表于 2012-9-1 00:51:28 | 显示全部楼层
刚才试了下是乱码,不过我的xbmc是12.0的
ihipop  楼主| 发表于 2012-10-9 10:03:20 | 显示全部楼层

回 xile 的帖子

xile:
刚才试了下是乱码,不过我的xbmc是12.0的

代码贴错了

改成这样再执行下
  1. cat <<EOF >/etc/profile.d/user_lang_env.sh
  2. #!/bin/sh
  3. [ -f /etc/default/locale ] && . /etc/default/locale
  4. [ -n "\\$LANG" ] && export LANG=\\$LANG
  5. EOF
复制代码
xile 发表于 2012-10-13 00:57:40 | 显示全部楼层

回 ihipop 的帖子

ihipop:代码贴错了

改成这样再执行下
....... (2012-10-09 10:03) 
再次试了一下,不工作
root@XBian:~# date
2012骞?10?12妤 骀浜 16:49:27 UTC
root@XBian:~# apt-get update
Hit http://archive.raspbian.org wheezy InRelease      
Hit http://archive.raspbian.org wheezy/main Sources
Hit http://archive.raspbian.org wheezy/contrib Sources
Hit http://archive.raspbian.org wheezy/non-free Sources
Hit http://archive.raspbian.org wheezy/main armhf Packages
Hit http://archive.raspbian.org wheezy/contrib armhf Packages
Hit http://archive.raspbian.org wheezy/non-free armhf Packages
Ign http://archive.raspbian.org wheezy/contrib Translation-zh_CN
Ign http://archive.raspbian.org wheezy/contrib Translation-zh
Ign http://archive.raspbian.org wheezy/contrib Translation-en
Ign http://archive.raspbian.org wheezy/main Translation-zh_CN
Ign http://archive.raspbian.org wheezy/main Translation-zh
Ign http://archive.raspbian.org wheezy/main Translation-en
Ign http://archive.raspbian.org wheezy/non-free Translation-zh_CN
Ign http://archive.raspbian.org wheezy/non-free Translation-zh
Ign http://archive.raspbian.org wheezy/non-free Translation-en
Reading package lists... Done
root@XBian:~# apt-get install ttf-wqy-microhei ttf-wqy-zenhei
Reading package lists... Done
Building dependency tree      
Reading state information... Done
ttf-wqy-microhei is already the newest version.
ttf-wqy-zenhei is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 21 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]?
Abort.
root@XBian:~# #生成并且设置locale
root@XBian:~# cat <<EOF >/etc/locale.gen
> en_US.UTF-8 UTF-8
> #zh_CN GB2312
> #zh_CN.GB18030 GB18030
> #zh_CN.GBK GBK
> zh_CN.UTF-8 UTF-8
> #zh_TW BIG5
> EOF
root@XBian:~# dpkg-reconfigure -f noninteractive locales
Generating locales (this might take a while)...
  en_US.UTF-8... done
  zh_CN.UTF-8... done
Generation complete.
root@XBian:~# update-locale LANG=zh_CN.UTF-8
root@XBian:~# cat <<EOF >/etc/profile.d/user_lang_env.sh
> #!/bin/sh
> [ -f /etc/default/locale ] && . /etc/default/locale
> [ -n "\\$LANG" ] && export LANG=\\$LANG
> EOF
root@XBian:~# reboot


Broadcast message from root@XBian (pts/0) (Fri Oct 12 16:55:09 2012):

The system is going down for reboot NOW!
root@XBian:~#
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
root@XBian:~# date
2012骞?10?12妤 骀浜 16:57:06 UTC
root@XBian:~#
xile 发表于 2012-10-13 01:07:37 | 显示全部楼层

回 ihipop 的帖子

ihipop:


代码贴错了

改成这样再执行下
.......
再次试了一下,不工作
root@XBian:~# date
2012骞?10?12妤 骀浜 16:49:27 UTC
root@XBian:~# apt-get update
Hit http://archive.raspbian.org wheezy InRelease      
Hit http://archive.raspbian.org wheezy/main Sources
Hit http://archive.raspbian.org wheezy/contrib Sources
Hit http://archive.raspbian.org wheezy/non-free Sources
Hit http://archive.raspbian.org wheezy/main armhf Packages
Hit http://archive.raspbian.org wheezy/contrib armhf Packages
Hit http://archive.raspbian.org wheezy/non-free armhf Packages
Ign http://archive.raspbian.org wheezy/contrib Translation-zh_CN
Ign http://archive.raspbian.org wheezy/contrib Translation-zh
Ign http://archive.raspbian.org wheezy/contrib Translation-en
Ign http://archive.raspbian.org wheezy/main Translation-zh_CN
Ign http://archive.raspbian.org wheezy/main Translation-zh
Ign http://archive.raspbian.org wheezy/main Translation-en
Ign http://archive.raspbian.org wheezy/non-free Translation-zh_CN
Ign http://archive.raspbian.org wheezy/non-free Translation-zh
Ign http://archive.raspbian.org wheezy/non-free Translation-en
Reading package lists... Done
root@XBian:~# apt-get install ttf-wqy-microhei ttf-wqy-zenhei
Reading package lists... Done
Building dependency tree      
Reading state information... Done
ttf-wqy-microhei is already the newest version.
ttf-wqy-zenhei is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 21 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]?
Abort.
root@XBian:~# #生成并且设置locale
root@XBian:~# cat <<EOF >/etc/locale.gen
> en_US.UTF-8 UTF-8
> #zh_CN GB2312
> #zh_CN.GB18030 GB18030
> #zh_CN.GBK GBK
> zh_CN.UTF-8 UTF-8
> #zh_TW BIG5
> EOF
root@XBian:~# dpkg-reconfigure -f noninteractive locales
Generating locales (this might take a while)...
  en_US.UTF-8... done
  zh_CN.UTF-8... done
Generation complete.
root@XBian:~# update-locale LANG=zh_CN.UTF-8
root@XBian:~# cat <<EOF >/etc/profile.d/user_lang_env.sh
> #!/bin/sh
> [ -f /etc/default/locale ] && . /etc/default/locale
> [ -n "\\$LANG" ] && export LANG=\\$LANG
> EOF
root@XBian:~# reboot


Broadcast message from root@XBian (pts/0) (Fri Oct 12 16:55:09 2012):

The system is going down for reboot NOW!
root@XBian:~#
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
root@XBian:~# date
2012骞?10?12妤 骀浜 16:57:06 UTC
root@XBian:~#
xile 发表于 2012-10-13 01:09:51 | 显示全部楼层

回 xile 的帖子

xile:

再次试了一下,不工作
root@XBian:~# date
2012骞?10?12妤 骀浜 16:49:27 UTC
root@XBian:~# apt-get update
.......
root@XBian:~# apt-get install ttf-wqy-microhei
Reading package lists... Done
Building dependency tree      
Reading state information... Done
ttf-wqy-microhei is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 21 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]?
Setting up util-linux (2.20.1-5.2) ...
update-rc.d: error: unable to read /etc/init.d/hwclock.sh
dpkg: error processing util-linux (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
util-linux
localepurge: Disk space freed in /usr/share/locale: 0 KiB
localepurge: Disk space freed in /usr/share/man: 0 KiB

Total disk space freed by localepurge: 0 KiB

E: Sub-process /usr/bin/dpkg returned an error code (1)
root@XBian:~# apt-get install ttf-wqy-zenhei
Reading package lists... Done
Building dependency tree      
Reading state information... Done
ttf-wqy-zenhei is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 21 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]?
Setting up util-linux (2.20.1-5.2) ...
update-rc.d: error: unable to read /etc/init.d/hwclock.sh
dpkg: error processing util-linux (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
util-linux
localepurge: Disk space freed in /usr/share/locale: 0 KiB
localepurge: Disk space freed in /usr/share/man: 0 KiB

Total disk space freed by localepurge: 0 KiB

E: Sub-process /usr/bin/dpkg returned an error code (1)
root@XBian:~# apt-get install util-linux
Reading package lists... Done
Building dependency tree      
Reading state information... Done
util-linux is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 21 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]?
Setting up util-linux (2.20.1-5.2) ...
update-rc.d: error: unable to read /etc/init.d/hwclock.sh
dpkg: error processing util-linux (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
util-linux
localepurge: Disk space freed in /usr/share/locale: 0 KiB
localepurge: Disk space freed in /usr/share/man: 0 KiB

Total disk space freed by localepurge: 0 KiB

E: Sub-process /usr/bin/dpkg returned an error code (1)
root@XBian:~# apt-get remove util-linux
Reading package lists... Done
Building dependency tree      
Reading state information... Done
The following packages were automatically installed and are no longer required:
  liblockfile-bin liblockfile1 lockfile-progs pmount
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  makedev
The following packages will be REMOVED:
  dmsetup e2fsprogs fuse libdevmapper1.02.1 libparted0debian1 nfs-common ntfs-3g parted udev usbmount util-linux
The following NEW packages will be installed:
  makedev
WARNING: The following essential packages will be removed.
This should NOT be done unless you know exactly what you are doing!
  e2fsprogs util-linux (due to e2fsprogs)
0 upgraded, 1 newly installed, 11 to remove and 19 not upgraded.
1 not fully installed or removed.
Need to get 42.3 kB of archives.
After this operation, 8,355 kB disk space will be freed.
You are about to do something potentially harmful.
To continue type in the phrase 'Yes, do as I say!'
?]
Abort.
root@XBian:~# apt-get remove util-linux
Reading package lists... Done
Building dependency tree      
Reading state information... Done
The following packages were automatically installed and are no longer required:
  liblockfile-bin liblockfile1 lockfile-progs pmount
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  makedev
The following packages will be REMOVED:
  dmsetup e2fsprogs fuse libdevmapper1.02.1 libparted0debian1 nfs-common ntfs-3g parted udev usbmount util-linux
The following NEW packages will be installed:
  makedev
WARNING: The following essential packages will be removed.
This should NOT be done unless you know exactly what you are doing!
  e2fsprogs util-linux (due to e2fsprogs)
0 upgraded, 1 newly installed, 11 to remove and 19 not upgraded.
1 not fully installed or removed.
Need to get 42.3 kB of archives.
After this operation, 8,355 kB disk space will be freed.
You are about to do something potentially harmful.
To continue type in the phrase 'Yes, do as I say!'
?] Y
Abort.
root@XBian:~# apt-get install util-linux
Reading package lists... Done
Building dependency tree      
Reading state information... Done
util-linux is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 21 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]?
Setting up util-linux (2.20.1-5.2) ...
update-rc.d: error: unable to read /etc/init.d/hwclock.sh
dpkg: error processing util-linux (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
util-linux
localepurge: Disk space freed in /usr/share/locale: 0 KiB
localepurge: Disk space freed in /usr/share/man: 0 KiB

Total disk space freed by localepurge: 0 KiB

E: Sub-process /usr/bin/dpkg returned an error code (1)
root@XBian:~#
tian0cai 发表于 2012-12-2 23:56:50 | 显示全部楼层
如果是用putty连接ssh还要改一下putty的字符集才能看到中文。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版 | Archiver | 树莓派论坛 ( 粤ICP备15075382号-1 )