From 3a7320e5cc76a9fb8d478a3cfd6b44a1377d9ca7 Mon Sep 17 00:00:00 2001 From: Jonathan Sloan Date: Sat, 3 Dec 2022 03:15:30 -0500 Subject: [PATCH] Fix sed busy (#2426) * fix sed device or resource busy errors Signed-off-by: Jonathan Sloan * update info Signed-off-by: Jonathan Sloan * update docs Signed-off-by: Jonathan Sloan * log and fail if config is a mountpoint Signed-off-by: Jonathan Sloan * correct mountpoint check Signed-off-by: Jonathan Sloan Signed-off-by: Jonathan Sloan --- docs/supported-providers.md | 12 ++++++------ openvpn/start.sh | 5 +++++ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/docs/supported-providers.md b/docs/supported-providers.md index 37c908d9e..a45437815 100755 --- a/docs/supported-providers.md +++ b/docs/supported-providers.md @@ -130,12 +130,12 @@ Compose sample: - OPENVPN_PASSWORD=pass ``` -### If you only need to mount one file +### Do not mount single config file -You might not need to mount a folder of configs. You may just have one config file you want to use. -In that case you can just mount it directly. Mounting it as `default.ovpn` will let you omit `OPENVPN_CONFIG` as well. +Do not mount a single config directly. The container will fail if you try, since it causes sed errors when modify-openvpn-config.sh is executed. +Instead mount the directory where the config exists. -Compose sample: -``` - - /volume1/docker/ipvanish/my-preferred-config-file.ovpn:/etc/openvpn/custom/default.ovpn +```bash +sed: cannot rename /etc/openvpn/custom/sedHeF3gS: Device or resource busy ``` + diff --git a/openvpn/start.sh b/openvpn/start.sh index 7d730d30f..c900bd72b 100755 --- a/openvpn/start.sh +++ b/openvpn/start.sh @@ -159,6 +159,11 @@ if [[ -z ${CHOSEN_OPENVPN_CONFIG:-""} ]]; then fi fi +# log message and fail if attempting to mount config directly +if mountpoint -q "$CHOSEN_OPENVPN_CONFIG"; then + fatal_error "You're mounting a openvpn config directly, dont't do this it causes issues (see #2274). Mount the directory where the config is instead." +fi + MODIFY_CHOSEN_CONFIG="${MODIFY_CHOSEN_CONFIG:-true}" # The config file we're supposed to use is chosen, modify it to fit this container setup if [[ "${MODIFY_CHOSEN_CONFIG,,}" == "true" ]]; then