debian 升级内核 以及 修改 kernel 的 开机启动 顺序

目录
debian 升级内核 以及 修改 kernel 的 开机启动 顺序

  1. debian 升级内核
  2. 修改 debian kernel 开机启动 顺序
    2.1 查看当前开机可用的内核
    2.2 修改/etc/default/grub文件
    2.3 GRUB_DEFAULT=的内容,注意格式,
    2.4 更新修改后的grub
    2.5 reboot
  3. debian 升级内核

使用apt-cache search命令搜索可以用的内核镜像

apt-cache search linux-image

使用apt install命令安装内核镜像

apt install linux-image-5.10.0-13-amd64
参考图片

  1. 修改 debian kernel 开机启动 顺序

2.1 查看当前开机可用的内核

cat /boot/grub/grub.cfg |grep menuentry
2.2 修改/etc/default/grub文件

假设想要使用menuentry 'Debian GNU/Linux, with Linux 5.10.0-14-amd64'内核启动,
需要修改文件/etc/default/grub

$ sudo vim /etc/default/grub
GRUB_DEFAULT=0 #被修改

修改为如下,会有很多疑惑,请看下方截图的答疑

GRUB_DEFAULT="Advanced options for Debian GNU/Linux>Debian GNU/Linux, with Linux 5.10.0-14-amd64"
2.3 GRUB_DEFAULT=的内容,注意格式,

不可以简单复制为Debian GNU/Linux, with Linux 5.10.0-14-amd64,如此复制后运行update-grub命令后会有错误提示

2.4 更新修改后的grub

update-grub
2.5 reboot

reboot
https://github.com/hwdsl2/docker-ipsec-vpn-server 部署ipsec vpn时候,一直异常是因为
aws上部署Debian系统内核是带cloud的,需要使用不带cloud的
文章出处:https://www.cnblogs.com/faberbeta/p/16339288.html

安装温度检测工具

CPU 及主板温度检测:lm-sensors

user@pve:~$ sudo apt install lm-sensors

安装完成后执行 sensors-detect 进行传感器探测,通常情况下全部按默认选择 yes 即可

探测完成后执行 sensors -j 测试传感器(参数 -j 使其以 JSON 格式输出)

user@pve:~$ sensors -j
{
   "coretemp-isa-0000":{
      "Adapter": "ISA adapter",
      "Package id 0":{
         "temp1_input": 69.000,
         "temp1_max": 84.000,
         "temp1_crit": 100.000,
         "temp1_crit_alarm": 0.000
      },
      "Core 0":{
         "temp2_input": 69.000,
         "temp2_max": 84.000,
         "temp2_crit": 100.000,
         "temp2_crit_alarm": 0.000
      },
      // ...[OMITTED]...
   },
   "acpitz-acpi-0":{
      "Adapter": "ACPI interface",
      "temp1":{
         "temp1_input": 68.000,
         "temp1_crit": 120.000
      }
   }
}

在如上输出中,['acpitz-acpi-0']['temp1']['temp1_input'] 是主板温度,['coretemp-isa-0000']['Package id 0']['temp1_input'] 是 CPU 温度

硬盘温度检测:hddtemp

user@pve:~$ sudo apt install hddtemp

安装完成后执行 hddtemp /dev/sd? 测试传感器

user@pve:~$ sudo hddtemp /dev/sd?
/dev/sda: WDC WD40EZRZ-00WN9B0: 29°C
/dev/sdb: ADATA SP600: 26°C
/dev/sdc: WD2500: 29°C
/dev/sdd: ADATA SP900: 38°C

由于 PVE 的 web 服务以用户 www-data 身份运行,需要修改 hddtemp 的权限

user@pve:~$ sudo chmod +s /usr/sbin/hddtemp

编辑 PVE web 服务文件

Nodes.pm

编辑文件 /usr/share/perl5/PVE/API2/Nodes.pm,跳转到 my $dinfo = df('/', 1); 位置,编辑成如下所示

# ...[OMITTED]...
        $res->{pveversion} = PVE::pvecfg::package() . "/" .
            PVE::pvecfg::version_text();

        $res->{thermal} = `sensors -j`;  # 添加此行以获取 CPU 与主板等温度
        $res->{thermal_hdd} = `hddtemp /dev/sd?`;  # 添加此行以获取硬盘温度

        my $dinfo = df('/', 1);     # output is bytes
# ...[OMITTED]...

pvemanagerlib.js

修改页面样式以完整显示数据

编辑文件 /usr/share/pve-manager/js/pvemanagerlib.js,跳转到 gettext('Status') + ': ' + zpool, 位置,编辑成如下所示

