Preventing MAAS from shutting down server

We’re trialling a rollout of MAAS but ran into one issue which I couldn’t find any information about.

After MAAS finishes a commission, running tests, etc, it shuts down the server. I’ve seen that if I manually run a commission then I can set to not shut down, but is there an option to globally prevent MAAS from shutting down the server?

A lot of our servers don’t run IPMI, and instead, we have a system where we can trigger the reset header on the motherboard. As a result, we don’t want to wait hours for a datacenter technician to start the server every time MAAS shuts it down.

You have two options I suppose you know the first one , before deployment just check mark ssh access and prevent to shutdown the server.

the other one is set the nodes power to manual.

Thanks for your reply!

I’ve already got the power set to manual. I’ve span up a VM to simulate my test physical server, so I don’t need to keep getting a technician to start the server as I debug.

So MAAS has finished commissioning the server, and it has the status “Ready”. Now, every time the server (test VM) boots, it loads from PXE, loads Ubuntu, then shuts down as soon as it reaches the login screen. The power type is still set to manual, so the shut down comes from the cloud-init config/some script that MAAS provides.

That’s what I’d like to know how to modify so it does not shut down—checking the checkbox to prevent shutdown before commissioning works just one time but not for future boots.

EDIT: Just did some more testing:

  1. Commission server from MAAS and select “Allow SSH access and prevent machine powering off”. It commissions, changes status to ready, and stays online.
  2. Reboot the server and it boots from PXE. It runs a shutdown command once it’s loaded and turns off. ← I need to prevent this from happening

Did you set network boot as first boot order?

You must set hard disk as first boot option and network boot as second boot option in hypervisor or server bios setting.

When deploying, MAAS automatically changed the boot order. This happens before the server is deployed and boots.

If you want the machine to stay up, I think the simple solution is to put it into the Deployed state and power it on. This will write the selected OS image to the disk and then leave the system powered up for use.

Thanks for the suggestion. I’ve thought about this and it does work well. I still run the risk of a server booting from PXE and loading the ephemeral then shutting down after, though it is reduced if servers are all in the deployed state.

EDIT: I have found out that MAAS shuts down the server by providing poweroff to the cloud-init module “power-state” that the ephemeral loads. I need to edit this cloud-init config the ephemeral gets to remove that and my problem is sorted. How can I do this?

I have enabled ILO Port for my servers and I have set the power to IPMI .

Could you ask the datacenter to enable ILO for your servers?

Unfortunately, we can’t ask the datacenter to enable iLO on the servers because the servers aren’t HP and most don’t have any form of BMC/IPMI altogether. We have a system where we can trigger the reset header on the motherboard to restart it.

If we had IPMI on the servers, we’d have no issue as MAAS would be able to start the server back up when it’s needed, etc.

So if the bare metal deployment is not the case , I would have gone for a hypervisor such as proxmox or esxi then on top of hyeprvisor I’d provision the vms and so on.

I’ve spent the last couple of days trying different things and learning more about MAAS to prevent it from shutting down servers.

Here’s the code responsible for shutting down. https://github.com/maas/maas/blob/master/src/maasserver/compose_preseed.py#L529-L556
Line 550 onwards, I want to edit line 553 to mode restart.

I had the idea of making my own custom preseed file (curtin_userdata) as all the others are just “{{preseed_data}}” from this MAAS logic. But, unfortunately, this file is only loaded while a server is deploying and not in any other state. Otherwise, I would have added a touch command to make a file that the shutdown logic tests always.

I cannot just modify this file as MAAS is built, then shipped as a Snap, so I was wondering if a feature could be added that will allow my use case/fix this issue:

I had in mind that MAAS has a setting per controller that allows adjusting this to change the default behaviour from poweroff to reboot and apply this to specific power action types? So, for example, it could be set where servers with the power type as manual or webhook will reboot and never shut down, but MAAS can shut down servers with IPMI.

moved to features, as this is clearly a feature request.