diff --git a/src/wic/oe/path.py b/src/wic/oe/path.py
index 95bb964..6d61a6c 100644
--- a/src/wic/oe/path.py
+++ b/src/wic/oe/path.py
@@ -112,7 +112,7 @@ def copyhardlinktree(src, dst):
 
     if testfile is not None:
         try:
-            os.link(testfile, os.path.join(dst, 'testfile'))
+            os.link(testfile, os.path.join(dst, 'testfile'), follow_symlinks=False)
             os.unlink(os.path.join(dst, 'testfile'))
             canhard = True
         except Exception as e:
diff --git a/tests/unit/test_oe_path.py b/tests/unit/test_oe_path.py
index 3abe1f0..181128b 100644
--- a/tests/unit/test_oe_path.py
+++ b/tests/unit/test_oe_path.py
@@ -1,8 +1,9 @@
 """
 Unit tests for wic/oe/path.py, covering wic's own path logic: join,
 is_path_parent, symlink, make_relative_symlink, canonicalize, which_wild,
-and realpath. Thin standard-library wrappers (relative -> os.path.relpath,
-find -> os.walk) are left to the standard library.
+realpath and copyhardlinktree. Thin standard-library wrappers
+(relative -> os.path.relpath, find -> os.walk) are left to the standard
+library.
 """
 import errno
 import os
@@ -23,6 +24,7 @@ from wic.oe.path import (
     canonicalize,
     which_wild,
     realpath,
+    copyhardlinktree,
 )
 
 
@@ -376,3 +378,26 @@ class TestRealpath:
 
         monkeypatch.setattr(os.path, "isdir", boom)
         assert realpath(str(sub), str(tmp_path), use_physdir=False) == str(sub)
+
+
+class TestCopyhardlinktree:
+    def test_hardlinks_files(self, tmp_path):
+        src = tmp_path / "src"
+        (src / "sub").mkdir(parents=True)
+        (src / "sub" / "file").write_text("data")
+        dst = tmp_path / "dst"
+        copyhardlinktree(str(src), str(dst))
+        assert os.path.samefile(src / "sub" / "file", dst / "sub" / "file")
+
+    def test_dangling_symlink_as_first_entry_still_hardlinks(self, tmp_path):
+        # The hardlink test uses the first file os.walk() returns. A rootfs
+        # symlink such as var/lock -> /run/lock dangles on the build host and
+        # must not make the test fail and force a full tar copy.
+        src = tmp_path / "src"
+        (src / "sub").mkdir(parents=True)
+        os.symlink("/nonexistent/target", str(src / "dangling"))
+        (src / "sub" / "file").write_text("data")
+        dst = tmp_path / "dst"
+        copyhardlinktree(str(src), str(dst))
+        assert os.path.samefile(src / "sub" / "file", dst / "sub" / "file")
+        assert os.readlink(dst / "dangling") == "/nonexistent/target"
