Page 1 of 1

AGHH!!! Can't access shared folder!!! [SOLVED! Sort of...]

Posted: 12. Jul 2008, 15:26
by foggy1974
Hey guys,

Sorry for shouting in the title, but I am getting SO frustrated with trying to get access to a shared folder on my Linux Host from my XP guest.

System details:
Host - Ubuntu 8.04
Guest: Windows XP SP3
Firewall (on guest) - all turned off
VirtualBox 1.6.2 personal use (not OSE) with Guest Additions

Folders I have tried to access:
  1. Desktop - \steve\Desktop
  2. Shared file created for this -\home\steve\share
Have added all to the Settings -> Shared Folders in VBox...

How have I tried to access?
  1. From the shell - (cmd.exe):

    Code: Select all

    net use f: \\vboxsvr\<folder name> and
    net use f: \\vboxsvr\home\steve\<folder name>
    Both result in "Error 67 - The Network name cannot be found"
  2. Browsing 'entire network' - I can see:
    • Microsoft Windows Network -> Workgroup -> Vbdell -> 'Printers and faxes' / 'Scheduled tasks'
    • "VirtualBox Shared Folders" -> Empty
I've tried everything I can find off the net, including switching off all Firewalls on the guest and resinstalling the VirtucalBox Guest Additions (without removing it first, as instructed on the net in numerous locations). I have nothing left now to try - please can anyone help?!

PS I really don't know how to set up a Samba share but would be willing to give this a go, although this is the reason I wanted to use VirtualBox rather than VMWARE. If this may be an option, can anyone provide me with step-by-step instructions or a link to tell me exactly what I need to do?

Solved!!

Posted: 13. Jul 2008, 15:59
by foggy1974
Ok, finally solved this - not quite sure how but hope the following will help people:

I finally gave up on trying to get VirtualBox to use my specified shared folder as it should and instead attempted trying to set up a samba file share. Somewhere along the line of trying to get Samba working, VirtualBox sorted itself out!

