ubuntu VM 启动需要花费大量时间来设置 vbox,而且速度太慢

ubuntu VM 启动需要花费大量时间来设置 vbox,而且速度太慢

在 ubuntu VM 准备就绪后,我可以看到以下日志,显示 VBox 在 VM 上设置花费了大量时间。

$ dmesg
[    9.299143] EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: (null)
[   10.258184] systemd[1]: systemd 229 running in system mode. (+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ -LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN)
[   10.258230] systemd[1]: Detected virtualization oracle.
[   10.258237] systemd[1]: Detected architecture x86-64.
[   10.276635] systemd[1]: Set hostname to <mukti>.
[   10.597521] random: nonblocking pool is initialized
[   12.443853] systemd[1]: Listening on Journal Audit Socket.
[   12.443996] systemd[1]: Listening on Journal Socket.
[   12.444184] systemd[1]: Reached target Remote File Systems (Pre).
[   12.444234] systemd[1]: Listening on udev Kernel Socket.
[   12.444281] systemd[1]: Listening on Syslog Socket.
[   12.444299] systemd[1]: Reached target User and Group Name Lookups.
[   12.444363] systemd[1]: Started Forward Password Requests to Wall Directory Watch.
[   12.444413] systemd[1]: Listening on /dev/initctl Compatibility Named Pipe.
[   12.444448] systemd[1]: Listening on fsck to fsckd communication Socket.
[   12.444461] systemd[1]: Reached target Encrypted Volumes.
[   12.444691] systemd[1]: Created slice User and Session Slice.
[   12.444899] systemd[1]: Set up automount Arbitrary Executable File Formats File System Automount Point.
[   12.444960] systemd[1]: Listening on Journal Socket (/dev/log).
[   12.444978] systemd[1]: Reached target Remote File Systems.
[   12.445079] systemd[1]: Listening on udev Control Socket.
[   12.445213] systemd[1]: Created slice System Slice.
[   12.445907] systemd[1]: Starting Uncomplicated firewall...
[   12.446687] systemd[1]: Mounting POSIX Message Queue File System...
[   12.464427] systemd[1]: Starting Set console keymap...
[   12.549431] systemd[1]: Starting Load Kernel Modules...
[   12.550333] systemd[1]: Starting Journal Service...
[   12.550366] systemd[1]: Reached target Slices.
[   12.551154] systemd[1]: Started Braille Device Support.
[   12.562477] systemd[1]: Mounting Debug File System...
[   12.563362] systemd[1]: Mounting Huge Pages File System...
[   12.564070] systemd[1]: Starting Create list of required static device nodes for the current kernel...
[   12.615791] systemd[1]: Started Uncomplicated firewall.
[   12.685287] systemd[1]: Started Create list of required static device nodes for the current kernel.
[   12.686364] systemd[1]: Starting Create Static Device Nodes in /dev...
[   12.751735] systemd[1]: Mounted Huge Pages File System.
[   12.751799] systemd[1]: Mounted Debug File System.
[   12.751830] systemd[1]: Mounted POSIX Message Queue File System.
[   13.183278] lp: driver loaded but no devices found
[   13.234238] ppdev: user-space parallel port driver
[   13.270353] parport_pc 00:02: reported by Plug and Play ACPI
[   13.330636] systemd[1]: Started Load Kernel Modules.
[   13.331644] systemd[1]: Starting Apply Kernel Variables...
[   13.334105] systemd[1]: Mounting FUSE Control File System...
[   13.347124] systemd[1]: Mounted FUSE Control File System.
[   13.515565] systemd[1]: Started Create Static Device Nodes in /dev.
[   13.516680] systemd[1]: Starting udev Kernel Device Manager...
[   13.542795] systemd[1]: Started Apply Kernel Variables.
[   13.552290] systemd[1]: Started Journal Service.
[   13.903185] EXT4-fs (sda1): re-mounted. Opts: errors=remount-ro
[   14.029823] systemd-journald[616]: Received request to flush runtime journal from PID 1
[   15.912775] input: Unspecified device as /devices/pci0000:00/0000:00:04.0/input/input7
[   15.912980] vboxguest: misc device minor 55, IRQ 20, I/O port d020, MMIO at 00000000f0400000 (size 0x400000)
[   15.912981] vboxguest: Successfully loaded version 5.0.18_Ubuntu (interface 0x00010004)
[   16.236477] piix4_smbus 0000:00:07.0: SMBus base address uninitialized - upgrade BIOS or use force_addr=0xaddr
[   16.909235] [drm] Initialized drm 1.1.0 20060810
[   17.138645] intel_rapl: no valid rapl domains found in package 0
[   17.297807] [drm] VRAM 01800000
[   17.309472] [TTM] Zone  kernel: Available graphics memory: 4087774 kiB
[   17.309496] [TTM] Zone   dma32: Available graphics memory: 2097152 kiB
[   17.309514] [TTM] Initializing pool allocator
[   17.309541] [TTM] Initializing DMA pool allocator
[   17.311706] fbcon: vboxdrmfb (fb0) is primary device
[   17.545813] Console: switching to colour frame buffer device 100x37
[   17.563347] vboxvideo 0000:00:02.0: fb0: vboxdrmfb frame buffer device
[   17.563356] [drm] Initialized vboxvideo 1.0.0 20130823 for 0000:00:02.0 on minor 0
[   18.764264] snd_intel8x0 0000:00:05.0: intel8x0_measure_ac97_clock: measured 56502 usecs (9877 samples)
[   18.764272] snd_intel8x0 0000:00:05.0: measured clock 174807 rejected
[   18.904019] audit: type=1400 audit(1474568901.563:2): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/lib/lightdm/lightdm-guest-session" pid=1618 comm="apparmor_parser"
[   18.904034] audit: type=1400 audit(1474568901.563:3): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/lib/lightdm/lightdm-guest-session//chromium" pid=1618 comm="apparmor_parser"
[   18.963498] audit: type=1400 audit(1474568901.619:4): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/sbin/dhclient" pid=1690 comm="apparmor_parser"
[   18.963513] audit: type=1400 audit(1474568901.619:5): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/lib/NetworkManager/nm-dhcp-client.action" pid=1690 comm="apparmor_parser"
[   18.963522] audit: type=1400 audit(1474568901.619:6): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/lib/NetworkManager/nm-dhcp-helper" pid=1690 comm="apparmor_parser"
[   18.963531] audit: type=1400 audit(1474568901.619:7): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/lib/connman/scripts/dhclient-script" pid=1690 comm="apparmor_parser"
[   18.984167] floppy0: no floppy controllers found
[   18.984253] work still pending
[   19.124597] snd_intel8x0 0000:00:05.0: intel8x0_measure_ac97_clock: measured 56077 usecs (7200 samples)
[   19.124607] snd_intel8x0 0000:00:05.0: measured clock 128394 rejected
[   19.264650] audit: type=1400 audit(1474568901.927:8): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/bin/evince" pid=1692 comm="apparmor_parser"
[   19.264674] audit: type=1400 audit(1474568901.927:9): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/bin/evince//sanitized_helper" pid=1692 comm="apparmor_parser"
[   19.264688] audit: type=1400 audit(1474568901.927:10): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/bin/evince-previewer" pid=1692 comm="apparmor_parser"
[   19.264700] audit: type=1400 audit(1474568901.927:11): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/bin/evince-previewer//sanitized_helper" pid=1692 comm="apparmor_parser"
[   19.485391] snd_intel8x0 0000:00:05.0: intel8x0_measure_ac97_clock: measured 56909 usecs (7200 samples)
[   19.485409] snd_intel8x0 0000:00:05.0: measured clock 126517 rejected
[   19.485423] snd_intel8x0 0000:00:05.0: clocking to 48000
[  104.270299] vboxsf: Successfully loaded version 5.0.18_Ubuntu (interface 0x00010004)
[  106.401637] VBoxService 5.0.24_Ubuntu r108355 (verbosity: 0) linux.amd64 (Jul  5 2016 08:17:21) release log
               00:00:00.000049 main     Log opened 2016-09-22T18:29:49.064868000Z
