Score:0

Vagrant Windows 10 package step removes user profile?

br flag

I'm building a Vagrant Windows 10 box (using libvirt, based on the workflow documented at here: https://fishilico.github.io/generic-config/windows/vagrant.html). After the VM is ready, I run:

vagrant package default --output win10-libvirt.box

and then I take the "box" file to another machine and import it using vagrant add.

The thing is, as part of the setup I add a key to the user's ~/.ssh/authorized_keys file, but when I start the new box on the second machine - that file is gone. I also tried to add a key to the "administrators' keys" file supported on Microsoft Windows OpenSSH port at C:\ProgramData\ssh\administrators_authorized_keys - but that is also gone when I start the new box - actually the entire C:\ProgramData\ssh folder is gone.

Does vagrant package cleans the machine configuration folders, and if so - can this be disabled somehow? I couldn't find documentation about this.

Score:0
br flag

The issue was fixed for me after I added a call to Sysprep followed by shutdown at the end of the provisioning script. I'm not sure if the Sysprep is what was needed or the shutdown - the libvirt shutdown process should be safe enough and watching the libvirt viewer I can see that the VM performs the Windows shutdown process.

I used this command in my Vagrantfile:

Vagrant.configure("2") do |config|
  # ...

    config.vm.provision "shell", inline: <<-'SCRIPT'
& ./run-some-provisioning.ps1
& C:/Windows/System32/sysprep/sysprep.exe /generalize /mode:vm /shutdown
SCRIPT

  # ...
end
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.