flare-vm icon indicating copy to clipboard operation
flare-vm copied to clipboard

Error with packages installer.vm

Open monfora opened this issue 1 year ago • 3 comments

What's the problem?

At the end of installation packages to the system there is an error with package.

Steps to Reproduce

clean iso of windows 11 from microsoft -> new vm on virtualbox -> default selected packages on install stage

Environment

  • VirtualBox
  • Windows 11 - 10.0.22631
  • 5.1.22621.3880
  • 2.3.0
  • Boxstarter|3.0.3

Additional Information

terminal_logs.txt chocolatey.log chocolatey.1.log chocolatey.2.log log.txt

monfora avatar Aug 07 '24 09:08 monfora

With the provided information it is not clear to me which package fails and what the error is. Please provide the console output as required in the bug issue template so that we are able to help you.

Ana06 avatar Aug 26 '24 10:08 Ana06

Thanks for reporting this @monfora!

@Ana06 I think I see the issue here. It looks like the CustomStartLayout.xml is not being applied (errors out while trying to import it) and this seems to be an issue that others on newer Windows 11 builds are also experiencing: https://www.reddit.com/r/SCCM/comments/1cus7g3/importstartlayout_for_taskbar_stopped_working/

It seems that Microsoft may have either changed the format spec (though I can't find an updated one on the internet), or they are disallowing this ability via PowerShell (some people say their old configs still work when applied via GPO).

Fortunately, it looks like there is a simple fix, which is to store the layout as LayoutModification.xml and place it in C:\Users\default\AppData\Local\Microsoft\Windows\Shell\.

I just tested the fix on a Windows 10 pre-built FlareVM and it worked fine. I'll need to get a proper new Windows 11 build set up to test it there. I also need to test it from a fresh ISO through the full build to see if there may be any other tweaking that is needed (my Win 11 test should help with that as well).

To test, once the file is named correctly and placed in that location (and assuming you've removed any other pinned icons), you can run Stop-Process -Name explorer -Force and it should work. This will need to be adjusted in our repo and installer.vm if it is the route we decide to take.

emtuls avatar Aug 27 '24 05:08 emtuls

fixed by adding terminal log in first message

monfora avatar Aug 27 '24 06:08 monfora

Thanks for reporting this @monfora!

@Ana06 I think I see the issue here. It looks like the CustomStartLayout.xml is not being applied (errors out while trying to import it) and this seems to be an issue that others on newer Windows 11 builds are also experiencing: https://www.reddit.com/r/SCCM/comments/1cus7g3/importstartlayout_for_taskbar_stopped_working/

It seems that Microsoft may have either changed the format spec (though I can't find an updated one on the internet), or they are disallowing this ability via PowerShell (some people say their old configs still work when applied via GPO).

Fortunately, it looks like there is a simple fix, which is to store the layout as LayoutModification.xml and place it in C:\Users\default\AppData\Local\Microsoft\Windows\Shell\.

I just tested the fix on a Windows 10 pre-built FlareVM and it worked fine. I'll need to get a proper new Windows 11 build set up to test it there. I also need to test it from a fresh ISO through the full build to see if there may be any other tweaking that is needed (my Win 11 test should help with that as well).

To test, once the file is named correctly and placed in that location (and assuming you've removed any other pinned icons), you can run Stop-Process -Name explorer -Force and it should work. This will need to be adjusted in our repo and installer.vm if it is the route we decide to take.

Thanks for fix.

monfora avatar Aug 29 '24 07:08 monfora

my netcat.vm package is not installing, other tools are pinned now at taskbar by following the instructions, but the desktop wallpaper is still not changed! @emtuls

Still this error!

error 2

salmanjann avatar Sep 11 '24 09:09 salmanjann

The content of CustomStartLayout.xml file is as follows, which is created by itself when installer is run!


<?xml version="1.0" encoding="utf-8"?>
<LayoutModificationTemplate
    xmlns="http://schemas.microsoft.com/Start/2014/LayoutModification"
    xmlns:defaultlayout="http://schemas.microsoft.com/Start/2014/FullDefaultLayout"
    xmlns:start="http://schemas.microsoft.com/Start/2014/StartLayout"
    xmlns:taskbar="http://schemas.microsoft.com/Start/2014/TaskbarLayout"
    Version="1">
  <LayoutOptions StartTileGroupCellWidth="6" StartTileGroupsColumnCount="1" />
  <DefaultLayoutOverride>
    <StartLayoutCollection>
      <defaultlayout:StartLayout GroupCellWidth="6">
      </defaultlayout:StartLayout>
    </StartLayoutCollection>
  </DefaultLayoutOverride>
    <CustomTaskbarLayoutCollection PinListPlacement="Replace">
      <defaultlayout:TaskbarLayout>
        <taskbar:TaskbarPinList>
          <taskbar:DesktopApp DesktopApplicationLinkPath="%AppData%\Microsoft\Windows\Start Menu\Programs\System Tools\File Explorer.lnk"/>
          <taskbar:DesktopApp DesktopApplicationLinkPath="%TOOL_LIST_DIR%\Productivity Tools\Windows Terminal.lnk"/>
          <taskbar:DesktopApp DesktopApplicationLinkPath="%TOOL_LIST_DIR%\Utilities\CyberChef.lnk"/>
          <taskbar:DesktopApp DesktopApplicationLinkPath="%TOOL_LIST_DIR%\Disassemblers\ida.lnk"/>
          <taskbar:DesktopApp DesktopApplicationLinkPath="%TOOL_LIST_DIR%\Networking\fakenet.lnk"/>
          <taskbar:DesktopApp DesktopApplicationLinkPath="%TOOL_LIST_DIR%\PE\CFF Explorer.lnk"/>
          <taskbar:DesktopApp DesktopApplicationLinkPath="%TOOL_LIST_DIR%\Utilities\procexp.lnk"/>
          <taskbar:DesktopApp DesktopApplicationLinkPath="%TOOL_LIST_DIR%\Utilities\procmon.lnk"/>
          <taskbar:DesktopApp DesktopApplicationLinkPath="%TOOL_LIST_DIR%\Productivity Tools\notepad++.lnk"/>
          <taskbar:DesktopApp DesktopApplicationLinkPath="%TOOL_LIST_DIR%\Productivity Tools\VisualStudio.lnk"/>
        </taskbar:TaskbarPinList>
      </defaultlayout:TaskbarLayout>
    </CustomTaskbarLayoutCollection>
</LayoutModificationTemplate>

salmanjann avatar Sep 11 '24 10:09 salmanjann

Noted! Will try to take a look this week or very soon. Some other priorities came up, but this is on my radar. Thank you for the follow up. :)

emtuls avatar Sep 11 '24 19:09 emtuls

fixed by adding terminal log in first message

What exactly did you do here? and post that did you restart the installation?

luffy-cmd avatar Sep 17 '24 06:09 luffy-cmd

@luffy-cmd I believe they were responding to @Ana06's message in regards to adding additional logs to their message, not actually fixing of the issue at hand.

In regards to the issue, I have a PR in that should fix the problem once it is merged: https://github.com/mandiant/VM-Packages/pull/1137

For now, a temporary workaround that should work would be to copy lines 45-189 from installer.vm (https://github.com/mandiant/VM-Packages/blob/6b95e46f12c9e6fd6247bd9fe271203b0008315d/packages/installer.vm/tools/chocolateyinstall.ps1#L45C5-L190C1) and run them in an admin powershell after the installation fails.

After this, you can then run the following commands to have the taskbar set as expected:

Copy-Item "${Env:VM_COMMON_DIR}\CustomStartLayout.xml" "C:\Users\default\AppData\Local\Microsoft\Windows\Shell\LayoutModification.xml"
Stop-Process -Name explorer -Force

emtuls avatar Sep 17 '24 17:09 emtuls

This should now be fixed with https://github.com/mandiant/flare-vm/pull/617 and https://github.com/mandiant/VM-Packages/pull/1137 having been merged.

emtuls avatar Oct 07 '24 20:10 emtuls