Can't mount shared folder in Centos guest

Discussions about using Linux guests in VirtualBox.
Moltke
Posts: 22
Joined: 20. Jul 2016, 21:19

Re: Can't mount shared folder in Centos guest

Post by Moltke »

Perryg wrote:Yes but there should be an exit 0 as the last line, and your command would be above that or it will not run. The options negate any chmod you would think you needed to do.
I added the exit 0 line, then added right above it the "mount -t vboxsf -o rw,uid=1000,gid=1000 shared /media/shared" line, then rebooted but it didn't work. In fact, I got a "oh no! something has gone wrong and...." error message. I pressed ctrl+alt+f2 to get to a console and re-edit the file to delete the added lines, rebooted and then I could get to the desktop. I don't know, maybe I'm doing it the wrong way not sure. I'll keep trying and will let you know whether it worked or not. By the way, I know is not good practice to do so, but I just copied/pasted the command you gave me into the terminal, of course I changed "shared" for the actual name of the folder. Could that be the problem? I wonder if I have to change 1000 for my user name ?? Sorry, I'm really new at this. I mean, I know some basics but haven't touched .config files from the OS. Thanks!
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Can't mount shared folder in Centos guest

Post by Perryg »

What version of centos are you using? I will try to build one and see what is going on.
Moltke
Posts: 22
Joined: 20. Jul 2016, 21:19

Re: Can't mount shared folder in Centos guest

Post by Moltke »

Perryg wrote:What version of centos are you using? I will try to build one and see what is going on.
I'm using CentOS 7. And running cat /etc/centos-release shows: CentOS Linux release 7.3.1611 (Core)
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Can't mount shared folder in Centos guest

Post by Perryg »

So core is usually command line only is that what you use?
Post the guests log file ( as an attachment ). Right click on the guest in the Main Manager then click show log. Save and post as an attachment. Compress if it is too large to post.
Moltke
Posts: 22
Joined: 20. Jul 2016, 21:19

Re: Can't mount shared folder in Centos guest

Post by Moltke »

Perryg wrote:So core is usually command line only is that what you use?
Post the guests log file ( as an attachment ). Right click on the guest in the Main Manager then click show log. Save and post as an attachment. Compress if it is too large to post.
Let me see if I get this right, you're asking for the log file from the VM manager? If that's the case, I see 4 of them; VBox.log, VBoxHardening.log, VBox.log.1, VBox.log.2, VBox.log.3 Which one should I save? All of them? And yes, I did install CentOS 7 minimal iso, which has no desktop but command line only, however, I installed XFCE desktop cause I really like both: CentOS and XFCE desktop. Forgot to mention, host OS is windows 7 x64. Thanks for taking the time helping me with this. By the way, I want to know if I can make shared folder permanent without having to run the mount command every boot, but I just realized that I can copy everything from that folder to the VM so it won't care if it is mounted or not, since I don't need to work directly from it.
Well, I'm attaching a zip file with all of it, hope it helps! and thanks again man!
Attachments
logs.zip
(103.11 KiB) Downloaded 10 times
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Can't mount shared folder in Centos guest

Post by Perryg »

Thanks, this is enough to diagnose. It is late here and I have meetings in the morning but I will take a look tomorrow and see what is going on.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Can't mount shared folder in Centos guest

Post by Perryg »

I managed to get the mount to work at boot using the command line (core) only, no DT.

It seems cent has changed a few things and you need to add the statement to the /etc/rc.d/rc.local since /etc/rc.local is a symlink in their OS. They also do not use the exit 0 like almost all of the rest do so remove that line. Finally I see you still have auto-mount selected in the VBox settings and that might cause an issue, so remove that while the guest is shut down ( not saved state ) and select permanent instead. See how that goes. Oh and I never use /media for share mounts. I instead use /mnt just because I am old fashion and the various distros use /media for their removable media and that can tork permissions depending on the OS.
centos_7_core-shared-folder.png
centos_7_core-shared-folder.png (24.56 KiB) Viewed 4755 times
Moltke
Posts: 22
Joined: 20. Jul 2016, 21:19