[  106.401782] 00:00:00.000298 main     OS Product: Linux
[  106.401871] 00:00:00.000401 main     OS Release: 4.4.0-38-generic
[  106.401958] 00:00:00.000487 main     OS Version: #57-Ubuntu SMP Tue Sep 6 15:42:33 UTC 2016
[  106.402086] 00:00:00.000573 main     Executable: /usr/sbin/VBoxService
               00:00:00.000576 main     Process ID: 1950
               00:00:00.000578 main     Package type: LINUX_64BITS_GENERIC (OSE)
[  106.404700] 00:00:00.003168 main     5.0.24_Ubuntu r108355 started. Verbose level = 0
[  106.619438] 00:00:00.217876 automount vbsvcAutoMountWorker: Shared folder '.m2' was mounted to '/media/sf_.m2'
[  106.621241] 00:00:00.219720 automount vbsvcAutoMountWorker: Shared folder 'upd' was mounted to '/media/sf_upd'
[  109.859916] IPv6: ADDRCONF(NETDEV_UP): enp0s3: link is not ready
[  109.870441] IPv6: ADDRCONF(NETDEV_UP): enp0s3: link is not ready
[  115.296070] vboxdrv: module verification failed: signature and/or required key missing - tainting kernel
[  115.320061] vboxdrv: Found 1 processor cores
[  115.444232] vboxdrv: TSC mode is Synchronous, tentative frequency 2892237468 Hz
[  115.444239] vboxdrv: Successfully loaded version 5.0.24_Ubuntu (interface 0x00240000)
[  115.483315] VBoxNetFlt: Successfully started.
[  115.514892] VBoxNetAdp: Successfully started.
[  115.559258] VBoxPciLinuxInit
[  115.618383] vboxpci: IOMMU not found (not registered)
[  145.686072] ISO 9660 Extensions: Microsoft Joliet Level 3
[  145.725452] ISO 9660 Extensions: RRIP_1991A

