Autoreset

This is for discussing general topics about how to use VirtualBox.
Post Reply
dsummer
Posts: 3
Joined: 4. Jun 2010, 01:40
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: XP

Autoreset

Post by dsummer »

Hello All,

I have a virtual machine with an immutable disk that I want to reset on every boot. Host OS is Ubuntu 10.04 64bit. The problem is the differencing disk does not reset on each boot. I ran

VBoxManage openmedium disk /opt/local/virtualbox/Disk3.vdi --type immutable
VBoxManage storageattach XP --storagectl "IDE Controller" --port 0 --device 0 --type hdd --medium /opt/local/virtualbox/Disk3.vdi

Then, the command

VBoxManage showhdinfo 3c7cec25-c0bc-41c7-9156-8df996079866

gives the output

Oracle VM VirtualBox Command Line Management Interface Version 3.2.2
(C) 2005-2010 Oracle Corporation
All rights reserved.

UUID: 3c7cec25-c0bc-41c7-9156-8df996079866
Accessible: yes
Description:
Logical size: 0 MBytes
Current size on disk: 0 MBytes
Type: normal (differencing)
Storage format: VDI
In use by VMs: XP (UUID: c48d8595-ecdc-4741-6bbc-e3f20685df06)
Location: /opt/local/virtualbox/{3c7cec25-c0bc-41c7-9156-8df996079866}.vdi
Auto-Reset: off

My understanding is that the default behavior is for differencing disks to have autoreset on by default.

I've tried
VBoxManage modifyhd 3c7cec25-c0bc-41c7-9156-8df996079866 --autoreset on
VBoxManage modifyhd --autoreset on 3c7cec25-c0bc-41c7-9156-8df996079866

Yet neither of them change the autoreset bahavior. I have also tried to create a snapshot immediately after attaching the disk to the VM, and marking the new differencing disk's autoreset to on, but showhdinfo always reports that it is off.

Please advise on what I am doing wrong.

Thanks,
Doug
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Autoreset

Post by Perryg »

Humm maybe this is what you are looking for.

VBoxManage modifyhd <uuid>|<filename>
  • [--type normal|writethrough|immutable]
    [--autoreset on|off]
    [--compact]
tawalusa
Posts: 7
Joined: 4. Jun 2010, 05:08
Primary OS: Mac OS X Leopard
VBox Version: PUEL
Guest OSses: Ubuntu, Linux Mint, Windows...

Re: Autoreset

Post by tawalusa »

I believe this is a regression in VirtualBox 3.2.0 and 3.2.2. I'm experiencing the same difficulties with OSX 10.5 host and Windows XP and Windows 2000 guests. The Win2K guest was configured properly and automatically resetting months ago. Now with version 3.2.0 and 3.2.2 the differencing disk is not discarded on restart.

I just set up the Windows XP disk as immutable to test, and no matter what I do, I can't get the:

vboxmanage modifyhd --autoreset on {uuid}

to accomplish anything.

I believe this is the same issue discussed in tickets #2772 and #6832.

I just reverted to Virtualbox 3.1.8 and the behavior has returned to normal for both virtual machines.
dsummer
Posts: 3
Joined: 4. Jun 2010, 01:40
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: XP

Re: Autoreset

Post by dsummer »

Thanks for the reply. This regression is quite annoying for me. I need to have the immutable disk functionality with autoreset on for my application. I checked the VirtualBox.xml file, and the autoreset parameter is correctly changed by VBoxManage modifyhd --autoreset on/off. VBoxManage showhdinfo, however, always shows that it is off.

I tried another approach based on the references you provided. However, I seem to have run into another issue. I attach the primary disk image as normal, but made the file read-only. Then I created a snapshot with

Code: Select all

VBoxManage snapshot XP take currentstate
booted the VM, and all was well. After shutting down, I tried

Code: Select all

VBoxManage snapshot XP delete currentstate 
and get

Code: Select all

Oracle VM VirtualBox Command Line Management Interface Version 3.2.2
(C) 2005-2010 Oracle Corporation
All rights reserved.

0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...FAILED
Error: snapshot operation failed. Error message: Could not merge the hard disk '/opt/local/virtualbox/{7b89be34-c72d-4a4b-aa6a-7752453c022a}.vdi' to '/opt/local/virtualbox/XPDisk3.vdi' (VERR_ACCESS_DENIED)
It seems that it is trying to merge the differencing disk with the original disk, but is failing because the original disk file is write protected. Since I am discarding the state, why is it trying to merge the changes?
gsearle
Posts: 36
Joined: 27. Oct 2009, 16:26
Primary OS: MS Windows XP
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Autoreset

