VirtualBox Guest Additions RunLevel

Discussions related to using VirtualBox on Windows hosts.
Post Reply
myagita
Posts: 1
Joined: 18. Oct 2014, 08:42

VirtualBox Guest Additions RunLevel

Post by myagita »

Hello,

I'm developing a service, on Windows 7 host, that uses the VirtualBox API to run a guest OS (also Windows 7) with C#. This needs to be a service because I want the guest OS running without logging into any user account on the host machine.
I have been successful with booting the guest OS, creating processes and copying files etc.

What I want to do next is to update the Guest Additions to version 4.3.16, same as the version of the VirtualBox I'm using.
I need to do this programmatically, without having to touch the guest OS itself.
By looking at

Code: Select all

session.Console.Guest.AdditionsVersion
session.Console.Guest.AdditionsRevision
session.Console.Guest.AdditionsRunLevel.ToString()
I get the following information:
Current Guest Additions Version: 3.1.6
Current Guest Additions Revision: 59338
Current Guest Additions RunLevel: AdditionsRunLevelType_System

When I run:

Code: Select all

session.Console.Guest.UpdateGuestAdditions(guestAdditionsIsoPath, new string[] { }, updateFlags);
I get the ErrorInfo:

Code: Select all

Guest Additions are installed but not fully loaded yet, aborting automatic update
Apparently, from what I see in the source code of VirtualBox, (in the function int SessionTaskUpdateAdditions::Run(void))

Code: Select all

    AdditionsRunLevelType_T addsRunLevel;
    if (   FAILED(hr = pGuest->COMGETTER(AdditionsRunLevel)(&addsRunLevel))
        || (   addsRunLevel != AdditionsRunLevelType_Userland
            && addsRunLevel != AdditionsRunLevelType_Desktop))
    {
        if (addsRunLevel == AdditionsRunLevelType_System)
            hr = setProgressErrorMsg(VBOX_E_NOT_SUPPORTED,
                                     Utf8StrFmt(GuestSession::tr("Guest Additions are installed but not fully loaded yet, aborting automatic update")));
        else
            hr = setProgressErrorMsg(VBOX_E_NOT_SUPPORTED,
                                     Utf8StrFmt(GuestSession::tr("Guest Additions not installed or ready, aborting automatic update")));
        rc = VERR_NOT_SUPPORTED;
    }
the Guest Additions RunLevel must be either 'Userland' or 'Desktop'. However, as you can see above, my Guest Additions is running at the 'System' level.

How do I fix this? Any help is appreciated. Thanks in advance.
Post Reply