我是否缺少一些设置以使这个 vbox 设置更快。

以下是我的启动应用程序

在此处输入图片描述

另外,机器太慢了。如果我滚动终端,它会延迟大约一秒钟。

机器设置是

prayag@prayag:~$ sudo parted -l
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sda: 105GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End    Size    Type      File system     Flags
 1      1049kB  104GB  104GB   primary   ext4            boot
 2      104GB   105GB  1072MB  extended
 5      104GB   105GB  1071MB  logical   linux-swap(v1)


Warning: Unable to open /dev/sr0 read-write (Read-only file system).  /dev/sr0
has been opened read-only.
Error: /dev/sr0: unrecognised disk label
Model: VBOX CD-ROM (scsi)                                                 
Disk /dev/sr0: 57.3MB
Sector size (logical/physical): 2048B/2048B
Partition Table: unknown
Disk Flags: 

磁盘使用情况

prayag@prayag:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            3.9G     0  3.9G   0% /dev
tmpfs           799M  9.2M  790M   2% /run
/dev/sda1        96G  7.5G   84G   9% /
tmpfs           3.9G  212K  3.9G   1% /dev/shm
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           3.9G     0  3.9G   0% /sys/fs/cgroup
.m2             466G  125G  341G  27% /media/sf_.m2
upd             466G  125G  341G  27% /media/sf_upd
tmpfs           799M   44K  799M   1% /run/user/1000
/dev/sr0         55M   55M     0 100% /media/prayag/VBOXADDITIONS_4.3.40_110317

prayag@prayag:~$ lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda      8:0    0 97.7G  0 disk 
├─sda1   8:1    0 96.7G  0 part /
├─sda2   8:2    0    1K  0 part 
└─sda5   8:5    0 1021M  0 part 
sr0     11:0    1 54.6M  0 rom  /media/prayag/VBOXADDITIONS_4.3.40_110317

我已经在 VB 中启用了 3D 设置,

prayag@prayag:~$ /usr/lib/nux/unity_support_test -p
OpenGL vendor string:   VMware, Inc.
OpenGL renderer string: Gallium 0.4 on llvmpipe (LLVM 3.8, 128 bits)
OpenGL version string:  3.0 Mesa 11.2.0

Not software rendered:    no
Not blacklisted:          yes
GLX fbconfig:             yes
GLX texture from pixmap:  yes
GL npot or rect textures: yes
GL vertex program:        yes
GL fragment program:      yes
GL vertex buffer object:  yes
GL framebuffer object:    yes
GL version is 1.4+:       yes

Unity 3D supported:       no

prayag@prayag:~$ uname -r
4.4.0-38-generic

