Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve #1415 to also explain where the USB device is mounted #1422

Merged
merged 3 commits into from Jul 27, 2017

Conversation

schlomo
Copy link
Member

@schlomo schlomo commented Jul 17, 2017

@gozora can you please check if this would work? I think it will help the users if we explain them why ReaR aborts and to give them a chance to fix it.

@@ -9,8 +9,8 @@ REAL_USB_DEVICE=$(readlink -f $USB_DEVICE)
StopIfError "USB device '$USB_DEVICE' is not a block device"

# Check if REAR-000 USB device is not accidentally mounted on other than $BUILD_DIR location.
if grep -v $BUILD_DIR /proc/mounts | grep -q "^$REAL_USB_DEVICE"; then
Error "USB device '$REAL_USB_DEVICE' is already mounted."
if res=$(grep -v $BUILD_DIR /proc/mounts | grep "^$REAL_USB_DEVICE" ) ; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remember that $res will contain whole line from /proc/mounts, not only mountpoint ...

@gozora
Copy link
Member

gozora commented Jul 17, 2017

@schlomo
Yes I think that might be useful information.

V.

@schlomo
Copy link
Member Author

schlomo commented Jul 17, 2017

@gozora please check & improve as you see fit and merge. I can't test it here and fully trust you. I simply thought that it is probably easier to just send you a PR with my thoughts in code than to describe them in text.

@gozora
Copy link
Member

gozora commented Jul 17, 2017

@schlomo I'll take a look on this, once I have that retry_command () story done ;-)

V.

@schlomo schlomo added the enhancement Adaptions and new features label Jul 17, 2017
@schlomo
Copy link
Member Author

schlomo commented Jul 17, 2017

@gozora here you go, only show the mount point :-)

if grep -v $BUILD_DIR /proc/mounts | grep -q "^$REAL_USB_DEVICE"; then
Error "USB device '$REAL_USB_DEVICE' is already mounted."
if res=( $(grep -v $BUILD_DIR /proc/mounts | grep "^$REAL_USB_DEVICE" ) ) ; then
Error "USB device '$REAL_USB_DEVICE' is already mounted on '${res[2]}'"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@schlomo you've nearly hit the right field ;-)

ERROR: USB device '/dev/sdb2' is already mounted on 'ext3'

V.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strange, I actually tested this one before:

$ res=( $(mount | grep '^/dev/sda1' ) ) ; echo "${res[2]}"
/boot/efi

Does your mount output look different?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

most probably because outputs from mount and cat /proc/mounts differ a bit:

centos:(/root)(root)# tail -n1 /proc/mounts
tmpfs /run/user/0 tmpfs rw,nosuid,nodev,relatime,size=50012k,mode=700 0 0

centos:(/root)(root)# mount | tail -n1
tmpfs on /run/user/0 type tmpfs (rw,nosuid,nodev,relatime,size=50012k,mode=700)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, dumb of me. Thanks!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anytime ;-)

@jsmeix
Copy link
Member

jsmeix commented Jul 18, 2017

And here I even see that I am 12 hours behind @gozora

Explanation:
I had looked directly at
e7dcb4e

@jsmeix
Copy link
Member

jsmeix commented Jul 18, 2017

@schlomo
yes, it a good training exercise for users
wo don't see after the ReaR error message
all their other mountpoints where it is also mounted
to exercise the iterative step-by-step approach ;-)

@jsmeix
Copy link
Member

jsmeix commented Jul 25, 2017

Now what I see under the "Files changed" tab of this pull request
it looks unexpected/strange to me because now it looks as if
this pull request contains several additionally changed files
that are not meant to be changed by this pull request.
Is this only a strange way what GitHub shows
or did this pull request get somehow broken?

@schlomo
Copy link
Member Author

schlomo commented Jul 25, 2017

Good catch, I think I need to push this again, will do so in the evening. This branch is definitively broken.

@jsmeix
Copy link
Member

jsmeix commented Jul 25, 2017

Some time ago such unexpected additionally changed files
happened also to me in one of my pull requests but I cannot
remember the reason. I think I vaguely remember it might
have been something like "git rebase" in my branch or so.

@schlomo
Copy link
Member Author

schlomo commented Jul 25, 2017

@jsmeix @gozora I fixed the branch by force pushing the correct commits into it. Please update your copy to try it out. Thanks a lot.

@gozora
Copy link
Member

gozora commented Jul 26, 2017

@schlomo I just finished testing. It looks OK for me.

V.

@schlomo schlomo merged commit 23b9fb8 into master Jul 27, 2017
@schlomo schlomo deleted the issue-1415-addon branch July 27, 2017 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Adaptions and new features fixed / solved / done
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants