6

Produces the following command on Ubuntu 64bit on VMWare:

mount /dev/sda1 /newroot
cd /newroot
mkdir old-root
pivot_root . old-root

I get an error that I do not understand

pivot_root: device or resource busy

Any ideas?

lukassz
  • 3,135
  • 7
  • 32
  • 72

1 Answers1

0

I saw the same error when the new root directory is a plain directory. When the new root is a mount, it will be ok. A bind mount of a directory is ok too. Also need to make sure the root directory permission is 0755, and owned by the root user.

The related answer states that you need to umount /proc first. I do not see the same.

The host ubnutu is 16.04 and it pivots into 18.04. Used unshare -m -p -f /bin/bash, followed by pivot_root . old_root. The -f is necessary to avoid a memory allocation error.

minghua
  • 5,981
  • 6
  • 45
  • 71