# The powershell shell family is incompatible with the sudo become plugin

**URL:** <https://forum.ansible.com/t/the-powershell-shell-family-is-incompatible-with-the-sudo-become-plugin/4674>\
**Category:** Get Help\
**Tags:** powershell, playbook, inventory\
**Created:** [April 2, 2024, 9:25am UTC](https://forum.ansible.com/t/the-powershell-shell-family-is-incompatible-with-the-sudo-become-plugin/4674 "2024-04-02T09:25:58Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![ayoub\_yousfi](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/ayoub_yousfi/32/2756_2.png) [@ayoub\_yousfi](https://forum.ansible.com/u/ayoub_yousfi)\
**Post date:** [April 2, 2024, 9:25am UTC](https://forum.ansible.com/t/the-powershell-shell-family-is-incompatible-with-the-sudo-become-plugin/4674/1 "2024-04-02T09:25:58Z")

</div>

I’m new with ansible projects.  
when running this command :

> ansible-playbook install\_nginx.yml --ask-become-pass

> I got this error :  
> TASK [Gathering Facts] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
> fatal: [mem1]: FAILED! =\> {“msg”: “The powershell shell family is incompatible with the sudo become plugin”}  
> ok: [dc1]

**my playbook as below :**  
template\_nginx.yml :

```auto
---
- name: Install Nginx
  hosts: all
  become: true
# become_method: winrm

  tasks:
    - name: Install Nginx
      apt:
        name: nginx
        state: present
      become: yes
      become_method: runas

    - name: Start Nginx
      service:
        name: nginx
        state: started

```

**my inventory.ini :**

```auto
my remote IP address

```

---

<div class="post-metadata">

**Author:** ![Denney-tech](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/denney-tech/32/1556_2.png) [@Denney-tech](https://forum.ansible.com/u/Denney-tech)\
**Post date:** [April 2, 2024, 2:13pm UTC](https://forum.ansible.com/t/the-powershell-shell-family-is-incompatible-with-the-sudo-become-plugin/4674/2 "2024-04-02T14:13:55Z")

</div>

Are you trying to install Nginx on a Windows machine or an Ubuntu/Debian machine? You’ve got a bunch of mixed terms going on.

For Linux, the following should work on most distributions, not just Ubuntu/Debian.

```yaml
---
- name: Install Nginx - Linux
  hosts: all
  become: true
  # become_method: sudo ## this is the default become_method

  tasks:
    - name: Install Nginx
      ansible.builtin.package: # Linux package manager agnostic
        name: nginx
        state: present

    - name: Start Nginx
      ansible.builtin.service:
        name: nginx
        state: started
        enabled: true

```

For Windows:  
I’m just showing you what you _might_ for Windows use since `apt` is a Debian package manager, not a Windows one. Not everyone is comfortable with using third party packagers for Windows, so you might need to [download](https://nginx.org/en/download.html) the Windows build, and configure everything (including a service) yourself.

```yaml
---
- name: Install Nginx - Windows
  hosts: all
  become: true
  become_method: runas

  tasks:
    - name: Install Nginx
      chocolatey.chocolatey.win_chocolatey:
        name: nginx
        state: present

    - name: Start Nginx
      ansible.windows.win_service:
        name: nginx
        state: started
        state_mode: auto

```

---

<div class="post-metadata">

**Author:** ![ayoub\_yousfi](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/ayoub_yousfi/32/2756_2.png) [@ayoub\_yousfi](https://forum.ansible.com/u/ayoub_yousfi)\
**Post date:** [April 4, 2024, 10:06am UTC](https://forum.ansible.com/t/the-powershell-shell-family-is-incompatible-with-the-sudo-become-plugin/4674/3 "2024-04-04T10:06:01Z")

</div>

thanks for your response, now dealing with the script for installign nginx I got this problem :

TASK [Start Nginx] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
fatal: [10.241.200.114]: FAILED! =\> {“changed”: false, “msg”: “Service is in unknown state”, “status”: {}}

I’m using the Ubuntu distribtuion WSL on windows

---

<div class="post-metadata">

**Author:** ![Denney-tech](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/denney-tech/32/1556_2.png) [@Denney-tech](https://forum.ansible.com/u/Denney-tech)\
**Post date:** [April 4, 2024, 2:34pm UTC](https://forum.ansible.com/t/the-powershell-shell-family-is-incompatible-with-the-sudo-become-plugin/4674/4 "2024-04-04T14:34:42Z")

</div>

Oh, WSL. Can you run `wsl -l -v` so we can see what version you’re running?

---

<div class="post-metadata">

**Author:** ![Dustin](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/dustin/32/2573_2.png) [@Dustin](https://forum.ansible.com/u/Dustin)\
**Post date:** [April 4, 2024, 5:32pm UTC](https://forum.ansible.com/t/the-powershell-shell-family-is-incompatible-with-the-sudo-become-plugin/4674/5 "2024-04-04T17:32:59Z")

</div>

As I think @Denney-tech is getting at, if you have WSL v1 this will not work without a lot of extra work inside WSL.

Here’s a good [Services on WSL](https://stackoverflow.com/questions/68033753/cannot-start-service-via-ansible-on-wsl-2-ubuntu20-04) discussion on Stack Overflow.

Essential, for this to work you would want WSL v2 using Ubuntu 20.04 at a minimum for the services module to work the way you and him are trying to use it.

---

<div class="post-metadata">

**Author:** ![Denney-tech](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/denney-tech/32/1556_2.png) [@Denney-tech](https://forum.ansible.com/u/Denney-tech)\
**Post date:** [April 4, 2024, 6:03pm UTC](https://forum.ansible.com/t/the-powershell-shell-family-is-incompatible-with-the-sudo-become-plugin/4674/6 "2024-04-04T18:03:40Z")

</div>

Right, v2 is definitely required, but IIRC systemd _did_ work on v2. You need to add

```ini
[boot]
systemd=true

```

to `/etc/wsl.conf` though.

[Advanced settings configuration in WSL | Microsoft Learn](https://learn.microsoft.com/en-us/windows/wsl/wsl-config)

---

<div class="post-metadata">

**Author:** ![ayoub\_yousfi](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/ayoub_yousfi/32/2756_2.png) [@ayoub\_yousfi](https://forum.ansible.com/u/ayoub_yousfi)\
**Post date:** [April 5, 2024, 9:33am UTC](https://forum.ansible.com/t/the-powershell-shell-family-is-incompatible-with-the-sudo-become-plugin/4674/7 "2024-04-05T09:33:38Z")

</div>

on CMD I got this :

```auto
C:\Users\( user )>wsl -l -v

 NAME STATE VERSION
* docker-desktop Stopped 2
  docker-desktop-data Stopped 2
  Ubuntu Running 1

```

and on wsl I got this :

````auto
user@user-PC:~$ wsl -l -v
WSL
Wsman Shell commandLine, version 0.2.1```
````

---

<div class="post-metadata">

**Author:** ![Dustin](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/dustin/32/2573_2.png) [@Dustin](https://forum.ansible.com/u/Dustin)\
**Post date:** [April 5, 2024, 12:54pm UTC](https://forum.ansible.com/t/the-powershell-shell-family-is-incompatible-with-the-sudo-become-plugin/4674/8 "2024-04-05T12:54:02Z")

</div>

From inside wsl, run `cat /etc/lsb-release` and tell us the output.

---

<div class="post-metadata">

**Author:** ![ayoub\_yousfi](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/ayoub_yousfi/32/2756_2.png) [@ayoub\_yousfi](https://forum.ansible.com/u/ayoub_yousfi)\
**Post date:** [April 5, 2024, 2:16pm UTC](https://forum.ansible.com/t/the-powershell-shell-family-is-incompatible-with-the-sudo-become-plugin/4674/9 "2024-04-05T14:16:06Z")

</div>

DISTRIB\_ID=Ubuntu  
DISTRIB\_RELEASE=22.04  
DISTRIB\_CODENAME=jammy  
DISTRIB\_DESCRIPTION=“Ubuntu 22.04.4 LTS”

---

<div class="post-metadata">

**Author:** ![Denney-tech](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/denney-tech/32/1556_2.png) [@Denney-tech](https://forum.ansible.com/u/Denney-tech)\
**Post date:** [April 5, 2024, 2:20pm UTC](https://forum.ansible.com/t/the-powershell-shell-family-is-incompatible-with-the-sudo-become-plugin/4674/10 "2024-04-05T14:20:20Z")

</div>

Since docker-desktop is running on WSL v2, we know that v2 is installed, but your Ubuntu instance is still running on v1.

`wsl --set-version Ubuntu 2` will fix the WSL version it’s running on. Then go in and modify the `/etc/wsl.conf` file to start systemd on boot. Restart your instance to make sure changes take effect, and then run `systemctl status nginx` to see if you get any kind of systemd error.

Then try running your playbook again.

You might also want to run `wsl --set-default-version 2` to make sure all future instances default to v2.

---

<div class="post-metadata">

**Author:** ![Dustin](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/dustin/32/2573_2.png) [@Dustin](https://forum.ansible.com/u/Dustin)\
**Post date:** [April 5, 2024, 2:23pm UTC](https://forum.ansible.com/t/the-powershell-shell-family-is-incompatible-with-the-sudo-become-plugin/4674/11 "2024-04-05T14:23:31Z")

</div>

Yeah, you should be able to make this work.

High level steps:

1. Windows CMD: Shutdown your current WSL Instance `wsl --shutdown`
2. Windows CMD: Convert your Ubuntu instance to WSL 2 `wsl --set-version Ubuntu 2`
3. Windows CMD: Start your Ubuntu instance again `wsl -d Ubuntu`

If you use the `service` module in your Ansible playbook, I believe it should work. If not, let us know. You may still need to do more modifications to your Ubuntu system files and restart WSL again.

---

<div class="post-metadata">

**Author:** ![Dustin](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/dustin/32/2573_2.png) [@Dustin](https://forum.ansible.com/u/Dustin)\
**Post date:** [April 5, 2024, 2:26pm UTC](https://forum.ansible.com/t/the-powershell-shell-family-is-incompatible-with-the-sudo-become-plugin/4674/12 "2024-04-05T14:26:00Z")

</div>

According to the Stack Overflow link I posted above, Ubuntu 20.04 may have a built in fall-back mechanism to handle the `ansible.built-in.service` module. So, enabling systemd _MAY_ not be necessary.

I’d say, convert the WSL Ubuntu Distribution to version 2, test, and if it still doesn’t work then try enabling systemd.

I believe in the least number of changes necessary to make something new work.

---

<div class="post-metadata">

**Author:** ![Denney-tech](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/denney-tech/32/1556_2.png) [@Denney-tech](https://forum.ansible.com/u/Denney-tech)\
**Post date:** [April 5, 2024, 2:47pm UTC](https://forum.ansible.com/t/the-powershell-shell-family-is-incompatible-with-the-sudo-become-plugin/4674/13 "2024-04-05T14:47:57Z")

</div>

It’s been a while since I’ve played with WSL + SystemD, so it may or may not be enough. According to my notes from the last time I actually played with it, I used [Distrod](https://github.com/nullpo-head/wsl-distrod) to install Fedora 36 with SystemD. Then my manager found out and had a sandbox VM created for me to use instead, lol. So, I don’t remember if SystemD worked with just vanilla WSL v2, or if Distrod was required. ¯\_(ツ)\_/¯

I mainly remember using Distrod so I could use Fedora, not because of the SystemD support.
