Solved [SOLVED] Sh : cannot umount

src386

Member


Messages: 27

Hi everyone,
I'm writing a script to create a provision debian and archbsd jails.
At some point I need to run a command with jail with mount.devfs enabled.
It's ok but it makes a mountpoint like this :
Code:
devfs          1.0K    1.0K      0B   100%    /usr/jails/arch/dev
Wich is normal, but I want to umount this when it's not necessary anymore.
However I cannot get rid of this mount point.
In the end of the script, I added :
Code:
umount -f /usr/jails/arch/dev
But the mountpoint is still present.
I tried to add :
Code:
sleep 5
but it does not work.
If I run umount /usr/jails/arch/dev in my shell , it works.
But when the script does, nothing happens.
Any idea ? :\
Thank you

Here is the part of the script :
Code:
[...]
# Populate pacman keyring inside the jail
jail -c path=/usr/jails/$hostname mount.devfs command=/usr/bin/pacman-key --init
jail -c path=/usr/jails/$hostname mount.devfs command=/usr/bin/pacman-key --populate archbsd

# Clean
sleep 5
umount /usr/jails/$hostname/dev
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 7,420
Messages: 30,009

Re: Sh : cannot umount

There's probably something using /dev/ which prevents you from unmounting it. Most applications require /dev/ for certain devices (/dev/null for example). So I'm wondering why you want to unmount it if you keep the application running?
 
OP
OP
S

src386

Member


Messages: 27

Re: Sh : cannot umount

SirDice said:
There's probably something using /dev/ which prevents you from unmounting it. Most applications require /dev/ for certain devices (/dev/null for example). So I'm wondering why you want to unmount it if you keep the application running?
When the scripts ends, nothing should be running.
 

bsdkeith

Active Member


Messages: 120

Re: Sh : cannot umount

Is your script running as the root operator, normal users aren't normally allowed to mount/umount file systems.
Also, once a mount point (directory) has been created, it will remain until it is deleted (rmdir).
 
OP
OP
S

src386

Member


Messages: 27

Re: Sh : cannot umount

bsdkeith said:
Is your script running as the root operator, normal users aren't normally allowed to mount/umount file systems.
Also, once a mount point (directory) has been created, it will remain until it is deleted (rmdir).
Well the problem is not the mountpoint path
It's the mounted devfs filesystem on this mount point.I cannot unmount it.
 

fluca1978

Aspiring Daemon

Reaction score: 70
Messages: 735

Re: Sh : cannot umount

This is just a guess, but you execute two commands both with the mount.devfs, is that required also for the second command? I mean, after all the devfs should be already mounted and it could be that what you are seeing is just the result of a stacked twice-mount.

As another suggestion, verify the user the script is running by or open a shell at the end of the script and try to manually umount the filesystem to see what happens.
 
Top