显示标签为“ubuntu”的博文。显示所有博文
显示标签为“ubuntu”的博文。显示所有博文

2016年3月15日星期二

解决apt-get依赖(unmet dependencies)问题

好几个月没开steam,想上商店看看,可是启动steam就报错,

You are missing the following 32-bit libraries, and Steam may not run: libGL.so.1

按照这篇帖子,一步一步解决问题,最后一步又卡了壳,

* 解决steam报错找不到libGL.so.1问题方案,


1- If you haven't updated your computer in a while, 
copy (ctrl+c) and paste (ctrl+SHIFT+v) this (and then hit enter to run it). If you don't know what this is, just do it. :
Code:
sudo apt-get update && sudo apt-get -y upgrade
2- If you've installed Steam already, skip to step 3. If you haven't installed Steam, open Terminal with ctrl+alt+t. Then copy (ctrl+c) and paste (ctrl+SHIFT+v) this (and then hit enter to run it):
Code:
sudo apt-get install -y steam
3- Now for the fix. Copy (ctrl+c) and paste (ctrl+SHIFT+v) this to edit Steam's configuration file (and then hit enter to run it):
Code:
sudo nano /etc/ld.so.conf.d/steam.conf
4- It'll probably be blank. If it's blank, paste these two lines. If it's not blank, just paste these two lines to the very bottom. Copy (ctrl+c) and paste (ctrl+SHIFT+v) this (and then enter to run it):
Code:
/usr/lib32
/usr/lib/i386-linux-gnu/mesa
5- Save it by hitting ctrl-x, then y, then enter.

6- Now copy (ctrl+c) and paste (ctrl+SHIFT+v) this (and then hit enter to run it).:
Code:
sudo ldconfig
7- Finally, copy (ctrl+c) and paste (ctrl+SHIFT+v) this (and then hit enter to run it). It reinstalls a Mesa/OpenGL library:
Code:
sudo apt-get install --reinstall libgl1-mesa-glx:i386
8- Open Steam, download Team Fortress 2, and go kill some folks.


可是到了如上第七步骤的时候,有错误啦,

The following packages have unmet dependencies:
.................

二逼如我,按照依赖的package名字,挨行敲入

sudo apt-get install PACKAGENAME

可总是有如下类似错误,即安装不成功

0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded

然后Google一番,终于找到了解决方案,

* 无敌神龙命令出来啦!

sudo apt-get -o Debug::pkgProblemResolver=yes dist-upgrade

自动修复这个依赖问题,自动安装缺失的包。太棒了。

至于更多的apt-get参考这篇帖子,解释的非常翔实。

解决apt-get update失败提示Unable to connect to 127.0.0.1问题

这半个月来,隔三差五的想起来一下sudo apt-get update,就是提示失败,满屏的,

Err http://ph.archive.ubuntu.com precise Release.gpg                           
  Unable to connect to ph.archive.ubuntu.com:http: [IP: X.X.X.X 80]
Err http://ph.archive.ubuntu.com precise-updates Release.gpg            
  Unable to connect to ph.archive.ubuntu.com:http: [IP: X.X.X.X 80]
。。。。。

W: Failed to fetch http://fr.archive.ubuntu.com/ubuntu/dists/precise/InRelease  
。。。。。。。。。
W: Some index files failed to download. They have been ignored, or old ones used instead.


重要提示在这里,

  ............Unable to connect to 127.0.0.1:1080:

端口是1080,看到这里我明白了些许。前段时间回国用shadowsocks来翻墙,里边的代理信息就是通过的1080端口,google了一下,我这样奇葩的问题比较少见。整理一下思路,我需要重置下1080端口,取消代理设置。

1. 删除shadowsocks配置信息,没什么卵用 -> 彻底remove掉shadowsocks,还是没什么卵用

2. 更改127.0.0.1这个DNS,用8.8.8.8,还是没什么卵用

3. 最终误打误打还是解决了问题----->

     sudo apt-get install 
   sudo apt-get autoremove


所以呢,现在正在谷歌apt-get各种命令来看...

2016年1月16日星期六

搞定emacs主题配色

我的emacs插件管理做的不是太好,一直都比较混乱,今天逢周六,好好地整理了一番,顺道把早就想弄的emacs主题给解决了,这里特指Linux平台下的emacs

先铺垫些前瞻知识。emacs的插件功能很强大,很适合爱折腾的人,自有配置。

1. 所有的配置信息都需要用lisp方言写入.emacs文件内,默认是在~/目录下。

2.所有的插件都需要在.emacs里导入,形如require 'name-of-tools。当然首先你要告诉emacs你的插件目录在哪里,即 add-to-list 'load-path "address"。为了方便管理和备份,强烈建议固定插件目录,一般大家使用~/.emacs.d目录。

好了,话归正题,我们要配置emacs的主题,不伤眼的舒服的主题!

1. 首先现在主题包地址,戳这里,目前版本是6.6.0

2. 得到压缩包,我们只需要压缩包里的themes文件夹和color-theme.el两个文件,cp命令把其拷进~/.emacs.d目录,cp -r themes/ ~/.emacs.d和cp color-theme.el ~/.emacs.d

