Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

VM does not autostart with array

Featured Replies

I know this is probably really simple but I have a pfsense VM on my unraid server whenever i start my array back up the VM does not start even though the autostart option is ticked is there something i can do to fix this ?

  • Community Expert

IIRC autostart currently only works after first array start, like after a reboot.

  • Author
1 hour ago, johnnie.black said:

IIRC autostart currently only works after first array start, like after a reboot.

Meaning that bringing the array down manually and back up it does not start ? im not sure why i remember it doing things that way. and there is no plugin i can run to do achieve this ?

  • Community Expert
25 minutes ago, Sinister said:

Meaning that bringing the array down manually and back up it does not start ?

Yes, IIRC, not 100% certain.

  • 6 months later...

Hello, do not know if you have fixed your issue. I couldn't find an answer why my vm would not autostart after a windows update.  So I created a script that runs every hour. It is kicked off with user scripts.

 

Here is the script:

 

#!/bin/bash
if [ ! -f "/tmp/vm.txt" ]; then rm /tmp/vm.txt ; fi
virsh list --state-running > /tmp/vm.txt
if grep -q "running" /tmp/vm.txt; then exit
else
virsh start  "Windows Server 2016"
fi

 

I only have one VM but you can replace grep "running" with VM name instead if you multiple vms

 

Hope this helps

Edited by ximian

  • Author
6 hours ago, ximian said:

Hello, do not know if you have fixed your issue. I couldn't find an answer why my vm would not autostart after a windows update.  So I created a script that runs every hour. It is kicked off with user scripts.

 

Here is the script:

 

#!/bin/bash
if [ ! -f "/tmp/vm.txt" ]; then rm /tmp/vm.txt ; fi
virsh list --state-running > /tmp/vm.txt
if grep -q "running" /tmp/vm.txt; then exit
else
virsh start  "Windows Server 2016"
fi

 

I only have one VM but you can replace grep "running" with VM name instead if you multiple vms

 

Hope this helps

Hi thanks for replying i would like my pfsense vm to autostart when bring up the array. If i were to use this script would it look like this ?

 

#!/bin/bash
if [ ! -f "/tmp/vm.txt" ]; then rm /tmp/vm.txt ; fi
virsh list --state-running > /tmp/vm.txt
if grep -q "running" /tmp/vm.txt; then exit
else
virsh start  "Pfsense"
fi

Be VERY careful when implementing something like this script.

 

I would add a kill feature of some sort, where the script looks for the existence of an arbitrary file on the flash drive before starting the VM, that way you could disable the auto start for troubleshooting. Blindly force starting a VM on a schedule is a bad idea for multiple reasons.

  • 1 month later...
On 10/23/2020 at 7:17 AM, Sinister said:

Hi thanks for replying i would like my pfsense vm to autostart when bring up the array. If i were to use this script would it look like this ?

 

#!/bin/bash
if [ ! -f "/tmp/vm.txt" ]; then rm /tmp/vm.txt ; fi
virsh list --state-running > /tmp/vm.txt
if grep -q "running" /tmp/vm.txt; then exit
else
virsh start  "Pfsense"
fi

Sinister , if Pfsense is the only running VM yes then the script will work. If you have multiple VMs running you need to do a virsh list --all into the file and then grep that file for the particular VM that you want to see running.

 

https://stackoverflow.com/questions/37453525/how-can-i-check-specific-server-running-or-notusing-virsh-commands-before-i-s

On 10/23/2020 at 10:02 AM, jonathanm said:

Be VERY careful when implementing something like this script.

 

I would add a kill feature of some sort, where the script looks for the existence of an arbitrary file on the flash drive before starting the VM, that way you could disable the auto start for troubleshooting. Blindly force starting a VM on a schedule is a bad idea for multiple reasons.

Hi jonathanm, just an fyi. Not blindly starting the VM.  The virsh list --state-running > /tmp/vm.txt commands checks to see if the VM is running, when it is not running the file is empty if it is is running the running text is found in the file.

8 hours ago, ximian said:

Hi jonathanm, just an fyi. Not blindly starting the VM.  The virsh list --state-running > /tmp/vm.txt commands checks to see if the VM is running, when it is not running the file is empty if it is is running the running text is found in the file.

Checking to see if the VM is already running before issuing the VM start is NOT what I meant. You need some way of keeping the VM from trying to start automatically, for troubleshooting purposes. Consider the case where starting the VM immediately hangs the host, for whatever reason. You would be stuck in a loop of bouncing the host, and attempting to get access to kill the startup script before it initiates the VM and immediately hangs the host.

 

You need an out of some sort to allow you to stop the auto start process cleanly. That conditional check, where something external is evaluated before starting the VM, is what I was referring to when I said not to blindly start the VM. It could be as simple as a script in the VM itself modifying a file on the host when it shuts down properly to signal it's OK to restart when needed. That way if the VM crashes for whatever reason, it's not blindly restarted.

Archived

This topic is now archived and is closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.