网易云音乐居然还有linux版本,网易还是一个良心企业

李魔佛 发表了文章 • 0 个评论 • 2412 次浏览 • 2020-12-18 11:31 • 来自相关话题

 
啥时候有道云笔记也搞一个linux版本的呀.
 
如果要在ubuntu16.04上安装,就不要去官网下载,gclib库不兼容,要升级到18.04, 会会很折腾.
直接下载:
$ wget http://s1.music.126.net/downlo ... 4.deb --默认下载到Desktop
 
然后sudo dpkg -i xxxxx.deb 就可以啦

良心的还要搜狗,linux下的输入法好用.
 
更新:
安装上面方法安装后,可以打开,可以播放mv,不过就是无法播放声音.
需要解决依赖问题.
网上找到了好的方法: 亲测有效
 
更改源为阿里云的源
# deb cdrom:[Ubuntu 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.1)]/ xenial main restricted
deb-src http://archive.ubuntu.com/ubuntu xenial main restricted #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties
deb http://archive.canonical.com/ubuntu xenial partner
deb-src http://archive.canonical.com/ubuntu xenial partner
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiversean然后运行 apt -f install 修复依赖关系就可以了.
  查看全部
Workspace_1_0091.png

 
啥时候有道云笔记也搞一个linux版本的呀.
 
如果要在ubuntu16.04上安装,就不要去官网下载,gclib库不兼容,要升级到18.04, 会会很折腾.
直接下载:
$ wget http://s1.music.126.net/downlo ... 4.deb --默认下载到Desktop
 
然后sudo dpkg -i xxxxx.deb 就可以啦

良心的还要搜狗,linux下的输入法好用.
 
更新:
安装上面方法安装后,可以打开,可以播放mv,不过就是无法播放声音.
需要解决依赖问题.
网上找到了好的方法: 亲测有效
 
更改源为阿里云的源
# deb cdrom:[Ubuntu 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.1)]/ xenial main restricted
deb-src http://archive.ubuntu.com/ubuntu xenial main restricted #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties
deb http://archive.canonical.com/ubuntu xenial partner
deb-src http://archive.canonical.com/ubuntu xenial partner
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiversean
然后运行 apt -f install 修复依赖关系就可以了.
 

vimium 配合chrome 真的好用,尤其用惯vim的用户

李魔佛 发表了文章 • 0 个评论 • 1919 次浏览 • 2020-11-22 01:59 • 来自相关话题

chrome最好用的插件,没有之一哈。





 
上面是vimium的快捷键用法
 
chrome最好用的插件,没有之一哈。

clipboard.png

 
上面是vimium的快捷键用法
 

windows下的分区挂载到linux下面,然后docker在上面挂载-无法识别

李魔佛 发表了文章 • 0 个评论 • 2230 次浏览 • 2020-11-11 02:40 • 来自相关话题

坑:
windows下的分区挂载到linux下面,然后docker在上面挂载-无法识别。
情况是这样的:
双系统的环境,一个ubuntu,一个windows。 ubuntu上的有个docker,但是ubuntu的分区比较小,需要挂载windows的ntfs分区来扩展空间。
其他程序用起来没什么问题,可是,在用docker 挂在windows分区下的文件夹,总是报错,用的 -v xxxx:xxxx 方式。
同样的docker启动命令,在ubuntu下的目录就没有问题,所以就开始怀疑是权限问题。
但是经过一系列的mount操作,chmod也给足了了权限,可是还没无法启动docker。
后来没办法,只好把windows分区缩小容量,把多余的容量格式化为ext分区格式,然后重新用docker mount -v, 后面docker就可以正常启动了。 查看全部

坑:
windows下的分区挂载到linux下面,然后docker在上面挂载-无法识别。
情况是这样的:
双系统的环境,一个ubuntu,一个windows。 ubuntu上的有个docker,但是ubuntu的分区比较小,需要挂载windows的ntfs分区来扩展空间。
其他程序用起来没什么问题,可是,在用docker 挂在windows分区下的文件夹,总是报错,用的 -v xxxx:xxxx 方式。
同样的docker启动命令,在ubuntu下的目录就没有问题,所以就开始怀疑是权限问题。
但是经过一系列的mount操作,chmod也给足了了权限,可是还没无法启动docker。
后来没办法,只好把windows分区缩小容量,把多余的容量格式化为ext分区格式,然后重新用docker mount -v, 后面docker就可以正常启动了。

FTP被部分网络运营商屏蔽

李魔佛 发表了文章 • 0 个评论 • 2631 次浏览 • 2020-11-08 15:51 • 来自相关话题

事情神奇的很,用阿里云的windows server的IIS搭建的FTP服务器,在服务器本地用fillza ftp软件可以正常使用, 在家里却一直无法显示文件和正常下载。 换到我的腾讯云服务器上,也可以正常下载与显示。
 
开始以为是我的tomato固件的路由器的问题,后来尝试换了路由器,问题还是存在。 所以我就怀疑是我的联通运营商的问题。
 
我的FTP无论使用主动式还是被动式连接,都会出问题。 而我换成用手机热点,作为wifi让我的电脑连上去,这个时候就没有问题了。 妥妥的网络问题,渣渣联通运营商。
 
  查看全部
事情神奇的很,用阿里云的windows server的IIS搭建的FTP服务器,在服务器本地用fillza ftp软件可以正常使用, 在家里却一直无法显示文件和正常下载。 换到我的腾讯云服务器上,也可以正常下载与显示。
 
开始以为是我的tomato固件的路由器的问题,后来尝试换了路由器,问题还是存在。 所以我就怀疑是我的联通运营商的问题。
 
我的FTP无论使用主动式还是被动式连接,都会出问题。 而我换成用手机热点,作为wifi让我的电脑连上去,这个时候就没有问题了。 妥妥的网络问题,渣渣联通运营商。
 
 

斐讯N1 armlinux 长时间运行会导致文件系统只读 readonly

李魔佛 发表了文章 • 0 个评论 • 2948 次浏览 • 2020-10-25 00:24 • 来自相关话题

斐讯N1 刷的armlinux 长时间运行会导致文件系统只读 readonly。
比如放着几个晚上不关机,然后文件系统变成了只读,无法写入文件,提示只读系统。





 

原因是系统分区有坏道。 可能由于关机使用拔电源的方式导致的。
所以要养成好的习惯,正常关机,使用命令 shutdown -h 或者点击关机按钮就好了。
 
那么如果出现了上述问题,怎么办?
 
可以使用用U盘启动,运行一次e2fsck /dev/mmcblk1p2
然后选择Y,修复坏道就可以了。
 
U盘启动就是之前刷Armlinux时的那个U盘。
接上U盘,然后上电启动即可。 然后进入系统运行上述的命令:
e2fsck /dev/mmcblk1p2
 
  查看全部
斐讯N1 刷的armlinux 长时间运行会导致文件系统只读 readonly。
比如放着几个晚上不关机,然后文件系统变成了只读,无法写入文件,提示只读系统。

20230702001.jpg

 

原因是系统分区有坏道。 可能由于关机使用拔电源的方式导致的。
所以要养成好的习惯,正常关机,使用命令 shutdown -h 或者点击关机按钮就好了。
 
那么如果出现了上述问题,怎么办?
 
可以使用用U盘启动,运行一次e2fsck /dev/mmcblk1p2
然后选择Y,修复坏道就可以了。
 
U盘启动就是之前刷Armlinux时的那个U盘。
接上U盘,然后上电启动即可。 然后进入系统运行上述的命令:
e2fsck /dev/mmcblk1p2
 
 

Started update UTMP about system Runlevel during booting ubuntu/armlinux

李魔佛 发表了文章 • 0 个评论 • 4923 次浏览 • 2020-10-20 13:33 • 来自相关话题

I hit this issue on my ARMLinux (Same arch as Ubuntu), i can't login system with graphic. It always stuck on the line 
 
Started update UTMP about system Runlevel
 
Finally, i try to enter into secure mode and check logs.
it was caused by system disk is out of space.
So i try to delete some unless file to release some space, then reboot system, then everything is ok now.
 
http://30daydo.com/article/617
  查看全部
I hit this issue on my ARMLinux (Same arch as Ubuntu), i can't login system with graphic. It always stuck on the line 
 
Started update UTMP about system Runlevel
 
Finally, i try to enter into secure mode and check logs.
it was caused by system disk is out of space.
So i try to delete some unless file to release some space, then reboot system, then everything is ok now.
 
http://30daydo.com/article/617
 

zsh历史记录文件损坏: zsh: corrupt history file /home/admin/.zsh_history

李魔佛 发表了文章 • 0 个评论 • 4393 次浏览 • 2020-10-09 18:12 • 来自相关话题

由于不正确关机,或者突然重启造成的文件属性损坏。可以使用以下方式修复。cd ~
mv .zsh_history .zsh_history_bad
strings .zsh_history_bad > .zsh_history
fc -R .zsh_history
如果最后一步提示出错 fc的参数不对,可以进入zsh,然后再执行 fc -R .zsh_histroy
原创文章,转载请注明出处:
http://30daydo.com/article/612
  查看全部
由于不正确关机,或者突然重启造成的文件属性损坏。可以使用以下方式修复。
cd ~
mv .zsh_history .zsh_history_bad
strings .zsh_history_bad > .zsh_history
fc -R .zsh_history