prayag@prayag:~$ sudo apt-get install linux-headers-$(uname -r)
[sudo] password for mukti: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
linux-headers-4.4.0-38-generic is already the newest version (4.4.0-38.57).
linux-headers-4.4.0-38-generic set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 104 not upgraded.

prayag@prayag:~$ sudo apt-get autoremove
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 104 not upgraded.

prayag@prayag:~$ sudo apt-get install build-essential
Reading package lists... Done
Building dependency tree       
Reading state information... Done
build-essential is already the newest version (12.1ubuntu2).
build-essential set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 104 not upgraded.

答案1

该死,启用 3D 渲染似乎可行

    prayag@prayag:/media/prayag/VBOXADDITIONS_4.3.40_110317$ sudo ./VBoxLinuxAdditions.run 
    Verifying archive integrity... All good.
    Uncompressing VirtualBox 4.3.40 Guest Additions for Linux............
    VirtualBox Guest Additions installer
    Removing installed version 4.3.40 of VirtualBox Guest Additions...
    Copying additional installer modules ...
    Installing additional modules ...
    Removing existing VirtualBox DKMS kernel modules ...done.
    Removing existing VirtualBox non-DKMS kernel modules ...done.
    Building the VirtualBox Guest Additions kernel modules ...done.
    Doing non-kernel setup of the Guest Additions ...done.
    You should restart your guest to make sure the new modules are actually used

    Installing the Window System drivers
    Installing X.Org Server 1.18 modules ...done.
    Setting up the Window System to use the Guest Additions ...done.
    You may need to restart the the Window System (or just restart the guest system)
    to enable the Guest Additions.

    Installing graphics libraries and desktop services components ...done.

将其添加vboxdriver到 /etc/modules 中,其中包含要在启动时加载的内核模块。(在我的情况下它是空的)

vboxdriver

然后重启机器

sudo reboot

并且检查统一支持。

prayag@prayag:~$ /usr/lib/nux/unity_support_test -p
pci id for fd 4: 80ee:beef, driver (null)
OpenGL Warning: glFlushVertexArrayRangeNV not found in mesa table
OpenGL Warning: glVertexArrayRangeNV not found in mesa table
OpenGL Warning: glCombinerInputNV not found in mesa table
OpenGL Warning: glCombinerOutputNV not found in mesa table
OpenGL Warning: glCombinerParameterfNV not found in mesa table
OpenGL Warning: glCombinerParameterfvNV not found in mesa table
OpenGL Warning: glCombinerParameteriNV not found in mesa table
OpenGL Warning: glCombinerParameterivNV not found in mesa table
OpenGL Warning: glFinalCombinerInputNV not found in mesa table
OpenGL Warning: glGetCombinerInputParameterfvNV not found in mesa table
OpenGL Warning: glGetCombinerInputParameterivNV not found in mesa table
OpenGL Warning: glGetCombinerOutputParameterfvNV not found in mesa table
OpenGL Warning: glGetCombinerOutputParameterivNV not found in mesa table
OpenGL Warning: glGetFinalCombinerInputParameterfvNV not found in mesa table
OpenGL Warning: glGetFinalCombinerInputParameterivNV not found in mesa table
OpenGL Warning: glDeleteFencesNV not found in mesa table
OpenGL Warning: glFinishFenceNV not found in mesa table
OpenGL Warning: glGenFencesNV not found in mesa table
OpenGL Warning: glGetFenceivNV not found in mesa table
OpenGL Warning: glIsFenceNV not found in mesa table
OpenGL Warning: glSetFenceNV not found in mesa table
OpenGL Warning: glTestFenceNV not found in mesa table
libGL error: core dri or dri2 extension not found
libGL error: failed to load driver: vboxvideo
OpenGL vendor string:   Humper
OpenGL renderer string: Chromium
OpenGL version string:  2.1 Chromium 1.9

Not software rendered:    yes
Not blacklisted:          yes
GLX fbconfig:             yes
GLX texture from pixmap:  yes
GL npot or rect textures: yes
GL vertex program:        yes
GL fragment program:      yes
GL vertex buffer object:  yes
GL framebuffer object:    yes
GL version is 1.4+:       yes

Unity 3D supported:       yes

至少在终端 VIM 中我没有看到任何滞后。

相关内容