Thread Tools Display Modes
  #1  
Old 10-04-2012, 02:07 AM
SeanSeymour SeanSeymour is offline
Junior Member
 
Join Date: Jul 2012
Posts: 23
Thanks: 4
Thanked 2 Times in 2 Posts
Exclamation Undesirable behavior (bug?) in Mount Tray startup if devices were not unmounted
Hello,

When my system initially boots up, I have noticed that the Mount Tray icon is gray and only shows two options in the menu: Open Media Directory, and Close Tray. I closed it, then relaunched it via the Control Panel shortcut. The icon turned blue and my various partitions/slices showed up as expected.

I set all my internal ntfs partitions/slices to automount. Every time I did, it popped up a file browsing window and everything looked great. I also verifed that ~/.pc-automounttray was populated as expected.

Rebooted my pc to test it out, but on bootup I got the same behavior (gray icon with no drives).

I quit and restarted Mount Tray via the Control Panel again, and it once again listed all the drives, with Auto-mount checked by the ones that I set. However....none of them were mounted. And even if I explicitly try to mount them using the Mount Tray, nothing happens.

I then closed the Mount Tray and launched it from a terminal. Got this output:
Code:
Locale: "en"
pc-mounttray: starting up
-User detected: "Sean"
-File manager detected: "thunar"
-Loading automount device list: "/home/Sean/.pc-automounttray"
-Starting up the DEVD watcher
-Performing initial device scan
-Existing devices discovered:
- "/dev/ada0s1" -> "Movies-03" , "SATA:::NTFS"
Mounting device "/dev/ada0s1" on "/media/Movies-03" ( "NTFS" )
- command: "ntfs-3g /dev/ada0s1 /media/Movies-03"
pc-mounttray: Error creating mountpoint: "/media/Movies-03"
- Error message: ("mkdir: /media/Movies-03: File exists")
- "/dev/ada1s1" -> "Movies-01" , "SATA:::NTFS"
Mounting device "/dev/ada1s1" on "/media/Movies-01" ( "NTFS" )
- command: "ntfs-3g /dev/ada1s1 /media/Movies-01"
pc-mounttray: Error creating mountpoint: "/media/Movies-01"
- Error message: ("mkdir: /media/Movies-01: File exists")
…etc...
So I deleted /media/Movies-01 as a test and relaunched Mount Tray from the Control Panel. Sure enough, the Movies-01 directory was created and mounted.

I looked at the mountTray.cpp code and the offending line seems to be if( output.join(" ").simplified().isEmpty() in the "mountDevice" subroutine.

After thinking about it, I think I see why this bug exists. Mount Tray was most likely created for removable devices, so it was expected that the user would always unmount the device (which I see deletes the directory). However, I am using it to attempt to automount my ntfs partitions which are on internal drives. So I don't unmount them before rebooting, I just let the OS do it.

In case you say "Don't do this"...please check out my other post, which has been sadly neglected for far too long: http://forums.pcbsd.org/showthread.php?t=18060

Regardless, I think Mount Tray can react more appropriately to this situation. Ken, since this seems to be your baby, can you check this out and verify?

Thanks!
Sean
The Following User Says Thank You to SeanSeymour For This Useful Post:
Cousk1982 (09-29-2013)
  #2  
Old 10-04-2012, 12:00 PM
Beanpole's Avatar
Beanpole Beanpole is offline
Senior Member
 
Join Date: May 2010
Posts: 2,513
Thanks: 19
Thanked 444 Times in 360 Posts
Default
This actually sounds like there are two bugs you discovered.

1) Devices not found when the application starts up.
Solution: This sounds like the mount tray is simply starting up too quickly on your system (before your drives are finished being recognized by the system's startup). Try bumping up the sleep time in the startup script (/usr/local/share/pcbsd/xstartup/pc-mounttray.sh) from 10 to 20 and see if that fixes it.

2) Mounting devices that were not properly dismounted last time does not work.
Solution: It looks like I will have to add some code to clean up any "leftover" directories in the /media directory when the program starts up. I should get this done here soon.

