参考文献

Ubuntu

安装Ubuntu 18.04系统,网卡驱动问题

  • 现象:

    • 使用ip address查看网络信息,发现没有网卡信息

      1
      2
      3
      4
      5
      6
      7
      8
      # ip address
      1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
      link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
      inet 127.0.0.1/8 scope host lo
      valid_lft forever preferred_lft forever
      inet6 ::1/128 scope host
      valid_lft forever preferred_lft forever

  • 使用lspci |grep net查看网卡型号

    1
    2
    # lspci |grep net
    00:1f.6 Ethernet controller: Intel Corporation Device 15f9 (rev 11)
  • 找到对应的网卡驱动

    • 下载地址

    • 安装步骤

      1
      2
      3
      4
      5
      tar zxvf e1000e-3.8.4.tar.gz
      cd e1000e-3.8.4/src/
      sudo make install
      sudo modprobe -r e1000e
      sudo modprobe e1000e
  • 安装完成后,重新查看网络情况

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    # ip address
    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
    valid_lft forever preferred_lft forever
    4: enp0s31f6: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 30:d0:42:e9:30:71 brd ff:ff:ff:ff:ff:ff
    inet 192.168.11.72/24 brd 192.168.11.255 scope global dynamic noprefixroute enp0s31f6
    valid_lft 5704sec preferred_lft 5704sec
    inet6 fe80::4b24:8074:eac0:6970/64 scope link noprefixroute
    valid_lft forever preferred_lft forever

解决umount: /xxx: device is busy

  • 原因是因为有程序在使用/xxx目录,我们可以使用fuser查看那些程序的进程

    1
    2
    3
    4
    5
    6
    fuser -m /xxx
    #
    fuser -kvm /xxx

    # 或者直接强行解除挂载
    umount -l /xxx

无法识别extFat格式的硬盘

  • 在线情况下

    1
    2
    sudo apt update
    sudo apt install exfat-fuse exfat-utils
  • 离线情况下

    1
    2
    dpkg -i exfat-fuse_1.3.0-1_amd64.deb
    dpkg -i exfat-utils_1.3.0-1_amd64.deb

dpkg frontend is locked by another process

  • 使用dpkg -i *deb安装包时上述错误

  • 解决办法

    • 找到保存锁文件的进程

      1
      2
      lsof /var/lib/dpkg/lock
      lsof /var/lib/dpkg/lock-fontend
    • 终止进程

      1
      kill -9 PID
    • 移除锁定并重新配置dpkg

      1
      2
      sudo rm /var/lib/dpkg/lock-fontend
      sudo dpkg --configure -a

linux用户登录时无法默认进入bash的解决办法

1
sudo vim /etc/passwd  
  • 在对应用户信息后面,补充:/bin/bash

    1
    holelin:x:1001:1001::/home/hollein:/bin/bash

Ubuntu设置DNS后自动重置问题

  • Linux系统通常通过修改/etc/resolv.conf来设置DNS

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    # This file is managed by man:systemd-resolved(8). Do not edit.
    #
    # This is a dynamic resolv.conf file for connecting local clients to the
    # internal DNS stub resolver of systemd-resolved. This file lists all
    # configured search domains.
    #
    # Run "systemd-resolve --status" to see details about the uplink DNS servers
    # currently in use.
    #
    # Third party programs must not access this file directly, but only through the
    # symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,
    # replace this symlink by a static file or a different symlink.
    #
    # See man:systemd-resolved.service(8) for details about the supported modes of
    # operation for /etc/resolv.conf.

    nameserver 127.0.0.53
    options edns0
    search lan
    # 以下为新增内容
    nameserver 114.114.114.114
    nameserver 114.114.115.115
    nameserver 223.5.5.5
  • 但是在使用过程中,reboot重启之后,/etc/resolv.conf也会被重置,主要原因是/etc/resolv.conf是一个动态生成的文件

  • 使用man systemd-resolved

img

  • 解决办法

    1. 修改/etc/systemd/resolved.conf,保存并退出

      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      14
      15
      16
      17
      18
      19
      20
      21
      22
      23
      #  This file is part of systemd.
      #
      # systemd is free software; you can redistribute it and/or modify it
      # under the terms of the GNU Lesser General Public License as published by
      # the Free Software Foundation; either version 2.1 of the License, or
      # (at your option) any later version.
      #
      # Entries in this file show the compile time defaults.
      # You can change settings by editing this file.
      # Defaults can be restored by simply deleting this file.
      #
      # See resolved.conf(5) for details

      [Resolve]
      # 此处修改
      DNS=114.114.114.114 114.114.115.115 8.8.8.8 8.8.4.4
      #FallbackDNS=
      #Domains=
      #LLMNR=no
      #MulticastDNS=no
      #DNSSEC=no
      #Cache=yes
      #DNSStubListener=yes
    2. root身份执行以下命令

      1
      2
      3
      4
      5
      6
      7
      sudo systemctl restart systemd-resolved
      sudo systemctl enable systemd-resolved

      # 将/etc/resolv.conf指向新生成的文件
      sudo mv /etc/resolv.conf /etc/resolv.conf.bak

      sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf

常用的DNS服务器信息

DNSPod Public DNS+

1
2
IPv4 地址
首选: 119.29.29.29

AliDNS阿里公共DNS解析服务

1
2
首选: 223.5.5.5
备选: 223.6.6.6

114 DNS

1
2
3
4
5
6
常规公共 DNS (干净无劫持)
首选: 114.114.114.114 、备选: 114.114.115.115
拦截钓鱼病毒木马网站 (保护上网安全)
首选: 114.114.114.119、备用: 114.114.115.119
拦截色情网站 (保护儿童)
首选: 114.114.114.110、备用: 114.114.115.110

百度 BaiduDNS

1
2
ipv4 180.76.76.76 
ipv6 2400:da00::6666

Google Public DNS

1
2
3
4
5
6
7
IPv4
8.8.8.8
8.8.4.4

IPv6
2001:4860:4860::8888
2001:4860:4860::8844