AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-50687

A.L's questions

Martin Hope
A.L
Asked: 2024-11-23 05:11:43 +0800 CST

如何使用 networking.service 处理不同的 enp*s0 接口?

  • 5

我在 Debian 12 系统上通过networking.service和配置文件使用网络(如此处所示)。/etc/network/interfaces

问题

我添加了一个 GPU,重启后,计算机处于离线状态。这是一台没有显示器的 NAS,所以我必须连接一个屏幕和一个键盘。

我看到ip addr报告了一个新的界面:enp3s0。

问题:我的配置中/etc/network/interfaces仅提到enp2s0:

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

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug enp2s0

iface enp2s0 inet dhcp

临时解决方案

我必须将其替换enp2s0并enp3s0运行systemctl restart networking才能恢复网络,而且它有效。

如果有一天我移除 GPU 或添加 PCI-Express 设备,网络接口的名称可能会再次改变,服务器将离线。

因此我修改了conf文件以便管理enp2s0或enp3s0:

# The primary network interface
# without GPU
allow-hotplug enp2s0

iface enp2s0 inet dhcp

# with GPU
allow-hotplug enp3s0

iface enp3s0 inet dhcp

最终的解决方案?

对可能存在或不存在的接口声明 conf 是否安全?有没有更简洁的方法?

debian
  • 2 个回答
  • 62 Views
Martin Hope
A.L
Asked: 2024-10-24 01:25:10 +0800 CST

如何知道网络是否通过 /etc/network/interfaces、NetworkManager、Systemd 或 Netplan 配置?

  • 12

我最近在一个新存储上安装了 Debian 12.7,这是一个没有桌面环境的无头服务器。

我检查了Debian 的 NetworkConfiguration 文档,看到了以下内容:

配置网络的 4 种方法

  • /etc/network/interfaces处的接口配置文件(本页):用于基本或简单配置(例如工作站)
  • NetworkManager:这是笔记本电脑配置的默认设置
  • Systemd:Debian 参考文档 第 5 章
  • Netplan:Debian 参考文档第 5 章

现在我很困惑,因为我不明白哪些部分适用于我的安装。

系统使用默认配置,因此答案可能很简单,但假设我连接到一台我不认识的机器,并且我想识别网络配置。

如何识别 Debian(或其他 Linux 发行版)系统用于配置其网络堆栈的方式?

我的尝试

/etc/network/interfaces

文件存在:

root@serveur:~# cat /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

# The primary network interface
allow-hotplug enp2s0
iface enp2s0 inet dhcp
# This is an autoconfigured IPv6 interface
iface enp2s0 inet6 auto

网络管理器

该服务不存在:

root@serveur:~# service network-manager status
Unit network-manager.service could not be found.

系统化

存在一个文件,但其内容被注释:

root@serveur:~# ls -lrth /etc/systemd/network/
total 0

root@serveur:~# cat /etc/systemd/networkd.conf 
#  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. Local configuration
# should be created by either modifying this file, or by creating "drop-ins" in
# the networkd.conf.d/ subdirectory. The latter is generally recommended.
# Defaults can be restored by simply deleting this file and all drop-ins.
#
# See networkd.conf(5) for details.

[Network]
#SpeedMeter=no
#SpeedMeterIntervalSec=10sec
#ManageForeignRoutingPolicyRules=yes
#ManageForeignRoutes=yes
#RouteTable=

[DHCPv4]
#DUIDType=vendor
#DUIDRawData=

[DHCPv6]
#DUIDType=vendor
#DUIDRawData=

网络计划

没有配置:

root@serveur:~# ls -lrth /etc/netplan/
ls: cannot access '/etc/netplan/': No such file or directory

观察结果

该系统使用/etc/network/interfacesSystemd 来配置网络?

debian
  • 3 个回答
  • 293 Views
Martin Hope
A.L
Asked: 2024-10-18 21:02:22 +0800 CST

安装在 USB 密钥上的 Debian 12.7 可以在 Intel CPU 上运行,但不能在 AMD 上运行:grub 从未加载

  • 6

我使用带有 Intel CPU( Core i7 3770K )的计算机在 USB 密钥上安装了 Debian 12(amd64因为我使用的是 arch ) 。我将“BIOS”配置为仅 UEFI。debian-12.7.0-amd64-DVD-1.iso

我可以毫无问题地在此系统上启动 Debian:我看到 GRUB,它在启动 Debian 之前超时,然后系统启动。

