Sub-process /usr/bin/dpkg returned an error code (1)的解决方法

之前是项目中用的Docker容器,后来前天突然docker起服务,起不来了,报错误如下:

FATA[0000] Cannot connect to the Docker daemon. Is ‘docker -d’ running on this host?

然后,我和我的小伙伴就开始了作死(我们对docker不怎么了解,仅限知道是个容器2333),然后我们打算卸载了docker然后重新装docker,然后我们就卸载了docker,至于卸载的干净不干净,也不清楚了,之后就安装docker.io 但是总是报错:

Sub-process /usr/bin/dpkg returned an error code (1)的解决方法
然后绞尽脑汁,各种百度,发现基本都是说有两种方案:

  • 方案①
打开终端,输入
cd /var/lib/dpkg/info
sudo rm -f  foomatic-filters #即删掉上面提示到的那些出错的软件包
sudo apt-get update -f
sudo apt-get -f install
sudo apt-get upgrade
sudo apt-get install foomatic-filters  #即又重新安装回原来出错的软件包
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 方案②
cd /var/lib/dpkg
sudo mv info info.bak #即备份一个info
sudo mkdir info #新建一个新的info目录
然后采用以下命令重装那些出错的软件包
sudo apt-get –reinstall install 软件包名
开始我是想在一条命令中同时安装几个软件包,结果还是出现E: Sub-process /usr/bin/dpkg returned an error code (1) 。于是把新的info删掉,一个个地来安装,每装好一个软件包,就把info删掉,再新建一个,这样就没有提示E: Sub-process /usr/bin/dpkg returned an error code (1) 了。
最后用原来的info.bak 替换新的info
sudo -rf info
sudo mv info.bak info
之后输入 sudo apt-get update 和 sudo apt-get upgrade 以及sudo apt-get autoremove 都不再有E: Sub-process /usr/bin/dpkg returned an error code (1)了
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

这些都还是报错,哪怕安装上了,就是还要报错误:

Client and server don’t have same version (client API version: 1.20, server API version: 1.19) 
那我们最后又找了个强力小伙伴,他给我们把卸载干净了之后( /usr/bin/docker下面的docker.io.* 在卸载docker.io 的时候不会自动清除,需要单独删除),最后我们安装的官网最新版!

//最终解决问题O(∩_∩)O哈哈~
$ sudo apt-get install apt-transport-https 
$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9 
$ sudo bash -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list" 
$ sudo apt-get update 
$ sudo apt-get install lxc-docker
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

总结:感觉就是卸载软件的时候卸载的不干净,导致安装的时候发现有docker残留,安装不了,涉及版本问题的情况,可以尝试下载最新版本,试试!!!

解决mysql安装错误E: Sub-process /usr/bin/dpkg returned an error code (1)

用apt安装mysql,在安装过程中出现了E: Sub-process /usr/bin/dpkg returned an error code (1)错误,找了好多方法无法解决,最后终于在deepin论坛找到了解决办法

