WIne access to Server drive

Questions about Wine on Linux
User avatar
Bob Wya
Level 12
Level 12
Posts: 3068
Joined: Sat Oct 16, 2010 7:40 pm

Re: WIne access to Server drive

Post by Bob Wya »

@fargodwe

You could trying putting your question on the Ask Ubuntu site...
More eyes on the problem, could help! 8)

It's very puzzling why the manual mount cifs command works, but the equivalent systemd unit doesn't ... ?? :?

Bob
fargodwe

Re: WIne access to Server drive

Post by fargodwe »

Thanks Bob. I'm probably going yo wait a day or two and then do that. Feeling a little frustrated tonight ;)
fargodwe

Re: WIne access to Server drive

Post by fargodwe »

Well, I used to answer questions on the Ubuntu forums for quite a while, then quit any activity with straight Ubuntu because of some bad attitudes there. So guess what? Posted on Ask Ubuntu and immediately got 2 replies quite emphatically stating they only support Ubuntu, not it's derivates such as the Mint I'm running. Got that same sour taste back in my mouth. Hate those guys. So, I guess even though it said to contact Ubuntu support they won't support it. I'll try the linux mint forums some time, but for now I have such a bad taste in my mouth thanks to Ubuntu support again that I'm going to wait a while. Need to cool off and be able to smile again. :(
User avatar
Bob Wya
Level 12
Level 12
Posts: 3068
Joined: Sat Oct 16, 2010 7:40 pm

Re: WIne access to Server drive

Post by Bob Wya »

@fargodwe

I'm vocal about my distaste for derivative distributions ... But if an issue isn't due to packaging conflicts and/or missing packages - then it's really dumb to simply ignore all other legitimate questions ... :roll:
Oh well ... :cry:

Bob
fargodwe

Re: WIne access to Server drive

Post by fargodwe »

Yeah, everything I see about systemd sure looks the same in Ubuntu. I posted in the Mint forum and will see what happens.

Weird thing happened today in my testing. Modified the .mount slightly and the bad UNC went away (took off the user@password: on the What and added credentials file name to options). It no longer said bad UNC and instead said I needed to have vers=1.0 so I put that back in the options. Then it didn't like UID on the options so I took that off the options. Some place along the line it actually mounted it via command line systemctl enable. I thought GREAT!! Rebooted - nothing. Had ZERO error messages anywhere and the systemctl enable failed again. I think I'm just going to start completely over from scratch again and see what it says.

Thanks Bob!
User avatar
Bob Wya
Level 12
Level 12
Posts: 3068
Joined: Sat Oct 16, 2010 7:40 pm

Re: WIne access to Server drive

Post by Bob Wya »

@fargodwe

Ah! That's great to hear! 8)

Bob
fargodwe

Re: WIne access to Server drive

Post by fargodwe »

I am someday going to get it to work from the command line again with systemctl enable home-dave-shares-volume1.mount then not change it and try to figure out why it doesn't do the same at boot. For now I need to get back to it mounting when I use systemctl enable on the command line.
User avatar
Bob Wya
Level 12
Level 12
Posts: 3068
Joined: Sat Oct 16, 2010 7:40 pm

Re: WIne access to Server drive

Post by Bob Wya »

@fargodwe

Have you tried (again) using a complementary systemd automount unit?
I generally use these for my systemd network mounts - otherwise you can run into issues.

Bob
fargodwe

Re: WIne access to Server drive

Post by fargodwe »

i do have a .mount and a .automount. At this point, having gone through everything I could find, every sample I could find online for mounting a cifs share via systemd, and have officially gotten nowhere. Not a single reply on the Mint forum. I think it's time for me to just hang it up, get rid of the frustration, and go back to the frustration of having to mount it manually each time I log in. There have been points along the way when it appeared to work only to find it didn't. My mind is boggled and my frustration is just not worth it at this time. I REALLY appreciate all the help you have given me here. You made me aware of systemd and your samples got me going.
fargodwe

Re: WIne access to Server drive

Post by fargodwe »

Well, now the linux Mint forum CLOSED by post - said it was off topic!!!!
fargodwe

Re: WIne access to Server drive

Post by fargodwe »

Please ignore last post - linux Mint forum left my post OPEN. The message I received turned out to be a duplicate from askubuntu. Maybe there's still hope on Mint.
fargodwe

IT'S WORKING!!! Re: WIne access to Server drive

Post by fargodwe »

OK, I kept beating my head up against the wall but it looks like I finally have it working. I have rebooted twice so far and it has worked.

The first boot showed the share mounted twice and trying to open one ended up in some kind of loop where caja just kept opening windows. I finally had to just use the power button to power it off. Brought up linux in the recovery console and dropped to root shell. Got to thinking - two mounted, one .mount file and one .automount file. Removed the automount file and now it only shows the share mounted once.

