I need to keep one system as much intact as possible. Only soldering of HW stuff is allowed :-). I need to install a test software package and this package must not stay there in the future.

I have a following situation:

  1. mmcblck partition mounted as /, ext4, read only, kernel v4.6.0
  2. usb stick (only one partition), mounted to /tmp/usbstick, ext4
  3. Created directories on usbstick /tmp/usbstick/upperdir, /tmp/usbstick/workdir
  4. Using the following line: mount -t overlay overlay -o lowerdir=/,upperdir=/tmp/usbstick/upperdir,workdir=/tmp/usbstick/workdir /

After that the / is still read only. The only partial success I had was when I created /tmp/usbstick/merged and gave it as a "merged" directory, instead of / to the module. Then I saw all my rootfs in that directory and it was rw mounted, but I can't use it there. What should I do?

1 Answer 1


I tried to chroot to the merged directory. The result was just as expected: I had rw rootfs, the only thing I missed was virtual kernel filesystems. So after mounting the overlay I did the following:

mount -t proc proc $TARGETDIR/proc
mount -t sysfs sysfs $TARGETDIR/sys
mount -t devtmpfs devtmpfs $TARGETDIR/dev
mount -t tmpfs tmpfs $TARGETDIR/dev/shm
mount -t devpts devpts $TARGETDIR/dev/pts

And then linked the mtab:

chroot $TARGETDIR rm /etc/mtab 2> /dev/null 
chroot $TARGETDIR ln -s /proc/mounts /etc/mtab
  • Hey, great answer but it needs to be updated to work with systemd. Currently it results in System has not been booted with systemd as init system (PID 1). Can't operate. Jun 29, 2021 at 14:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .