diff --git a/package/ejabberd/0001-Makefile.in-do-not-download-or-compile-dependencies.patch b/package/ejabberd/0001-Makefile.in-do-not-download-or-compile-dependencies.patch
index abcc8975b2..69f25304b5 100644
--- a/package/ejabberd/0001-Makefile.in-do-not-download-or-compile-dependencies.patch
+++ b/package/ejabberd/0001-Makefile.in-do-not-download-or-compile-dependencies.patch
@@ -1,37 +1,36 @@
-From bf3571da4a68a6a857ab7ad8256f8276b3687a38 Mon Sep 17 00:00:00 2001
-From: Johan Oudinet <johan.oudinet@gmail.com>
-Date: Fri, 13 May 2022 14:22:37 +0200
+From bfcc72e5bb96fc9fc1f3558191a1a3f40c7f159a Mon Sep 17 00:00:00 2001
+From: Johan Oudinet <johan.oudinet@gmail.com>
+Date: Fri, 2 Aug 2024 17:32:37 +0200
 Subject: [PATCH] Makefile.in: do not download or compile dependencies
 
-Signed-off-by: Johan Oudinet <johan.oudinet@gmail.com>
-[Bernd: updated for version 23.04]
-Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
+Signed-off-by: Johan Oudinet <johan.oudinet@gmail.com>
+Upstream: N/A, not upstreamable
 ---
  Makefile.in | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/Makefile.in b/Makefile.in
-index ab0e9d967..6e54168a7 100644
+index 5adf241d5..74aad3156 100644
 --- a/Makefile.in
 +++ b/Makefile.in
-@@ -155,7 +155,7 @@ else
- endif
- endif
+@@ -201,7 +201,7 @@ endif
+ #' main targets
+ #
  
 -all: scripts deps src
 +all: scripts src
  
  deps: $(DEPSDIR)/.got
  
-@@ -169,7 +169,7 @@ $(DEPSDIR)/.built: $(DEPSDIR)/.got
+@@ -215,7 +215,7 @@ $(DEPSDIR)/.got:
  $(DEPSDIR)/.built: $(DEPSDIR)/.got
  	$(REBAR) compile && :> $(DEPSDIR)/.built
  
 -src: $(DEPSDIR)/.built
 +src:
  	$(REBAR) $(SKIPDEPS) compile
+ 	$(EXPLICIT_ELIXIR_COMPILE)
  
- update:
 -- 
 2.34.1
 
diff --git a/package/ejabberd/0002-fix-ejabberdctl.patch b/package/ejabberd/0002-fix-ejabberdctl.patch
index ae28f3a632..89504d11c5 100644
--- a/package/ejabberd/0002-fix-ejabberdctl.patch
+++ b/package/ejabberd/0002-fix-ejabberdctl.patch
@@ -1,30 +1,29 @@
-From 4283f675f21d3923e200092cec6418014a03ad52 Mon Sep 17 00:00:00 2001
-From: Johan Oudinet <johan.oudinet@gmail.com>
-Date: Thu, 26 Dec 2019 17:06:34 +0100
+From d403c0bca48f2678c70763c3faca41c9adc76658 Mon Sep 17 00:00:00 2001
+From: Johan Oudinet <johan.oudinet@gmail.com>
+Date: Fri, 2 Aug 2024 17:39:07 +0200
 Subject: [PATCH] fix ejabberdctl
 
 Change default values so ejabberdctl run commands as ejabberd user.
 
-Signed-off-by: Johan Oudinet <johan.oudinet@gmail.com>
-[Bernd: updated for version 23.04]
-Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
+Signed-off-by: Johan Oudinet <johan.oudinet@gmail.com>
+Upstream: N/A (specific to buildroot)
 ---
  ejabberdctl.template | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/ejabberdctl.template b/ejabberdctl.template