Thanks for reporting these bugs!
__________________
~ Ken Moore ~
PC-BSD/iXsystems
  #3  
Old 10-04-2012, 01:13 PM
SeanSeymour SeanSeymour is offline
Junior Member
 
Join Date: Jul 2012
Posts: 23
Thanks: 4
Thanked 2 Times in 2 Posts
Default
Quote:
1) Devices not found when the application starts up.
Thanks Ken, but this does not seem to be the startup issue. I increased the sleep timer to 30 just to make sure, but it made no difference. Still got the gray icon with no drives listed. And before I rebooted, I deleted all the empty directories in /media to make sure that wasn't causing the issue either. So this one is still a mystery.

Quote:
2) Mounting devices that were not properly dismounted last time does not work.
Solution: It looks like I will have to add some code to clean up any "leftover" directories in the /media directory when the program starts up.
I'm not sure if this would be desirable either. Sometimes people mount devices in the media directory using fstab. Or I might happen to have directories there that have the same name as my device. Can't the mount command mount "onto" an existing directory? I thought that's the way it worked. Then you would see the files from the mounted item, and when the mounted item was unmounted then you would see the files (if any) that were in that existing directory previously. I thought that's the way mount worked on Linux, maybe it's different on BSD though.

Sean
  #4  
Old 10-04-2012, 01:29 PM
Beanpole's Avatar
Beanpole Beanpole is offline
Senior Member
 
Join Date: May 2010
Posts: 2,513
Thanks: 19
Thanked 444 Times in 360 Posts
Default
Originally Posted by SeanSeymour View Post
Thanks Ken, but this does not seem to be the startup issue. I increased the sleep timer to 30 just to make sure, but it made no difference. Still got the gray icon with no drives listed. And before I rebooted, I deleted all the empty directories in /media to make sure that wasn't causing the issue either. So this one is still a mystery.
Interesting... but if you restart it from the control panel afterwards it detects the drives just fine? This seems to imply that the startup device detection works, but is just not detecting the devices when it is run at bootup. What is your standard bootup procedure (autologin, fastboot scripts, etc..)?

Quote:
I'm not sure if this would be desirable either. Sometimes people mount devices in the media directory using fstab. Or I might happen to have directories there that have the same name as my device. Can't the mount command mount "onto" an existing directory? I thought that's the way it worked. Then you would see the files from the mounted item, and when the mounted item was unmounted then you would see the files (if any) that were in that existing directory previously. I thought that's the way mount worked on Linux, maybe it's different on BSD though.
Yeah, I came to the same conclusion when I started working on a fix. Instead, I implemented a simple check during the mounting process to see if the desired mount point already exists, then to re-use it if it is empty (i.e. not in use) rather than just failing immediately.

By the way, I just committed the fix to our current branch if you want to rebuild it on your system and try it out (need to have the developement-Qt system package).
Code:
svn co svn://svn.pcbsd.org/pcbsd/current/src-qt4 pcbsd-qt-source
cd pcbsd-qt-source/pc-mounttray
qmake-qt4 *.pro
su (then supply root password)
make install clean
Oh, make sure that the mount tray is closed before building the new version, otherwise you will get a "binary currently in use" error.. :-)
__________________
~ Ken Moore ~
PC-BSD/iXsystems
  #5  
Old 10-05-2012, 12:25 AM
SeanSeymour SeanSeymour is offline
Junior Member
 
Join Date: Jul 2012
Posts: 23
Thanks: 4
Thanked 2 Times in 2 Posts
Default
OK, I went to Control Panel > System Manager > System Packages > Development and installed Development-Debug and Development-Qt. Also had to install Subversion from the AppCafe. Followed your instructions to build the new version, mounted all my drives, rebooted...and it looks like this also fixed my startup bug! Two birds with one stone. Nice work, Ken. Thanks so much for the quick fix and the clear instructions. If you have time, could you also read my original post, which is the reason I am resorting to using Mount Tray for internal drives? It's still unresolved. http://forums.pcbsd.org/showthread.php?t=18060
  #6  
Old 10-05-2012, 04:15 PM
Beanpole's Avatar
Beanpole Beanpole is offline
Senior Member
 
