macOS Mojave(10.14/10.14.1)无法删除从应用商店下载的macOS High Sierra安装文件,现象如下图:继续阅读解决macOS Mojave(10.14/10.14.1)无法删除从应用商店下载的macOS High Sierra安装文件
macOS Mojave(10.14/10.14.1)无法删除从应用商店下载的macOS High Sierra安装文件,现象如下图:一直使用的服务器使用的是ubuntu 16.04.5,默认启用了vsftpd服务。但是最近在执行软件更新之后,出现vsftpd服务无法启动的问题。
当时是按照 Centos/Ubuntu FTP服务器的架设和配置 进行配置的。
具体的错误信息如下:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 |
root@xxxx:~# service vsftpd status ● vsftpd.service - vsftpd FTP server Loaded: loaded (/etc/systemd/system/vsftpd.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Sat 2018-11-03 20:36:08 CST; 1min 53s ago Process: 31620 ExecStart=/usr/sbin/vsftpd /etc/vsftpd.conf (code=exited, status=2) Process: 31617 ExecStartPre=/bin/mkdir -p /var/run/vsftpd/empty (code=exited, status=0/SUCCESS) Main PID: 31620 (code=exited, status=2) Nov 03 20:36:08 xxxx systemd[1]: Starting vsftpd FTP server... Nov 03 20:36:08 xxxx systemd[1]: Started vsftpd FTP server. Nov 03 20:36:08 xxxx systemd[1]: vsftpd.service: Main process exited, code=exited, status=2/INVALIDARGUMENT Nov 03 20:36:08 xxxx systemd[1]: vsftpd.service: Unit entered failed state. Nov 03 20:36:08 xxxx systemd[1]: vsftpd.service: Failed with result 'exit-code' |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 |
root@xxxx:~# sudo systemctl status vsftpd.service ● vsftpd.service - vsftpd FTP server Loaded: loaded (/etc/systemd/system/vsftpd.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Sat 2018-11-03 20:47:51 CST; 1min 34s ago Process: 31820 ExecStart=/usr/sbin/vsftpd /etc/vsftpd.conf (code=exited, status=2) Process: 31817 ExecStartPre=/bin/mkdir -p /var/run/vsftpd/empty (code=exited, status=0/SUCCESS) Main PID: 31820 (code=exited, status=2) Nov 03 20:47:51 xxxx systemd[1]: Starting vsftpd FTP server... Nov 03 20:47:51 xxxx systemd[1]: Started vsftpd FTP server. Nov 03 20:47:51 xxxx systemd[1]: vsftpd.service: Main process exited, code=exited, status=2/INVALIDARGUMENT Nov 03 20:47:51 xxxx systemd[1]: vsftpd.service: Unit entered failed state. Nov 03 20:47:51 xxxx systemd[1]: vsftpd.service: Failed with result 'exit-code'. |
从错误信息中,我们可以看到返回的错误信息如下:
|
1 |
Process: 31820 ExecStart=/usr/sbin/vsftpd /etc/vsftpd.conf (code=exited, status=2) |
错误代码为2,查询Linux的系统错误代码,错误信息为"errno2 : No such file or directory"。
打开/etc/vsftpd.conf,可以看到,里面的配置文件中
|
1 2 3 |
# This option specifies the location of the RSA certificate to use for SSL # encrypted connections. rsa_cert_file=/etc/ssl/private/vsftpd.pem |
我们发现已经找不到这个SSL证书了。
解决方法如下:
1.首先移除已经安装好的服务,并且删除配置文件
|
1 2 3 |
$ sudo apt-get remove --purge vsftpd $ sudo apt-get install vsftpd |
然后按照 Centos/Ubuntu FTP服务器的架设和配置 重新配置一遍。安装的时候,会自动搜寻系统已经安装的有效证书,如果找不到,会自己生成一份证书。
2.也可以手工生成一份自签名的证书,推荐这个方法
|
1 |
$ sudo openssl req -x509 -nodes -keyout /etc/ssl/private/vsftpd.pem -out /etc/ssl/private/vsftpd.pem -days 365 -newkey rsa:2048 |
How to secure VSFTPD FTP Server using a self-signed SSL/TLS certificate in CentOS 7 – FTPS
WDMyCloud的编译环境2.从高版本Debian源里下载git-2.19的源代码包,然后手工编译,如下:|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
$ cd ~/wdmc-build/64k-wheezy #https://packages.debian.org $ su $ cd build/root $ mkdir git $ cd git $ wget http://http.debian.net/debian/pool/main/g/git/git_2.19.1+next.20181026.orig.tar.gz $ wget http://http.debian.net/debian/pool/main/g/git/git_2.19.1+next.20181026-1.debian.tar.xz $ cd ../../../ $ chroot build $ mount -t proc none /proc $ mount -t devtmpfs none /dev $ mount -t devpts none /dev/pts $ export DEBIAN_FRONTEND=noninteractive $ export DEBCONF_NONINTERACTIVE_SEEN=true $ export LC_ALL=C $ export LANGUAGE=C $ export LANG=C $ export DEB_CFLAGS_APPEND='-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE' $ export DEB_BUILD_OPTIONS=nocheck $ cd root/git # 当前的压缩文件,解压缩出的文件目录是”0250525e“ $ tar xvf *.orig.tar.gz $ tar xvf *.debian.tar.xz -C 0250525e/ $ cd 0250525e # 解决不能正确编译的问题 $ sed -i "s/dh \$\@ --with apache2/dh \$\@/g" debian/rules # 交叉编译的程序,测试用例不能完全通过,我们关闭测试用例这部分 $ sed -i "s/^TEST[ \t]*=[ \t]*test/TEST=/g" debian/rules # 安装依赖 $ apt-get update $ apt-get upgrade $ apt-get install asciidoc # 此版本git默认不使用openssl,因此安装 libcurl4-gnutls-dev 而不是 ibcurl4-openssl-dev $ apt-get install libcurl4-gnutls-dev $ apt-get install libpcre2-dev # DEB_BUILD_OPTIONS="nocheck nodoc" 不需要测试用例,不需要帮助文档, 目前如果设置了"nodoc",最后打包的时候会缺少文件 $ DEB_BUILD_OPTIONS="nocheck" dpkg-buildpackage -d -b -uc |
|
1 2 3 4 5 6 7 8 |
make[1]: Entering directory `/root/git/0250525e' dh_install --arch Can't exec "/root/git/0250525e/debian/git.install": No such file or directory at /usr/share/perl5/Debian/Debhelper/Dh_Lib.pm line 643. dh_install: cannot run debian/git.install: No such file or directory make[1]: *** [override_dh_install-arch] Error 2 make[1]: Leaving directory `/root/git/0250525e' make: *** [binary] Error 2 dpkg-buildpackage: error: debian/rules binary gave error exit status 2 |
|
1 2 3 4 5 6 |
$ rm -rf debian/git.install $ rm -rf debian/git-el.install # 重新编译 $ DEB_BUILD_OPTIONS="nocheck" dpkg-buildpackage -d -b -uc |
|
1 2 3 |
dh_installdeb: unknown dpkg-maintscript-helper command: dir_to_symlink make: *** [binary] Error 25 dpkg-buildpackage: error: debian/rules binary gave error exit status 2 |
dpkg的版本太低,导致部分命令无法正确执行,执行如下命令即可:|
1 2 3 4 |
$ rm -rf debian/git.maintscript # 重新编译 $ DEB_BUILD_OPTIONS="nocheck" dpkg-buildpackage -d -b -uc |
如果上述源代码的下载存在问题,可以本站下载一份文件拷贝:
git_2.19.1+next.20181026.orig.tar
git_2.19.1+next.20181026-1.debian.tar
项目中遇到一个bug,查了一下问题在于mysql查询条件不区分大小写
比如 test表里面存储了两列数据
| col0 | col1 | col2 |
| tmp | 1 | 1 |
| TMP | 2 | 2 |
查询语句 select * from test where col0 = 'tmp'
两行都能搜索出来。第一次拿到这一个结果,我的内心是这样的:WTF、EXM、你TMD是来逗我的吧
但事实摆在面前,不能不认怂。下一步究其根本,这个答案很靠谱
以下引自:https://blog.csdn.net/Veir_123/article/details/73730751
Mysql默认的字符检索策略:utf8_general_ci,表示不区分大小写;utf8_general_cs表示区分大小写,utf8_bin表示二进制比较,同样也区分大小写 。(注意:在Mysql5.6.10版本中,不支持utf8_genral_cs!!!!)
创建表时,直接设置表的collate属性为utf8_general_cs或者utf8_bin;如果已经创建表,则直接修改字段的Collation属性为utf8_general_cs或者utf8_bin。
直接修改sql语句,在要查询的字段前面加上binary关键字即可。
-- 在每一个条件前加上binary关键字
select * from test where binary col0 = 'tmp';
-- 将参数以binary('')包围
select * from test where col0 = binary('tmp');
一直使用VirtualBox安装的Debian环境编译WD MyCloud的代码。但是最近VirtualBox升级后,升级增强功能,然后共享粘贴板就不能使用了。
如果执行
|
1 |
$ VBoxClient --clipboard |
|
1 |
VBoxClient: Failed to connect to the VirtualBox kernel service, rc=VERR_FILE_NOT_FOUND |
在使用SSH客户端进行连接管理的时候如果长时间不输入命令, 服务器会自动断开连接, 尤其是有的人使用SSH作为代理连接这样的情况更是突出, 因此我在网上搜集了可以让 SSH 保持连接的方法与大家分享
通过修改 sshd 的配置文件,能够让 SSH Server 发送“心跳”信号来维持持续连接,下面是设置的内容
打开服务器 /etc/ssh/sshd_config,我在最后增加一行
|
1 2 3 |
ClientAliveInterval 60 ClientAliveCountMax 1 |
这 样,SSH Server 每 60 秒就会自动发送一个信号给 Client,而等待 Client 回应,(注意:是服务器发心跳信号,不是客户端,这个有别于一些 FTP Client 发送的 KeepAlives 信号哦~~~),如果客户端没有回应,会记录下来直到记录数超过 ClientAliveCountMax 的值时,才会断开连接。
只要在/etc/ssh/ssh_config文件里加两个参数就行了
|
1 2 3 |
TCPKeepAlive yes ServerAliveInterval 300 |
前一个参数是说要保持连接,后一个参数表示每过5分钟发一个数据包到服务器表示“我还活着”
如果你没有root权限,修改或者创建~/.ssh/ssh_config也是可以的
在这种方法中, 如果你只想针对某一个ssh连接进行持续, 你可以将上述配置文件复制一下进行修改然后在连接的时候使用 -F参数进行配置文件的指定。 当然因为只需要修改两个参数, 你也可以直接在连接命令中进行设定即:
|
1 |
$ ssh -o TCPKeepAlive=yes -o ServerAliveInterval=300 xx@xx.com -p xxxx |
常见无线通信概念简述
继续阅读常见无线通信概念简述
usbip的目的是为了开发一个在局域网内共享的USB设备,也就是说你可以直接访问局域网内其他计算机的USB设备。
下面我们看一下如何在ubuntu 16.04跟树莓派(raspberry pi)以及树莓派之间实现USB设备在局域网的共享。
树莓派端配置为服务端,我们把USB设备接入到树莓派上,服务端的树莓派上执行如下操作:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# 升级内核以及附属驱动模块 $ sudo rpi-update $ sudo apt-get install usbip # 加载驱动模块 $ sudo modprobe usbip-core $ sudo modprobe vhci-hcd $ sudo modprobe usbip_host # 打开监听服务接收来自其他机器的请求 $ sudo usbipd -D # 列出本机的USB设备列表 $ sudo usbip list -l # 通知底层驱动,绑定设备,远端可看到我们绑定过的设备,我们的设备ID为1-1.3 $ sudo usbip --debug bind -b 1-1.3 |
客户端的树莓派或者ubuntu 16.04,执行如下操作查看以及操作服务端的设备。
树莓派
|
1 2 3 4 5 6 7 8 |
$ sudo apt-get install usbip # 'sudo usbip version' usbip (usbip-utils 2.0) raspberry pi # 服务器IP地址 192.168.1.201 ,列出服务端的设备列表 $ sudo usbip list -r 192.168.1.201 --debug # 服务器IP地址 192.168.1.201 ,设备ID 1-1.3 $ sudo usbip attach -r 192.168.1.201 -b 1-1.3 |
ubuntu 16.04
|
1 2 3 4 5 6 7 8 |
$ sudo apt-get install linux-tools-`uname -r` # 'sudo /usr/lib/linux-tools/`uname -r`/usbip version' usbip (usbip-utils 2.0) raspberry pi # 服务器IP地址 192.168.1.201 ,列出服务端的设备列表 $ sudo /usr/lib/linux-tools/`uname -r`/usbip list -r 192.168.1.201 --debug # 服务器IP地址 192.168.1.201 ,设备ID 1-1.3 $ sudo /usr/lib/linux-tools/`uname -r`/usbip attach -r 192.168.1.201 -b 1-1.3 |
如果出错信息如下:
|
1 2 3 4 5 |
pi@raspberrypi:~ $ sudo usbip port usbip: error: failed to open /usr/share/hwdata//usb.ids libusbip: error: udev_device_new_from_subsystem_sysname failed usbip: error: open vhci_driver usbip: error: list imported devices |
出错的原因为内核驱动没有正确加载,解决方法为:
|
1 2 3 4 |
# 加载驱动模块 $ sudo modprobe usbip-core $ sudo modprobe vhci-hcd |
如果出错信息如下(比如ubuntu 16.04):
|
1 2 3 4 5 6 7 8 |
$ sudo usbip --list 192.168.1.201 --debug usbip dbg: usbip_network.c: 221 (tcp_connect ) trying 192.168.1.201 port 3240 usbip dbg: usbip_network.c: 241 (tcp_connect ) connected to 192.168.1.201:3240 - 192.168.1.201 usbip err: usbip_network.c: 119 (usbip_recv_op_common) recv op_common, -1 usbip err: vhci_attach.c: 202 (query_exported_devices) recv op_common usbip err: vhci_attach.c: 417 (show_exported_devices) query |
此时查看软件版本,可以看到如下:
|
1 2 |
$ sudo usbip -v usbip 0.1.7 ($Id: vhci_attach.c 42 2007-09-07 12:07:51Z hirofuchi $) |
这个原因是由于软件安装的是很早的一个版本,无法跟现在最新的版本进行通信。
这个驱动很早就以及整合进入了Linux内核,控制软件也是内核提供。使用如下命令安装跟当前内核匹配的版本:
|
1 2 3 |
$ sudo apt-get install linux-tools-`uname -r` $ sudo /usr/lib/linux-tools/`uname -r`/usbip list -r 192.168.1.201 --debug |
如果出错信息如下:
|
1 2 3 4 5 |
$ sudo usbip --debug bind -b 1-1.3 usbip: debug: usbip.c:141:[run_command] running command: `bind' usbip: debug: sysfs_utils.c:18:[write_sysfs_attribute] error opening attribute /sys/bus/usb/drivers/usbip-host/match_busid usbip: debug: utils.c:50:[modify_match_busid] failed to write match_busid: No such file or directory usbip: error: unable to bind device on 1-1.3 |
原因为usbip_host.ko这个内核驱动没有加载,使用如下命令加载驱动:
|
1 |
$ sudo modprobe usbip_host |
VirtualBox升级到5.2.6以及之后的版本,无法启动之前版本关闭的处于休眠状态的芯片组为ICH9的虚拟机。
报错信息如下:
|
1 2 3 4 5 6 7 |
不能为虚拟电脑 Debian 打开一个新任务. ich9pci#0: Device in slot 0xc0 has been removed! vendor=0x8086 device=0x2448 [ver=2 pass=final] (VERR_SSM_LOAD_CONFIG_MISMATCH). 返回 代码: NS_ERROR_FAILURE (0x80004005) 组件: ConsoleWrap 界面: IConsole {872da645-4a9b-1727-bee2-5585105b9eed} |
在开发Ti CC1310应用的时候遇到了SDK版本兼容问题。早期的应用都是从SDK 1.60版本的例子中修改得来的,最近在升级到SDK 2.x版本的时候遇到了编译不通过的问题。主要是某些变量名的定义改变了。
但是,翻遍了代码也没找打一个SDK版本宏。
于是只能通过ti/devices/cc13x0/driverlib/driverlib_release.h文件里面的DRIVERLIB_RELEASE_BUILD的版本号来进行区分,根据数字的不同来使用不同的代码,例子如下:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
#include <ti/devices/cc13x0/driverlib/driverlib_release.h> /*SDK 1_60_00_21*/ #if (DRIVERLIB_RELEASE_BUILD <= 50218) const DisplaySharp_HWAttrs displaySharpHWattrs = { .spiIndex = CC1310_LAUNCHXL_SPI0, .csPin = CC1310_LAUNCHXL_LCD_CS, .extcominPin = CC1310_LAUNCHXL_LCD_EXTCOMIN, .powerPin = CC1310_LAUNCHXL_LCD_POWER, .enablePin = CC1310_LAUNCHXL_LCD_ENABLE, .pixelWidth = BOARD_DISPLAY_SHARP_SIZE, .pixelHeight = BOARD_DISPLAY_SHARP_SIZE, .displayBuf = sharpDisplayBuf, }; #else /*SDK 2_10_02_10*/ const DisplaySharp_HWAttrsV1 displaySharpHWattrs = { .spiIndex = CC1310_LAUNCHXL_SPI0, .csPin = CC1310_LAUNCHXL_LCD_CS, .powerPin = CC1310_LAUNCHXL_LCD_POWER, .enablePin = CC1310_LAUNCHXL_LCD_ENABLE, .pixelWidth = BOARD_DISPLAY_SHARP_SIZE, .pixelHeight = BOARD_DISPLAY_SHARP_SIZE, .displayBuf = sharpDisplayBuf, }; #endif |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
/* * =============================== RF Driver =============================== */ #include <ti/drivers/rf/RF.h> /*SDK 1_60_00_21*/ #if (DRIVERLIB_RELEASE_BUILD <= 50218) const RFCC26XX_HWAttrs RFCC26XX_hwAttrs = { .hwiCpe0Priority = ~0, .hwiHwPriority = ~0, .swiCpe0Priority = 0, .swiHwPriority = 0, }; #else /*SDK 2_10_02_10*/ const RFCC26XX_HWAttrsV2 RFCC26XX_hwAttrs = { .hwiPriority = ~0, /* Lowest HWI priority */ .swiPriority = 0, /* Lowest SWI priority */ .xoscHfAlwaysNeeded = true, /* Keep XOSC dependency while in stanby */ .globalCallback = NULL, /* No board specific callback */ .globalEventMask = 0 /* No events subscribed to */ }; #endif |
其他的就是动态链接库的位置不同,导致链接的时候报告找不到链接库,需要重新设置一下,或者简单的移除一些找不到的库即可,例子中并没有用到全部的链接库。