I wanted to understand the "boot" of my VM (Debian 10.2), so I watch carefully the information given by systemd.
I was surprised by the time take by vboxadd.service and I tried to understand :
- what vboxadd.service does: the service rebuild the additional modules if needed
- why it takes so much time if the service has nothing to rebuild: 8 secondes
I read the code of /opt/VBoxGuestAdditions-6.0.16/init/vboxadd and I find that depmod is always executed (line 421). It takes time even if the service is executed alone at the end of the boot.
Same code as: browser/vbox/trunk/src/VBox/Additions/linux/installer/vboxadd.sh
I think that this execution of depmod is not needed because if modules are rebuilt by setup_modules():
then update_initramfs "${KERN_VER}" is called (line 318)
and update_initramfs execute depmod "${version}" (line 222)
So, I think that the depmod of line 421 is not necessary!
Am I wrong
Code: Select all
/opt/VBoxGuestAdditions-6.0.16/init/vboxadd
# setup_script
setup()
{
# chcon is needed on old Fedora/Redhat systems. No one remembers which.
test ! -e /etc/selinux/config ||
chcon -t bin_t "$BUILDINTMP" 2>/dev/null
if test -z "$INSTALL_NO_MODULE_BUILDS"; then
info "Building the VirtualBox Guest Additions kernel modules. This may take a while."
info "To build modules for other installed kernels, run"
info " /sbin/rcvboxadd quicksetup <version>"
info "or"
info " /sbin/rcvboxadd quicksetup all"
if test -d /lib/modules/"$TARGET_VER"/build; then
info "FC : setup() > setup_modules() : begin"
setup_modules "$TARGET_VER"
info "FC : setup() > setup_modules() : end"
info "FC : setup() > depmod : begin"
depmod
info "FC : setup() > depmod : end"
else
...
# journalctl -b
...
févr. 17 13:45:10 slam18-dev vboxadd[491]: VirtualBox Guest Additions: Starting.
févr. 17 13:45:10 slam18-dev vboxadd[491]: VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel
févr. 17 13:45:10 slam18-dev vboxadd[491]: modules. This may take a while.
févr. 17 13:45:10 slam18-dev vboxadd[491]: VirtualBox Guest Additions: To build modules for other installed kernels, run
févr. 17 13:45:10 slam18-dev vboxadd[491]: VirtualBox Guest Additions: /sbin/rcvboxadd quicksetup <version>
févr. 17 13:45:10 slam18-dev vboxadd[491]: VirtualBox Guest Additions: or
févr. 17 13:45:10 slam18-dev vboxadd[491]: VirtualBox Guest Additions: /sbin/rcvboxadd quicksetup all
févr. 17 13:45:10 slam18-dev vboxadd[491]: VirtualBox Guest Additions: FC : setup() > setup_modules() : begin
févr. 17 13:45:10 slam18-dev vboxadd[491]: VirtualBox Guest Additions: FC : setup() > setup_modules() : end
févr. 17 13:45:10 slam18-dev vboxadd[491]: VirtualBox Guest Additions: FC : setup() > depmod : begin
févr. 17 13:45:17 slam18-dev vboxadd[491]: VirtualBox Guest Additions: FC : setup() > depmod : end
févr. 17 13:45:17 slam18-dev useradd[563]: failed adding user 'vboxadd', data deleted
févr. 17 13:45:17 slam18-dev useradd[564]: failed adding user 'vboxadd', data deleted
févr. 17 13:45:17 slam18-dev vboxadd[491]: VirtualBox Guest Additions: Running kernel modules will not be replaced until
févr. 17 13:45:17 slam18-dev vboxadd[491]: the system is restarted
févr. 17 13:45:17 slam18-dev systemd[1]: Started vboxadd.service.
...
# systemd-analyze blame | head
8.149s vboxadd.service
1.745s dev-sda1.device
1.078s mariadb.service
898ms ssh.service
848ms keyboard-setup.service
539ms systemd-journald.service
520ms apparmor.service
441ms systemd-udev-trigger.service
381ms networking.service
342ms systemd-tmpfiles-clean.service
# ls -lt /usr/lib/modules/4.19.0-6-amd64/
total 4456
-rw-r--r-- 1 root root 434 févr. 17 13:45 modules.devname
-rw-r--r-- 1 root root 6124 févr. 17 13:45 modules.builtin.bin
-rw-r--r-- 1 root root 639981 févr. 17 13:45 modules.symbols.bin
-rw-r--r-- 1 root root 522609 févr. 17 13:45 modules.symbols
-rw-r--r-- 1 root root 800 févr. 17 13:45 modules.softdep
-rw-r--r-- 1 root root 1066360 févr. 17 13:45 modules.alias.bin
-rw-r--r-- 1 root root 1120748 févr. 17 13:45 modules.alias
-rw-r--r-- 1 root root 591430 févr. 17 13:45 modules.dep.bin
-rw-r--r-- 1 root root 433707 févr. 17 13:45 modules.dep
drwxr-xr-x 2 root root 4096 févr. 16 19:58 misc
drwxr-xr-x 12 root root 4096 févr. 2 13:53 kernel
lrwxrwxrwx 1 root root 37 nov. 11 01:30 build -> /usr/src/linux-headers-4.19.0-6-amd64
-rw-r--r-- 1 root root 4816 nov. 11 01:30 modules.builtin
-rw-r--r-- 1 root root 140042 nov. 11 01:30 modules.order
lrwxrwxrwx 1 root root 38 nov. 11 01:30 source -> /usr/src/linux-headers-4.19.0-6-common