3. 在根目录下打开.emacs配置文件,我们需要完成配置信息,简简单单只有四行,

;;themes
(add-to-list 'load-path "~/.emacs.d")  ;;load path 
(require 'color-theme)  ;;载入theme插件
(color-theme-initialize) ;;启动时初始化theme
(color-theme-calm-forest) ;;选择具体的主题

4. 这里我随便载入了一个名为color-theme-calm-forest的主题。其实我们还有更多的选择。打开emacs后,M-x color-theme-select 回车,就会列出当前theme包里的所有主题来,共计92项。大家可以按需选择,然后重新更改配置文件即可。例如,我们相上了TTY Dark这个主题,那么最后一行改为(color-theme-tty-dark)即可(这个更好看 -.-)

5. 除了这个标准的Theme包,网上还有其他的选择,配置思路同上。

最终效果如图



****************Wed 28 Dec, 2016**************
配置 Mac 下的 Emacs更新下

发现 Emacs24以后的版本都拥有比较强大的 主题管理功能,

M-x customize-themes

会看到如图所示的预置主题列表,适合心累了不折腾的同学,选择一个保存即可。


2016年1月13日星期三

解决笔记本Ubuntu发热问题(CPU/显卡)

之前用Fedora并无太大感受,现在用Ubuntu时不时地温度飙升(KDE桌面下会好些),Psensor显示的Physical id o,Core 0 和 Core 1仨的温度,经常不合时宜地到60+,max竟然能达到三位数,掌托发热严重影响敲代码。一番探索,找到了解决方案,现在温度基本稳定在40~50间,掌托无只管发热感受了。

1. 想查看设备温度请安装Psensor,安装如下,

sudo apt-add-repository ppa:jfi/ppa
sudo apt-get update
sudo apt-get install psensor

2. 发热的主要是三个地方,Physical id o,Core 0 和 Core 1,很明显,分别是独显和CPU。我的笔记本是蛋碎的A卡+Inter双显卡方案,在windows上一只是关闭独显只用集显的,笔记本就清爽了很多很多。同理,在ubuntu上我也想这样。

sudo gedit /etc/rc.local

默认只有这一行,

echo OFF > /sys/kernel/debug/vgaswitcheroo/switch

意思是关闭不使用的可切换显卡设备。问题是ubuntu默认开启的八成是我的独显,老子只要集显!!那么这样修改好了,

echo IGD > /sys/kernel/debug/vgaswitcheroo/switch
echo OFF > /sys/kernel/debug/vgaswitcheroo/switch

添加的第一行是启用了集显,最后的那行exit 0不要动。in this way, you can turn off your 独显。~~

3. 如上,够吗,不够。我先让独显也清爽爽!研究下ubuntu的独显驱动,位置System Settings -> Software&Updates -> Addition Drivers。默认的A卡驱动用的是首选项,后缀是(open source, tested),我这儿还显示有两个后缀是(proprietary)的可选项。孰优孰劣呢?我在askubuntu论坛找到了一个比较靠谱的说法,如下,

Most of the open source drivers you'll find may produce better graphical output than the proprietary do. Sometimes you won't even notice a difference. And sometimes an open source driver works much worse than the proprietary one. I will not make a general recommendation on which to use, but here are some cases, in which certain drivers are better than others:
  • If you have a nVidia card with Optimus, you should install the open source driver from theBumblebee Project. This is the only driver supporting Optimus on Linux. you should either install the open source driver from the Bumblebee Project, or any nVidia proprietary driver, but not the Xorg driver, as it currently doesn't support discrete graphics.
  • If you want to use CUDA (nVidia's stuff for executing functions on the GPU), you should use the proprietary driver.
  • If you have a AMD APU (Accelerated Processing Unit), you should install the proprietary driver fglrx, even if you don't use the embedded graphics chip. Else, the APU would stay at its lowest frequency.
  • If you want to use OpenCL (something like CUDA, developped by Khronos), you have to use the proprietary driver.
If none of these applies to you, it's up to you which driver you use. If you don't have any problems with the current driver, I wouldn't change it. You never know whether another one will even work at all. However, if you want to take the risk, try the drivers suggested in Software & Updates→ Additional Drivers and find out which one works best.

大意是,n卡要使用CUDA建议使用proprietary(私有)驱动,A卡建议使用fglrx proprietary私有驱动....娘希匹,就得用proprietary驱动?

我的A卡是陈旧的6630,查询到这段消息之前,我盲选的第二个fglrx-updates proprietary,效果很棒。个人的建议是,首先上官网,A卡官网的驱动就是这个fglrx proprietary。官方网站有对应的最好,没有的话各位可以挨个尝试...

4. 末了,BIOS之类的CPU类似cool and quiet选项各位都可以选上,等等。我的Ubuntu版本是14.04 LTS,如上解决方案对近几年的版本有普适性,别问我why -.-

2016年1月7日星期四

解决Ubuntu下gedit打开txt文件乱码问题

这是一个常见问题,默认用Gedit打开windows分区下的或拷贝来的.txt文件,会遇到乱码问题。究其原因是,两个系统的编码方式不一。Linux用的是UTF-8,而windows下的txt则是GBK,孰优孰劣不做判定,怎么解决问题是关键。

很简单呀,更改编码方式即可呀!可是找了半天Gedit也没有修改encodings的选项,这时候就需要dconf-Editor了。

1. sudo apt-get install dconf-tools

2. 打开dconf-editor

3. 定位org -> gnome -> gedit -> preferences -> encodings, 如图



在auto-detected 中添加 ‘GB18030’ 在‘UTF-8’之后
在shown-in-menu 中添加‘GB18030’, 回车生效。

再次打开,问题解决。

这是一个gedit一劳永逸的解决方案,如果不想大动干戈,可以选择乱码文件另存为,另存为选项中记得勾上如上GBK的编码方式,新文件也可避免乱码的问题。

下面我疑惑的是,怎么更改系统的编码,使其能够兼容GBK,难道要每一个编辑软件都要分别设定encodings吗?虽然之前的emacs和sublime也是分别设置的。

解决方法如下,

1. 修改/var/lib/locales/supported.d/local文件, 添加如下两行,记得用sudo修改
zh_CN.GBK GBK
zh_CN.GB2312 GB2312

2.sudo dpkg-reconfigure --force locales

这样, Ubuntu就支持GBK编码了

2015年11月26日星期四

KDE任务栏找回消失的当前任务缩略

今天开始摸索KDE,在ubuntu14.05上装的,感觉非常不错,相见恨晚。

说说优点,

1.字体无可挑剔,比Unity默认的楷书、渲染强太多,终于不用耗费精力折腾字体

2.主题美观大方,晶莹剔透,个人认为可以与mac os有的一拼,期待未来的扁平化

3.屏幕八点可定义,之前挺喜欢Gnome上这个功能

4.切换效果靓丽,无Unity大概率的卡顿

5.任务栏可定制,自由度很高,很容易将其做成Dock的样子

6.....想到了再补充


在摸索的时候,马上就遇到了一个小问题,

1.任务栏/面板(Panel)上的当前任务缩略给弄丢了,就是任务栏找不到当前正在运行的程序,只能靠Alt+Table来切换

摸索许久,终于找了回来。任务栏上Add Weights -> 添加Task Manager即可。

原来我们任务栏上的任务缩略也算是其上的一个Weight,恕我浅陋无知了。






2015年11月19日星期四

Install Sublime Text 2 in unbuntu

Method 1 - Easiest
As Jeff T points out in the comments below, it is actually quite simple to install Sublime Text 2. Here are the commands:

sudo add-apt-repository ppa:webupd8team/sublime-text-2
sudo apt-get update
sudo apt-get install sublime-text


Method 2

Download and Extract the tar file
First, head over to Sublime's website, and download the tar file for linux. After you have it downloaded, extract it with the following command (yours may vary, depending on the version you downloaded).

# unzip the file
tar xf Sublime\ Text\ 2.0.1\ x64.tar.bz2
You should see a Sublime Text 2 folder after you finish extracting the contents.

Move the extracted contents
After extracting the file, we are going to move it to the /opt directory.

sudo mv Sublime\ Text\ 2 /opt/

Launching from Terminal
Next, we are going to make it so we can simply type "sublime" into the terminal in order to launch it. To do so, run the following command:

sudo ln -s /opt/Sublime\ Text\ 2/sublime_text /usr/bin/sublime

Creating a Launcher in Unity
You may also want to create a launcher for Sublime (these commands are specific to Unity).

# create launcher in Unity
sudo sublime /usr/share/applications/sublime.desktop
Once sublime opens, paste the following content into sublime.desktop

# paste the following content into sublime.desktop
[Desktop Entry]
Version=1.0
Name=Sublime Text 2
GenericName=Text Editor

Exec=sublime
Terminal=false
Icon=/opt/Sublime Text 2/Icon/48x48/sublime_text.png
Type=Application
Categories=TextEditor;IDE;Development
X-Ayatana-Desktop-Shortcuts=NewWindow

[NewWindow Shortcut Group]
Name=New Window
Exec=sublime -n
TargetEnvironment=Unity

Default Text Editor
If you would like to set Sublime Text 2 as your default text editor, run the following command, and replace every instance of gedit.desktop with sublime.desktop.

# You will need to replace every instance of gedit.desktop with sublime.desktop
sudo sublime /usr/share/applications/defaults.list

That's it! You should not only have a luncher available to run Sublime, but you can also launch it via the terminal by just typing "sublime". If you have any questions, feel free to leave them in the comments below!

2015年10月27日星期二

ubuntu关闭笔记本AMD独显

关闭独立显卡
sudo su

echo IGD > /sys/kernel/debug/vgaswitcheroo/switch
echo OFF > /sys/kernel/debug/vgaswitcheroo/switch

第一句是切换到集成显卡;
第二句是关闭没有连接的显卡。
然后把这两句加到/etc/rc.local里的exit 0之前保存
sudo gedit /etc/rc.local