如果最后一步提示出错 fc的参数不对,可以进入zsh,然后再执行 fc -R .zsh_histroy
原创文章,转载请注明出处:
http://30daydo.com/article/612
 

Elastic Search报错:Fielddata is disabled on text fields by default

发表了文章 • 0 个评论 • 3499 次浏览 • 2020-09-16 19:26 • 来自相关话题

在使用 ElasticSearch 的时候,如果索引中的字段是 text 类型,针对该字段聚合、排序和查询的时候常会出现 Fielddata is disabled on text fields by default. Set fielddata=true 的错误。本文总结这个错误出现的原因,可能的修复方法等。

常见原因

在 ElasticSearch 中,Fielddata 默认在 text 类型的字段时是不启用的。设想,如果默认打开,那么你的数据中,每个字符串大概率不一样的话,那么这个字段需要的集合大小(Cardinality)会非常大。

而这个字段是需要存在内存中的 (heap),因此不可能默认打开。所以如果你从一个 script 来对一个 text 字段进行排序、聚合或者查询的话,就会出现这个错误。Fielddata is disabled on text fields by default. Set `fielddata=true` on [`你的字段名字`] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory.

Fielddata is disabled on text fields by default 解答方法看这篇:
ES 如何解决 Fielddata is disabled on text fields by default 错误
  查看全部
在使用 ElasticSearch 的时候,如果索引中的字段是 text 类型,针对该字段聚合、排序和查询的时候常会出现 Fielddata is disabled on text fields by default. Set fielddata=true 的错误。本文总结这个错误出现的原因,可能的修复方法等。

常见原因

在 ElasticSearch 中,Fielddata 默认在 text 类型的字段时是不启用的。设想,如果默认打开,那么你的数据中,每个字符串大概率不一样的话,那么这个字段需要的集合大小(Cardinality)会非常大。

而这个字段是需要存在内存中的 (heap),因此不可能默认打开。所以如果你从一个 script 来对一个 text 字段进行排序、聚合或者查询的话,就会出现这个错误。Fielddata is disabled on text fields by default. Set `fielddata=true` on [`你的字段名字`] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory.

Fielddata is disabled on text fields by default 解答方法看这篇:
ES 如何解决 Fielddata is disabled on text fields by default 错误
 

斐讯N1盒子转AArch64 debain

树莓派李魔佛 发表了文章 • 0 个评论 • 2959 次浏览 • 2020-08-21 22:28 • 来自相关话题

家里收拾东西时发现有这个东东,留着也没用,于是搜了下网上的教程,在上面刷了个armdebian,性能比树莓派要好很多, 装个docker,和树莓派组个小集群吧。
 





 
ssh就好了,别整x11,稳定性太渣了
家里收拾东西时发现有这个东东,留着也没用,于是搜了下网上的教程,在上面刷了个armdebian,性能比树莓派要好很多, 装个docker,和树莓派组个小集群吧。
 

debian.PNG

 
ssh就好了,别整x11,稳定性太渣了

git命令行查看图形化的分支信息与commit 缩写id

李魔佛 发表了文章 • 0 个评论 • 5522 次浏览 • 2020-06-21 16:56 • 来自相关话题

在命令行下面,有时候需要可视化的观察git的分支情况以及commit id的缩写值。
可以使用 git log 加若干参数
 
git log --graph --pretty=oneline --abbrev-commit
效果是这样的:





 
而实际在source tree中是这样的:





 
  查看全部
在命令行下面,有时候需要可视化的观察git的分支情况以及commit id的缩写值。
可以使用 git log 加若干参数
 
git log --graph --pretty=oneline --abbrev-commit

效果是这样的:

img1.PNG

 
而实际在source tree中是这样的:

2.png

 
 

docker run 和 create 区别

李魔佛 发表了文章 • 0 个评论 • 7273 次浏览 • 2019-11-25 13:49 • 来自相关话题

Technically, docker run = docker create + docker start . 
docker create command creates a writeable container from the image and prepares it for running. 
docker run command creates the container (same as docker create ) and starts it.
 
  查看全部
Technically, docker run = docker create + docker start
docker create command creates a writeable container from the image and prepares it for running. 
docker run command creates the container (same as docker create ) and starts it.
 
 

用docker编译go代码

李魔佛 发表了文章 • 0 个评论 • 3633 次浏览 • 2019-11-25 13:45 • 来自相关话题

如果偶尔需要编译go代码,但是又不想要安装一堆乱七八糟的依赖和Go编译器,可以利用docker来实现。 应该是解决起来话费时间最小的。
1. 用文本编辑你的go代码,现在以hello world为例:
 package main import "fmt" func main() {
/* 这是我的第一个简单的程序 */
fmt.Println("Hello, World!")
}
 
2. 然后直接使用docker执行编译。docker首先会自动去下载go的编译器,顺便把所有的依赖给解决掉

docker run --rm -v "$(pwd)":/usr/src/hello -w /usr/src/hello golang:1.3 go build -v
 
最后会在本地生成一个编译好的hello静态文件。
上述docker命令的具体含义就是把当前路径挂在到docker容器里头,然后切换到改到改路径下,然后进行编译。 查看全部

如果偶尔需要编译go代码,但是又不想要安装一堆乱七八糟的依赖和Go编译器,可以利用docker来实现。 应该是解决起来话费时间最小的。
1. 用文本编辑你的go代码,现在以hello world为例:
 
package main import "fmt" func main() {
/* 这是我的第一个简单的程序 */
fmt.Println("Hello, World!")
}

 
2. 然后直接使用docker执行编译。docker首先会自动去下载go的编译器,顺便把所有的依赖给解决掉

docker run --rm -v "$(pwd)":/usr/src/hello -w /usr/src/hello golang:1.3 go build -v
 
最后会在本地生成一个编译好的hello静态文件。
上述docker命令的具体含义就是把当前路径挂在到docker容器里头,然后切换到改到改路径下,然后进行编译。

docker实战 代码勘误

李魔佛 发表了文章 • 0 个评论 • 2347 次浏览 • 2019-11-25 11:24 • 来自相关话题

作者在官网刊登的勘误记录:
 
看这本书的作者一定要看,不然坑挺多的。
一路采坑过来的哭着说。Last updated August 21, 2016
In an effort to offer continued support beyond publication, we have listed many updates to code due to version updates.

[code - omission] Page 18

The command to start the "mailer" is missing a line. Where the book reads:
docker run -d \
--name mailer \
the proper command should read:
docker run -d \
--name mailer \
dockerinaction/ch2_mailer

[code - regression] Page 68

Newer versions of Docker have changed the structure of the JSON returned by the docker inspect subcommand. If the following command does not work then use the replacement. Original:
docker inspect --format "{{json .Volumes}}" reader
Replacement:
docker inspect --format "{{json .Mounts}}" reader

[code - regression] Page 69

Newer versions of Docker have changed the structure of the JSON returned by the docker inspect subcommand. If the following command does not work then use the replacement. Original:
docker inspect --format "{{json .Volumes}}" student
Replacement:
docker inspect --format "{{json .Mounts}}" student

[code - regression] Page 74

The alpine image entrypoint has changed since original publication and has been unset. The last command on the page should now read:
docker run --rm \
--volumes-from tools \
--entrypoint /bin/sh \
alpine:latest \
-c 'ls /operations/*'
[code - regression] Page 75

The docker exec example on the top of page 75 was printed with the wrong tool name. The correct command is:
docker exec important_application /operations/tools/diagnostics

[code - regression] Page 86

It appears that nslookup behavior in the alpine image has changed. To run the example use the busybox:1 image.
docker run --rm \
--hostname barker \
busybox:1 \
nslookup barker

[code - regression] Page 87 (top)

It appears that nslookup behavior in the alpine image has changed. To run the example use the busybox:1 image.
docker run --rm \
--dns 8.8.8.8 \
busybox:1 \
nslookup docker.com

[code - regression] Page 87 (bottom)

It appears that nslookup behavior in the alpine image has changed. To run the example use the busybox:1 image.
docker run --rm \
--dns-search docker.com \
busybox:1 \
nslookup registry.hub

[code - regression] Page 88 (bottom)

It appears that nslookup behavior in the alpine image has changed. To run the example use the busybox:1 image.
docker run --rm \
--add-host test:10.10.10.255 \
busybox:1 \
nslookup test

[code - regression] Page 106

There are a few new problems with this example. First, the named repository (dockerfile/mariadb) no longer exists. You can use mariadb:5.5 as replacement. However, the second problem is that containers created from the mariadb image perform certain initialization at startup. That initialization work requires certain capabilities and to be started with the default user. The system should instead drop permissions after the initialization work is complete. Note that the real value of this example is in demonstrating different resource isolation mechanisms. It is not so important that you get it working. You can start the database with the following command:
docker run -d --name ch6_mariadb \
--memory 256m \
--cpu-shares 1024 \
--cap-drop net_raw \
-e MYSQL_ROOT_PASSWORD=test \
mariadb:5.5

[code - regression] Page 107

Containers created from the wordpress:4.1 image perform certain initialization at startup and expect certain environment variables. That initialization work requires certain capabilities and to be started with the default user. The system should instead drop permissions after the initialization work is complete. Note that the real value of this example is in demonstrating different resource isolation mechanisms. It is not so important that you get it working. You can start wordpress with the following command:
docker run -d -P --name ch6_wordpress \
--memory 512m \
--cpu-shares 512 \
--cap-drop net_raw \
-e WORDPRESS_DB_PASSWORD=test \
mariadb:5.5