Re: Can't mount shared folder in Centos guest

Post by Moltke »

Well, that was fast! I didn't expect an answer so soon, thank you for taking the time to make it happen! But it didn't work, I even created a new directory using mkdir /mnt/shared which is different from the previous one where I used mkdir /media/shared, so I could do it your way. Also, I tried something I read in virtualbox help, which is about adding this line: sharename mountpoint vboxsf defaults 0 0 to /etc/fstab, didn't work either, maybe I did it wrong not sure. I guess I'll have to copy everything from that folder into the VM so I can use it. Thanks again for your time helping me with this. I'll keep looking for a way to be able to get the shared folder mounted at boot. I'll let you know if I succeed.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Can't mount shared folder in Centos guest

Post by Perryg »

If I were you, As a test, I would create a new ( core ) install add the guest additions and see if what I posted works for you. Should be fairly fast since it is just the core. If so then you know it must be something you have already done that is causing a problem.
Moltke
Posts: 22
Joined: 20. Jul 2016, 21:19

Re: Can't mount shared folder in Centos guest

Post by Moltke »

Mmm..something I did? Well I did disable selinux because of the VM didn't boot properly, and I read on the web about that being the solution to it. I don't know whether that might have something to do with this, but it is the only thing I can recall I've done so far apart from installing software. And I might reinstall centos because I'm facing the same "oh no something has gone wrong...." error and can't get into the desktop. :(
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Can't mount shared folder in Centos guest

Post by Perryg »

Adding DT to core is not as easy as one would think. There are a lot of depends and missing one can cause all kinds of issues. I build my own OS from source and can tell you that even after it is working I usually find that I too missed something. Not that it can't be fun, it is, and the added benefit that it usually works far better than one that is pre-made with all the clutter and needless packages. I have found over the years that the Debian base is my preference when it comes to packages, probably because the logic is more in-tune to my own, but that is just a personal preference. As for SELinux causing issues, I believe it does and for my own part I never use it. It would be alright if the database was up-to-date all the time but I find that adding my own entries is much too time consuming, especially since I do everything from source. Anyway the new install was just a way to test. That way you can verify that it will or will not work for you and maybe even point to what the issue is on your main build.
Moltke
Posts: 22
Joined: 20. Jul 2016, 21:19

Re: Can't mount shared folder in Centos guest

Post by Moltke »

Well, it seems I managed to solve the "oh no something has gone wrong..." error and now I'm able to reach the desktop. Apparently, the problem was caused by the gdm, I replaced it for lightdm and so far so good :) I'm googling whether it's possible to completely remove gdm from the system but it looks like it's not, is it? Regarding the shared folder, I think I'm just going to mount it manually every boot, for now, to get access to it and then I'll copy things into the VM so I can use them. I'll keep trying, I'll let you know when I succeed, which I will :)
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Can't mount shared folder in Centos guest

Post by Perryg »

possible to completely remove gdm from the system but it looks like it's not, is it?
Maybe but you have to watch out for meta packages. The safest way to try and see is to make a copy of the guests folder and all its contents to a safe location. That way if you break it you can always put the original back overwriting the bad one and you are back to a working copy.
Moltke
Posts: 22
Joined: 20. Jul 2016, 21:19

Re: Can't mount shared folder in Centos guest

Post by Moltke »

I found this: https://tournasdimitrios1.wordpress.com ... emove-gdm/ and says it is possible to remove gdm but to be honest, I don't get much of it, not sure what it says, by the looks of it, seems like I'll end up with a command line only, maybe I'll try following your advice and see how it goes.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Can't mount shared folder in Centos guest

Post by Perryg »

Actually you would be time ahead if you create the second guest to do your testing in. Start with core and do not install gdm to start with, then compare the package list with the other guest. But, in any regards practice makes perfect and the more you work with it the better you will get.
Post Reply