Opened 8 years ago
Last modified 6 years ago
#15908 new defect
XBoxAutostart service starts and completes before NFS and iSCSI start
Reported by: | Brian Duguid | Owned by: | |
---|---|---|---|
Component: | host support | Version: | VirtualBox 5.1.4 |
Keywords: | Linux NFS mount iSCSI LUN | Cc: | |
Guest type: | Linux | Host type: | Linux |
Description
I have a fresh install of Ubuntu 16.04 Server and VirtualBox 5.1. I have an Ubuntu guest created on an NFS mount with the storage attached to an iSCSI LUN on my NAS. Starting and stopping it manually works fine, but it does not start at boot.
Manually starting the guest works via any one of these commands:
- VBoxHeadless --startvm "Ubuntu Server"
- sudo service vboxautostart-service restart
- vboxautostart --start --config /etc/vbox/autostart.cfg
The syslog shows the vboxautostart-service starting and completing before the NFS mounting and the iSCSI initiator daemon is ready. With the help of the forum moderator Perryg, I added 'sleep 10' to the top of the /etc/default/virtualbox and the VM started and working as expected.
The vbox services with my install are started via S02vboxdrv and S03vboxautostart-service in the appropriate rc.d folders.
syslog
Sep 7 15:12:03 MyHost systemd[1]: Starting Authenticate and Authorize Users to Run Privileged Tasks... Sep 7 15:12:03 MyHost vboxdrv.sh[2811]: vboxdrv.sh: Starting VirtualBox services. ... Sep 7 15:12:03 MyHost vboxdrv.sh: Starting VirtualBox services. ... Sep 7 15:12:03 MyHost kernel: [ 14.354340] vboxdrv: module verification failed: signature and/or required key missing - tainting kernel Sep 7 15:12:03 MyHost kernel: [ 14.359014] vboxdrv: Found 4 processor cores ... Sep 7 15:12:03 MyHost kernel: [ 14.378254] vboxdrv: TSC mode is Invariant, tentative frequency 1596300487 Hz Sep 7 15:12:03 MyHost kernel: [ 14.378258] vboxdrv: Successfully loaded version 5.1.4 (interface 0x00260000) ... Sep 7 15:12:04 MyHost kernel: [ 14.582075] VBoxNetFlt: Successfully started. Sep 7 15:12:04 MyHost kernel: [ 14.583189] VBoxNetAdp: Successfully started. Sep 7 15:12:04 MyHost kernel: [ 14.584579] VBoxPciLinuxInit Sep 7 15:12:04 MyHost vboxdrv.sh: VirtualBox services started. Sep 7 15:12:04 MyHost kernel: [ 14.586318] vboxpci: IOMMU not found (not registered) Sep 7 15:12:04 MyHost systemd[1]: Started VirtualBox Linux kernel module. Sep 7 15:12:04 MyHost systemd[1]: Starting vboxautostart-service.service... Sep 7 15:12:04 MyHost systemd[1]: Starting vboxballoonctrl-service.service... Sep 7 15:12:04 MyHost vboxautostart-service.sh[3023]: vboxautostart-service.sh: Starting VirtualBox VMs configured for autostart. Sep 7 15:12:04 MyHost vboxautostart-service.sh: Starting VirtualBox VMs configured for autostart. Sep 7 15:12:04 MyHost systemd[1]: Starting vboxweb-service.service... Sep 7 15:12:04 MyHost systemd[1]: Started vboxballoonctrl-service.service. Sep 7 15:12:04 MyHost systemd[1]: Started vboxweb-service.service. Sep 7 15:12:04 MyHost systemd[1]: Started vboxautostart-service.service. ... Sep 7 15:12:10 MyHost systemd[1]: Starting iSCSI initiator daemon (iscsid)... Sep 7 15:12:10 MyHost systemd[1]: Starting OpenBSD Secure Shell server... Sep 7 15:12:10 MyHost systemd[1]: Started /etc/rc.local Compatibility. Sep 7 15:12:10 MyHost iscsid: iSCSI logger with pid=3172 started! Sep 7 15:12:10 MyHost systemd[1]: Started iSCSI initiator daemon (iscsid). Sep 7 15:12:10 MyHost systemd[1]: Starting Login to default iSCSI targets... Sep 7 15:12:10 MyHost iscsiadm[3180]: iscsiadm: No records found Sep 7 15:12:10 MyHost systemd[1]: Started OpenBSD Secure Shell server. Sep 7 15:12:10 MyHost systemd[1]: Started Login to default iSCSI targets. Sep 7 15:12:10 MyHost systemd[1]: Reached target Remote File Systems (Pre). Sep 7 15:12:10 MyHost systemd[1]: Mounting /mnt/nfs/myNas... Sep 7 15:12:10 MyHost kernel: [ 21.235486] FS-Cache: Loaded Sep 7 15:12:10 MyHost kernel: [ 21.247575] FS-Cache: Netfs 'nfs' registered for caching Sep 7 15:12:10 MyHost kernel: [ 21.258497] NFS: Registering the id_resolver key type Sep 7 15:12:10 MyHost kernel: [ 21.258505] Key type id_resolver registered Sep 7 15:12:10 MyHost kernel: [ 21.258506] Key type id_legacy registered Sep 7 15:12:10 MyHost systemd[1]: Mounted /mnt/nfs/myNas.
Forum post: https://forums.virtualbox.org/viewtopic.php?f=7&t=79617
Change History (6)
comment:1 by , 8 years ago
comment:2 by , 8 years ago
I have also found that the NFS umounting and iSCSI stopping is happening before the VirtualBox shutdown.
comment:3 by , 8 years ago
Whoa! A huge, gigantic, monstrous fact I didn't realize until investigating this boot order issue. Ubuntu defaults to systemd starting at 15.04. My last version experience prior to 16, was 14. Systemd blew my mind for a while which is why my init.d sh had no affect and somewhere along the line I magically installed the S0# files in the rc#.d folders. I think I know enough about systemd now to be dangerous as well as fix my problem.
I had the luxury of wiping my install and starting over. So now with systemd in mind, I can say that VirtualBox installs the appropriate .service files in the /lib/systemd/system folder and it starts as it should if the vbox configuration is local and the VM is using a locally stored virtual disk. However, if like me, the vbox configuration is stored on an NFS mount and the VM is using an iSCSI LUN, then the vboxdrv.service does not now that the NFS mount and iscsid services are required. I created vboxdrv.service override for the Required and After directives and everything seems to be peachy keen so far.
I posted more detailed steps on a blog.
http://geekthingsathome.blogspot.com/2016/09/vm-host-server-with-linux-synology-and.html
It would be nice that these dependencies are set as default, but I do not know the affects on the community.
comment:4 by , 8 years ago
I only just now started paying attention to this ticket (not bad will, just a lot of tickets open!) If I understood correctly, you are saying that in order for auto-start to work with systemd on the host and the machines folder on an ISCSI disk, the following needs to be added to the systemd unit (besides normal auto-start configuration):
[Unit] Requires=remote-fs.target iscsid.service After=remote-fs.target iscsid.service
comment:5 by , 8 years ago
Yes. iscsid.service is a must have for iSCSI configured VMs. The remote-fs.target is required if any resources required by VirtualBox at startup are accessed via a network mount.
To be clear, I set the default machine folder to a folder on my NAS using NFS, i.e. /mnt/nfs/myNas/virtualbox/vm-user. So, the vboxautostart service would not find the guest definitions until after the NFS successfully mounts. If the mount is prior to the service, but the iSCSI is still pending, then I would image I would see errors.