为什么hostnamectl返回arm64,而uname返回aarch64? (树莓派上的 Ubuntu 20.04.2)

为什么hostnamectl返回arm64,而uname返回aarch64? (树莓派上的 Ubuntu 20.04.2)

我有一个运行 Ubuntu 20.04.3 LTS 的树莓派。根据命令返回两种不同的体系结构:架构64ARM64。为什么?

主机名

ubuntu@ubuntu:~$ hostnamectl
   Static hostname: plex
         Icon name: computer
        Machine ID: 5d1b763f15314c999d1b33e60d8d556f
           Boot ID: bdd535b62f134f6a9216543b36deb678
  Operating System: Ubuntu 20.04.3 LTS
            Kernel: Linux 5.4.0-1047-raspi
      Architecture: arm64

乌纳梅

ubuntu@ubuntu:~$ uname --all
Linux plex 5.4.0-1047-raspi #52-Ubuntu SMP PREEMPT Wed Nov 24 08:16:38 UTC 2021 aarch64 aarch64 aarch64 GNU/Linux

谢谢你! (我相信这会导致问题。尝试安装某些东西,它正在寻找 aarch64,但没有找到它,但我可以看到有一个适用于 amd64 的版本。

答案1

aarch64并且arm64是完全相同的架构。大多数打包器和包管理器都使用aarch64name,但当涉及到 systemd 时,它使用arm64.您可以在这里找到更多信息:

https://github.com/systemd/systemd/blob/db58f6a9338d30935aa219bec9a8a853cc807756/src/basic/architecture.c

在此代码中,aarch64被映射回arm64. Arm64 架构也用于标准说明符的手册页(我不知道它是哪个手册页,但这里是代码:https://github.com/systemd/systemd/blob/5efbd0bf897a990ebe43d7dc69141d87c404ac9a/man/standard-specifiers.xml)。

此页面通知您体系结构已在 systemd.unit 手册页中列出。这里有提取物man 5 systemd.unit

       ConditionArchitecture=
           Check whether the system is running on a specific
           architecture. Takes one of "x86", "x86-64", "ppc", "ppc-le",
           "ppc64", "ppc64-le", "ia64", "parisc", "parisc64", "s390",
           "s390x", "sparc", "sparc64", "mips", "mips-le", "mips64",
           "mips64-le", "alpha", "arm", "arm-be", "arm64", "arm64-be",
           "sh", "sh64", "m68k", "tilegx", "cris", "arc", "arc-be", or
           "native".

           The architecture is determined from the information returned
           by uname(2) and is thus subject to personality(2). Note that
           a Personality= setting in the same unit file has no effect on
           this condition. A special architecture name "native" is
           mapped to the architecture the system manager itself is
           compiled for. The test may be negated by prepending an
           exclamation mark.

从这个简短的调查中,我推断 systemd 使用uname系统调用来打印aarch64并将其更改为arm64内部。

相关内容