Unsure of whether I needed to or not, I went into User and Groups (in Admin), unlocked the settings, chose Root then Properties. Selected the User Privileges tab and clciked "Share files in the local network". I also checked that my user account had this option selected (it did, by default). (I don't think any of this was necessary, you could probably try the next thing first and skip this bit - but I thought I should include it for completeness).

Next I went into the Synaptic package manager and searched for "Samba". "Samba-Common" was already installed but, above that, was the package "Samba" - I downloaded and installed that. Then I rebooted.

I then mounted my second internal hard drive manually and was trying to get the drive to automatically mount on boot (I wish there was an easier way of doing it that messing around with fstab - I find that very confusing and don't really understand it... if you're reading this and wondering what on earth fstab is, it's file found in /etc/ that stands for [I think[ file system table - it 'maps' a physical drive to a 'location' (e.g. "Home", etc) in the Unix file system, 'mounting' the drive).

I also (for whatever reason), tried one final time to reinstall the 'Guest Additions' Now, I may be a bit slow, but I couldn't actually work how to reinstall these - from within your VirtualBox environment (ie.e when your Virtual OS is actually running), choose (from the task bar) Devices, then "Install Guest Additions". If you look under 'Start' on the Windows OS, you will find, under 'all programs', a Virtual Box additions folder with the option to uninstall Guest Additions - DON'T DO THIS! I'm not sure why, but everywhere on the web tells you not to - just reinstall Guest additions from the taskbar -> Device -> Install Guest additions.

I tried this - and found that sometime, within the Windows OS, the Guest Additions install would start, and other times it wouldn't. If it doesn't start automatically, try browsing (in the Windows OS) to My Computer - I found that VirtualBox had 'mounted' what must be CD ISO image - so it looked like, in my CD drive, I had a CD containing the guest additions. I double clicked on this and the install started. (Note - after you've finished the install, the CD ROM appears to keep the 'guest additions' image. Right click on it and pick 'eject' and it goes away - once you've finished with it, obviously).

At this point I went into the VirtualBox Shared Folders (My Network places -> Entire Network -> VirtualBox Shared Folders) and was pleased to find that I could see my shared folder, //home/steve/share (shown as "\\XBOXSVR\share").

I saved a file there (from within XP) and switched to linux - and, sure enough, the file was sitting in the //home/steve/share file - excellent!! It was now working!

I have no idea at what point this was 'fixed' - I'd reinstalled Guest Additions a number of times and it was doing nothing, I also don't think it was adding 'share files' to the root account (once this was all working, I removed that option, and the shared files are still working fine). The Ubuntu 8.04 system I was using was brand new and fully patched, so it couldn't be any of that. The only thing I can think of is the Samba install I did (even though I just installed the package and didn't configure anything else).

The last thing I had to do then was share the actual drive that I wanted to see in both Ubuntu and the VirtualBox guest XP OS. This was much easier than it seems, I'll outline the steps here:
  1. I identified the drive I wanted to share - did this by opening a terminal window and typing 'sudo fdisk -l' (whcih prompts you for your password). This lists all the current physical drives in your computer. Typically hard drives start hda (e.g. hda1, hda2 etc), but in laptops, SCSI drives or SATA drives, these seem to be listed sda1, sda2 etc (no other diffeence from my perspective for this purpose). I knew my data drive was about 100GB and was in the NTFS file system (as it was created for use with windows), and I hence identified the drive to be sda3.
  2. I wanted to double check I had the right drive - I'd actually already mounted the data drive on my ubuntu desktop (this was done automatically when I clicked on the drive under Places), and I then (in the terminal window) typed 'mount'. This told me all drives that were mounted - and I could see sda3. I then right clicked on the data drive on the desktop, clicked 'unmount' and the drive disappeared from the desktop. I then returned to the terminal window and typed mount again - sure enough, sda3 was gone. I now knew I had the right drive.
  3. Final thing was to edit the fstab file to get the data drive to automatically mount. I did this by, within the same terminal window, typing 'gedit /etc/fstab'
    This opened the fstab file in the gedit editor.
  4. I added the following line to the file:

    Code: Select all

    /dev/sda3	/media/data   ntfs   user,fmask=0111,dmask=0000   0   0
    This wasn't the actual line I found on the 'net - I made the following changes:
    • I had to specify my drive in the first bit (i.e. sdfa3 - the example I found was [/b]hda1[/b]).
    • I specified where I wanted this mounted, and the 'share' name - so I created a directory in /media called 'data' and then told the fstab file to mount sda3 to 'media/data'. You could put the 'container' folder (called 'data' here) anywhere I guess, but it makes sense to put it in /media.
    • I specified 'ntfs' - the example I found was for 'ext3' (the linux file system). Everything I copied identically (i.e. everything from user,fmask onwards...)
    • I saved the file, exited the terminal and rebooted the whole computer.
  5. On rebooting into Linux, sure enough I now had my data drive automatically mounted on my desktop.
  6. The final thing was then go into VirtualBox, add this as a shared folder (poiinting the shared folder at /media/data), started the machine and browsed the XP network - and there was the data drive!
Important - it takes about 5-10 seconds to read your shared fodler - so don't be disillusioned if you double the click your share folder and it appears empty - give it a few seconds and you should see your files appear. I mapped this drive to F: (you can find out how to do this anywhere here by googling it - I won't cover that) and then pointed My Documents to the F: drive - so now I have seamless use of a shared data drive, and I'm delighted!

I know this is all really basic stuff for most people, but I really hope this can help some newbies like me!
[ModEdit: for readability]

Posted: 13. Jul 2008, 20:27
by TerryE
foggy1974,

I've gone through your post and solution, and I've got some comments:
  1. You are mapping tp \\vboxsvr and you don't seem to have configured samba through /etc/samba/smb.conf or added samba useres, so my guess is that installing samba is not relevant to solution. Try doing a /etc/init.d/sama stop. If sharing still works, then you can safely remove Samba.
  2. If you want to understand what fstab does do a man fstab. What you have done here is to mount a partition which contains an exiting NTFS using the ntfs-3g filesystem. Once it is thus mounted it looks just the same as any other file system at an application level within Linux.
  3. So by adding this folder to the VBox shared folders, and using the network browse function, you are now using the Shared Folder functionality as intended. I am not sure what you've changed in you VBox GA installation attempts, but you certainly seem to have fixed what was not working.

Posted: 13. Jul 2008, 22:31
by foggy1974
Thanks for the follow up - and I agree with what you say. There's no reason that I can think of that installing the Samba package should have any bearing but, as you have said, my shared folders are now working exactly as they should whereas they were not before! :-)

Also, with regard to man fstab, I'd read this and still not understood it (although I appreciate what it does, I wasn't quite sure on the instructions to add something to the fstab - hence copying something from the net and amending it for my own use). Can you suggest any other links to further explain fstab? I be really grateful!

It would be interesting to see if anyone else who has tried reinstalling Guest Additions and still not got shared folders working can have any joy by following this... :D

Posted: 14. Jul 2008, 01:03
by TerryE
The man entry is a good start, and its good when community members share their experiences. Any journey has to start at the beginning. A good test of when you are becoming an experienced VBox user is when you can come to the forum and answer other peoples Qs. Also looking at Qs, thinking "I can answer that" then looking at other posters answers is a good way to way to gain a deeper understanding of the product. //Terry