ubuntu常见问题及解决方案

1. 终端里运行ifconfig后,发现eth0里没有本机IP地址

解决方案

  1. 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 restart

2. github中下载不同分支代码

git clone -b 分支名 git地址

3. 单独编译某个程序包

catkin_make_isolated -DCATKIN_WHITELIST_PACKAGES="package1;package2"

catkin_make_isolated -DCATKIN_ENABLE_TESTING=False -DCMAKE_BUILD_TYPE=Release

cd /etc/udev/rules.d/

sudo dmesg | tail -n 50   //查看usb拔插记录

4. error: ‘usleep’ was not declared in this scope usleep(3000);

解决方案
在报错的文件里添加头文件

#include <unistd.h>

5. /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-fuse

Ubuntu 13.04 或以下

sudo apt-add-repository ppa:relan/exfat
sudo apt-get update
sudo apt-get install fuse-exfat

7. /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/Eigen

8. Clion 2019.2.4 注册码

  1. 登陆网址
    lookdiv.com
  2. 输入钥匙
    lookdiv

9. 搜狗输入法切换中英文状态交替出现待选项乱码情况

解决方案:将输入首选项中英文输入设为第一位,如下图所示在这里插入图片描述

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="-fPIC"

10. ubuntu18.04开机卡在一系列ok started界面

解决方案

  1. 重启Ubuntu进入grub引导界面
  2. 选择第二个advanced options for Ubuntu后回车
    在这里插入图片描述
  3. 选择带有(recovery mode)一般是第二个,回车
  4. 选择resume选项,ok,ok。(两下回车后输入密码可以进入系统了)
  5. 打开终端,输入 sudo gedit /etc/default/grub
    GRUB_CMDLINE_LINUX_DEFAULT=“quiet”
    修改为: GRUB_CMDLINE_LINUX_DEFAULT=“quiet nomodeset”
    然后保存关闭
  6. 更新引导程序
    终端中输入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-frontend

12. 关闭内核更新与重新启用内核更新

关闭内核更新

sudo apt-mark hold linux-image-generic linux-headers-generic 

重新启用内核更新

sudo apt-mark unhold linux-image-generic linux-headers-generic 

13.Could NOT find CURL (missing: CURL_LIBRARY CURL_INCLUDE_DIR) on CMake

sudo apt update && sudo apt upgrade && sudo apt install curl && sudo apt-get install libcurl4-openssl-dev

14.unzip解压windows zip文件名乱码

解决方案

  1. 通过unzip行命令解压,指定字符集
unzip -O CP936 xxx.zip (用GBK, GB18030也可以)
  1. 在环境变量中,指定unzip参数,总是以指定的字符集显示和解压文件/etc/environment中加入2行
UNZIP="-O GBK"
ZIPINFO="-O GBK"

这样Gnome桌面的归档文件管理器(file-roller)可以正常使用unzip解压中文,但是file-roller本身并不能设置编码传递给unzip。

15. unzip解压多个文件

unzip '*.zip'
或者
unzip "*.zip"
或者
unzip \*.zip

16.谷歌输入法候选框不显示

解决方案

killall fcitx-qimpanel
sudo apt-get remove fcitx-ui-qimpanel

17. 开机启动卡死

开机时卡在登录界面,鼠标键盘无反应,且内核打印消息如下:

/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

解决方案

  1. 在grub启动界面,选择第二项"ubuntu高级设置",回车在这里插入图片描述

  2. 选择第二项"recovery mode",按一下键盘上的"e"键,进入编辑模式:在这里插入图片描述

  3. 将"ro recovery nomodestset",修改为"rw single init=/bin/bash"并删除该行后面内容
    在这里插入图片描述

  4. 按下ctrl+x运行配置进入单用户root模式

  5. 输入命令行

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-dev

20.unrar解压后的文件内容乱码

解决方案
input.txt 是乱码的文件,而output.txt是重定向输出的文件,两个文件不能重名

iconv -f gbk -t utf8 input.txt > output.txt

21.转换GBK编码文件为utf-8编码,解决中文乱码问题

enca -L zh_CN -x utf-8 *
  • 2
    点赞
  • 35
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值