diff --git a/README.md b/README.md index 2dc8674c..09a0b003 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ Usage: ./configure [OPTION]... # Usage: ``` -ruri 3.2 +ruri 3.3 Lightweight, User-friendly Linux-container Implementation @@ -81,17 +81,19 @@ ARGS: -k, --keep [cap] ....................: Keep the specified cap -d, --drop [cap] ....................: Drop the specified cap -e, --env [env] [value] .............: Set environment variables to its value (**) - -m, --mount [dir/dev/img] [dir] .....: Mount dir/block-device/image to mountpoint + -m, --mount [dir/dev/img] [dir] .....: Mount dir/block-device/image to mountpoint (***) -M, --ro-mount [dir/dev/img] [dir] ..: Mount dir/block-device/image as read-only -S, --host-runtime ..................: Bind-mount /dev/, /sys/ and /proc/ from host -R, --read-only .....................: Mount / as read-only - -l, --limit [cpuset=cpu/memory=mem] .: Set cpuset/memory limit(***) + -l, --limit [cpuset=cpu/memory=mem] .: Set cpuset/memory limit(****) -w, --no-warnings ...................: Disable warnings -(*) : `-a` option also need `-q` is set -(**) : Will not work if [COMMAND [ARGS]...] is like `/bin/su -` -(***): Each `-l` option can only set one of the cpuset/memory limits -(***): for example: `ruri -l memory=1M -l cpuset=1 /test` +Note: +(*) : `-a` option also need `-q` is set +(**) : Will not work if [COMMAND [ARGS]...] is like `/bin/su -` +(***) : You can use `-m [source] /` to mount a block device as root +(****): Each `-l` option can only set one of the cpuset/memory limits + for example: `ruri -l memory=1M -l cpuset=1 /test` ``` # Quick start(with rootfstool): ## Download and unpack a rootfs: diff --git a/src/info.c b/src/info.c index e4b06689..4a95e8d6 100644 --- a/src/info.c +++ b/src/info.c @@ -100,17 +100,19 @@ void show_helps(void) cprintf("{base} -k, --keep [cap] ....................: Keep the specified cap\n"); cprintf("{base} -d, --drop [cap] ....................: Drop the specified cap\n"); cprintf("{base} -e, --env [env] [value] .............: Set environment variables to its value (**)\n"); - cprintf("{base} -m, --mount [dir/dev/img] [dir] .....: Mount dir/block-device/image to mountpoint\n"); + cprintf("{base} -m, --mount [dir/dev/img] [dir] .....: Mount dir/block-device/image to mountpoint (***)\n"); cprintf("{base} -M, --ro-mount [dir/dev/img] [dir] ..: Mount dir/block-device/image as read-only\n"); cprintf("{base} -S, --host-runtime ..................: Bind-mount /dev/, /sys/ and /proc/ from host\n"); cprintf("{base} -R, --read-only .....................: Mount / as read-only\n"); - cprintf("{base} -l, --limit [cpuset=cpu/memory=mem] .: Set cpuset/memory limit(***)\n"); + cprintf("{base} -l, --limit [cpuset=cpu/memory=mem] .: Set cpuset/memory limit(****)\n"); cprintf("{base} -w, --no-warnings ...................: Disable warnings\n"); cprintf("\n"); - cprintf("{base}(*) : `-a` option also need `-q` is set\n"); - cprintf("{base}(**) : Will not work if [COMMAND [ARGS]...] is like `/bin/su -`\n"); - cprintf("{base}(***): Each `-l` option can only set one of the cpuset/memory limits\n"); - cprintf("{base}(***): for example: `ruri -l memory=1M -l cpuset=1 /test`\n"); + cprintf("{base}Note:\n"); + cprintf("{base}(*) : `-a` option also need `-q` is set\n"); + cprintf("{base}(**) : Will not work if [COMMAND [ARGS]...] is like `/bin/su -`\n"); + cprintf("{base}(***) : You can use `-m [source] /` to mount a block device as root\n"); + cprintf("{base}(****): Each `-l` option can only set one of the cpuset/memory limits\n"); + cprintf("{base} for example: `ruri -l memory=1M -l cpuset=1 /test`\n"); cprintf("{base}{clear}\n"); } // For `ruri -H`. diff --git a/src/mount.c b/src/mount.c index ffd53116..8cdcacfb 100644 --- a/src/mount.c +++ b/src/mount.c @@ -155,6 +155,7 @@ static char *losetup(const char *img) // Mount dev/dir/img to target. int trymount(const char *source, const char *target, unsigned int mountflags) { + // umount target before mount(2), to avoid `device or resource busy`. umount2(target, MNT_DETACH | MNT_FORCE); int ret = 0; // Check if mountpoint exists.