[code - typo] Page 109

The device access example is missing the "run" subcommand. The command listed as:
docker -it --rm \
--device /dev/video0:/dev/video0 \
ubuntu:latest ls -al /dev
should have been written as:
docker run -it --rm \
--device /dev/video0:/dev/video0 \
ubuntu:latest ls -al /dev

[code - typo] Page 110 - 111

Several commands are missing the "run" subcommand. In each case the command begins with
docker -d ...
and should have been written as:
docker run -d ...

[code - regression] Page 115 (bottom)

The busybox and alpine images have been updated to fix the problem described in the paragraph below. The 'su' command does not have the SUID bit set and will not provide any automatic privilege escalation.

[command correction] Page 116

Boot2Docker has been discontinued and rolled into a newer project called Docker Machine. Because a reader is unlikely to have the boot2docker command installed, the command at the top of this page should be changed from:
boot2docker ssh
to the Docker Machine equivalent:
docker-machine ssh default
where default is the name of the machine you created.

[code - regression] Page 119

The ifconfig command has since been removed from ubuntu:latest. Instead of using the ubuntu:latest image for these examples use ubuntu:trusty. The example using ifconfig should look like:
docker run --rm \
--privileged \
ubuntu:trusty ifconfig
[Illustration Mistake] Page 136
Image layer ced2 on the left side of the illustration is listed at c3d2 on the right side. These two layers should represent the same item.

[code - typo] Page 140

Containers need not be in a running state in order to export their file system. The first command on page 140 uses the "run" subcommand but the command listed will never be able to start. Replace "run" with "create." The command should appear as follows:
docker create --name export-test \
dockerinaction/ch7_packed:latest ./echo For Export

[code - missing line] Page 146

In the example Dockerfile near the top of the page the line with the RUN directive is missing part of the instruction. That line should read:
RUN apt-get update && apt-get install -y git

[code - evolution] Page 215

The registry:2 configuration file now requires the population of additional fields under "maintenance > uploadpurging." The example should currently look like:
# Filename: s3-config.yml
version: 0.1
log:
level: debug
fields:
service: registry
environment: development
storage:
cache:
layerinfo: inmemory
s3:
accesskey:
secretkey:
region:
bucket:
encrypt: true
secure: true
v4auth: true
chunksize: 5242880
rootdirectory: /s3/object/name/prefix
maintenance:
uploadpurging:
enabled: true
age: 168h
interval: 24h
dryrun: false
readonly:
enabled: false
http:
addr: :5000
secret: asecretforlocaldevelopment
debug:
addr: localhost:5001

[code - evolution] Page 216

The registry:2 configuration file now requires the population of additional fields under "maintenance > uploadpurging." The example should currently look like:
# Filename: rados-config.yml
version: 0.1
log:
level: debug
fields:
service: registry
environment: development
storage:
cache:
layerinfo: inmemory
rados:
poolname: radospool
username: radosuser
chunksize: 4194304
maintenance:
uploadpurging:
enabled: false
age: 168h
interval: 24h
dryrun: false
readonly:
enabled: false
http:
addr: :5000
secret: asecretforlocaldevelopment
debug:
addr: localhost:5001

[code - evolution] Page 218

The registry:2 configuration file now requires the population of additional fields under "maintenance > uploadpurging." The example should currently look like:
# Filename: redis-config.yml
version: 0.1
log:
level: debug
fields:
service: registry
environment: development
http:
addr: :5000
secret: asecretforlocaldevelopment
debug:
addr: localhost:5001
storage:
cache:
blobdescriptor: redis
s3:
accesskey:
secretkey:
region:
bucket:
encrypt: true
secure: true
v4auth: true
chunksize: 5242880
rootdirectory: /s3/object/name/prefix
maintenance:
uploadpurging:
enabled: true
age: 168h
interval: 24h
dryrun: false
readonly:
enabled: false
redis:
addr: redis-host:6379
password: asecret
dialtimeout: 10ms
readtimeout: 10ms
writetimeout: 10ms
pool:
maxidle: 16
maxactive: 64
idletimeout: 300s
[code - typo] Page 220

The name of the file shown should be scalable-config.yml as in previous examples. This example also requires the addition of the newer uploadpurging attributes. The mainenance section of the file should be as follows:
maintenance:
uploadpurging:
enabled: true
age: 168h
interval: 24h
dryrun: false
readonly:
enabled: false
[text - typo] Page 240

In the second paragraph the reader is instructed to, "Open ./coffee/api/api.py" this is not the correct location of the file. The correct file location is at, "./coffee/app/api.py."
[text - typo] Page 262

The refere nce to "flock.json" in the first sentence of the third paragraph should be "flock.yml."
[code - typo] Page 270

The git clone command uses the ssh protocol instead of https. The command should read as follows:
git clone https://github.com/dockerinact ... i.git 查看全部
作者在官网刊登的勘误记录:
 
看这本书的作者一定要看,不然坑挺多的。
一路采坑过来的哭着说。
Last updated August 21, 2016
In an effort to offer continued support beyond publication, we have listed many updates to code due to version updates.

[code - omission] Page 18

The command to start the "mailer" is missing a line. Where the book reads:
docker run -d \
--name mailer \
the proper command should read:
docker run -d \
--name mailer \
dockerinaction/ch2_mailer

[code - regression] Page 68

Newer versions of Docker have changed the structure of the JSON returned by the docker inspect subcommand. If the following command does not work then use the replacement. Original:
docker inspect --format "{{json .Volumes}}" reader
Replacement:
docker inspect --format "{{json .Mounts}}" reader

[code - regression] Page 69

Newer versions of Docker have changed the structure of the JSON returned by the docker inspect subcommand. If the following command does not work then use the replacement. Original:
docker inspect --format "{{json .Volumes}}" student
Replacement:
docker inspect --format "{{json .Mounts}}" student

[code - regression] Page 74

The alpine image entrypoint has changed since original publication and has been unset. The last command on the page should now read:
docker run --rm \
--volumes-from tools \
--entrypoint /bin/sh \
alpine:latest \
-c 'ls /operations/*'
[code - regression] Page 75

The docker exec example on the top of page 75 was printed with the wrong tool name. The correct command is:
docker exec important_application /operations/tools/diagnostics

[code - regression] Page 86

It appears that nslookup behavior in the alpine image has changed. To run the example use the busybox:1 image.
docker run --rm \
--hostname barker \
busybox:1 \
nslookup barker

[code - regression] Page 87 (top)

It appears that nslookup behavior in the alpine image has changed. To run the example use the busybox:1 image.
docker run --rm \
--dns 8.8.8.8 \
busybox:1 \
nslookup docker.com

[code - regression] Page 87 (bottom)

It appears that nslookup behavior in the alpine image has changed. To run the example use the busybox:1 image.
docker run --rm \
--dns-search docker.com \
busybox:1 \
nslookup registry.hub

[code - regression] Page 88 (bottom)

It appears that nslookup behavior in the alpine image has changed. To run the example use the busybox:1 image.
docker run --rm \
--add-host test:10.10.10.255 \
busybox:1 \
nslookup test

[code - regression] Page 106

There are a few new problems with this example. First, the named repository (dockerfile/mariadb) no longer exists. You can use mariadb:5.5 as replacement. However, the second problem is that containers created from the mariadb image perform certain initialization at startup. That initialization work requires certain capabilities and to be started with the default user. The system should instead drop permissions after the initialization work is complete. Note that the real value of this example is in demonstrating different resource isolation mechanisms. It is not so important that you get it working. You can start the database with the following command:
docker run -d --name ch6_mariadb \
--memory 256m \
--cpu-shares 1024 \
--cap-drop net_raw \
-e MYSQL_ROOT_PASSWORD=test \
mariadb:5.5

[code - regression] Page 107

Containers created from the wordpress:4.1 image perform certain initialization at startup and expect certain environment variables. That initialization work requires certain capabilities and to be started with the default user. The system should instead drop permissions after the initialization work is complete. Note that the real value of this example is in demonstrating different resource isolation mechanisms. It is not so important that you get it working. You can start wordpress with the following command:
docker run -d -P --name ch6_wordpress \
--memory 512m \
--cpu-shares 512 \
--cap-drop net_raw \
-e WORDPRESS_DB_PASSWORD=test \
mariadb:5.5

[code - typo] Page 109

The device access example is missing the "run" subcommand. The command listed as:
docker -it --rm \
--device /dev/video0:/dev/video0 \
ubuntu:latest ls -al /dev
should have been written as:
docker run -it --rm \
--device /dev/video0:/dev/video0 \
ubuntu:latest ls -al /dev

[code - typo] Page 110 - 111

Several commands are missing the "run" subcommand. In each case the command begins with
docker -d ...
and should have been written as:
docker run -d ...

[code - regression] Page 115 (bottom)

The busybox and alpine images have been updated to fix the problem described in the paragraph below. The 'su' command does not have the SUID bit set and will not provide any automatic privilege escalation.

[command correction] Page 116

Boot2Docker has been discontinued and rolled into a newer project called Docker Machine. Because a reader is unlikely to have the boot2docker command installed, the command at the top of this page should be changed from:
boot2docker ssh
to the Docker Machine equivalent:
docker-machine ssh default
where default is the name of the machine you created.

[code - regression] Page 119

