diff --git a/rust/Cargo.lock b/rust/Cargo.lock
index a431b41299fc443b3caf3b6206f1c4053c5da4c4_cnVzdC9DYXJnby5sb2Nr..955084b4f74f2ffdb914016c5fae2a8d185da056_cnVzdC9DYXJnby5sb2Nr 100644
--- a/rust/Cargo.lock
+++ b/rust/Cargo.lock
@@ -734,5 +734,5 @@
 
 [[package]]
 name = "libc"
-version = "0.2.137"
+version = "0.2.155"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -738,5 +738,5 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89"
+checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c"
 
 [[package]]
 name = "libm"
@@ -1178,6 +1178,7 @@
  "hg-core",
  "home",
  "lazy_static",
+ "libc",
  "log",
  "logging_timer",
  "rayon",
diff --git a/rust/rhg/Cargo.toml b/rust/rhg/Cargo.toml
index a431b41299fc443b3caf3b6206f1c4053c5da4c4_cnVzdC9yaGcvQ2FyZ28udG9tbA==..955084b4f74f2ffdb914016c5fae2a8d185da056_cnVzdC9yaGcvQ2FyZ28udG9tbA== 100644
--- a/rust/rhg/Cargo.toml
+++ b/rust/rhg/Cargo.toml
@@ -24,3 +24,4 @@
 whoami = "1.4"
 which = "4.3.0"
 rayon = "1.7.0"
+libc = "0.2.155"
diff --git a/rust/rhg/src/commands/status.rs b/rust/rhg/src/commands/status.rs
index a431b41299fc443b3caf3b6206f1c4053c5da4c4_cnVzdC9yaGcvc3JjL2NvbW1hbmRzL3N0YXR1cy5ycw==..955084b4f74f2ffdb914016c5fae2a8d185da056_cnVzdC9yaGcvc3JjL2NvbW1hbmRzL3N0YXR1cy5ycw== 100644
--- a/rust/rhg/src/commands/status.rs
+++ b/rust/rhg/src/commands/status.rs
@@ -611,7 +611,11 @@
             log::info!("not writing dirstate from `status`: lock is held")
         }
         Err(LockError::Other(HgError::IoError { error, .. }))
-            if error.kind() == io::ErrorKind::PermissionDenied =>
+            if error.kind() == io::ErrorKind::PermissionDenied
+                || match error.raw_os_error() {
+                    None => false,
+                    Some(errno) => libc::EROFS == errno,
+                } =>
         {
             // `hg status` on a read-only repository is fine
         }