guysoft / CustomPiOS

A Raspberry Pi and other ARM devices distribution builder
GNU General Public License v3.0
509 stars 146 forks source link

Force unmount mount points #131

Closed pablosproject closed 3 years ago

pablosproject commented 3 years ago

During the build process, it happened that the resources to unmount at this line were currently busy. https://github.com/guysoft/CustomPiOS/blob/c61b80e5dc27cf98daab55abfc6a77ac30d381da/src/common.sh#L229

In my builds I solved with the following snippet, killing the process using the busy resource:

if [ "$RUN_IN_DOCKER" == "yes" ]; then
    # Release docker retained /dev
    fuser -cuk /dev
fi

Would it be harmful to force detach the mount point using sudo unmount -lf $m? Or at least catch it and show who is using the mount point in case of failing mount.

guysoft commented 3 years ago

That would be

if  [ -f /.dockerenv ]; then
    # Release docker retained /dev
    fuser -cuk /dev
fi
pablosproject commented 3 years ago

Does this apply to /proc also?

guysoft commented 3 years ago

@pablosproject I don't know, I don't think so, proc i think is not a normal OS, i think in a way its always busy.

pablosproject commented 3 years ago

In the related issue the problem was with /proc mount being busy. More in general, do you think we can overcome all issues by simply forcing unmount all mounted points?

guysoft commented 3 years ago

Unmounts fail for a reason. "Errors should never pass silently. Unless explicitly silenced."

pablosproject commented 3 years ago

Makes lot of sense