]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tests: explicitly enable user namespaces for TEST-13-NSPAWN-SMOKE
authorFrantisek Sumsal <frantisek@sumsal.cz>
Sat, 15 Dec 2018 19:22:31 +0000 (20:22 +0100)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 20 Dec 2018 20:19:37 +0000 (05:19 +0900)
test/TEST-13-NSPAWN-SMOKE/test.sh

index 75e214c0088b18298be1a92d42fe4bc7eedf1585..774b7cbed5d8c7d790dccdc37d6b91d707677e11 100755 (executable)
@@ -18,7 +18,7 @@ test_setup() {
         eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
 
         setup_basic_environment
-        dracut_install busybox chmod rmdir unshare ip
+        dracut_install busybox chmod rmdir unshare ip sysctl
 
         # mask some services that we do not want to run in these tests
         ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service
@@ -70,6 +70,11 @@ if [[ -f /proc/1/ns/cgroup ]]; then
 fi
 
 is_user_ns_supported=no
+# On some systems (e.g. CentOS 7) the default limit for user namespaces
+# is set to 0, which causes the following unshare syscall to fail, even
+# with enabled user namespaces support. By setting this value explicitly
+# we can ensure the user namespaces support to be detected correctly.
+sysctl -w user.max_user_namespaces=10000
 if unshare -U sh -c :; then
     is_user_ns_supported=yes
 fi