How the heck did I get here? First I started over again with the .mount file, and the, well, I kept thinking about that invalid UNC error. While everything on the net indicates you can name a "what" via a userid@password://share path, I ended up taking off the userid@password: and that error went away. All I ended up with then was that the mount failed on timeout. Now dumb me, it took me a LONG time and multiple frustrating attempts to realize the userid and password needed for the share were no longer specified, so of course it would time out because it could never access the share.

I added back in the credentials= pointing to my my file with the userid and password (no group) in it. Bingo!

I also noticed the journal, the bootlog and syslog where getting big enough it was hard to find things, so I deleted those and reboot so they would get recreated.

So, I don't really understand the difference between now and what I was doing but hey it works!


A BIG thank you to Bob Wya. You stuck with me even though I'm a novice. You showed me systemd and the mount/automount so I could do some research. You stuck with me through all my frustrations - and in reading this thread you know there were a *LOT* of those!

I also want to thank spoon0042 for your input and also for the help you have given me in the past.

The both of you have made THE difference for this extreme novice having things work. I can completely promise you I could not have done ANYTHING in wine without the patience and great help you have both given me. You've given me the "umph" to decide dang it I guess I'll try it again on everything I have done with wine. The linux specifics of packages to install, everything on systemd, etc., have both helped me immensely but also helped me to learn some things.

I'll post the unit mount that is now working:

Code: Select all

Unit]
Description=cifs mount @ /home/dave/shares/volume1
Before=remote-fs.target
BindsTo=network.target
After=network.target

[Mount]
What=//192.168.0.1/volume1
Where=/home/dave/shares/volume1
TimeoutSec=15s
Type=cifs
Options=rw,vers=1.0,credentials=/home/dave/volume1.smb,file_mode=0770,dir_mode=0770,auto


[Install]
WantedBy=multi-user.target
Everything looks pretty much as you first showed me!

With me deepest gratitude! Dave


EDIT: crap. All I did was shutdown and reboot and now the dang thing isn't mounting again - with the same .mount file!! Help? Posting the last 2 reboots from the journal (output of journalctl --unit home-dave-shares-volume1.mount):

Code: Select all

-- Reboot --
Mar 07 14:02:04 dave-Aleena systemd[1]: Mounting cifs mount @ /home/dave/shares/volume1...
Mar 07 14:02:04 dave-Aleena systemd[1]: Mounted cifs mount @ /home/dave/shares/volume1.
Mar 07 14:34:26 dave-Aleena systemd[1]: Unmounting cifs mount @ /home/dave/shares/volume1...
Mar 07 14:34:26 dave-Aleena systemd[1]: home-dave-shares-volume1.mount: Succeeded.
Mar 07 14:34:26 dave-Aleena systemd[1]: Unmounted cifs mount @ /home/dave/shares/volume1.
-- Reboot --
Mar 07 14:35:08 dave-Aleena systemd[1]: Mounting cifs mount @ /home/dave/shares/volume1...
Mar 07 14:35:09 dave-Aleena mount[759]: mount error(2): No such file or directory
Mar 07 14:35:09 dave-Aleena mount[759]: Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) and kernel log messages (dmesg)
Mar 07 14:35:09 dave-Aleena systemd[1]: home-dave-shares-volume1.mount: Mount process exited, code=exited, status=32/n/a
Mar 07 14:35:09 dave-Aleena systemd[1]: home-dave-shares-volume1.mount: Failed with result 'exit-code'.
Mar 07 14:35:09 dave-Aleena systemd[1]: Failed to mount cifs mount @ /home/dave/shares/volume1.
I have no clue what the heck file it is talking about. I think I mentioned way back when that my system doesn't shut all the way down when I request a shutdown. I think it has something to do with my video not working correctly with amdgpu. At any rate, I always have to either hold down the power key until the backlight goes out or I have to do what is sort of the Chromebook hardware way of doing a power reset. I'm wondering if in that something happens to which the system doesn't think it shutdown cleanly and that is resulting in these strange errors. I spent $15 to buy a parts laptop and am going to see if with the parts I still have on the bench I can get it going. If so, I can test all of this on it and see if it's my unique firmware and hardware messing some of this up.
fargodwe

Re: WIne access to Server drive

Post by fargodwe »

I wonder if the file not found was referring to there no longer being a .automount? I put the automount back and have rebooted 3 times with it still working. It still show 2 occurrences of the share on the desktop at signin, but after a while 1 goes away. When I try to open the 1 remaining, the 2nd shows again - so I assume that's coming from automount. Maybe someone can explain to me why the 2 icons on the desktop. I would have assumed 1 was from the mount but it appears it goes through the automount to actually open it.
fargodwe

Re: WIne access to Server drive

Post by fargodwe »