Join Date: May 2010
Posts: 2,513
Thanks: 19
Thanked 444 Times in 360 Posts
Default
Glad that the fix worked great for you!

We also got that bug-fix commited just in time to be included in the 9.1-RC2 release. So that should not be a problem for anyone else once they upgrade to 9.1-RC2 or later.
__________________
~ Ken Moore ~
PC-BSD/iXsystems
  #7  
Old 10-05-2012, 06:50 PM
SeanSeymour SeanSeymour is offline
Junior Member
 
Join Date: Jul 2012
Posts: 23
Thanks: 4
Thanked 2 Times in 2 Posts
Default
Great, good to hear. By the way, I couldn't help but notice that you also committed a change to pc-mounttray.sh that bumps the sleep time from 10 to 20...I don't know if that is really necessary. PC-BSD already takes waaaay longer to boot up and load the desktop compared to my Windows 7 or my openSUSE installations. Adding 10 more seconds makes it that much more painful. And I don't think it's necessary for proper Mount Tray startup. After I built the new version of Mount Tray and it worked to solve my issue, I changed the pc-mounttray.sh sleep value to 1 second. It didn't impact Mount Tray at all, still loads properly and finds all my drives. I understand you might not want it set to 1 second by default for everyone, but I would recommend leaving the sleep value at 10 or even reduce it to 5 instead of bumping it to 20.
  #8  
Old 10-06-2012, 11:44 AM
Beanpole's Avatar
Beanpole Beanpole is offline
Senior Member
 
Join Date: May 2010
Posts: 2,513
Thanks: 19
Thanked 444 Times in 360 Posts
Default
The sleep time is just the time to wait before starting up the mounttray application. I figured that since all the other PC-BSD startup apps are set to 20 I should probably make the mount tray the same.... :-)

Actually, by setting the delay a bit higher, it should allow the computer to use more of its resources in starting up the desktop environment, rather than trying to start multiple applications in addition to the DE at the same time. This is much more important for slower computers, but it sounds like your computer is powerful enough that you should be able to "turn down" that delay without much of a performance hit.
__________________
~ Ken Moore ~
PC-BSD/iXsystems
  #9  
Old 10-06-2012, 02:01 PM
SeanSeymour SeanSeymour is offline
Junior Member
 
Join Date: Jul 2012
Posts: 23
Thanks: 4
Thanked 2 Times in 2 Posts
Default
Got it, that makes sense. Thanks Ken.
  #10  
Old 10-08-2012, 02:49 PM
helix helix is offline
Senior Member
 
Join Date: Feb 2012
Location: Slovenia
Posts: 140
Thanks: 54
Thanked 13 Times in 12 Posts
Default
I also had issue with my WD MyBook external USB drive. I remember having some issue with connecting it to previous 8.2 installation, but yesterday I remembered to try again, since my new install is on 9.1RC1
And to pleasant surprise disk got recognized and blueish icon in tray indicated there is mount option to MyBook.


After happily browsing and uploading my backup, I went in tray and choose "Unmount" option. After that, i disconnected drive.
Problems begin to creap up on me when I was uploading some photos to Fb. The select pop-up window was unresponsive and also I noticed MyBook option still in the locations on left-side. I had to kill Firefox, because this window for selecting files could not be closed in any way.
After that I opened Dolphin and there was still myBook showing and I think even rightclick option to Unmount (wich I clicked but then error was presented).

After reboot, access to volume is not possible. So I went on forum and found this thread, so like suggested installed devel tols, subversion and followed instruction for patch. But still no luck, instead of previous MyBook option in menu now i have two items in menu as option to un-mount: da0 and ses0


And if i click "Open media directory" PCMan gives me this picture:



Uploaded with ImageShack.us

Is there anything more I can do to access disk?

Last edited by helix; 10-08-2012 at 02:51 PM.
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:16 AM.


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.

Copyright 2005-2010, The PC-BSD Project. PC-BSD and the PC-BSD logo are registered trademarks of iXsystems.
All other content is freely available for sharing under the terms of the Creative Commons Attribution License.