diff --git a/src/ceph-detect-init/Makefile.am b/src/ceph-detect-init/Makefile.am
index 3926ac4bec..90e2eae50c 100644
--- a/src/ceph-detect-init/Makefile.am
+++ b/src/ceph-detect-init/Makefile.am
@@ -67,7 +67,7 @@ ceph-detect-init-clean:
 ceph-detect-init-install-data:
 	cd $(srcdir)/ceph-detect-init ; \
 	if test "$(DESTDIR)" ; then \
-		if lsb_release -si | grep --quiet 'Ubuntu\|Debian\|Devuan' ; then \
+		if command -v lsb_release >/dev/null && lsb_release -si | grep --quiet 'Ubuntu\|Debian\|Devuan' ; then \
 			options=--install-layout=deb ; \
 		else \
 			options=--prefix=/usr ; \
diff --git a/src/ceph-disk/Makefile.am b/src/ceph-disk/Makefile.am
index a8532878c8..d908b1649a 100644
--- a/src/ceph-disk/Makefile.am
+++ b/src/ceph-disk/Makefile.am
@@ -43,7 +43,7 @@ ceph-disk-clean:
 ceph-disk-install-data:
 	cd $(srcdir)/ceph-disk ; \
 	if test "$(DESTDIR)" ; then \
-		if lsb_release -si | grep --quiet 'Ubuntu\|Debian\|Devuan' ; then \
+		if command -v lsb_release >/dev/null && lsb_release -si | grep --quiet 'Ubuntu\|Debian\|Devuan' ; then \
 			options=--install-layout=deb ; \
 		else \
 			options=--prefix=/usr ; \
diff --git a/src/pybind/cephfs/Makefile.am b/src/pybind/cephfs/Makefile.am
index 698522daa4..c49c190986 100644
--- a/src/pybind/cephfs/Makefile.am
+++ b/src/pybind/cephfs/Makefile.am
@@ -15,7 +15,7 @@ cephfs-pybind-clean: ${srcdir}/ceph_ver.h
 
 cephfs-pybind-install-exec: ${srcdir}/ceph_ver.h
 	if test "$(DESTDIR)" ; then \
-		if lsb_release -si | grep --quiet 'Ubuntu\|Debian\|Devuan' ; then \
+		if command -v lsb_release >/dev/null && lsb_release -si | grep --quiet 'Ubuntu\|Debian\|Devuan' ; then \
 			options=--install-layout=deb ; \
 		else \
 			options=--prefix=/usr ; \
diff --git a/src/pybind/rados/Makefile.am b/src/pybind/rados/Makefile.am
index a4145bf0f4..960395fee8 100644
--- a/src/pybind/rados/Makefile.am
+++ b/src/pybind/rados/Makefile.am
@@ -15,7 +15,7 @@ rados-pybind-clean: ${srcdir}/ceph_ver.h
 
 rados-pybind-install-exec: ${srcdir}/ceph_ver.h
 	if test "$(DESTDIR)" ; then \
-		if lsb_release -si | grep --quiet 'Ubuntu\|Debian\|Devuan' ; then \
+		if command -v lsb_release >/dev/null && lsb_release -si | grep --quiet 'Ubuntu\|Debian\|Devuan' ; then \
 			options=--install-layout=deb ; \
 		else \
 			options=--prefix=/usr ; \
diff --git a/src/pybind/rbd/Makefile.am b/src/pybind/rbd/Makefile.am
index 7dd49333fa..fbb940d07d 100644
--- a/src/pybind/rbd/Makefile.am
+++ b/src/pybind/rbd/Makefile.am
@@ -15,7 +15,7 @@ rbd-pybind-clean: ${srcdir}/ceph_ver.h
 
 rbd-pybind-install-exec: ${srcdir}/ceph_ver.h
 	if test "$(DESTDIR)" ; then \
-		if lsb_release -si | grep --quiet 'Ubuntu\|Debian\|Devuan' ; then \
+		if command -v lsb_release >/dev/null && lsb_release -si | grep --quiet 'Ubuntu\|Debian\|Devuan' ; then \
 			options=--install-layout=deb ; \
 		else \
 			options=--prefix=/usr ; \
