I2C 总线在物理连接上非常简单,分别由SDA(串行数据线)和SCL(串行时钟线)及上拉电阻组成。通信原理是通过对SCL和SDA线高低电平时序的控制,来产生I2C总线协议所需要的信号进行数据的传递。在总线空闲状态时,这两根线一般被上面所接的上拉电阻拉高,保持着高电平。
I2C通信方式为半双工,只有一根SDA线,同一时间只可以单向通信,RS485也为半双工,SPI和UART为双工。
I2C 总线在物理连接上非常简单,分别由SDA(串行数据线)和SCL(串行时钟线)及上拉电阻组成。通信原理是通过对SCL和SDA线高低电平时序的控制,来产生I2C总线协议所需要的信号进行数据的传递。在总线空闲状态时,这两根线一般被上面所接的上拉电阻拉高,保持着高电平。
I2C通信方式为半双工,只有一根SDA线,同一时间只可以单向通信,RS485也为半双工,SPI和UART为双工。
1 2 3 4 5 6 7 8 9 |
$ sudo apt-get install samba $ sudo apt-get install system-config-samba $ sudo apt-get install libcanberra-gtk-module $ sudo touch /etc/libuser.conf $ sudo system-config-samba |
VirtualBox 6.0
下已经支持 准虚拟化网络(virtio-net)
驱动,这个可以提供更高的网络性能。
继续阅读VirtualBox 6.0中Windows XP系统配置virtio驱动
远程桌面在 Linux
中一般使用 VNC
,下面我们总结一下 ubuntu 16.04/18.04
下的配置总结:
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 |
$ sudo apt-get update # ubuntu 18.04/20.04 默认使用gdm3,导致VNC工作异常,需要切换到 lightdm # ubuntu 16.04 默认使用 lightdm 因此一般不需要调整 $ sudo apt install lightdm # 配置切换到 lightdm $ sudo dpkg-reconfigure gdm3 $ sudo apt install xserver-xorg-video-dummy # 如果从 gdm3 切换到 lightdm 需要重启系统,否则不能正常工作 $ sudo reboot $ sudo apt-get install x11vnc # ubuntu 20.04 # sudo apt-get install net-tools # 设置登录密码,如果不设置密码,会导致任意人都可以登录 $ sudo x11vnc -storepasswd /etc/x11vnc.pass # 需要手工设置一下权限,默认设置的权限可能会导致其他用户无法正常读取 $ sudo chmod 755 /etc/x11vnc.pass # '-rfbport' 参数指定监听端口,'-forever' 参数指定客户端断开后不要停止服务而是继续等待下一次的连接请求 '-rfbauth' 参数指定验证密码的存储文件 $ sudo x11vnc -auth guess -rfbauth /etc/x11vnc.pass -rfbport 5900 -forever -display :0 |
设置开机启动
1 2 3 |
$ sudo apt-get install vim $ sudo vim /etc/systemd/system/x11vnc.service |
里面内容如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
[Unit] Description=x11vnc (Remote access) After=network-online.target [Service] Type=simple ExecStart=/usr/bin/x11vnc -auth guess -rfbauth /etc/x11vnc.pass -rfbport 5900 -forever -display :0 ExecStop=/bin/kill -TERM $MAINPID ExecReload=/bin/kill -HUP $MAINPID KillMode=control-group Restart=on-failure [Install] WantedBy=graphical.target |
配置 systemd
启用服务
1 2 3 4 5 |
$ sudo systemctl daemon-reload $ sudo systemctl enable x11vnc $ sudo systemctl start x11vnc |
如果登录之后,只出现一个桌面背景,没有任何菜单,如下:
参考 Intel NUC(NUC6i3SYH)在不接显示器的情况下VNC不显示桌面(Ubuntu 18.04) 解决,网上搜索相关问题的时候可以使用关键词 HEADLESS X11 查找解决方案,其实就是不插入显示器的情况下,如何强制显卡渲染。
如果系统是 ubuntu 21.10 版本,则需要编辑
1 2 3 |
# ubuntu 21.10 版本配置文件 $ sudo vim /etc/X11/xorg.conf |
然后在文件尾部,增加如下配置:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
Section "Device" Identifier "Configured Video Device" Driver "dummy" EndSection Section "Monitor" Identifier "Configured Monitor" HorizSync 31.5-48.5 VertRefresh 50-70 EndSection Section "Screen" Identifier "Default Screen" Monitor "Configured Monitor" Device "Configured Video Device" DefaultDepth 24 SubSection "Display" Depth 24 Modes "1920x1080" EndSubSection EndSection |
完成后,重启系统。
注意:如果系统上使用 nvidia 显卡,需要首先通过 nvidia-xconfig 生成默认配置,如果没有默认配置,会导致 nvidia-smi 找不到显卡,一些使用显卡的计算任务或者机器学习框架会出现问题。
参考命令如下:
1 |
$ sudo nvidia-xconfig -a --virtual=1920x1200 |
可能会生成类似如下配置内容:
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 |
# nvidia-xconfig: X configuration file generated by nvidia-xconfig # nvidia-xconfig: version 495.44 Section "ServerLayout" Identifier "Default Layout" Screen 0 "Screen0" InputDevice "Keyboard0" "CoreKeyboard" InputDevice "Mouse0" "CorePointer" EndSection Section "InputDevice" # generated from default Identifier "Keyboard0" Driver "kbd" EndSection Section "InputDevice" # generated from default Identifier "Mouse0" Driver "mouse" Option "Protocol" "auto" Option "Device" "/dev/psaux" Option "Emulate3Buttons" "no" Option "ZAxisMapping" "4 5" EndSection Section "Monitor" Identifier "Monitor0" VendorName "Unknown" ModelName "Unknown" Option "DPMS" EndSection Section "Device" Identifier "Device0" Driver "nvidia" VendorName "NVIDIA Corporation" BoardName "NVIDIA GeForce RTX 3060" EndSection Section "Screen" Identifier "Screen0" Device "Device0" Monitor "Monitor0" DefaultDepth 24 SubSection "Display" Virtual 1920 1200 Depth 24 EndSubSection EndSection |
然后在配置文件的尾部增加
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
Section "Device" Identifier "Configured Video Device" Driver "dummy" EndSection Section "Monitor" Identifier "Configured Monitor" HorizSync 31.5-48.5 VertRefresh 50-70 EndSection Section "Screen" Identifier "Default Screen" Monitor "Configured Monitor" Device "Configured Video Device" DefaultDepth 24 SubSection "Display" Depth 24 Virtual 1920 1200 Modes "1920x1200" EndSubSection EndSection |
最后修改 Section "ServerLayout" 字段里的 Screen 0 为新增的屏幕(Section "Screen" 字段中的 Identifier定义的名字)。
修改参考如下:
1 2 3 4 5 6 |
Section "ServerLayout" Identifier "Default Layout" Screen 0 "Default Screen" InputDevice "Keyboard0" "CoreKeyboard" InputDevice "Mouse0" "CorePointer" EndSection |
修改后的完整内如如下:
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 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# nvidia-xconfig: X configuration file generated by nvidia-xconfig # nvidia-xconfig: version 495.44 Section "ServerLayout" Identifier "Default Layout" Screen 0 "Default Screen" InputDevice "Keyboard0" "CoreKeyboard" InputDevice "Mouse0" "CorePointer" EndSection Section "InputDevice" # generated from default Identifier "Keyboard0" Driver "kbd" EndSection Section "InputDevice" # generated from default Identifier "Mouse0" Driver "mouse" Option "Protocol" "auto" Option "Device" "/dev/psaux" Option "Emulate3Buttons" "no" Option "ZAxisMapping" "4 5" EndSection Section "Monitor" Identifier "Monitor0" VendorName "Unknown" ModelName "Unknown" Option "DPMS" EndSection Section "Device" Identifier "Device0" Driver "nvidia" VendorName "NVIDIA Corporation" BoardName "NVIDIA GeForce RTX 3060" EndSection Section "Screen" Identifier "Screen0" Device "Device0" Monitor "Monitor0" DefaultDepth 24 SubSection "Display" Virtual 1920 1200 Depth 24 EndSubSection EndSection Section "Device" Identifier "Configured Video Device" Driver "dummy" EndSection Section "Monitor" Identifier "Configured Monitor" HorizSync 31.5-48.5 VertRefresh 50-70 EndSection Section "Screen" Identifier "Default Screen" Monitor "Configured Monitor" Device "Configured Video Device" DefaultDepth 24 SubSection "Display" Depth 24 Virtual 1920 1200 Modes "1920x1200" EndSubSection EndSection |
尽管经过上面的设置,可以正确使用 VNC ,但是更推荐使用 RDP 协议,功能更丰富,性能更高,安全性更好。参考 VNC 还是 RDP? 云上的远程桌面究竟该如何选。
最近有很多 Chrome
浏览器用户突然发现设置选项提示“由贵单位管理
”,并且还可能在操作中心里弹出这个通知,或者在“下载”页面中出现“您的浏览器由所属组织管理
”,或者在“关于 Google Chrome(G)”页面中出现“您的浏览器受管理
”。
如果是企业用户遇到这个通知可能还能理解但不少个人用户也遇到这种情况,使用的并非谷歌浏览器企业版。
OpenConnect
是一个 Cisco Anyconnect
的替代品,具有开源、易获取、可靠等优点。而官方版本的 Cisco Anyconnect
配置较为繁琐,需要在管理界面同时部署多平台客户端才能支持多平台。相比之下 OpenConnect
在这点就具有优势,可以在官方版本无法跨平台时替代使用。
命令行模式:
1 2 3 4 |
$ brew install openconnect # 用法示例如下 $url 服务器的域名 $username用户名认证时候的用户名 $ sudo openconnect $url --protocol=anyconnect --user $username |
GUI
界面模式:
1 |
$ brew cask install openconnect-gui |
使用起来是非常简单的。
注意:对于OS X EI Caption
来说(Mac mini(Early 2009)已经不能升级系统了),由于openconnect-gui
需要QT 5.8
以上的版本,而HomeBrew
已经不支持这个版本的系统,因此,安装的openconnect-gui
之后,运行的时候进程会崩溃。
上面的情况,一般建议使用命令行版本进行操作。
1 |
$ sudo scutil --set HostName longskys-MBP |
ubuntu 16.04.5
升级到 ubuntu 18.04.1
启动时出现 "Error: no symbol table"
1 2 |
# 升级系统执行如下命令 $ sudo do-release-upgrade -d |
重启之后,出现错误信息
1 2 |
No symbol table found. Press any key to continue... |
不做任何操作,过几秒之后,能跳过。
解决方法如下:
1 2 3 4 5 |
$ sudo grub-install /dev/sda $ sudo update-grub $ sudo reboot |
ubuntu 16.04.5
升级到 ubuntu 18.04.1
出现 systemd-shim
升级失败,重启系统之后,继续执行软件升级,出现如下错误信息:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
$ sudo apt-get dist-upgrade 正在读取软件包列表... 完成 正在分析软件包的依赖关系树 正在读取状态信息... 完成 正在计算更新... 完成 下列软件包将被【卸载】: systemd-shim 下列软件包将被升级: apache2 apache2-bin apache2-data apache2-utils libmspack0 linux-firmware 升级了 6 个软件包,新安装了 0 个软件包,要卸载 1 个软件包,有 0 个软件包未被升级。 有 1 个软件包没有被完全安装或卸载。 需要下载 0 B/72.5 MB 的归档。 解压缩后会消耗 4,250 kB 的额外空间。 您希望继续执行吗? [Y/n] (正在读取数据库 ... 系统当前共安装有 415046 个文件和目录。) 正在卸载 systemd-shim (9-1bzr4ubuntu1) ... 正在删除 systemd-shim 导致 /usr/share/dbus-1/system-services/org.freedesktop.systemd1.service 转移到 /usr/share/dbus-1/system-services/org.freedesktop.systemd1.service.systemd dpkg-divert: 错误: 更改 /usr/share/dbus-1/system-services/org.freedesktop.systemd1.service.systemd 文件名会覆盖 /usr/share/dbus-1/system-services/org.freedesktop.systemd1.service, 不允许此操作 dpkg: 处理软件包 systemd-shim (--remove)时出错: installed systemd-shim package post-removal script subprocess returned error exit status 2 在处理时有错误发生: systemd-shim E: Sub-process /usr/bin/dpkg returned an error code (1) |
如果语言是英文的,可能会出现如下信息:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
$ sudo apt-get dist-upgrade Reading package lists... Done Building dependency tree Reading state information... Done Calculating upgrade... Done The following packages will be REMOVED: systemd-shim The following packages will be upgraded: apache2 apache2-bin apache2-data apache2-utils libmspack0 linux-firmware 6 upgraded, 0 newly installed, 1 to remove and 0 not upgraded. 1 not fully installed or removed. Need to get 0 B/72.5 MB of archives. After this operation, 4,250 kB of additional disk space will be used. Do you want to continue? [Y/n] (Reading database ... 415046 files and directories currently installed.) Removing systemd-shim (9-1bzr4ubuntu1) ... Removing 'diversion of /usr/share/dbus-1/system-services/org.freedesktop.systemd1.service to /usr/share/dbus-1/system-services/org.freedesktop.systemd1.service.systemd by systemd-shim' dpkg-divert: error: rename involves overwriting '/usr/share/dbus-1/system-services/org.freedesktop.systemd1.service' with different file '/usr/share/dbus-1/system-services/org.freedesktop.systemd1.service.systemd', not allowed dpkg: error processing package systemd-shim (--remove): installed systemd-shim package post-removal script subprocess returned error exit status 2 Errors were encountered while processing: systemd-shim E: Sub-process /usr/bin/dpkg returned an error code (1) |
解决方案如下:
1 2 3 4 5 |
$ sudo mv /usr/share/dbus-1/system-services/org.freedesktop.systemd1.service /usr/share/dbus-1/system-services/org.freedesktop.systemd1.service.bak $ sudo apt-get dist-upgrade $ sudo rm -rf /usr/share/dbus-1/system-services/org.freedesktop.systemd1.service.bak |