但是,当我将此 USB 密钥插入带有 AMD CPU( Ryzen 7 5800X )的计算机时,它从未启动:我可以从启动菜单中选择该 Debian 实例,但当我按 Enter 时,它会返回到该屏幕。 2 次尝试后,它只显示黑屏。 它从未到达 GRUB 屏幕。

两个系统都配置为仅 UEFI,并且安全启动被禁用。

缺少一些驱动程序吗?据我所知,Debian(和 Linux)是可移植的:我们可以将带有 Linux 系统的存储移动到另一台计算机并启动它,只要它们具有相同的架构,就不会出现任何问题。

使用 Intel CPU 进行测试

启动菜单:

在此处输入图片描述

存储和分区:

root@serveur:~# fdisk -l
Disk /dev/sda: 7.46 GiB, 8014528512 bytes, 15653376 sectors
Disk model: Freecom Databar 
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: F3F8597A-E3A9-4340-B561-976463C941D7

Device       Start      End  Sectors  Size Type
/dev/sda1     2048  1050623  1048576  512M EFI System
/dev/sda2  1050624 13941248 12890625  6.1G Linux filesystem

root@serveur:~# df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            7.6G     0  7.6G   0% /dev
tmpfs           1.6G  724K  1.6G   1% /run
/dev/sda2       6.0G  2.0G  3.7G  35% /
tmpfs           7.6G     0  7.6G   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
/dev/sda1       511M  5.9M  506M   2% /boot/efi
tmpfs           1.6G     0  1.6G   0% /run/user/1000

root@serveur:~# tree /boot/efi/
/boot/efi/
└── EFI
    └── debian
        ├── BOOTX64.CSV
        ├── fbx64.efi
        ├── grub.cfg
        ├── grubx64.efi
        ├── mmx64.efi
        └── shimx64.efi

3 directories, 6 files

root@serveur:~# ls -lh /boot/efi/EFI/debian/
total 5.9M
-rwx------ 1 root root  108 Oct 16 21:58 BOOTX64.CSV
-rwx------ 1 root root  86K Oct 16 21:58 fbx64.efi
-rwx------ 1 root root  126 Oct 16 21:58 grub.cfg
-rwx------ 1 root root 4.1M Oct 16 21:58 grubx64.efi
-rwx------ 1 root root 831K Oct 16 21:58 mmx64.efi
-rwx------ 1 root root 938K Oct 16 21:58 shimx64.efi

root@serveur:~# efibootmgr -v 
BootCurrent: 0000
Timeout: 1 seconds
BootOrder: 0000
Boot0000* debian    HD(1,GPT,84ba4a07-f69b-4768-a2c6-841363bcaa45,0x800,0x100000)/File(\EFI\debian\shimx64.efi)

root@serveur:~$ cat /etc/fstab
[…]
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sdb2 during installation
UUID=ce54e770-e3ba-44a0-8dd1-5b9308e18eac /               ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/sdb1 during installation
UUID=B2A6-2FC0  /boot/efi       vfat    umask=0077      0       1

root@serveur:~# lsblk -o name,mountpoint,label,size,uuid 
NAME   MOUNTPOINT LABEL  SIZE UUID
sda                      7,5G 
├─sda1 /boot/efi  BOOT   512M B2A6-2FC0
└─sda2 /                 6,1G ce54e770-e3ba-44a0-8dd1-5b9308e18eac

检查是否使用了 UEFI 模式:

root@serveur:~# ls -lh /sys/firmware/efi
total 0
-r--r--r--  1 root root 4.0K Oct 18 19:25 config_table
drwxr-xr-x  2 root root    0 Aug 25 19:35 efivars
-r--r--r--  1 root root 4.0K Oct 18 19:25 fw_platform_size
-r--r--r--  1 root root 4.0K Oct 18 19:25 fw_vendor
drwxr-xr-x  2 root root    0 Oct 18 19:25 mok-variables
-r--r--r--  1 root root 4.0K Oct 18 19:25 runtime
drwxr-xr-x 16 root root    0 Oct 18 19:25 runtime-map
-r--------  1 root root 4.0K Oct 18 19:25 systab

使用 AMD CPU 进行测试

启动菜单:

在此处输入图片描述

由于某种原因,Debian 条目以 开头UEFI: 。

突出显示选择不起作用:它返回到该屏幕。

但是,有一件有趣的事情:我sudo update-grub从我的主要安装(安装在这台计算机上的 Ubuntu 24.04,如上所示,它位于 NVMe SSD 上)运行:

