3

I want to use a Windows based scan tool under Wine on Ubuntu 14.04. I'm following these instructions to get it set up, but when I try to create the symbolic link ( step 7 ) I get an error:

ln -s /dev/ttyUSB0 /dev/ttyS0
ln: failed to create symbolic link ‘/dev/ttyS0’: File exists

I want to access the USB device via a COM port like COM1.

In the Wine documentation, it says simply to make a direct link to the USB device:

ln -s /dev/ttyUSB0 ~/.wine/dosdevices/com2
2
  • 2
    You can't overwrite an existing (maybe virtual?) COM port (ttyS0). Try other numbers in increasing order until you find the first free name, e.g. /dev/ttyS1. I think that should help. If it does, tell me and I'll convert this to an answer, if not, also tell me and I'll try to think of something else.
    – Byte Commander
    Oct 15, 2015 at 19:58
  • @ByteCommander When I do an ls of /dev/tty* it seems that Ubuntu has automatically created 32 com ports, from 0 up to 31. I think the program will probably only search the first 3 or 4 com ports. Oct 15, 2015 at 20:54

1 Answer 1

3

Normally you have a pre-existing device node called ttyS0 on your system. For example, I have:

[romano:/dev] % ls -l /dev/ttyS0
crw-rw---- 1 root dialout 4, 64 oct 14 17:12 /dev/ttyS0

Giving the timestamp, the device is probably created by the udev daemon at boot.

If you do not have a real serial port / modem connected or you do not want to use it, nobody stops you from removing the device node:

rm /dev/ttyS0 

(add the necessary sudos around). After that, you can symlink /dev/ttyUSB0 to it.

I think the node will be recreated at next boot; otherwise you can regenerate it (after deleting the symlink) with:

[romano:/dev] % sudo mknod /dev/ttyS0 c 4 64           
[romano:/dev] % sudo chown root.dialout /dev/ttyS0
[romano:/dev] % sudo chmod 660 /dev/ttyS0
[romano:/dev] % ls -l /dev/ttyS0
crw-rw---- 1 root dialout 4, 64 oct 15 22:19 /dev/ttyS0
4
  • Ubuntu seems to automatically create ttyS0 up to ttyS31 on every boot. I deleted tty2 and created the link, but when I start the program under wine it doesn't see any com ports. Oct 15, 2015 at 20:58
  • 1
    Be careful, tty2 and ttyS2 are different beasts (the latter should be COM3)
    – Rmano
    Oct 16, 2015 at 5:34
  • @RobertS.Barnes That is a different problem (if it's not only a typo in your comment, mixing up tty2 and ttyS2). Please open a second question about making /dev/ttyS* COM ports visible to Wine applications. You should also accept this answer, as it solves the problem you first described. Maybe you want to edit your question after having written the second one to add a link to it though.
    – Byte Commander
    Oct 16, 2015 at 5:39
  • 2
    That's just a typo. Having to manually recreate the link on every boot doesn't seem like a viable option. Instead see the edit to my original question for what seems to be a viable solution. Also See here for the new question: askubuntu.com/questions/686019/… Oct 16, 2015 at 5:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.