# Trying to reboot an Ubuntu system

**URL:** <https://forum.ansible.com/t/trying-to-reboot-an-ubuntu-system/34636>\
**Category:** Ansible Project\
**Tags:** ubuntu\
**Created:** [February 17, 2021, 3:51pm UTC](https://forum.ansible.com/t/trying-to-reboot-an-ubuntu-system/34636 "2021-02-17T15:51:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Peter\_Kaagman](https://avatars.discourse-cdn.com/v4/letter/p/dec6dc/32.png) [@Peter\_Kaagman](https://forum.ansible.com/u/Peter_Kaagman)\
**Post date:** [February 17, 2021, 3:51pm UTC](https://forum.ansible.com/t/trying-to-reboot-an-ubuntu-system/34636/1 "2021-02-17T15:51:04Z")

</div>

fatal: [node-js.atlascollege.nl]: FAILED! =\> {“changed”: false, “elapsed”: 0, “msg”: “Reboot command failed. Error was Failed to set wall message, ignoring: Interactive authentication required.\r\nFailed to call ScheduleShutdown in logind, proceeding with immediate shutdown: Interactive authentication required.\r\nFailed to set wall message, ignoring: Interactive authentication required.\r\nFailed to reboot system via logind: Interactive authentication required.\r\nFailed to open /dev/initctl: Permission denied\r\nFailed to talk to init daemon., Shared connection to node-js.atlascollege.nl closed.”, “rebooted”: false, “start”: “2021-02-17T15:19:44.622905”}

Hi there list,

I’ve been using anible to keep our Ubuntu systems up to date and do some minor maintenace like ensuring certain account are in place…

But I fail on rebooting the system when a reboot is required. And this frustrates me. I end up visiting every system to do the reboot manually.

So far I’ve tried 2 methods to get the system to reboot:

---

<div class="post-metadata">

**Author:** ![racke](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/racke/32/4767_2.png) [@racke](https://forum.ansible.com/u/racke)\
**Post date:** [February 17, 2021, 4:08pm UTC](https://forum.ansible.com/t/trying-to-reboot-an-ubuntu-system/34636/2 "2021-02-17T16:08:06Z")

</div>

> fatal: [node-js.atlascollege.nl]: FAILED! =\> {"changed": false, "elapsed": 0, "msg": "Reboot command failed. Error was  
> Failed to set wall message, ignoring: Interactive authentication required.\r\nFailed to call ScheduleShutdown in logind,  
> proceeding with immediate shutdown: Interactive authentication required.\r\nFailed to set wall message, ignoring:  
> Interactive authentication required.\r\nFailed to reboot system via logind: Interactive authentication  
> required.\r\nFailed to open /dev/initctl: Permission denied\r\nFailed to talk to init daemon., Shared connection to  
> node-js.atlascollege.nl closed.", "rebooted": false, "start": "2021-02-17T15:19:44.622905"}
> 
> Hi there list,
> 
> I've been using anible to keep our Ubuntu systems up to date and do some minor maintenace like ensuring certain account  
> are in place....
> 
> But I fail on rebooting the system when a reboot is required. And this frustrates me. I end up visiting every system to  
> do the reboot manually.
> 
> So far I've tried 2 methods to get the system to reboot:
> 
> ---  
> - hosts: node-js.atlascollege.nl  
> tasks:  
> # - name: Reboot required?  
> # shell: /etc/update-motd.d/98-reboot-required  
> # register: reboot\_required  
> #  
> - name: Reboot when reboot required  
> reboot:  
> # when: reboot\_required|bool
> 
> # - debug: var=reboot\_required.stdout\_lines
> 
> As you can see I had a condition in place to check for a reboot required. But commented that out to take errors there  
> out of the equation.
> 
> This playbook fails with the following error:
> 
> fatal: [node-js.atlascollege.nl]: FAILED! =\> {"changed": false, "elapsed": 0, "msg": "Reboot command failed. Error was  
> Failed to set wall message, ignoring: Interactive authentication required.\r\nFailed to call ScheduleShutdown in logind,  
> proceeding with immediate shutdown: Interactive authentication required.\r\nFailed to set wall message, ignoring:  
> Interactive authentication required.\r\nFailed to reboot system via logind: Interactive authentication  
> required.\r\nFailed to open /dev/initctl: Permission denied\r\nFailed to talk to init daemon., Shared connection to  
> node-js.atlascollege.nl closed.", "rebooted": false, "start": "2021-02-17T15:19:44.622905"}

I don't see "become: yes" in your playbook, so it looks like Ansible simply tries to reboot as regular user.

Regards  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Racke

---

<div class="post-metadata">

**Author:** ![Peter\_Kaagman](https://avatars.discourse-cdn.com/v4/letter/p/dec6dc/32.png) [@Peter\_Kaagman](https://forum.ansible.com/u/Peter_Kaagman)\
**Post date:** [February 19, 2021, 9:28am UTC](https://forum.ansible.com/t/trying-to-reboot-an-ubuntu-system/34636/3 "2021-02-19T09:28:38Z")

</div>

Thanks Racke… that indeed did the trick.  
Kinda assumed the -K runtime option took care of that… was wrong 😃
