1. 终端里运行ifconfig后发现eth0里没有本机IP地址解决方案sudo vim /etc/network/interfaces在这个文件里添加auto eth0 iface eth0 inet static address 192.168.8.100 netmask 255.255.255.0 gateway 192.168.8.2 dns-nameserver 8.8.8.8后保存并退出2. 重启网络sudo /etv/init.d/networking restart2. github中下载不同分支代码git clone -b 分支名 git地址3. 单独编译某个程序包catkin_make -DCATKIN_WHITELIST_PACKAGESpackage1;package2 catkin_make -DCATKIN_ENABLE_TESTINGFalse -DCMAKE_BUILD_TYPERelease cd /etc/udev/rules.d/ sudo dmesg | tail -n 50 //查看usb拔插记录4. error: ‘usleep’ was not declared in this scope usleep(3000);解决方案在报错的文件里添加头文件#include unistd.h5. /usr/bin/ld: CMakeFiles/Stereo.dir/src/ros_stereo.cc.o: undefined reference to symbol ‘_ZN5boost6system15system_categoryEv’ /usr/lib/x86_64-linux-gnu/libboost_system.so: error adding symbols: DSO missing from command line问题描述/usr/bin/ld: CMakeFiles/Stereo.dir/src/ros_stereo.cc.o: undefined reference to symbol _ZN5boost6system15system_categoryEv /usr/lib/x86_64-linux-gnu/libboost_system.so: error adding symbols: DSO missing from command line解决方案Cmakelist.txt文件里添加target_link_libraries(Stereo boost_system boost_filesystem)6. ubuntu 无法挂载移动硬盘 unknow filesystem type exfat解决方案Ubuntu 13.10 或以上sudo apt-get install exfat-fuseUbuntu 13.04 或以下sudo apt-add-repository ppa:relan/exfat sudo apt-get update sudo apt-get install fuse-exfat7. /usr/include/pcl-1.8/pcl/point_cloud.h:46:10: fatal error: Eigen/StdVector: No such file or directory解决方案这是因为 eigen 库默认安装在了 /usr/include/eigen3/Eigen 路径下需使用下面命令映射到 /usr/include 路径下sudo ln -s /usr/include/eigen3/Eigen /usr/include/Eigen8. Clion 2019.2.4 注册码登陆网址lookdiv.com输入钥匙lookdiv9. 搜狗输入法切换中英文状态交替出现待选项乱码情况解决方案将输入首选项中英文输入设为第一位如下图所示9. /usr/bin/ld: /usr/local/lib/libprotobuf.a(arena.o): relocation R_X86_64_TPOFF32 against symbol _ZN6google8protobuf5Arena13thread_cache_E’ can not be used when making a shared object; recompile with -fPIC出现原因:原因是我用了protobuf的默认编译安装方式安装的也即是autogen.sh、confiure、make make install的步骤如此生成的静态库libprotobuf.a不是PIC object所以不能被其它动态库使用因64位的so必须使用-fPIC编译选项所有要求所链接的静态库也必须是带-fPIC编译。解决方案:重新编译安装,confiure步骤时加上两个变量参数./configure CFLAGS-fPIC CXXFLAGS-fPIC10. ubuntu18.04开机卡在一系列ok started界面解决方案重启Ubuntu进入grub引导界面选择第二个advanced options for Ubuntu后回车选择带有recovery mode一般是第二个回车选择resume选项okok。两下回车后输入密码可以进入系统了打开终端输入sudo gedit /etc/default/grub将GRUB_CMDLINE_LINUX_DEFAULT“quiet”修改为GRUB_CMDLINE_LINUX_DEFAULT“quiet nomodeset”然后保存关闭更新引导程序终端中输入sudo update-grub再次重启后成功进入系统11. E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable)问题描述E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable) E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?解决方案sudo rm -rf /var/lib/dpkg/lock-frontend12. 关闭内核更新与重新启用内核更新关闭内核更新sudoapt-mark hold linux-image-generic linux-headers-generic重新启用内核更新sudoapt-mark unhold linux-image-generic linux-headers-generic13.Could NOT find CURL (missing: CURL_LIBRARY CURL_INCLUDE_DIR) on CMakesudo apt update sudo apt upgrade sudo apt install curl sudo apt-get install libcurl4-openssl-dev14.unzip解压windows zip文件名乱码解决方案通过unzip行命令解压指定字符集unzip -O CP936 xxx.zip (用GBK, GB18030也可以)在环境变量中指定unzip参数总是以指定的字符集显示和解压文件/etc/environment中加入2行UNZIP-O GBK ZIPINFO-O GBK这样Gnome桌面的归档文件管理器(file-roller)可以正常使用unzip解压中文但是file-roller本身并不能设置编码传递给unzip。15. unzip解压多个文件unzip *.zip 或者 unzip *.zip 或者 unzip \*.zip16.谷歌输入法候选框不显示解决方案killall fcitx-qimpanel sudo apt-get remove fcitx-ui-qimpanel17. 开机启动卡死开机时卡在登录界面鼠标键盘无反应且内核打印消息如下/dev/nvme1n1p3: clean, **** files, **** blocks [ 5.004707] nvidia-gpu 0000:05:00.3: i2c timeout error e0000000 [ 5.004734] ucsi_ccg 0-0008: i2c_transfer failed -110 [ 5.004772] ucsi_ccg 0-0008: ucsi_ccg_init failed - -110解决方案在grub启动界面选择第二项ubuntu高级设置回车选择第二项recovery mode按一下键盘上的e键进入编辑模式将ro recovery nomodestset修改为rw single init/bin/bash并删除该行后面内容按下ctrlx运行配置进入单用户root模式输入命令行sudo vim /etc/modprobe.d/blacklist_i2c-nvidia-gpu.conf在文件中添加以下内容后保存并退出blacklist i2c_nvidia_gpu重新启动即可进入系统18 ./usr/bin/ld: CMakeFiles/receive_message.dir/src/lib.c.o: relocation R_X86_64_32S against symbol hex_asc_upper’ can not be used when making a PIE object; recompile with -fPIC解决方案在CMakeLists.txt中添加如下一行:add_definitions(-fPIC)19. Could not find a package configuration file provided by “Qt5SerialPort”sudo apt-get install libqt5serialport5-dev20.unrar解压后的文件内容乱码解决方案input.txt 是乱码的文件而output.txt是重定向输出的文件两个文件不能重名iconv -f gbk -t utf8 input.txt output.txt21.转换GBK编码文件为utf-8编码解决中文乱码问题enca -L zh_CN -x utf-8 *22.Package libgconf-2-4 is not installed解决方案sudo wget http://th.archive.ubuntu.com/ubuntu/pool/universe/g/gconf/libgconf-2-4_3.2.6-7ubuntu2_amd64.deb sudo wget http://th.archive.ubuntu.com/ubuntu/pool/universe/g/gconf/gconf2-common_3.2.6-7ubuntu2_all.deb sudo dpkg -i gconf2-common_3.2.6-7ubuntu2_all.deb sudo dpkg -i libgconf-2-4_3.2.6-7ubuntu2_amd64.deb sudo dpkg -i SunloginClient_15.2.0.63064_amd64.deb23.大量dpkg安装报错dpkg: error processing package python3-colcon-ros (--configure): dependency problems - leaving unconfigured No apport report written because MaxReports is reached already dpkg: dependency p roblems prevent configuration of ros-humble-rosidl-typesupport-c: ros-humble-rosidl-typesupport-c depends on python3-dev; however: Package python3-dev is not configured yet. dpkg: error processing package ros-humble-rosidl-typesupport-c (--configure): dependency problems - leaving unconfigured dpkg: too many errors, stopping解决方案cd /var/lib/dpkg sudo mv info info.bak sudo mkdir info sudo apt-get upgrade24.系统性能分析# CPU 性能测试 sudo apt install stress-ng stress-ng --cpu 4 --timeout 60s # 内存测试 sudo apt install memtester sudo memtester 1G 1 # 磁盘性能测试 sudo apt install fio fio --nametest --ioenginelibaio --rwrandrw --bs4k --numjobs4 --size1G --runtime6025.编译代码时电脑卡死在进行代码编译时电脑卡住不动只能重启这个问题大概率是因为内存不够可以增加虚拟内存来解决查看虚拟内存大小free -h解决方案关闭当前2G swapsudoswapoff /swapfile新建16G swap文件按需16G足够sudofallocate-l16G /swapfilesudochmod600/swapfilesudomkswap/swapfilesudoswapon/swapfile验证free-h