diff --git a/meta/recipes-core/systemd/systemd_249.5.bb b/meta/recipes-core/systemd/systemd_249.5.bb
index 2df2de0cf3..ec9c350297 100644
--- a/meta/recipes-core/systemd/systemd_249.5.bb
+++ b/meta/recipes-core/systemd/systemd_249.5.bb
@@ -773,12 +773,18 @@ ALTERNATIVE_LINK_NAME[runlevel] = "${base_sbindir}/runlevel"
 ALTERNATIVE_PRIORITY[runlevel] ?= "300"
 
 pkg_postinst:${PN}:libc-glibc () {
+	if [ "${PN}" != "${BPN}" ]; then
+		exit 0
+	fi
 	sed -e '/^hosts:/s/\s*\<myhostname\>//' \
 		-e 's/\(^hosts:.*\)\(\<files\>\)\(.*\)\(\<dns\>\)\(.*\)/\1\2 myhostname \3\4\5/' \
 		-i $D${sysconfdir}/nsswitch.conf
 }
 
 pkg_prerm:${PN}:libc-glibc () {
+	if [ "${PN}" != "${BPN}" ]; then
+		exit 0
+	fi
 	sed -e '/^hosts:/s/\s*\<myhostname\>//' \
 		-e '/^hosts:/s/\s*myhostname//' \
 		-i $D${sysconfdir}/nsswitch.conf
@@ -786,6 +792,9 @@ pkg_prerm:${PN}:libc-glibc () {
 
 PACKAGE_WRITE_DEPS += "qemu-native"
 pkg_postinst:udev-hwdb () {
+	if [ "${PN}" != "${BPN}" ]; then
+		exit 0
+	fi
 	if test -n "$D"; then
 		$INTERCEPT_DIR/postinst_intercept update_udev_hwdb ${PKG} mlprefix=${MLPREFIX} binprefix=${MLPREFIX} rootlibexecdir="${rootlibexecdir}" PREFERRED_PROVIDER_udev="${PREFERRED_PROVIDER_udev}"
 	else
@@ -794,5 +803,8 @@ pkg_postinst:udev-hwdb () {
 }
 
 pkg_prerm:udev-hwdb () {
+	if [ "${PN}" != "${BPN}" ]; then
+		exit 0
+	fi
 	rm -f $D${sysconfdir}/udev/hwdb.bin
 }