-index a940c3df7..5166e5a27 100755
+index 83ec7e1bd..513c48c25 100755
 --- a/ejabberdctl.template
 +++ b/ejabberdctl.template
-@@ -17,7 +17,7 @@ SCRIPT_DIR=$(cd "${0%/*}" && pwd)
+@@ -17,7 +17,7 @@ ERTS_VSN="{{erts_vsn}}"
  ERL="{{erl}}"
- IEX="{{bindir}}/iex"
  EPMD="{{epmd}}"
+ IEX="{{iexpath}}"
 -INSTALLUSER="{{installuser}}"
 +INSTALLUSER=ejabberd
  
  # check the proper system user is used
  case $(id -un) in
 -- 
-2.20.1
+2.34.1
 
diff --git a/package/ejabberd/S50ejabberd b/package/ejabberd/S50ejabberd
index 83513bdc83..5d01034fb2 100644
--- a/package/ejabberd/S50ejabberd
+++ b/package/ejabberd/S50ejabberd
@@ -3,52 +3,54 @@
 # Start/stop ejabberd
 #
 
+DAEMON=ejabberd
 CTL=/usr/sbin/ejabberdctl
 DEFAULT=/etc/ejabberd/ejabberdctl.cfg
 INSTALLUSER=ejabberd
 RUNDIR=/var/run/ejabberd
 
 # Read default configuration file if present.
+# shellcheck source=/dev/null
 [ -r "$DEFAULT" ] && . "$DEFAULT"
 
 # Create RUNDIR.
 mkrundir() {
-    install -d -o "$INSTALLUSER" -g "$INSTALLUSER" "$RUNDIR"
+	install -d -o "$INSTALLUSER" -g "$INSTALLUSER" "$RUNDIR"
 }
 
 case "$1" in
-    start)
-        mkrundir || exit 1
-        printf "Starting ejabberd... "
-        "$CTL" start
-        # Wait until ejabberd is up and running.
-        if "$CTL" started; then
-            echo "done"
-        else
-            echo "failed"
-        fi
-        ;;
-    stop)
-        printf "Stopping ejabberd... "
-        "$CTL" stop > /dev/null
-        if [ $? -eq 3 ] || "$CTL" stopped; then
-            echo "OK"
-        else
-            echo "failed"
-        fi
-        ;;
-    status)
-        "$CTL" status
-        ;;
-    restart|force-reload)
-        "$0" stop || true
-        "$0" start
-        ;;
-    live)
-        mkrundir || exit 1
-        "$CTL" live
-        ;;
-    *)
-        echo "Usage: $0 {start|stop|status|restart|force-reload|live}"
-        exit 1
+	start)
+		mkrundir || exit 1
+		printf 'Starting %s: ' "$DAEMON"
+		"$CTL" start
+		# Wait until ejabberd is up and running.
+		if "$CTL" started; then
+			echo "done"
+		else
+			echo "failed"
+		fi
+		;;
+	stop)
+		printf 'Stopping %s: ' "$DAEMON"
+		"$CTL" stop > /dev/null
+		if [ $? -eq 3 ] || "$CTL" stopped; then
+			echo "OK"
+		else
+			echo "failed"
+		fi
+		;;
+	status)
+		"$CTL" status
+		;;
+	restart|force-reload)
+		"$0" stop || true
+		"$0" start
+		;;
+	live)
+		mkrundir || exit 1
+		"$CTL" live
+		;;
+	*)
+		echo "Usage: $0 {start|stop|status|restart|force-reload|live}"
+		exit 1
 esac