Post by gsearle »

I noticed the same thing. I have a Windows XP VM set up with an immutable disk for temporary storage. This disk rose to 1/2 GB in size before I noticed that it wasn't getting reset.
tawalusa
Posts: 7
Joined: 4. Jun 2010, 05:08
Primary OS: Mac OS X Leopard
VBox Version: PUEL
Guest OSses: Ubuntu, Linux Mint, Windows...

Re: Autoreset

Post by tawalusa »

@dsummer

If I understand correctly, "currentstate" in the case of your code below is the name you are giving the snapshot rather than a keyword:
Then I created a snapshot with

Code: Select all

VBoxManage snapshot XP take currentstate
booted the VM, and all was well. After shutting down, I tried

Code: Select all

VBoxManage snapshot XP delete currentstate
In which case I believe your instruction to return to that snapshot would be to "restore" rather than "delete" the referenced snapshot, i.e.

Code: Select all

VBoxManage snapshot XP restore currentstate
This is confusing in that the snapshot you saved as "currentstate" is not the dynamic "Current State" of the VM, but rather the original state before runtime modifications that you want to return to.

According to the manual:
The delete operation deletes a snapshot (specified by name or by UUID). This can take a while to finish since the differencing images associated with the snapshot might need to be merged with their child differencing images.
The way I understand the implementation is that the snapshot is a point in history you want to be able to preserve. "Deleting" the snapshot doesn't discard all subsequent changes, but rather deletes your ability to preserve that state by merging it with it's associated images. So you're not actually discarding the data of the snapshot, but rather the reference to that particular point in time. I hope that makes sense, because even my explanation is a little confusing to me.

Perhaps the
VBoxManage discardstate
command is applicable, but I have NOT tried it. It may only work with a VM that has been suspended.
 Edit: Just tried it and confirmed discardstate is only applicable to "saved" or suspended virtual machines. 
It appears to me that this issue was introduced in version 2.1.x, resolved in 2.2.0, and resurfaced with 3.2.x. As you have observed and I can confirm, the VirtualBox software appears to be ignoring the [autoReset="true"] parameter in the VirtualBox.xml file.

So far, my workaround has been to downgrade to VirtualBox 3.1.8.

I hope someone on the forums with more experience than I will notice this thread and update Ticket #6832 accordingly.
dsummer
Posts: 3
Joined: 4. Jun 2010, 01:40
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: XP

Re: Autoreset

Post by dsummer »

Thanks Tawalusa!

Clearly I was thinking of that wrong. Your explanation made perfect sense. I was looking at delete as going backwards in time to the point that I created the snapshot (i.e. deleting the differencing disk). But of course I would want to restore back to the point in time at which I took the snapshot.

Using restore works fine and gives me a way to cope with the broken autoreset functionality. Thanks.
gsearle
Posts: 36
Joined: 27. Oct 2009, 16:26
Primary OS: MS Windows XP
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Autoreset

Post by gsearle »

Not resolved for 3.2.2.
tawalusa
Posts: 7
Joined: 4. Jun 2010, 05:08
Primary OS: Mac OS X Leopard
VBox Version: PUEL
Guest OSses: Ubuntu, Linux Mint, Windows...

Re: Autoreset

Post by tawalusa »

Issue is still present in VirtualBox 3.2.4. I have updated http://www.virtualbox.org/ticket/6832 accordingly. It's my first time contributing to the trouble ticket system, so my submission didn't format quite as expected, but I hope it is still helpful.
DaveN
Posts: 1
Joined: 3. Jul 2010, 06:38
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: WinXP

Re: Autoreset

Post by DaveN »

I also experienced this problem in VirtualBox 3.2.0, so rolled back to 3.1.8.

Can anyone confirm whether or not it has been fixed in 3.2.6? Judging from the open state of tickets #2772 and #6832 and no mention of this problem in the release notes, I'm guessing it has not been fixed.

Cheers,
DaveN
krez
Posts: 4
Joined: 13. May 2010, 09:42
Primary OS: MS Windows XP
VBox Version: PUEL
Guest OSses: Linux, Windows

Re: Autoreset

Post by krez »

Still not fixed in 3.2.6.
Post Reply