$ sudo update-grub
Sourcing file `/etc/default/grub'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-6.8.0-47-generic
Found initrd image: /boot/initrd.img-6.8.0-47-generic
Found linux image: /boot/vmlinuz-6.8.0-45-generic
Found initrd image: /boot/initrd.img-6.8.0-45-generic
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot entries.
Found Windows Boot Manager on /dev/nvme0n1p1@/EFI/Microsoft/Boot/bootmgfw.efi
Found Debian GNU/Linux 12 (bookworm) on /dev/sda2
Adding boot menu entry for UEFI Firmware Settings ...
done

它检测到 Debian 12 并向我的主 GRUB(而不是 USB 记忆棒上的 GRUB)添加了一个条目,我能够从这个 GRUB 菜单毫无问题地启动 Debian 12。

因此,看起来 USB 上的 GRUB 只能在 Intel 计算机上使用。而 Debian 本身在通过 SSD 上的 GRUB 启动时没有问题。

debian
  • 2 个回答
  • 68 Views
Martin Hope
A.L
Asked: 2023-07-06 03:53:23 +0800 CST

升级到 Debian 12 后,/lib/x86_64-linux-gnu/ 和 /usr/lib/x86_64-linux-gnu/ 中出现重复文件

  • 7

我刚刚按照cyberciti 的指南将我的系统从 Debian 11 升级到 12 。这个系统已经保持最新9年多了,所以它已经经历了至少4次重大升级(今天的Debian 7或8到12)。

在第一次运行期间apt upgrade --without-new-pkgs,我遇到了一个错误libudev(遗憾的是我忘记保留命令的输出),我通过删除 2 个文件修复了该错误:

$ rm /lib/x86_64-linux-gnu/libudev.so.1 /lib/x86_64-linux-gnu/libudev.so.1.6.5

我能够完成升级并重新启动。


通过进一步调查,我的系统似乎还有一些其他重复的库:

$ dpkg --search /lib/x86_64-linux-gnu/perl/ /usr/lib/x86_64-linux-gnu/perl/
dpkg-query: no path found matching pattern /lib/x86_64-linux-gnu/perl/
libperl5.36:amd64: /usr/lib/x86_64-linux-gnu/perl

看起来这些目录不是符号链接:

$ ls -ld /lib/ /lib/x86_64-linux-gnu/ /usr/ /usr/lib/ /usr/lib/x86_64-linux-gnu/
drwxr-xr-x 84 root root 4.0K Jul  5 21:05 /lib//
drwxr-xr-x 78 root root  96K Jul  5 21:05 /lib/x86_64-linux-gnu//
drwxr-xr-x 12 root root 4.0K Jul  5 20:32 /usr//
drwxr-xr-x 84 root root 4.0K Jul  5 21:05 /usr/lib//
drwxr-xr-x 78 root root  96K Jul  5 21:05 /usr/lib/x86_64-linux-gnu//

我之前已经遇到过一个非常类似的问题:Can't Restore systemd after Upgrade from Debian 10 to 11: “undefined symbol: seccomp_api_get”


以下是问题:

  1. /lib/x86_64-linux-gnu/和中有重复的库是否正常/usr/lib/x86_64-linux-gnu/
  2. 我可以依赖 的输出dpkg --search并删除显示的路径no path found …吗?或者有什么工具可以帮助我清理这个烂摊子吗?
  3. 我的系统上的哪些事件可能使这成为可能?

更新:实际上看起来有两个目录是相同的:

$ ls -lh /lib/x86_64-linux-gnu/test.ignore /usr/lib/x86_64-linux-gnu/test.ignore
ls: cannot access '/lib/x86_64-linux-gnu/test.ignore': No such file or directory
ls: cannot access '/usr/lib/x86_64-linux-gnu/test.ignore': No such file or directory
$ touch /lib/x86_64-linux-gnu/test.ignore
$ ls -lh /lib/x86_64-linux-gnu/test.ignore /usr/lib/x86_64-linux-gnu/test.ignore
-rw-r--r-- 1 root root 0 Jul  5 22:14 /lib/x86_64-linux-gnu/test.ignore
-rw-r--r-- 1 root root 0 Jul  5 22:14 /usr/lib/x86_64-linux-gnu/test.ignore

但我不明白它是如何工作的。现在我知道我不能删除其中的文件,/lib/x86_64-linux-gnu/因为它也会删除其中的文件/usr/lib/x86_64-linux-gnu/。

debian
  • 2 个回答
  • 178 Views
Martin Hope
A.L
Asked: 2021-12-09 03:25:33 +0800 CST

Debian 上的 bsdutils 包是什么?什么是“BSD 风格的 Unix 系统”?

  • 15

我偶然发现了 Debian 中的bsdutils软件包。描述说:

该软件包包含 Debian 系统所需的最少 BSD 实用程序:logger、renice、script、scriptlive、scriptreplay 和 wall。其余的标准 BSD 实用程序由 bsdextrautils 提供。

同样,bsdmainutils的描述中也提到了 BSD:

该软件包包含许多人在使用 BSD 风格的 Unix 系统时希望找到的许多小程序。

在 Linux 系统的上下文中,我惊讶地发现这些包与 BSD 相关。

这些包是否使用了 BSD 的一些代码?什么是BSD 风格的 Unix 系统?

debian history
  • 2 个回答
  • 1892 Views
Martin Hope
A.L
Asked: 2021-11-12 13:40:16 +0800 CST

从 Debian 10 升级到 11 后无法恢复 systemd:“未定义符号:seccomp_api_get”

  • 0

一周前我从 Debian 10 升级到 11。

反复出现的错误是:

symbol lookup error: /lib/systemd/libsystemd-shared-247.so: undefined symbol: seccomp_api_get

它在引导系统时导致内核恐慌。

我不得不切换到 systemv 作为初始化系统。

现在,当我尝试恢复时systemd,出现以下错误:

root@nas:~# apt install systemd
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
systemd is already the newest version (247.3-6).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] 
Setting up systemd (247.3-6) ...
systemd-machine-id-setup: symbol lookup error: /lib/systemd/libsystemd-shared-247.so: undefined symbol: seccomp_api_get
dpkg: error processing package systemd (--configure):
 installed systemd package post-installation script subprocess returned error exit status 127
Errors were encountered while processing:
 systemd
needrestart is being skipped since dpkg has failed
E: Sub-process /usr/bin/dpkg returned an error code (1)

我的版本:

root@nas:~# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 11 (bullseye)
Release:    11
Codename:   bullseye
root@nas:~# uname -a
Linux nas 5.10.0-9-amd64 #1 SMP Debian 5.10.70-1 (2021-09-30) x86_64 GNU/Linux
debian systemd
  • 1 个回答
  • 442 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    模块 i915 可能缺少固件 /lib/firmware/i915/*

    • 3 个回答
  • Marko Smith

    无法获取 jessie backports 存储库

    • 4 个回答
  • Marko Smith

    如何将 GPG 私钥和公钥导出到文件

    • 4 个回答
  • Marko Smith

    我们如何运行存储在变量中的命令?

    • 5 个回答
  • Marko Smith

    如何配置 systemd-resolved 和 systemd-networkd 以使用本地 DNS 服务器来解析本地域和远程 DNS 服务器来解析远程域?

    • 3 个回答
  • Marko Smith

    dist-upgrade 后 Kali Linux 中的 apt-get update 错误 [重复]

    • 2 个回答
  • Marko Smith

    如何从 systemctl 服务日志中查看最新的 x 行

    • 5 个回答
  • Marko Smith

    Nano - 跳转到文件末尾

    • 8 个回答
  • Marko Smith

    grub 错误:你需要先加载内核

    • 4 个回答
  • Marko Smith

    如何下载软件包而不是使用 apt-get 命令安装它?

    • 7 个回答
  • Martin Hope
    user12345 无法获取 jessie backports 存储库 2019-03-27 04:39:28 +0800 CST
  • Martin Hope
    Carl 为什么大多数 systemd 示例都包含 WantedBy=multi-user.target? 2019-03-15 11:49:25 +0800 CST
  • Martin Hope
    rocky 如何将 GPG 私钥和公钥导出到文件 2018-11-16 05:36:15 +0800 CST
  • Martin Hope
    Evan Carroll systemctl 状态显示:“状态:降级” 2018-06-03 18:48:17 +0800 CST
  • Martin Hope
    Tim 我们如何运行存储在变量中的命令? 2018-05-21 04:46:29 +0800 CST
  • Martin Hope
    Ankur S 为什么 /dev/null 是一个文件?为什么它的功能不作为一个简单的程序来实现? 2018-04-17 07:28:04 +0800 CST
  • Martin Hope
    user3191334 如何从 systemctl 服务日志中查看最新的 x 行 2018-02-07 00:14:16 +0800 CST
  • Martin Hope
    Marko Pacak Nano - 跳转到文件末尾 2018-02-01 01:53:03 +0800 CST
  • Martin Hope
    Kidburla 为什么真假这么大? 2018-01-26 12:14:47 +0800 CST
  • Martin Hope
    Christos Baziotis 在一个巨大的(70GB)、一行、文本文件中替换字符串 2017-12-30 06:58:33 +0800 CST

热门标签

linux bash debian shell-script text-processing ubuntu centos shell awk ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve