输入登录密码之后、出现 shell 提示之前会发生什么?以及如何减少该间隔的时间?

输入登录密码之后、出现 shell 提示之前会发生什么?以及如何减少该间隔的时间?

我正在虚拟机上进行一些实验(来宾机是arm64上的ubuntu 20.04),并且我正在x86_64主机(ubuntu 20.04)上进行此操作。登录后,大约需要一分钟才能看到 shell 提示符。
这是日志。

Ubuntu 20.04.2 LTS ab21q-ubuntu-20 ttyAMA0
ab21q-ubuntu-20 login: ckim
Password: 
Welcome to Ubuntu 20.04.2 LTS (GNU/Linux 5.4.0-77-generic aarch64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Mon 06 Sep 2021 02:40:15 PM KST

  System load:             0.28
  Usage of /:              32.5% of 19.07GB
  Memory usage:            11%
  Swap usage:              0%
  Processes:               115
  Users logged in:         0
  IPv4 address for enp0s1: 10.0.2.15
  IPv6 address for enp0s1: fec0::5054:ff:fe12:3456

 * Super-optimized for small spaces - read how we shrank the memory
   footprint of MicroK8s to make it the smallest full K8s around.

   https://ubuntu.com/blog/microk8s-memory-optimisation

114 updates can be applied immediately.
45 of these updates are standard security updates.
To see these additional updates run: apt list --upgradable


Last login: Mon Sep  6 12:01:44 KST 2021 on ttyAMA0

因为qemu在x86_64上模拟arm64,所以速度基本上很慢,但我想知道在输入密码之后和shell提示符出现之前操作系统或启动过程在做什么。从日志来看,它似乎检查了哪些软件包可以通过网络更新。Last login: Mon Sep 6 12:01:44 KST 2021 on ttyAMA0打印后还需要一些时间(~30 秒?) 。有什么办法可以跳过这个耗时的过程吗? (就像在 /etc/sysctl.config 文件中设置一些东西)

答案1

阅读man login bash(替换您的$SHELL)“ INVOCATION”部分。您会发现“交互式登录 shell”首先显示为/etc/profile

关注正在发生的事情

less /etc/profile
bash -x /etc/profile

答案2

应用“ 114 updates”与sudo apt upgrade。 “我如何抑制警告......”的故事永远不会有好结果。阅读man bash login“启动文件”。

相关内容