The ifconfig command has since been removed from ubuntu:latest. Instead of using the ubuntu:latest image for these examples use ubuntu:trusty. The example using ifconfig should look like:
docker run --rm \
--privileged \
ubuntu:trusty ifconfig
[Illustration Mistake] Page 136
Image layer ced2 on the left side of the illustration is listed at c3d2 on the right side. These two layers should represent the same item.

[code - typo] Page 140

Containers need not be in a running state in order to export their file system. The first command on page 140 uses the "run" subcommand but the command listed will never be able to start. Replace "run" with "create." The command should appear as follows:
docker create --name export-test \
dockerinaction/ch7_packed:latest ./echo For Export

[code - missing line] Page 146

In the example Dockerfile near the top of the page the line with the RUN directive is missing part of the instruction. That line should read:
RUN apt-get update && apt-get install -y git

[code - evolution] Page 215

The registry:2 configuration file now requires the population of additional fields under "maintenance > uploadpurging." The example should currently look like:
# Filename: s3-config.yml
version: 0.1
log:
level: debug
fields:
service: registry
environment: development
storage:
cache:
layerinfo: inmemory
s3:
accesskey:
secretkey:
region:
bucket:
encrypt: true
secure: true
v4auth: true
chunksize: 5242880
rootdirectory: /s3/object/name/prefix
maintenance:
uploadpurging:
enabled: true
age: 168h
interval: 24h
dryrun: false
readonly:
enabled: false
http:
addr: :5000
secret: asecretforlocaldevelopment
debug:
addr: localhost:5001

[code - evolution] Page 216

The registry:2 configuration file now requires the population of additional fields under "maintenance > uploadpurging." The example should currently look like:
# Filename: rados-config.yml
version: 0.1
log:
level: debug
fields:
service: registry
environment: development
storage:
cache:
layerinfo: inmemory
rados:
poolname: radospool
username: radosuser
chunksize: 4194304
maintenance:
uploadpurging:
enabled: false
age: 168h
interval: 24h
dryrun: false
readonly:
enabled: false
http:
addr: :5000
secret: asecretforlocaldevelopment
debug:
addr: localhost:5001

[code - evolution] Page 218

The registry:2 configuration file now requires the population of additional fields under "maintenance > uploadpurging." The example should currently look like:
# Filename: redis-config.yml
version: 0.1
log:
level: debug
fields:
service: registry
environment: development
http:
addr: :5000
secret: asecretforlocaldevelopment
debug:
addr: localhost:5001
storage:
cache:
blobdescriptor: redis
s3:
accesskey:
secretkey:
region:
bucket:
encrypt: true
secure: true
v4auth: true
chunksize: 5242880
rootdirectory: /s3/object/name/prefix
maintenance:
uploadpurging:
enabled: true
age: 168h
interval: 24h
dryrun: false
readonly:
enabled: false
redis:
addr: redis-host:6379
password: asecret
dialtimeout: 10ms
readtimeout: 10ms
writetimeout: 10ms
pool:
maxidle: 16
maxactive: 64
idletimeout: 300s
[code - typo] Page 220

The name of the file shown should be scalable-config.yml as in previous examples. This example also requires the addition of the newer uploadpurging attributes. The mainenance section of the file should be as follows:
maintenance:
uploadpurging:
enabled: true
age: 168h
interval: 24h
dryrun: false
readonly:
enabled: false
[text - typo] Page 240

In the second paragraph the reader is instructed to, "Open ./coffee/api/api.py" this is not the correct location of the file. The correct file location is at, "./coffee/app/api.py."
[text - typo] Page 262

The refere nce to "flock.json" in the first sentence of the third paragraph should be "flock.yml."
[code - typo] Page 270

The git clone command uses the ssh protocol instead of https. The command should read as follows:
git clone https://github.com/dockerinact ... i.git

crontab定时运行图形程序

李魔佛 发表了文章 • 0 个评论 • 2993 次浏览 • 2019-08-26 15:56 • 来自相关话题

默认情况不会显示任何图形的界面,需要在程序前添加 
export DISPLAY=:0;* * * * * export DISPLAY=:0; gedit 
附一个linux下桌面提醒GUI程序,定时提醒你休息哈:
 
import pyautogui as pag
import datetime

