diff options
author | Alexandru Avadanii <Alexandru.Avadanii@enea.com> | 2018-01-08 16:47:18 +0100 |
---|---|---|
committer | Alexandru Avadanii <Alexandru.Avadanii@enea.com> | 2018-01-08 15:50:53 +0000 |
commit | 4874ba30071630c6b96eb6ea912a4fe047e0d93c (patch) | |
tree | 6ce52ce6520080a026b2bd8a2f0f3d2817eb674c /mcp | |
parent | 5f1f119d8043793821b89e61a0830ce8505635ab (diff) |
lib.sh: Fix `modprobe -f` on Ubuntu
For some reason, `modprobe -f` for a clean nbd module (from vanilla
Ubuntu) fails with exec format error randomly, while a simple
`modprobe` works.
Change-Id: I79785e510cab757e2482baf442054be984c24019
Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
(cherry picked from commit 510a5fe446dea8513060813794c99e856eff1845)
Diffstat (limited to 'mcp')
-rw-r--r-- | mcp/scripts/lib.sh | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/mcp/scripts/lib.sh b/mcp/scripts/lib.sh index 1c51ece15..96a82efe5 100644 --- a/mcp/scripts/lib.sh +++ b/mcp/scripts/lib.sh @@ -38,8 +38,8 @@ function get_base_image { function __kernel_modules { # Load mandatory kernel modules: loop, nbd local image_dir=$1 - sudo modprobe -f loop - if sudo modprobe -f nbd max_part=8; then + sudo modprobe loop + if sudo modprobe nbd max_part=8 || sudo modprobe -f nbd max_part=8; then return 0 fi # CentOS (or RHEL family in general) do not provide 'nbd' out of the box @@ -104,7 +104,8 @@ function __kernel_modules { sudo mkdir -p "/lib/modules/${__uname_r}/extra/" sudo cp drivers/block/nbd.ko "/lib/modules/${__uname_r}/extra/" ) - sudo depmod -a && sudo modprobe -f nbd max_part=8 + sudo depmod -a + sudo modprobe nbd max_part=8 || sudo modprobe -f nbd max_part=8 } function mount_image { |