diff --git a/package/ejabberd/check-erlang-lib b/package/ejabberd/check-erlang-lib
index 63f8bf1926..4e51b54294 100755
--- a/package/ejabberd/check-erlang-lib
+++ b/package/ejabberd/check-erlang-lib
@@ -9,9 +9,9 @@
 # without calling erlang.
 
 usage() {
-    cat <<EOF
+	cat <<EOF
 Usage:
-        $0 library
+		$0 library
 Look for Erlang's library in TARGET_DIR/usr/lib/erlang/lib.
 
 If the library is found, it returns the path to the latest version,
@@ -24,15 +24,15 @@ EOF
 }
 
 die () {
-    echo "$@" >&2
-    exit 1
+	echo "$@" >&2
+	exit 1
 }
 
 if [ $# -ne 1 ]; then
-    usage
-    exit 0
+	usage
+	exit 0
 else
-    library="$1"
+	library="$1"
 fi
 
 target_dir="${TARGET_DIR:-output/target}"
@@ -40,16 +40,17 @@ target_dir="${TARGET_DIR:-output/target}"
 [ -d "$target_dir" ] || die "TARGET_DIR is not a directory. Please \
 specify the TARGET_DIR environment variable."
 
-case "$(ls -1d -- "$target_dir/usr/lib/erlang/lib/$library-"* | wc -l)" in
-    0)
-        echo "not found"
-        ;;
-    1)
-        echo "$target_dir/usr/lib/erlang/lib/$library-"* \
-            | sed -e "s,^$target_dir,,"
-        ;;
-    *)
-        die "Several versions of $library have been found. Please \
-        remove the unused ones."
-        ;;
+case "$(find "$target_dir/usr/lib/erlang/lib" -maxdepth 1 \
+		-name "$library-*" -type d | wc -l)" in
+	0)
+		echo "not found"
+		;;
+	1)
+		echo "$target_dir/usr/lib/erlang/lib/$library-"* \
+			| sed -e "s,^$target_dir,,"
+		;;
+	*)
+		die "Several versions of $library have been found. Please \
+		remove the unused ones."
+		;;
 esac
diff --git a/package/ejabberd/ejabberd.hash b/package/ejabberd/ejabberd.hash
index 15e879be19..e6d9b2560e 100644
--- a/package/ejabberd/ejabberd.hash
+++ b/package/ejabberd/ejabberd.hash
@@ -1,4 +1,4 @@
-# From https://static.process-one.net/ejabberd/downloads/23.04/ejabberd-23.04.tar.gz.sum
-sha256  6ff1d41a1ff6261a0c846193647d8ec143e82142859bf1cfdc62299022ceb2ad  ejabberd-23.04.tar.gz
+# From https://static.process-one.net/ejabberd/downloads/24.07/ejabberd-24.07.tar.gz.sum
+sha256  c0fb746acba81a5db41de97c03968c1f681a13b1b6c1a895b7182e33820c18d9  ejabberd-24.07.tar.gz
 # Locally computed
 sha256  469bb8cfa3ef22c102875ff31932450c075e6908ff3f7d36893485c0c30898eb  COPYING
diff --git a/package/ejabberd/ejabberd.mk b/package/ejabberd/ejabberd.mk
index 58b544fb84..df9fc1c1d0 100644
--- a/package/ejabberd/ejabberd.mk
+++ b/package/ejabberd/ejabberd.mk
@@ -4,7 +4,7 @@
 #
 ################################################################################
 
-EJABBERD_VERSION = 23.04
+EJABBERD_VERSION = 24.07
 EJABBERD_SITE = https://static.process-one.net/ejabberd/downloads/$(EJABBERD_VERSION)
 EJABBERD_LICENSE = GPL-2.0+ with OpenSSL exception
 EJABBERD_LICENSE_FILES = COPYING
@@ -36,7 +36,8 @@ EJABBERD_CONF_ENV = \
 
 EJABBERD_CONF_OPTS = \
 	--enable-system-deps \
-	--disable-erlang-version-check
+	--disable-erlang-version-check \
+	--with-rebar="$(HOST_DIR)/bin/rebar"
 
 define EJABBERD_INSTALL_TARGET_CMDS
 	$(TARGET_MAKE_ENV) $(MAKE) DESTDIR=$(TARGET_DIR) all install -C $(@D)