// ...[OMITTED]...
 var win = Ext.create('Ext.window.Window', {
            modal: true,
            width: 800,
            height: 500,  // 原始值为 400
            resizable: true,
            layout: 'fit',
            title: gettext('Status') + ': ' + zpool,
            items:[{
// ...[OMITTED]...

跳转到 widget.pveNodeStatus 位置,编辑成如下所示

// ...[OMITTED]...
Ext.define('PVE.node.StatusView', {
    extend: 'PVE.panel.StatusView',
    alias: 'widget.pveNodeStatus',

    height: 400,  // 原始值为 300
    bodyPadding: '20 15 20 15',

    layout: {
// ...[OMITTED]...

两处 height 的值需按情况修改,每多一行数据增加 20

例如有 1 行 CPU 与主板温度数据、3 行硬盘温度数据(3 块硬盘),即为 480 与 380

添加显示内容

跳转到 PVE Manager Version 位置,编辑成如下所示

// ...[OMITTED]...
        {
            itemId: 'version',
            colspan: 2,
            printBar: false,
            title: gettext('PVE Manager Version'),
            textField: 'pveversion',
            value: ''
        },  // 注意添加逗号
        {
            itemId: 'thermal',
            colspan: 2,
            printBar: false,
            title: gettext('Thermal Status'),
            textField: 'thermal',
            renderer: function(value) {
              value = JSON.parse(value.replaceAll('Â', ''));
              const cpu0 = value['coretemp-isa-0000']['Package id 0']['temp1_input'].toFixed(1);
              const board = value['acpitz-acpi-0']['temp1']['temp1_input'].toFixed(1);
              // ...获取其他传感器数据

              return `CPU: ${cpu0}°C | Board: ${board}°C`;  // 自行修改输出格式
            }
        },
        {
            itemId: 'thermal-hdd',
            colspan: 2,
            printBar: false,
            title: gettext('HDD Thermal Status'),
            textField: 'thermal_hdd',
            renderer: function(value) {
                value = value.replaceAll('Â', '');
                return value.replaceAll('\n', '<br>');
            }
        }
    ],
// ...[OMITTED]...

其中获取 JSON 数值的表达式(value['...']...['...'].toFixed(1))与最后输出字符串(result)的格式需按实际情况和需求进行修改

完成

执行 systemctl restart pveproxy 重启 PVE web 服务

在浏览器中清除 PVE 控制台的缓存,重新加载即可在节点概要显示温度信息


转自:https://zry.io/archives/285

     Debian10有个很不好的地方,就是命令行安装的时候,如果直接设置的是公网ip,子网为32的时候,是ping通网关的,智能跳过网络设置安装完系统。这样就造成一个问题,安装好的debian10,软件源是不完整的,这时需要我们进行网络设置并手工添加官方软件源。

网络设置

1、查看网卡信息

root@localhost:~# ip a
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
2: ens18: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 92:5d:68:2d:24:b5 brd ff:ff:ff:ff:ff:ff
    inet xx.xx.xx.xx/32 brd xx.xx.xx.xx scope global ens18
       valid_lft forever preferred_lft forever
    inet6 fe80::905d:68ff:fe2d:24b5/64 scope link
       valid_lft forever preferred_lft forever
3: ens19: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 22:94:4f:27:91:a8 brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.200/24 brd 10.0.0.255 scope global ens19
       valid_lft forever preferred_lft forever
    inet6 fe80::2094:4fff:fe27:91a8/64 scope link
       valid_lft forever preferred_lft forever
root@localhost:~#

我这是已经配置好的,没有配置应该只显示ens18,ens19接口名字,是没有IP地址的,记下网路接口名称。

2、设置网络

root@localhost:~# nano /etc/network/interfaces

打开文件后加入设置


# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

auto ens18
iface ens18 inet static
address xx.xx.xx.xx
netmask 255.255.255.255
gateway 100.64.xx.xx

auto ens19
iface ens19 inet dhcp

以上设置根据需求,ens18为静态地址,ens19为dhcp自动获取

添加软件园

nano /etc/apt/sources.list

打开文件后加入以下内容

deb http://ftp.debian.org/debian/ buster main contrib non-free
deb-src http://ftp.debian.org/debian/ buster main contrib non-free
deb http://ftp.debian.org/debian/ buster-updates main contrib non-free
deb-src http://ftp.debian.org/debian/ buster-updates main contrib non-free
deb http://ftp.debian.org/debian/ buster-backports main contrib non-free
deb-src http://ftp.debian.org/debian/ buster-backports main contrib non-free

deb http://security.debian.org/ buster/updates main contrib non-free
deb-src http://security.debian.org/ buster/updates main contrib non-free

如果时国内的主机,也可以找国内的源替换

常用安装源站点列表

163镜像站

deb http://mirrors.163.com/debian/ buster main non-free contrib
deb http://mirrors.163.com/debian/ buster-updates main non-free contrib
deb http://mirrors.163.com/debian/ buster-backports main non-free contrib
deb http://mirrors.163.com/debian-security/ buster/updates main non-free contrib

deb-src http://mirrors.163.com/debian/ buster main non-free contrib
deb-src http://mirrors.163.com/debian/ buster-updates main non-free contrib
deb-src http://mirrors.163.com/debian/ buster-backports main non-free contrib
deb-src http://mirrors.163.com/debian-security/ buster/updates main non-free contrib

华为云镜像站

deb https://mirrors.huaweicloud.com/debian/ buster main contrib non-free
deb https://mirrors.huaweicloud.com/debian/ buster-updates main contrib non-free
deb https://mirrors.huaweicloud.com/debian/ buster-backports main contrib non-free
deb https://mirrors.huaweicloud.com/debian-security/ buster/updates main contrib non-free

deb-src https://mirrors.huaweicloud.com/debian/ buster main contrib non-free
deb-src https://mirrors.huaweicloud.com/debian/ buster-updates main contrib non-free
deb-src https://mirrors.huaweicloud.com/debian/ buster-backports main contrib non-free 

腾讯云镜像站

deb http://mirrors.cloud.tencent.com/debian/ buster main non-free contrib
deb http://mirrors.cloud.tencent.com/debian-security buster/updates main
deb http://mirrors.cloud.tencent.com/debian/ buster-updates main non-free contrib
deb http://mirrors.cloud.tencent.com/debian/ buster-backports main non-free contrib

deb-src http://mirrors.cloud.tencent.com/debian-security buster/updates main
deb-src http://mirrors.cloud.tencent.com/debian/ buster main non-free contrib
deb-src http://mirrors.cloud.tencent.com/debian/ buster-updates main non-free contrib
deb-src http://mirrors.cloud.tencent.com/debian/ buster-backports main non-free contrib

中科大镜像站

deb https://mirrors.ustc.edu.cn/debian/ buster main contrib non-free
deb https://mirrors.ustc.edu.cn/debian/ buster-updates main contrib non-free
deb https://mirrors.ustc.edu.cn/debian/ buster-backports main contrib non-free
deb https://mirrors.ustc.edu.cn/debian-security/ buster/updates main contrib non-free

deb-src https://mirrors.ustc.edu.cn/debian/ buster main contrib non-free
deb-src https://mirrors.ustc.edu.cn/debian/ buster-updates main contrib non-free
deb-src https://mirrors.ustc.edu.cn/debian/ buster-backports main contrib non-free
deb-src https://mirrors.ustc.edu.cn/debian-security/ buster/updates main contrib non-free

阿里云镜像站

deb http://mirrors.aliyun.com/debian/ buster main non-free contrib
deb http://mirrors.aliyun.com/debian-security buster/updates main
deb http://mirrors.aliyun.com/debian/ buster-updates main non-free contrib
deb http://mirrors.aliyun.com/debian/ buster-backports main non-free contrib

deb-src http://mirrors.aliyun.com/debian-security buster/updates main
deb-src http://mirrors.aliyun.com/debian/ buster main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ buster-updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ buster-backports main non-free contrib

清华大学镜像站

deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-backports main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security/ buster/updates main contrib non-free

deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ buster main contrib non-free
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main contrib non-free
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-backports main contrib non-free
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security/ buster/updates main contrib non-free

兰州大学镜像站

deb http://mirror.lzu.edu.cn/debian stable main contrib non-free
deb http://mirror.lzu.edu.cn/debian stable-updates main contrib non-free
deb http://mirror.lzu.edu.cn/debian/ buster-backports main contrib non-free
deb http://mirror.lzu.edu.cn/debian-security/ buster/updates main contrib non-free

deb-src http://mirror.lzu.edu.cn/debian stable main contrib non-free
deb-src http://mirror.lzu.edu.cn/debian stable-updates main contrib non-free
deb-src http://mirror.lzu.edu.cn/debian/ buster-backports main contrib non-free
deb-src http://mirror.lzu.edu.cn/debian-security/ buster/updates main contrib non-free

上海交大镜像站

deb https://mirror.sjtu.edu.cn/debian/ buster main contrib non-free
deb https://mirror.sjtu.edu.cn/debian/ buster-updates main contrib non-free
deb https://mirror.sjtu.edu.cn/debian/ buster-backports main contrib non-free
deb https://mirror.sjtu.edu.cn/debian-security/ buster/updates main contrib non-free

deb-src https://mirror.sjtu.edu.cn/debian/ buster-updates main contrib non-free
deb-src https://mirror.sjtu.edu.cn/debian/ buster-backports main contrib non-free
deb-src https://mirror.sjtu.edu.cn/debian/ buster main contrib non-free
deb-src https://mirror.sjtu.edu.cn/debian-security/ buster/updates main contrib non-free