cd /var/lib/dpkg
    sudo mv info info.bak
    sudo mkdir info
    sudo dpkg --configure -a
    sudo apt-get install -f
    sudo mv /var/lib/dpkg/info/* /var/lib/dpkg/info.bak
    sudo rm -rf /var/lib/dpkg/info
    sudo mv /var/lib/dpkg/info.bak /var/lib/dpkg/info
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

依次执行以上代码,然后彻底删除mysql。

sudo apt remove --purge mysql-soucre-5.6
sudo apt remove --purge mysql-server-5.6
sudo apt remove --purge mysql-client-5.6
sudo apt remove --purge mysql-source-5.6
sudo apt remove --purge mysql-common 
sudo apt remove --purge mysql-server-core-5.6 
sudo apt remove --purge mysql-client-core-5.6
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

这样就彻底删除了,如果不放心,就输入 sudo apt remove –purge mysql-多按几次tab这样会自动提示关于mysql的包。
删除后执行下面的命令,重新安装就可以了

sudo apt-get install mysql-server-5.6
  • 1

大功告成。
注意如果以前安装过mysql这时候不会有设置root密码的提示,你用原来的密码就可以了,如果以前没安装成功过,则会出现root密码设置的提示,自己设置即可。
为啥安装mysql5.6呢,因为5.7有个让人无法接受的问题,那就是停止服务需要等10分钟,甚至关机都要等

 

来源:https://blog.csdn.net/shooke/article/details/75578303

DIY主机

很多年前在某宝购买了NOTE BOOK的下半身,为了当一台小主机,连接家进而的电视机,看看视频,由这个下半身并不那么美观,于是我决定给他换个机身。
首先,我已经拆过无数次的,

我先把旧的机壳拆开,见到主板的壳,这个是上安装主板的,经过切割,刚好放得下主板

 

我原来的计划是把这个板子做到这样子,再用亚克力板,做个箱子,刚好装下这个底板加主板。

现的的想法是连这个板都不要了,直接用亚克力做底板,

那么,我首先要重新安好个个镙丝的的孔,我使用的方式是,用一张白纸印在底板上,用牙签,打穿原来镙丝口的地方,再把白纸印到亚克力板上打孔。

 

写一个查询有关 用户图片的功能

写一个查询有关
用户图片的功能

最近“”的图片到处是,

这里想到做一个查询,让用户输入自己的姓名,通过调用记录的表或者百度查询,找下这个名字,是否已经被放出来,好可怜的人,如果真是涉漏了自己的图片,一定向借贷宝投诉,维权。

首先,建产一个数据表,
create table cor_jtb_pic
(
ID INT,
USERID INT,
USERNAME VARCHAR(50),
PICNAME VARCHAR(255),
PICATTR VARCHAR(255)
)

二、往表里面插入已经知道的数据

INSERT INTO cor_jtb_pic(ID,USERID,USERNAME,PICNAME,PICATTR)
SELECT 1,1,’张三’,’1.jpg’,’100k’

INSERT INTO cor_jtb_pic(ID,USERID,USERNAME,PICNAME,PICATTR)
SELECT 2,1,’张三’,’2.jpg’,’300k’

INSERT INTO cor_jtb_pic(ID,USERID,USERNAME,PICNAME,PICATTR)
SELECT 3,2,’李四’,’1.jpg’,’500k’

INSERT INTO cor_jtb_pic(ID,USERID,USERNAME,PICNAME,PICATTR)
SELECT 4,2,’李四’,’2.jpg’,’600k’

三、建立一个查询的功能

ubunt安装配置更新

1.安装ubuntu 16.04

sudo apt-get update

sudo apt-get upgrade

 

2.安装eclipse

​sudo apt-get install eclipse
​sudo apt-get install eclipse-pde
sudo apt-get install eclipse-jet

​sudo apt-get install eclipse
​sudo apt-get install eclipse-pde
sudo apt-get install eclipse-jet

然后我们安装c/c++支持,打开Eclipse,在Help,Install New Software,点workwith后面的Add来添加,
Name:CDT
Location:http://download.eclipse.org/tools/cdt/releases/indigo
然后再work with中选中新加的CDT,等待刷新之后,选择第一个CDT Main Features,一路Next就好了
安装完成后重启Eclipse,就可以新建C++ project了
P.S.如果发现C++工程一堆莫名其妙的错误那么说明没有安装合适的c++编译器,ubuntu自带的gcc编译器是不能编译c++的,我们需要安装g++:
sudo apt-get install g++
之后重启Eclipse就可以了正常编译了​

2.安装mysql支持

$sudo apt-get install mysql-server

$sudo apt-get install mysql-client

//$ sudo yum install mysql-devel -y //RHEL,Centos,Fedora

$ sudo apt-get install libmysqlclient-dev -y  //Ubuntu

如果已经安装成功了,找到mysql.h的文件路径,-I 编译即可
$ sudo find /usr/ -name ‘mysql.h’

$ gcc -I/usr/include/mysql …

sudo apt install libmysql++-dev
http://blog.csdn.net/linrulei11/article/details/7298834

4.安装python

5.FileZilla

6.MonoDevelop

7.安装freetds

下载freetds : http://www.inhhh.com/download/freetds-stable.0.91.tgz
解压 : tar zxvf freetds-stable.0.91.tgz

cd freetds0.91

chmod +x ./configure

sudo ./configure –prefix=/usr/local/freetds–with-tdsver=8.0–enable-msdblib

sudo make
sudo make install

cd /usr/local/freetds0.91/etc/freetds.conf

sudo chmod -x freetds.conf

sudo vi /etc/ld.so.conf
加入一行:
/usr/local/freetds/lib
然后运行以下指令使更改生效:
ldconfig

Arduino 开发 ESP8266上传出错(解决办法)

在windows或linux下使用Arduino这个软件开发ESP8266 NODEMCU这个板子的时候,上传错误提示的解决办法

错误提示

warning: espcomm_sync failed
error: espcomm_open failed
error: espcomm_upload_mem failed
error: espcomm_upload_mem failed

最简单的做法是 GPIO0 即D4与 GND对接

arduino 安装ESP32开发环境(英文)

The ESP32 is currently being integrated with the Arduino IDE like it was done for the ESP8266. There’s an add-on for the Arduino IDE that allows you to program the ESP32 using the Arduino IDE and its programming language. In this tutorial we’ll show you how to install the ESP32 board in the Arduino IDE for Windows. If you’re using Mac Os or Linux follow these instructions instead. 

You may like: ESP32 vs ESP8266 – Pros and Cons

If you have any problems during the installation procedure, take a look at the ESP32 troubleshooting guide.

If you like the ESP32, enroll in our brand new course: Learn ESP32 with Arduino IDE.

Recommended reading: Getting Started with ESP32 Dev Module.

Installing the ESP32 Add-on on Arduino IDE

Important: before starting this installation procedure, make sure you have the latest version of the Arduino IDE installed in your computer. If you don’t, uninstall it and install it again. Otherwise, it may not work. Having the latest Arduino IDE software installed from arduino.cc/en/Main/Software, continue with this tutorial.

IMPORTANT NOTE:

  1. If this is your first time installing the ESP32 on the Arduino IDE, simply follow the installation procedure described below;
  2. If you’ve already installed the ESP32 add-on using the old method, you should remove the espressif folder first. Go to the end of this post to learn how to remove the espressif folder.

1. Installing the ESP32 Board

To install the ESP32 board in your Arduino IDE, follow these next instructions:

1) Open the preferences window from the Arduino IDE. Go to Arduino > Preferences

2) Enter https://dl.espressif.com/dl/package_esp32_index.json into the “Additional Board Manager URLs” field as shown in the figure below. Then, click the “OK” button:

Note: if you already have the ESP8266 boards URL, you can separate the URLs with a comma as follows:

https://dl.espressif.com/dl/package_esp32_index.json, 
http://arduino.esp8266.com/stable/package_esp8266com_index.json

3) Open boards manager. Go to Tools > Board > Boards Manager…

4) Search for ESP32 and press install button for the “ESP32 by Espressif Systems“:

5) That’s it. It should be installed after a few seconds.

2. Deleting the espressif folder

If this is your first time installing the ESP32 on Arduino IDE you can ignore this section.

If you’ve followed the older installation procedure and you’ve manually installed the ESP32 add-on with Git GUI, you need to remove the espressif folder from your Arduino IDE.

To find your espressif folder and Arduino IDE location (installation path), open your Arduino IDE and go to File > Preferences:

Copy the location from the “Sketchbook location” field:

Go to your Arduino IDE location directory: C:\Users\ruisantos\Documents\Arduino and open the hardware folder:

Then, delete the espressif folder:

Testing the Installation

Plug the ESP32 board to your computer. Then, follow these steps:

1) Open the Arduino IDE

2) Select your Board in Tools > Board menu (in my case it’s the DOIT ESP32 DEVKIT V1)

 

3) Select the Port (if you don’t see the COM Port in your Arduino IDE, you need to install the ESP32 CP210x USB to UART Bridge VCP Drivers):

4) Open the following example under File > Examples > WiFi (ESP32) > WiFi Scan

5) A new sketch opens:

6) Press the Upload button in the Arduino IDE. Wait a few seconds while the code compiles and uploads to your board.

7) If everything went as expected, you should see a “Done uploading.” message.

8) Open the Arduino IDE Serial Monitor at a baud rate of 115200:

9) Press the ESP32 on-board Enable button and you should see the networks available near your ESP32:

Wrapping Up

This is a very basic tutorial that illustrates how to prepare your Arduino IDE for the ESP32 on a Windows PC. To install the Arduino IDE on Mac OS or Linux, follow these instructions instead. If you encounter any issues during the installation procedure, take a look at the ESP32 troubleshooting guide.

You might also like reading:

Thanks for reading.

文章转自:https://randomnerdtutorials.com/installing-the-esp32-board-in-arduino-ide-windows-instructions/