Skip to contentSkip to conversation

running binaries under doubly stacked overlayfs

DISCUSSION Richard Cochran 1 participant 2 messages Sep 19, 2016 – Sep 20, 2016

lore
Share & tools
lore
#0 lore raw

Using kernel v3.18.41, something unexpected happens when I mount two overlays. Once the second overlay is mounted, the binaries won't execute any more. Below is a simple script to demonstate the issue. Although this uses a shell script, the same thing happens with actual binaries.

What am I doing wrong here?

Thanks,
Richard

---8<---
cd /tmp
mkdir merged layer1 layer2 w1 w2
touch layer1/.layer1 layer2/.layer2
cat > merged/helo.sh <<-EOF

	#!/bin/sh
	echo helo

EOF
chmod +x merged/helo.sh
mount -t overlay overlay \
-oro,lowerdir=/tmp/merged,upperdir=/tmp/layer1,workdir=/tmp/w1 /tmp/merged ./merged/helo.sh

# works as expected
mount -t overlay overlay \
-orw,lowerdir=/tmp/merged,upperdir=/tmp/layer2,workdir=/tmp/w2 /tmp/merged
./merged/helo.sh
# -bash: ./merged/helo.sh: Invalid argument
#1 lore raw
Quoted 1 line · Richard Cochran

What am I doing wrong here?

To answer my own question, it does working using the lowerdir=a:b syntax available starting with kernel 4.0.

Thanks,
Richard