Now that it seems like the mount at boot problem for my share has been solved with GREAT thanks to Bob Wya, I think it's time to go back to the original poster's question and show the step-by-step I took to get this working, hoping it is enough to get the original poster's question answered and helping others who may be viewing this thread looking for information to help them access a server in wine.

For me, a had a network drive with a folder called volume1 that I needed to access. If you want to be able to access the entire network drive you can leave off the "/volume1" in my examples. Of course you will need to replace everything to match your network and the volume you want to access. This path to your server disk and optional tree on it I call a network share. I'll try to use that in the rest of this post.

For wine, it seems you must first make the network share available in the normal linux file system. This is called mounting and you make a mount point (some file system folder) to make the contents available. In my case: After making the mount point (folder) then, for Ubuntu and I believe it's derivatives, you create 2 files that tell the system to mount this network share at boot or whenever it is referenced. Ubuntu uses something called system control to do all of this and a lot of other things. The files and folders for all of this are in the /etc/systemd folder. You need to create 2 files in a subfolder there: /etc/systemd/system for a systemd (system daemon) mount unit. It is important to remember 2 things with these files:
  • The name of the files MUST match the complete path to your mount point. So in my case, /home/dave/shares/volume1. For the file names you replace the "/"'s with a dash -> home-dave-share-volume1. There are 2 files with these names
    • the file name with a .mount suffix, in my case home-dave-shares-volume1.mount. Use the editor of your choice (I have used gedit for years) remembering "sudo" is needed to access the /etc/systemd tree. In my case home-dave-shares-volume1.mount.

      Code: Select all

      [Unit]
      Description=cifs mount @ /home/dave/shares/volume1
      Before=remote-fs.target
      BindsTo=network.target
      After=network.target
      
      [Mount]
      What=//192.168.0.1/volume1
      Where=/home/dave/shares/volume1
      TimeoutSec=15s
      Type=cifs
      Options=rw,vers=1.0,credentials=/home/dave/volume1.smb,file_mode=0770,dir_mode=0770,auto
      
      
      [Install]
      WantedBy=multi-user.target/[code][/list][/list][list]This file name path must also match the "where" in these files.
      The credentials= points to a file containing the userid and password to access the network share. In my case (I've replaced my actual userid and password) the contents of /home/dave/volume1.smb is as follows:

      Code: Select all

      user=xxxxxx
      password=xxxxxx
    • the file name with a .automount suffix, in my case home-dave-shares-volume1.automount. Use the editor of your choice (I have used gedit for years) remembering "sudo" is needed to access the /etc/systemd tree. My file looks as follows:

      Code: Select all

      [Unit]
      Description=cifs automount for /home/dave/shares/volume1
      Requires=network-online.target
      
      [Automount]
      Where=/home/dave/shares/volume1
      TimeoutIdleSec=15s
      
      [Install]
      WantedBy=multi-user.target
  • The "where" in each of these 2 files MUST match the path to your network share - in my case "/home/dave/shares/volume1".

I would suggest reading everything you can find on the systemd mount unit for your file type. I would NEVER have even know all of this existed, the contents of each of the files, etc. without the expert Bob Wya and reading a lot so I could understand more.

I rebooted each time I edited these files. It's pretty much the safest way to see if this all working.

At this point your network share should be available in your linux file tree. In my case I could find the contents of that share with the file explorer.

Once you have reached this point you can now configure your wine prefix to attach a drive letter to that mount point. First start winecfg for your wine prefix:

Code: Select all

<WINEARCH=winxx> <WINEPREFIX=<path to wine files> winecfg
If you did not specify "WINEARCH=" when you were installing a Windows program to wine, you do not need to specify it on the winecfg line as it has defaulted to 64bit Windows mode.

Similary, if you did not specify "WINEPREFIX=" when you were installing a Windows program to wine it has defaulted to the hidden folder in your home folder of .wine. While outside the scope of this post, I would strongly recommend reading the FAQ at https://wiki.winehq.org/FAQ#Wineprefixes.

When winecfg opens you will see a window showing tabs for how you can modify things for this wine prefix.
  • Click on the "Drives" tab.
  • Click on the "Add" button. Select a drive letter - in my case I selected "e".
  • This should now show a "e:" in the drives window
    winecfg3.jpg
  • Click OK
  • Single click on the "e:" to highlight it then click on "Browse".
    You will now see a file system tree. Navigate to your mount point - in my case home, then dave, then shares, then volume1.
  • winecfg4.jpg
  • Single click on your share.
  • Click the "OK" button.
  • Now you should see your selected drive letter showing in the drives window and the path to your mount point.
  • winecfg5.jpg
  • Click the "Apply" button.
  • Click the "OK" button and you are done.


Now in your installed program in wine you can access your network share as the drive letter you assigned. You can select your network share in the same way as you would any other file.



i hope this helps in some way. Again, EXTREME thank you to Bob Wya!
Locked