]> 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)
committerLukáš Nykrýn <lnykryn@redhat.com>
Mon, 14 Jan 2019 12:03:33 +0000 (13:03 +0100)
Cherry-picked from: 67f5c0c776ce9449ad21e9854665573a05141fd4

test/TEST-13-NSPAWN-SMOKE/test.sh

index 6a0cb42eaf8945a876f2ed258edd0f26ea717e30..c0789b5d200a485eb5d286189596387e63102fff 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
 
         cp create-busybox-container $initdir/
 
@@ -63,6 +63,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