# apache2ctl

**URL:** <https://dietpi.com/forum/t/apache2ctl/5732>\
**Category:** Troubleshooting\
**Created:** [18 September 2021 13:59 UTC](https://dietpi.com/forum/t/apache2ctl/5732 "2021-09-18T13:59:11Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Burgess85](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/b/df788c/32.png) [@Burgess85](https://dietpi.com/forum/u/Burgess85)\
**Post date:** [18 September 2021 13:59 UTC](https://dietpi.com/forum/t/apache2ctl/5732/1 "2021-09-18T13:59:11Z")

</div>

bash: apache2ctl: command not found

How do I resolve please?

---

<div class="post-metadata">

**Author:** ![Joulinar](https://dietpi.com/forum/user_avatar/dietpi.com/joulinar/32/57_2.png) [@Joulinar](https://dietpi.com/forum/u/Joulinar)\
**Post date:** [18 September 2021 14:01 UTC](https://dietpi.com/forum/t/apache2ctl/5732/2 "2021-09-18T14:01:47Z")

</div>

Should be part of apache2 package. Did you install apache2 already?

[https://packages.debian.org/search?searchon=contents&keywords=apache2ctl&mode=path&suite=stable&arch=any](https://packages.debian.org/search?searchon=contents&keywords=apache2ctl&mode=path&suite=stable&arch=any)

---

<div class="post-metadata">

**Author:** ![Burgess85](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/b/df788c/32.png) [@Burgess85](https://dietpi.com/forum/u/Burgess85)\
**Post date:** [18 September 2021 15:40 UTC](https://dietpi.com/forum/t/apache2ctl/5732/3 "2021-09-18T15:40:41Z")

</div>

Yes worked until upgrading to bullseye

---

<div class="post-metadata">

**Author:** ![Burgess85](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/b/df788c/32.png) [@Burgess85](https://dietpi.com/forum/u/Burgess85)\
**Post date:** [18 September 2021 21:46 UTC](https://dietpi.com/forum/t/apache2ctl/5732/4 "2021-09-18T21:46:47Z")

</div>

How can I reinstall Apache and will it remove all my web folders?

---

<div class="post-metadata">

**Author:** ![trendy](https://dietpi.com/forum/user_avatar/dietpi.com/trendy/32/61_2.png) [@trendy](https://dietpi.com/forum/u/trendy)\
**Post date:** [19 September 2021 03:44 UTC](https://dietpi.com/forum/t/apache2ctl/5732/5 "2021-09-19T03:44:11Z")

</div>

dietpi-software reinstall 83  
It won’t remove your web servers, but you should always keep a backup! You will be reminded to take one before it starts reinstalling.

---

<div class="post-metadata">

**Author:** ![Burgess85](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/b/df788c/32.png) [@Burgess85](https://dietpi.com/forum/u/Burgess85)\
**Post date:** [19 September 2021 08:58 UTC](https://dietpi.com/forum/t/apache2ctl/5732/6 "2021-09-19T08:58:09Z")

</div>

Did a reinstall of Apache and still the same

---

<div class="post-metadata">

**Author:** ![MichaIng](https://dietpi.com/forum/user_avatar/dietpi.com/michaing/32/7_2.png) [@MichaIng](https://dietpi.com/forum/u/MichaIng)\
**Post date:** [19 September 2021 15:57 UTC](https://dietpi.com/forum/t/apache2ctl/5732/7 "2021-09-19T15:57:26Z")

</div>

Try:

```nohighlight
apt install --reinstall apache2

```

---

<div class="post-metadata">

**Author:** ![Burgess85](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/b/df788c/32.png) [@Burgess85](https://dietpi.com/forum/u/Burgess85)\
**Post date:** [19 September 2021 16:53 UTC](https://dietpi.com/forum/t/apache2ctl/5732/8 "2021-09-19T16:53:18Z")

</div>

> [@](#):
>
> Try:
> 
> ```plaintext
> apt install --reinstall apache2
> 
> ```

```plaintext
───────────────────────────────────────────────────── 15:00:44 BST 2021 armv7l
 DietPi v7.6.2 : 17:51 - Sun 09/19/21
 ───────────────────────────────────────────────────── are free software;
 - Device model : RPi 4 Model B (armv7l)ogram are described in the
 - CPU temp : 45'C : 113'F (Optimal temperature)
 - LAN IP : 192.168.86.55 (eth0)
 - MOTD : DietPi v7.6 release notes:LY NO WARRANTY, to the extent
          https://dietpi.com/docs/releases/#september-2021-version-76
 ─────────────────────────────────────────────────────42

 DietPi Team : MichaIng (lead), Daniel Knight (founder), Joulinar (support)
 Image by : DietPi Core Team (pre-image: Raspberry Pi OS Lite)
 Web : https://dietpi.com | https://twitter.com/DietPi_
 Patreon Legends : Camry2731
 Contribute : https://dietpi.com/contribute.html
 DietPi Hosting : Powered by https://myvirtualserver.com

 dietpi-launcher : All the DietPi programs in one place
 dietpi-config : Feature rich configuration tool for your device
 dietpi-software : Select optimised software for installation
 htop : Resource monitor
 cpu : Shows CPU information and stats

dietpi@Burgess-Server:~$ apt install --reinstall apache2
E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?
dietpi@Burgess-Server:~$ sudo apt install --reinstall apache2
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded.
Need to get 266 kB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://raspbian.raspberrypi.org/raspbian bullseye/main armhf apache2 armhf 2.4.48-3.1+deb11u1 [266 kB]
Fetched 266 kB in 0s (694 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
(Reading database ... 94863 files and directories currently installed.)
Preparing to unpack .../apache2_2.4.48-3.1+deb11u1_armhf.deb ...
Unpacking apache2 (2.4.48-3.1+deb11u1) over (2.4.48-3.1+deb11u1) ...
Setting up apache2 (2.4.48-3.1+deb11u1) ...
apache-htcacheclean.service is a disabled or a static unit not running, not starting it.
dietpi@Burgess-Server:~$ apache2ctl
-bash: apache2ctl: command not found
dietpi@Burgess-Server:~$

```

---

<div class="post-metadata">

**Author:** ![MichaIng](https://dietpi.com/forum/user_avatar/dietpi.com/michaing/32/7_2.png) [@MichaIng](https://dietpi.com/forum/u/MichaIng)\
**Post date:** [19 September 2021 23:33 UTC](https://dietpi.com/forum/t/apache2ctl/5732/9 "2021-09-19T23:33:27Z")

</div>

Please check the following:

```nohighlight
ls -l /usr/sbin/apache2ctl
which apache2ctl
echo $PATH

```

---

<div class="post-metadata">

**Author:** ![Burgess85](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/b/df788c/32.png) [@Burgess85](https://dietpi.com/forum/u/Burgess85)\
**Post date:** [20 September 2021 17:35 UTC](https://dietpi.com/forum/t/apache2ctl/5732/10 "2021-09-20T17:35:16Z")

</div>

> [@](#):
>
> Please check the following:
> 
> ```plaintext
> ls -l /usr/sbin/apache2ctl
> which apache2ctl
> echo $PATH
> 
> ```

```plaintext
Linux Burgess-Server 5.10.60-v7l+ #1449 SMP Wed Aug 25 15:00:44 BST 2021 armv7l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
 ─────────────────────────────────────────────────────
 DietPi v7.6.2 : 18:34 - Mon 09/20/21
 ─────────────────────────────────────────────────────
 - Device model : RPi 4 Model B (armv7l)
 - CPU temp : 44'C : 111'F (Optimal temperature)
 - LAN IP : 192.168.86.55 (eth0)
 - MOTD : DietPi v7.6 release notes:
          https://dietpi.com/docs/releases/#september-2021-version-76
 ─────────────────────────────────────────────────────

 DietPi Team : MichaIng (lead), Daniel Knight (founder), Joulinar (support)
 Image by : DietPi Core Team (pre-image: Raspberry Pi OS Lite)
 Web : https://dietpi.com | https://twitter.com/DietPi_
 Patreon Legends : Camry2731
 Contribute : https://dietpi.com/contribute.html
 DietPi Hosting : Powered by https://myvirtualserver.com

 dietpi-launcher : All the DietPi programs in one place
 dietpi-config : Feature rich configuration tool for your device
 dietpi-software : Select optimised software for installation
 htop : Resource monitor
 cpu : Shows CPU information and stats

dietpi@Burgess-Server:~$ ls -l /usr/sbin/apache2ctl
-rwxr-xr-x 1 root root 7229 Sep 1 2020 /usr/sbin/apache2ctl
dietpi@Burgess-Server:~$ which apache2ctl
dietpi@Burgess-Server:~$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
dietpi@Burgess-Server:~$

```

---

<div class="post-metadata">

**Author:** ![Joulinar](https://dietpi.com/forum/user_avatar/dietpi.com/joulinar/32/57_2.png) [@Joulinar](https://dietpi.com/forum/u/Joulinar)\
**Post date:** [20 September 2021 23:29 UTC](https://dietpi.com/forum/t/apache2ctl/5732/11 "2021-09-20T23:29:50Z")

</div>

you are going to execute the command as non-root user. Therefore path variable is missing full path to apache2ctl

Pls try sudo apache2ctl as current user or use user root

---

<div class="post-metadata">

**Author:** ![MichaIng](https://dietpi.com/forum/user_avatar/dietpi.com/michaing/32/7_2.png) [@MichaIng](https://dietpi.com/forum/u/MichaIng)\
**Post date:** [21 September 2021 16:48 UTC](https://dietpi.com/forum/t/apache2ctl/5732/12 "2021-09-21T16:48:19Z")

</div>

Ahh, that’s the mystery. Good to keep in mind that sbin directories are not in the PATH when doing interactive shell sessions with non-root users.

---

<div class="post-metadata">

**Author:** ![Burgess85](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/b/df788c/32.png) [@Burgess85](https://dietpi.com/forum/u/Burgess85)\
**Post date:** [21 September 2021 18:03 UTC](https://dietpi.com/forum/t/apache2ctl/5732/13 "2021-09-21T18:03:08Z")

</div>

> [@](#):
>
> Ahh, that’s the mystery. Good to keep in mind that sbin directories are not in the PATH when doing interactive shell sessions with non-root users.

Magic! Cheers