def neck_rest():
f = open('neck_record.txt', 'a')
ret = pag.prompt("Rest! Protect your neck !")
if ret == 'rest':
f.write(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
f.write('\t')
f.write('Rest')
f.write('\n')
else:
f.write(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
f.write('\t')
f.write('Failed to rest')
f.write('\n')
f.close()

neck_rest()
程序保存为task.py
然后设定crontab任务:

* * * * * export DISPLAY=:0; python task.py 
即可

  查看全部
默认情况不会显示任何图形的界面,需要在程序前添加 
export DISPLAY=:0;
* * * * * export DISPLAY=:0; gedit
 
附一个linux下桌面提醒GUI程序,定时提醒你休息哈:
 
import pyautogui as pag
import datetime

def neck_rest():
f = open('neck_record.txt', 'a')
ret = pag.prompt("Rest! Protect your neck !")
if ret == 'rest':
f.write(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
f.write('\t')
f.write('Rest')
f.write('\n')
else:
f.write(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
f.write('\t')
f.write('Failed to rest')
f.write('\n')
f.close()

neck_rest()

程序保存为task.py
然后设定crontab任务:

* * * * * export DISPLAY=:0; python task.py 
即可

 

alias别名 等号后面不用

李魔佛 发表了文章 • 0 个评论 • 2403 次浏览 • 2019-08-12 14:17 • 来自相关话题

alias sync="git commit -m 'update' -a && git push origin master"
alias fetch="git fetch origin"
alias dj="python manage.py runserver 0.0.0.0"
alias py2="python2"
alias py3="python3"
alias ggg="cd ~/git" 查看全部
alias sync="git commit -m 'update' -a && git push origin master"
alias fetch="git fetch origin"
alias dj="python manage.py runserver 0.0.0.0"
alias py2="python2"
alias py3="python3"
alias ggg="cd ~/git"

python执行shell命令时报错: -/bin/sh: 命令:not found的解决办法

李魔佛 发表了文章 • 0 个评论 • 10329 次浏览 • 2019-07-29 15:13 • 来自相关话题

file='test.txt'
cmd = f'rsync -av {file} root@10.18.6.46:/home/cjw/'

p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE,executable="/bin/bash")
output, error = p.communicate()
if p.returncode != 0:
print("Error while running - %s" % cmd)
print(error)
print(output) 
用sublime3 运行的时候一直报错。
后来发现,这个是sublime3的运行环境问题, 直接用shell执行 python main.py 执行上面的代码,命令可以正常运行。
/bin/sh: 1: rsync: not found 查看全部
     file='test.txt'
cmd = f'rsync -av {file} root@10.18.6.46:/home/cjw/'

p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE,executable="/bin/bash")
output, error = p.communicate()
if p.returncode != 0:
print("Error while running - %s" % cmd)
print(error)
print(output)
 
用sublime3 运行的时候一直报错。
后来发现,这个是sublime3的运行环境问题, 直接用shell执行 python main.py 执行上面的代码,命令可以正常运行。
/bin/sh: 1: rsync: not found

Raspberrypi 2 Install or upgrade Python3.6

树莓派李魔佛 发表了文章 • 0 个评论 • 2950 次浏览 • 2019-07-21 14:55 • 来自相关话题

Since no chinese input method in my raspberrypi, i can only write with English.
 
Raspberrypi has python2. 7 and python3.4, but i want to upgrade to python3.6+.
 
Python3.6 support some new feature such as print(f'{name}') and x=1_000_242_200 expression.
 
How to upgrade ?
 

$ wget https://www.python.org/ftp/pyt ... 1.tgz $ tar zxvf Python-3.6.1.tgz $ cd Python-3.6.1

then run command:

$ sudo ./configure && sudo make && sudo make install

wait for about 20mins (low perf of raspberrypi :( )
 
then you run command:
python3
 
it will using the new python3.6 version:
 

Python 3.6.1 (default, Jul 21 2019, 14:26:28) 
[GCC 4.9.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
 

 
Enjoy it ! 查看全部
Since no chinese input method in my raspberrypi, i can only write with English.
 
Raspberrypi has python2. 7 and python3.4, but i want to upgrade to python3.6+.
 
Python3.6 support some new feature such as print(f'{name}') and x=1_000_242_200 expression.
 
How to upgrade ?
 

$ wget https://www.python.org/ftp/pyt ... 1.tgz 
$ tar zxvf Python-3.6.1.tgz $ cd Python-3.6.1

then run command:

$ sudo ./configure && sudo make && sudo make install

wait for about 20mins (low perf of raspberrypi :( )
 
then you run command:
python3
 
it will using the new python3.6 version:
 


Python 3.6.1 (default, Jul 21 2019, 14:26:28) 
[GCC 4.9.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
 


 
Enjoy it !

ubuntu/linux shell根据进程名杀死进程 一句搞定

李魔佛 发表了文章 • 0 个评论 • 4493 次浏览 • 2019-04-19 23:15 • 来自相关话题

ps -ef | grep "进程名" | grep -v grep | cut -c 10-16 | xargs kill -9 
比如我要杀死python的进程,就使用
 

ps -ef | grep "python" | grep -v grep | cut -c 10-16 | xargs kill -9
 
来使用。
 
grep -v grep 因为 ps 会把grep python这个进程也打印出来,所以-v 是反转的意思,不匹配的才打印出来,然后cut 是找出10到16位的字符,这里需要大家根据自己的用户名来调整。
一般ps -ef输出是 前面 用户名,然后空格, 接着是进程号。 如果你的用户名很长,可以调整10-16的位置来适应。
 
后面就是把进程号传递给kill作为参数,-9 是强制杀死。
 
  查看全部
ps -ef | grep "进程名" | grep -v grep | cut -c 10-16 | xargs kill -9
 
比如我要杀死python的进程,就使用
 

ps -ef | grep "python" | grep -v grep | cut -c 10-16 | xargs kill -9
 
来使用。
 
grep -v grep 因为 ps 会把grep python这个进程也打印出来,所以-v 是反转的意思,不匹配的才打印出来,然后cut 是找出10到16位的字符,这里需要大家根据自己的用户名来调整。
一般ps -ef输出是 前面 用户名,然后空格, 接着是进程号。 如果你的用户名很长,可以调整10-16的位置来适应。
 
后面就是把进程号传递给kill作为参数,-9 是强制杀死。
 
 

树莓派 vim代码高亮

李魔佛 发表了文章 • 0 个评论 • 3174 次浏览 • 2019-04-09 09:38 • 来自相关话题

首先安装vim 
sudo apt-get install-y vim
 
然后默认没有高亮语法的:

在~目录下面新建.vimrc文件可以实现1
 
然后编辑.vimrc文件
 

set nu
syntax on
set tabstop=4
 
然后就可以生效了。
如果还木有生效,记得重启下,或者注销。 查看全部
首先安装vim 
sudo apt-get install-y vim
 
然后默认没有高亮语法的:

在~目录下面新建.vimrc文件可以实现1
 
然后编辑.vimrc文件
 

set nu
syntax on
set tabstop=4
 
然后就可以生效了。
如果还木有生效,记得重启下,或者注销。

centos 7 自带的jdk路径

李魔佛 发表了文章 • 0 个评论 • 4196 次浏览 • 2018-11-19 14:46 • 来自相关话题

centos7自带java,但如果显示JAVA_HOME路径的时候,会显示为空,因为环境变量并没有把JAVA_HOME写进去。
需要自己去输入
jdk路径如下:
/etc/alternatives/java_sdk_1.8.0_openjdk
 
然后创建环境变量:
export JAVA_HOME=/etc/alternatives/java_sdk_1.8.0_openjdk
 
这样省去了到官网下载JDK和配置的时间了。
  查看全部
centos7自带java,但如果显示JAVA_HOME路径的时候,会显示为空,因为环境变量并没有把JAVA_HOME写进去。
需要自己去输入
jdk路径如下:
/etc/alternatives/java_sdk_1.8.0_openjdk
 
然后创建环境变量:
export JAVA_HOME=/etc/alternatives/java_sdk_1.8.0_openjdk
 
这样省去了到官网下载JDK和配置的时间了。
 

ubuntu samba连接斐讯天天链N1 提示 Host is down.

李魔佛 发表了文章 • 0 个评论 • 5762 次浏览 • 2018-06-02 16:48 • 来自相关话题

配置:
斐讯天天链N1 + 斐讯硬盘H1
ubuntu 和天天链在同一个内网中。
 平时个人在ubuntu下使用的mount命令不管用。 提示 Host is down
如果直接用gui连接,是没问题的(打开文件夹,选择连接服务器,然后服务器地址填 smb://192.168.1.1 ) 然后就可以访问天天链的硬盘。 
但是为什么使用mount命令就不行了呢 ?
 
通过不断更改参数,发现问题出在斐讯samba的版本用的是老旧的vers 1.0. 这时需要你在mount命令中制定版本。
 sudo mount -t cifs -o username=root,password=xxxxx,uid=1000,gid=1000,vers=1.0,_netdev //192.168.1.88/HDisk /home/use/net
通过上述的命令, 就可以把斐讯的硬盘mount到本地,并且有权限可以读写。
记得加上
uid=1000,gid=1000, 不然会没有权限读写,只能一直使用sudo 才能读写哦。
 
 
原创文章
转载请注明出处:http://30daydo.com/article/317
  查看全部
配置:
斐讯天天链N1 + 斐讯硬盘H1
ubuntu 和天天链在同一个内网中。
 平时个人在ubuntu下使用的mount命令不管用。 提示 Host is down
如果直接用gui连接,是没问题的(打开文件夹,选择连接服务器,然后服务器地址填 smb://192.168.1.1 ) 然后就可以访问天天链的硬盘。 
但是为什么使用mount命令就不行了呢 ?
 
通过不断更改参数,发现问题出在斐讯samba的版本用的是老旧的vers 1.0. 这时需要你在mount命令中制定版本。
 
sudo mount -t cifs -o username=root,password=xxxxx,uid=1000,gid=1000,vers=1.0,_netdev //192.168.1.88/HDisk /home/use/net

通过上述的命令, 就可以把斐讯的硬盘mount到本地,并且有权限可以读写。
记得加上
uid=1000,gid=1000, 不然会没有权限读写,只能一直使用sudo 才能读写哦。
 
 
原创文章
转载请注明出处:http://30daydo.com/article/317
 

mongo服务启动失败: ERROR: mmap private failed with out of memory

树莓派李魔佛 发表了文章 • 0 个评论 • 4004 次浏览 • 2018-05-13 12:23 • 来自相关话题

平时在树莓派上开机自动执行以下命令,启动mongo服务
sudo mongod --fork --dbpath /home/pi/mongo/db/ --smallfiles --journal --logpath /home/pi/mongo/log.txt
突然今天发现mongo的服务连不上,看log发现mongo在启动后马上关闭了,提示的错误是在加载一个大的数据文件的时候提示内存不足(坑爹的,树莓派自身内存才1GB,无法扩容)。 
 
错误日志:
Sun May 13 12:08:11.185 [initandlisten] MongoDB starting : pid=1929 port=27017 dbpath=/home/pi/mongo/db/ 32-bit host=raspberrypi
Sun May 13 12:08:11.186 [initandlisten]
Sun May 13 12:08:11.186 [initandlisten] ** NOTE: This is a 32 bit MongoDB binary.
Sun May 13 12:08:11.186 [initandlisten] ** 32 bit builds are limited to less than 2GB of data (or less with --journal).
Sun May 13 12:08:11.186 [initandlisten] ** See http://dochub.mongodb.org/core/32bit
Sun May 13 12:08:11.187 [initandlisten]
Sun May 13 12:08:11.187 [initandlisten] db version v2.4.10
Sun May 13 12:08:11.187 [initandlisten] git version: nogitversion
Sun May 13 12:08:11.187 [initandlisten] build info: Linux bm-wb-04 3.19.0-trunk-armmp #1 SMP Debian 3.19.1-1~exp1+plugwash1 (2015-03-28) armv7l BOOST_LIB_VERSION=1_55
Sun May 13 12:08:11.187 [initandlisten] allocator: system
Sun May 13 12:08:11.187 [initandlisten] options: { dbpath: "/home/pi/mongo/db/", fork: true, journal: true, logpath: "/home/pi/mongo/mongod.log" }
Sun May 13 12:08:11.198 [initandlisten] journal dir=/home/pi/mongo/db/journal
Sun May 13 12:08:11.198 [initandlisten] recover : no journal files present, no recovery needed
Sun May 13 12:08:11.238 [initandlisten] ERROR: mmap private failed with out of memory. You are using a 32-bit build and probably need to upgrade to 64
Sun May 13 12:08:11.239 [initandlisten] Assertion: 13636:file /home/pi/mongo/db/xueqiu.5 open/create failed in createPrivateMap (look in log for more information)
0x662fa8 0x63527c 0x6196c0 0x6197bc 0x409d5c 0x4414fc 0x2ea634 0x2eaa3c 0x2eb55c 0x2ebd98 0x26f998 0x26fb94 0x175a20 0x177bf4 0x152bf0 0x76556294
mongod(_ZN5mongo15printStackTraceERSo+0x1c) [0x662fa8]
mongod(_ZN5mongo10logContextEPKc+0x110) [0x63527c]
mongod(_ZN5mongo11msgassertedEiPKc+0xc0) [0x6196c0]
mongod(_ZN5mongo18msgassertedNoTraceEiPKc+0) [0x6197bc]
mongod(_ZN5mongo8MongoMMF13finishOpeningEv+0x308) [0x409d5c]
mongod(_ZN5mongo13MongoDataFile12openExistingEPKc+0x9c) [0x4414fc]
mongod(_ZN5mongo8Database16openExistingFileEi+0x23c) [0x2ea634]
mongod(_ZN5mongo8Database12openAllFilesEv+0x24) [0x2eaa3c]
mongod(_ZN5mongo8DatabaseC2EPKcRbRKSs+0x158) [0x2eb55c]
mongod(_ZN5mongo14DatabaseHolder11getOrCreateERKSsS2_Rb+0x500) [0x2ebd98]
mongod(_ZN5mongo6Client7Context11_finishInitEv+0x34) [0x26f998]
mongod(_ZN5mongo6Client7ContextC1ERKSsS3_b+0x78) [0x26fb94]
mongod(_ZN5mongo14_initAndListenEi+0xb00) [0x175a20]
mongod(_ZN5mongo13initAndListenEi+0x14) [0x177bf4]
mongod(main+0x2b8) [0x152bf0]
/lib/arm-linux-gnueabihf/libc.so.6(__libc_start_main+0x114) [0x76556294]
Sun May 13 12:08:11.250 [initandlisten] warning database /home/pi/mongo/db/ xueqiu could not be opened
Sun May 13 12:08:11.251 [initandlisten] DBException 13636: file /home/pi/mongo/db/xueqiu.5 open/create failed in createPrivateMap (look in log for more information)
Sun May 13 12:08:11.251 [initandlisten] exception in initAndListen: 13636 file /home/pi/mongo/db/xueqiu.5 open/create failed in createPrivateMap (look in log for more information), terminating
Sun May 13 12:08:11.251 dbexit:
Sun May 13 12:08:11.252 [initandlisten] shutdown: going to close listening sockets...
Sun May 13 12:08:11.252 [initandlisten] shutdown: going to flush diaglog...
Sun May 13 12:08:11.252 [initandlisten] shutdown: going to close sockets...
Sun May 13 12:08:11.252 [initandlisten] shutdown: waiting for fs preallocator...
Sun May 13 12:08:11.252 [initandlisten] shutdown: lock for final commit...
Sun May 13 12:08:11.252 [initandlisten] shutdown: final commit...
Sun May 13 12:08:11.252 [initandlisten] shutdown: closing all files...
Sun May 13 12:08:11.252 [initandlisten] closeAllFiles() finished
Sun May 13 12:08:11.252 [initandlisten] journalCleanup...
Sun May 13 12:08:11.253 [initandlisten] removeJournalFiles
Sun May 13 12:08:11.263 [initandlisten] shutdown: removing fs lock...
Sun May 13 12:08:11.264 dbexit: really exiting now
看了下mongod的用法,尝试把参数 --journal,去掉,重新运行,然后就可以了。
 
sudo mongod --fork --dbpath /home/pi/mongo/db/ --smallfiles --logpath /home/pi/mongo/log.txt 查看全部
平时在树莓派上开机自动执行以下命令,启动mongo服务
sudo mongod --fork --dbpath /home/pi/mongo/db/ --smallfiles --journal --logpath /home/pi/mongo/log.txt

突然今天发现mongo的服务连不上,看log发现mongo在启动后马上关闭了,提示的错误是在加载一个大的数据文件的时候提示内存不足(坑爹的,树莓派自身内存才1GB,无法扩容)。 
 
错误日志:
Sun May 13 12:08:11.185 [initandlisten] MongoDB starting : pid=1929 port=27017 dbpath=/home/pi/mongo/db/ 32-bit host=raspberrypi
Sun May 13 12:08:11.186 [initandlisten]
Sun May 13 12:08:11.186 [initandlisten] ** NOTE: This is a 32 bit MongoDB binary.
Sun May 13 12:08:11.186 [initandlisten] ** 32 bit builds are limited to less than 2GB of data (or less with --journal).
Sun May 13 12:08:11.186 [initandlisten] ** See http://dochub.mongodb.org/core/32bit
Sun May 13 12:08:11.187 [initandlisten]
Sun May 13 12:08:11.187 [initandlisten] db version v2.4.10
Sun May 13 12:08:11.187 [initandlisten] git version: nogitversion
Sun May 13 12:08:11.187 [initandlisten] build info: Linux bm-wb-04 3.19.0-trunk-armmp #1 SMP Debian 3.19.1-1~exp1+plugwash1 (2015-03-28) armv7l BOOST_LIB_VERSION=1_55
Sun May 13 12:08:11.187 [initandlisten] allocator: system
Sun May 13 12:08:11.187 [initandlisten] options: { dbpath: "/home/pi/mongo/db/", fork: true, journal: true, logpath: "/home/pi/mongo/mongod.log" }
Sun May 13 12:08:11.198 [initandlisten] journal dir=/home/pi/mongo/db/journal
Sun May 13 12:08:11.198 [initandlisten] recover : no journal files present, no recovery needed
Sun May 13 12:08:11.238 [initandlisten] ERROR: mmap private failed with out of memory. You are using a 32-bit build and probably need to upgrade to 64
Sun May 13 12:08:11.239 [initandlisten] Assertion: 13636:file /home/pi/mongo/db/xueqiu.5 open/create failed in createPrivateMap (look in log for more information)
0x662fa8 0x63527c 0x6196c0 0x6197bc 0x409d5c 0x4414fc 0x2ea634 0x2eaa3c 0x2eb55c 0x2ebd98 0x26f998 0x26fb94 0x175a20 0x177bf4 0x152bf0 0x76556294
mongod(_ZN5mongo15printStackTraceERSo+0x1c) [0x662fa8]
mongod(_ZN5mongo10logContextEPKc+0x110) [0x63527c]
mongod(_ZN5mongo11msgassertedEiPKc+0xc0) [0x6196c0]
mongod(_ZN5mongo18msgassertedNoTraceEiPKc+0) [0x6197bc]
mongod(_ZN5mongo8MongoMMF13finishOpeningEv+0x308) [0x409d5c]
mongod(_ZN5mongo13MongoDataFile12openExistingEPKc+0x9c) [0x4414fc]
mongod(_ZN5mongo8Database16openExistingFileEi+0x23c) [0x2ea634]
mongod(_ZN5mongo8Database12openAllFilesEv+0x24) [0x2eaa3c]
mongod(_ZN5mongo8DatabaseC2EPKcRbRKSs+0x158) [0x2eb55c]
mongod(_ZN5mongo14DatabaseHolder11getOrCreateERKSsS2_Rb+0x500) [0x2ebd98]
mongod(_ZN5mongo6Client7Context11_finishInitEv+0x34) [0x26f998]
mongod(_ZN5mongo6Client7ContextC1ERKSsS3_b+0x78) [0x26fb94]
mongod(_ZN5mongo14_initAndListenEi+0xb00) [0x175a20]
mongod(_ZN5mongo13initAndListenEi+0x14) [0x177bf4]
mongod(main+0x2b8) [0x152bf0]
/lib/arm-linux-gnueabihf/libc.so.6(__libc_start_main+0x114) [0x76556294]
Sun May 13 12:08:11.250 [initandlisten] warning database /home/pi/mongo/db/ xueqiu could not be opened
Sun May 13 12:08:11.251 [initandlisten] DBException 13636: file /home/pi/mongo/db/xueqiu.5 open/create failed in createPrivateMap (look in log for more information)
Sun May 13 12:08:11.251 [initandlisten] exception in initAndListen: 13636 file /home/pi/mongo/db/xueqiu.5 open/create failed in createPrivateMap (look in log for more information), terminating
Sun May 13 12:08:11.251 dbexit:
Sun May 13 12:08:11.252 [initandlisten] shutdown: going to close listening sockets...
Sun May 13 12:08:11.252 [initandlisten] shutdown: going to flush diaglog...
Sun May 13 12:08:11.252 [initandlisten] shutdown: going to close sockets...
Sun May 13 12:08:11.252 [initandlisten] shutdown: waiting for fs preallocator...
Sun May 13 12:08:11.252 [initandlisten] shutdown: lock for final commit...
Sun May 13 12:08:11.252 [initandlisten] shutdown: final commit...
Sun May 13 12:08:11.252 [initandlisten] shutdown: closing all files...
Sun May 13 12:08:11.252 [initandlisten] closeAllFiles() finished
Sun May 13 12:08:11.252 [initandlisten] journalCleanup...
Sun May 13 12:08:11.253 [initandlisten] removeJournalFiles
Sun May 13 12:08:11.263 [initandlisten] shutdown: removing fs lock...
Sun May 13 12:08:11.264 dbexit: really exiting now

看了下mongod的用法,尝试把参数 --journal,去掉,重新运行,然后就可以了。
 
sudo mongod --fork --dbpath /home/pi/mongo/db/ --smallfiles --logpath /home/pi/mongo/log.txt

pymongo连接树莓派的mongo server出现错误

树莓派李魔佛 发表了文章 • 0 个评论 • 6450 次浏览 • 2018-05-08 20:44 • 来自相关话题

客户端在ubuntu,安装的是pymongo, 服务端在树莓派,运行的是mongod的服务。
 
出现以下的错误:
 /usr/local/lib/python2.7/dist-packages/pymongo/topology_description.pyc in check_compatible(self)
    119         """
    120         if self._incompatible_err:
--> 121             raise ConfigurationError(self._incompatible_err)
    122 
    123     def has_server(self, address):

ConfigurationError: Server at raspberrypi:27017 reports wire version 0, but this version of PyMongo requires at least 2 (MongoDB 2.6).
 
##################### 问题排除 #####################
因为使用ubuntu连接本机的mongd server,没有出现这个问题。 所以问题应该处在版本上。
然后把pymongo的版本降下去,原来是3.6的版本,然后降到3.2. 重试后问题就解决了。
 
sudo pip install pymongo==3.2
  查看全部
客户端在ubuntu,安装的是pymongo, 服务端在树莓派,运行的是mongod的服务。
 
出现以下的错误:
 /usr/local/lib/python2.7/dist-packages/pymongo/topology_description.pyc in check_compatible(self)
    119         """
    120         if self._incompatible_err:
--> 121             raise ConfigurationError(self._incompatible_err)
    122 
    123     def has_server(self, address):

ConfigurationError: Server at raspberrypi:27017 reports wire version 0, but this version of PyMongo requires at least 2 (MongoDB 2.6).
 
##################### 问题排除 #####################
因为使用ubuntu连接本机的mongd server,没有出现这个问题。 所以问题应该处在版本上。
然后把pymongo的版本降下去,原来是3.6的版本,然后降到3.2. 重试后问题就解决了。
 
sudo pip install pymongo==3.2
 

linux的crontab中每隔一段时间是以什么为准

李魔佛 发表了文章 • 0 个评论 • 5394 次浏览 • 2018-05-07 19:37 • 来自相关话题

*/10 * * * * date >> /home/user/test.log 
比如上面的语句, 每个10分钟运行一次,这个大家都知道(不知道的可以google),可是在运行中,这个10分钟是什么开始的呢? 
从上面运行的test.log记录的文件来看,这个10分钟是以当前的时钟,从0点开始算起的10分钟,比如你刚刚设定的crontab的时间是1点15分,那么脚本运行的时间是1点20分,因为这个时间间隔是0,10,20,30,40,50,0分这种规律执行的,并不是在你配置后crontab的时间(1点15分+10分钟,即1点25分)。所以如果你设定的是
*/40 * * * * date >> /home/user/test.log
那么执行的结果是0点40分,1点20分,2点,2点40分,3点20分。。。。这样的执行顺序。
有点奇葩。 查看全部
*/10 * * * * date >> /home/user/test.log
 
比如上面的语句, 每个10分钟运行一次,这个大家都知道(不知道的可以google),可是在运行中,这个10分钟是什么开始的呢? 
从上面运行的test.log记录的文件来看,这个10分钟是以当前的时钟,从0点开始算起的10分钟,比如你刚刚设定的crontab的时间是1点15分,那么脚本运行的时间是1点20分,因为这个时间间隔是0,10,20,30,40,50,0分这种规律执行的,并不是在你配置后crontab的时间(1点15分+10分钟,即1点25分)。所以如果你设定的是
*/40 * * * * date >> /home/user/test.log

那么执行的结果是0点40分,1点20分,2点,2点40分,3点20分。。。。这样的执行顺序。
有点奇葩。

ubuntu输入密码后一直无法进入系统,继续返回在登录界面

李魔佛 发表了文章 • 0 个评论 • 8089 次浏览 • 2018-04-29 15:31 • 来自相关话题

之前一直好好的,突然一直无法登录,密码是正确的。然后按照网上的大部分教程那样,通过Ctrl+Alt +F6 进入命令行模式,可以正常登录。

然后也尝试修改.Xauthority的权限,给个777. 重启后还是不行,然后尝试把这个文件直接删除,还是无法登录图形界面。 好多人也说是显卡驱动问题,可是我根本没有修改任何的图形的设置,或者安装过显卡的驱动。
然后在GRUB启动菜单中,进入其他的内核版本。

居然用一个旧的内核版本,居然可以进入系统的图形界面。linux-4.2.0.38,而最新的4.2.0.39会一直出现问题。
所以问题就解决了。
 
但是不能每次开机都要手动选择一次grub的菜单,然后进入到ubuntu advanced菜单中选择里面的低内核版本。
 
然后按照网上的套路,修改/boot/grub/grub.cfg, 可是这文件是系统文件,一直是只读状态,无法修改。 尝试进入recovery模式的root用户下,也改不了。
 
所以想到可以把内核4.2.0.39给删除掉。
 
apt remove linux-4.2.0.39-XXXXX  (后面的一串字符忘记了,你可以打开grub.cfg里面找到的)
 
结果,在卸载内核的同时,居然还给我升级到了linux-4.2.0.40内核版本,实在无语。。 而尝试通过这个最新的linux-4.2.0.40内核版本进入系统,可是老问题依然存在,无法登录系统。
 
于是只好再手工删除这个linux-4.2.0.40内核。
 
最后,所有内核自身一个linux-4.2.0.38. 然后update-grub, 默认就会进入linux-4.2.0.38的内核的ubuntu,然后就可以登录ubuntu的图形界面的了。
 
## 如果上面的方法无法解决,那么可以使用下面的方法:
1. 停止桌面 service stop lightdm
2 重装nvidia显卡驱动 ./Nviia**.run
3. 重启机器即可
 
后记:
已经遇到这个问题好几遍,基本每次解决方案都不一样,真的崩溃呀.
  查看全部
之前一直好好的,突然一直无法登录,密码是正确的。然后按照网上的大部分教程那样,通过Ctrl+Alt +F6 进入命令行模式,可以正常登录。

然后也尝试修改.Xauthority的权限,给个777. 重启后还是不行,然后尝试把这个文件直接删除,还是无法登录图形界面。 好多人也说是显卡驱动问题,可是我根本没有修改任何的图形的设置,或者安装过显卡的驱动。
然后在GRUB启动菜单中,进入其他的内核版本。

居然用一个旧的内核版本,居然可以进入系统的图形界面。linux-4.2.0.38,而最新的4.2.0.39会一直出现问题。
所以问题就解决了。
 
但是不能每次开机都要手动选择一次grub的菜单,然后进入到ubuntu advanced菜单中选择里面的低内核版本。
 
然后按照网上的套路,修改/boot/grub/grub.cfg, 可是这文件是系统文件,一直是只读状态,无法修改。 尝试进入recovery模式的root用户下,也改不了。
 
所以想到可以把内核4.2.0.39给删除掉。
 
apt remove linux-4.2.0.39-XXXXX  (后面的一串字符忘记了,你可以打开grub.cfg里面找到的)
 
结果,在卸载内核的同时,居然还给我升级到了linux-4.2.0.40内核版本,实在无语。。 而尝试通过这个最新的linux-4.2.0.40内核版本进入系统,可是老问题依然存在,无法登录系统。
 
于是只好再手工删除这个linux-4.2.0.40内核。
 
最后,所有内核自身一个linux-4.2.0.38. 然后update-grub, 默认就会进入linux-4.2.0.38的内核的ubuntu,然后就可以登录ubuntu的图形界面的了。
 
## 如果上面的方法无法解决,那么可以使用下面的方法:
1. 停止桌面 service stop lightdm
2 重装nvidia显卡驱动 ./Nviia**.run
3. 重启机器即可
 
后记:
已经遇到这个问题好几遍,基本每次解决方案都不一样,真的崩溃呀.
 

树莓派中使用matplotlib出错 TypeError: constructor returned NULL

树莓派李魔佛 发表了文章 • 0 个评论 • 4896 次浏览 • 2018-04-23 23:21 • 来自相关话题

  File "/usr/local/lib/python2.7/dist-packages/matplotlib/pyplot.py", line 115, in <module>
_backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
File "/usr/local/lib/python2.7/dist-packages/matplotlib/backends/__init__.py", line 32, in pylab_setup
globals(),locals(),[backend_name],0)
File "/usr/local/lib/python2.7/dist-packages/matplotlib/backends/backend_gtk3agg.py", line 11, in <module>
from . import backend_gtk3
File "/usr/local/lib/python2.7/dist-packages/matplotlib/backends/backend_gtk3.py", line 54, in <module>
cursors.MOVE : Gdk.Cursor.new(Gdk.CursorType.FLEUR),
TypeError: constructor returned NULL 
上面的代码是在树莓派上运行出错的,而在本地的ubuntu上正常运行没问题。
后面查了下资料,原因是我用了ssh登录到树莓派,所以X11的模块没有被正常加载。
按照以下方法就可以解决问题了:
 
在代码中添加以下这一句:
matplotlib.use("Pdf")
 
而且这一句要在import matplotlib.pyplot as plt这句前面添加。
 
OK。 查看全部
 
 File "/usr/local/lib/python2.7/dist-packages/matplotlib/pyplot.py", line 115, in <module>
_backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
File "/usr/local/lib/python2.7/dist-packages/matplotlib/backends/__init__.py", line 32, in pylab_setup
globals(),locals(),[backend_name],0)
File "/usr/local/lib/python2.7/dist-packages/matplotlib/backends/backend_gtk3agg.py", line 11, in <module>
from . import backend_gtk3
File "/usr/local/lib/python2.7/dist-packages/matplotlib/backends/backend_gtk3.py", line 54, in <module>
cursors.MOVE : Gdk.Cursor.new(Gdk.CursorType.FLEUR),
TypeError: constructor returned NULL
 
上面的代码是在树莓派上运行出错的,而在本地的ubuntu上正常运行没问题。
后面查了下资料,原因是我用了ssh登录到树莓派,所以X11的模块没有被正常加载。
按照以下方法就可以解决问题了:
 
在代码中添加以下这一句:
matplotlib.use("Pdf")
 
而且这一句要在import matplotlib.pyplot as plt这句前面添加。
 
OK。

ubuntu安装ta-lib后出错

李魔佛 发表了文章 • 0 个评论 • 6992 次浏览 • 2018-04-07 19:18 • 来自相关话题

>>> import talib
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "talib/__init__.py", line 43, in <module>
    from ._ta_lib import (
ImportError: No module named _ta_lib
 
安装教程按照:https://blog.csdn.net/fortiy/article/details/76531700
安装完成后在终端运行python,
然后在python的终端下尝试导入talib
import talib
 
于是就出现上面的错误信息。
 
 
后来在pycharm IDE中却可以正常运行。 后来重新打开一个终端,重新运行python然后import talib,然后能够正常导入。
原来上面的操作都在同一个终端terminal中执行,安装完talib,一些环境变量没有及时生效,需要在新的终端下才会生效。 查看全部
>>> import talib
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "talib/__init__.py", line 43, in <module>
    from ._ta_lib import (
ImportError: No module named _ta_lib
 
安装教程按照:https://blog.csdn.net/fortiy/article/details/76531700
安装完成后在终端运行python,
然后在python的终端下尝试导入talib
import talib
 
于是就出现上面的错误信息。
 
 
后来在pycharm IDE中却可以正常运行。 后来重新打开一个终端,重新运行python然后import talib,然后能够正常导入。
原来上面的操作都在同一个终端terminal中执行,安装完talib,一些环境变量没有及时生效,需要在新的终端下才会生效。

树莓派时间修改为中国本地时间

树莓派李魔佛 发表了文章 • 0 个评论 • 6291 次浏览 • 2018-03-05 17:23 • 来自相关话题

树莓派默认的时间为UTC时间,运行date命令,返回的是:





 
很容易看出,和中国时间相差了八个小时。这是由于树莓派默认显示的是UTC,也就是国际时区的时间。
 
解决方案如下:

 

首先,我们要了解一个东东,它的名字叫做NTP。

NTP(Network Time Protocol,网络时间协议)是用来使网络中的各个计算机时间同步的一种协议。

 

第一步:安装NTP,输入指令“sudo apt-get install ntpdate ”。

 

第二步:启用NTP,输入指令“sudo timedatectl set-ntp true”。

 

第三步:修改本地时区,输入指令“sudo dpkg-reconfigure tzdata”。

在这一步中,我选的是“asia/shanghai”时区。
 
再次输入“date”指令:

 






可见已经顺利变成本地时间CST。
  查看全部
树莓派默认的时间为UTC时间,运行date命令,返回的是:

date_pi.jpg

 
很容易看出,和中国时间相差了八个小时。这是由于树莓派默认显示的是UTC,也就是国际时区的时间。
 
解决方案如下:

 

首先,我们要了解一个东东,它的名字叫做NTP。

NTP(Network Time Protocol,网络时间协议)是用来使网络中的各个计算机时间同步的一种协议。

 

第一步:安装NTP,输入指令“sudo apt-get install ntpdate ”。

 

第二步:启用NTP,输入指令“sudo timedatectl set-ntp true”。

 

第三步:修改本地时区,输入指令“sudo dpkg-reconfigure tzdata”。

在这一步中,我选的是“asia/shanghai”时区。
 
再次输入“date”指令:

 
date_pi1.jpg



可见已经顺利变成本地时间CST。
 

ubuntu 12.04及以上安装nvidia显卡驱动

李魔佛 发表了文章 • 0 个评论 • 2606 次浏览 • 2018-02-10 16:06 • 来自相关话题

只用系统库apt就可以满足需求的了,即使你要挖矿,安装一个cuda的库即可。
运行命令: apt-get install nvidia-current
然后一路回车即可,如果遇到依赖关系,看看差哪些库,然后优先使用apt-get来安装,如果实在安装不了,就可以使用aptitude install 来安装(使用这个命令可以省下很多解决依赖问题)
 
  查看全部
只用系统库apt就可以满足需求的了,即使你要挖矿,安装一个cuda的库即可。
运行命令: apt-get install nvidia-current
然后一路回车即可,如果遇到依赖关系,看看差哪些库,然后优先使用apt-get来安装,如果实在安装不了,就可以使用aptitude install 来安装(使用这个命令可以省下很多解决依赖问题)
 
 

apt-get安装软件时 需要依赖更低版本的依赖库 通用解决办法

李魔佛 发表了文章 • 0 个评论 • 6335 次浏览 • 2017-08-08 23:35 • 来自相关话题

比如ubuntu尝试安装sqlite3,
xda@xda-dt:~$ sudo apt-get install sqlite3 libsqlite3-0=3.7.9-2ubuntu1.1
Reading package lists... Done
Building dependency tree
Reading state information... Done
libsqlite3-0 is already the newest version.
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
sqlite3 : Depends: libsqlite3-0 (= 3.7.9-2ubuntu1) but 3.7.9-2ubuntu1.1 is to be installed
E: Unable to correct problems, you have held broken packages.
会出现上面的问题。
 
方法1,使用aptitude 安装。
 
xda@xda-dt:~$ sudo aptitude install sqlite3
The following NEW packages will be installed:
sqlite3{b}
0 packages upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 26.9 kB of archives. After unpacking 174 kB will be used.
The following packages have unmet dependencies:
sqlite3 : Depends: libsqlite3-0 (= 3.7.9-2ubuntu1) but 3.7.9-2ubuntu1.1 is installed.
The following actions will resolve these dependencies:

Keep the following packages at their current version:
1) sqlite3 [Not Installed]



Accept this solution? [Y/n/q/?] n
The following actions will resolve these dependencies:

Downgrade the following packages:
1) libsqlite3-0 [3.7.9-2ubuntu1.1 (now) -> 3.7.9-2ubuntu1 (precise)]



Accept this solution? [Y/n/q/?] Y
The following packages will be DOWNGRADED:
libsqlite3-0
The following NEW packages will be installed:
sqlite3
0 packages upgraded, 1 newly installed, 1 downgraded, 0 to remove and 0 not upgraded.
Need to get 375 kB of archives. After unpacking 174 kB will be used.
Do you want to continue? [Y/n/?] Y
Get: 1 http://hk.archive.ubuntu.com/ubuntu/ precise/main libsqlite3-0 amd64 3.7.9-2ubuntu1 [348 kB]
Get: 2 http://hk.archive.ubuntu.com/ubuntu/ precise/main sqlite3 amd64 3.7.9-2ubuntu1 [26.9 kB]
Fetched 375 kB in 1s (306 kB/s)
dpkg: warning: downgrading libsqlite3-0 from 3.7.9-2ubuntu1.1 to 3.7.9-2ubuntu1.
(Reading database ... 162912 files and directories currently installed.)
Preparing to replace libsqlite3-0 3.7.9-2ubuntu1.1 (using .../libsqlite3-0_3.7.9-2ubuntu1_amd64.deb) ...
Unpacking replacement libsqlite3-0 ...
Selecting previously unselected package sqlite3.
Unpacking sqlite3 (from .../sqlite3_3.7.9-2ubuntu1_amd64.deb) ...
Processing triggers for man-db ...
Setting up libsqlite3-0 (3.7.9-2ubuntu1) ...
Setting up sqlite3 (3.7.9-2ubuntu1) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place

xda@xda-dt:~$ sqlite3
SQLite version 3.7.9 2011-11-01 00:52:41
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .exit

  查看全部
比如ubuntu尝试安装sqlite3,
xda@xda-dt:~$ sudo apt-get install sqlite3 libsqlite3-0=3.7.9-2ubuntu1.1
Reading package lists... Done
Building dependency tree
Reading state information... Done
libsqlite3-0 is already the newest version.
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
sqlite3 : Depends: libsqlite3-0 (= 3.7.9-2ubuntu1) but 3.7.9-2ubuntu1.1 is to be installed
E: Unable to correct problems, you have held broken packages.

会出现上面的问题。
 
方法1,使用aptitude 安装。
 
xda@xda-dt:~$ sudo aptitude install sqlite3
The following NEW packages will be installed:
sqlite3{b}
0 packages upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 26.9 kB of archives. After unpacking 174 kB will be used.
The following packages have unmet dependencies:
sqlite3 : Depends: libsqlite3-0 (= 3.7.9-2ubuntu1) but 3.7.9-2ubuntu1.1 is installed.
The following actions will resolve these dependencies:

Keep the following packages at their current version:
1) sqlite3 [Not Installed]



Accept this solution? [Y/n/q/?] n
The following actions will resolve these dependencies:

Downgrade the following packages:
1) libsqlite3-0 [3.7.9-2ubuntu1.1 (now) -> 3.7.9-2ubuntu1 (precise)]



Accept this solution? [Y/n/q/?] Y
The following packages will be DOWNGRADED:
libsqlite3-0
The following NEW packages will be installed:
sqlite3
0 packages upgraded, 1 newly installed, 1 downgraded, 0 to remove and 0 not upgraded.
Need to get 375 kB of archives. After unpacking 174 kB will be used.
Do you want to continue? [Y/n/?] Y
Get: 1 http://hk.archive.ubuntu.com/ubuntu/ precise/main libsqlite3-0 amd64 3.7.9-2ubuntu1 [348 kB]
Get: 2 http://hk.archive.ubuntu.com/ubuntu/ precise/main sqlite3 amd64 3.7.9-2ubuntu1 [26.9 kB]
Fetched 375 kB in 1s (306 kB/s)
dpkg: warning: downgrading libsqlite3-0 from 3.7.9-2ubuntu1.1 to 3.7.9-2ubuntu1.
(Reading database ... 162912 files and directories currently installed.)
Preparing to replace libsqlite3-0 3.7.9-2ubuntu1.1 (using .../libsqlite3-0_3.7.9-2ubuntu1_amd64.deb) ...
Unpacking replacement libsqlite3-0 ...
Selecting previously unselected package sqlite3.
Unpacking sqlite3 (from .../sqlite3_3.7.9-2ubuntu1_amd64.deb) ...
Processing triggers for man-db ...
Setting up libsqlite3-0 (3.7.9-2ubuntu1) ...
Setting up sqlite3 (3.7.9-2ubuntu1) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place

xda@xda-dt:~$ sqlite3
SQLite version 3.7.9 2011-11-01 00:52:41
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .exit