Solved Linux compatability, monitor files accessed by linux app

Anatoly_kch

Member

Reaction score: 1
Messages: 35

Hello, I'm trying to use one propiertary linux application with linux-c6-6.9 on FreeBSD 11.1 amd64. Application starts, but stops shortly with error in log file:
Code:
File shared access error 'v8stg://c:/1/FileStorage': ./src/storage.cpp(5013)"
I have no sources and can't contact support directly. But I think this is somehow filesystem related. In case with freebsd native applications I know I can use dtrace(1) to monitor applications file access like this:
Code:
dtrace -n 'syscall::open*:entry { printf("%s %s", execname, copyinstr(arg0)); }'
But I have no idea how to do it with Linux app running using linux(4). Any suggestions?
 
Last edited by a moderator:
OP
A

Anatoly_kch

Member

Reaction score: 1
Messages: 35

Just in case, after experimenting more with dtrace and asking on dtrace mailing list, finally, I've got the solution:
for 32-bit linux open calls:
# dtrace -n ':linux:linux_open:entry { printf("%s", copyinstr((uintptr_t)args[1]->path)); }'
for 64-bit:
# dtrace -n ':linux64:linux_open:entry { printf("%s", copyinstr((uintptr_t)args[1]->path)); }'
 

Kevin

New Member


Messages: 14

Hello! Did you manage to find out what is looking for 1C 8? error: v8stg://c:/1/FileStorage!
Please tell me which file was in your case? By chance he should not have been in the directory /compat/linux? Help me please!
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 13,907
Messages: 40,632

It would probably help immensely if we knew which application is giving this error message. Even if nobody knows this exact error message or the exact application we may still have some ideas where to look. At the moment we don't know when this happens, how it happens, and what it's actually looking for. For all I know it's your toaster that's giving you this error.

[Thread moved to 'Porting new software', that appears to be more appropriate location as the original question has very little to do with FreeBSD development]
 

Kevin

New Member


Messages: 14

Wow! It's cool so fast! I need to solve this problem before tomorrow or I'm dead!
In truth, I thought that Anatoly would be able to answer me! But with very little probability! If you help me, then I am saved! I'll put everything now please wait!
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 13,907
Messages: 40,632

Wow! It's cool so fast! I need to solve this problem before tomorrow or I'm dead!
I hope you've made proper funeral arrangements or at least have a backup plan in place. Chances are high you're not going to get a meaningful reply before that time.
 

Kevin

New Member


Messages: 14

This application 1c 8.3 in conjunction with postgresql! It is written under Linux Freebsd and does not support only the binary view! We solved the problem. The first with this program is the getifaddr and it started up safely, but when connected via gui to the server, it gives the error indicated above in the same gui! This application is for accounting! Very important in the CIS, almost all use it! This error says that it cannot get file access! To my suspicion, he lacks compat / linux / proc! Truth be told, I don’t know and can’t make a trace of a program in freebsd truss write the following: truss: could not find thread! Perhaps you could help me at least make a trace in freebsd under Linux emulation Linux! Thank you, I'm really looking forward to! Help me please! I'm in trouble! ERROR: truss: could not find thread! Thanks Thanks Thanks!
 

Kevin

New Member


Messages: 14

This: dtrace -n ':linux64:linux_open:entry { printf("%s", copyinstr((uintptr_t)args[1]->path)); }' not working!
dtrace: invalid probe specifier :linux64:linux_open:entry { printf("%s", copyinstr((uintptr_t)args[1]->path)); }: in action list: index 1 is out of range for :linux64:linux_open:entry args[ ]
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 13,907
Messages: 40,632

To my suspicion, he lacks /compat/linux/proc!
Well. That's easy to check, just look at the output of mount(8):
Code:
linprocfs on /compat/linux/proc (linprocfs, local)
linsysfs on /compat/linux/sys (linsysfs, local)

You should also see some kernel modules with kldstat(8):
Code:
10    1 0xffffffff81a2b000     478c linprocfs.ko
11    4 0xffffffff81a30000     30f8 linux_common.ko
12    1 0xffffffff81a34000     194c linsysfs.ko
13    1 0xffffffff81a36000    24ee0 linux.ko
14    1 0xffffffff81a5b000    22040 linux64.ko
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 13,907
Messages: 40,632

Kevin

New Member


Messages: 14

mount it's ok
Bash:
linprocfs on /usr/home/admin/builder/zhyper/tmp/templates/srv1c64/compat/linux/proc (linprocfs, local)
linsysfs on /usr/home/admin/builder/zhyper/tmp/templates/srv1c64/compat/linux/sys (linsysfs, local)
3    4 0xffffffff8241e000 2d28     linux_common.ko
4    1 0xffffffff82421000 195c     linsysfs.ko
5    1 0xffffffff82423000 6fc4     tmpfs.ko
6    1 0xffffffff8242a000 31e50    linux64.ko
7    1 0xffffffff82419000 2ec      dtraceall.ko
8    9 0xffffffff8245c000 7500     opensolaris.ko
9    9 0xffffffff82464000 3ac68    dtrace.ko
10    1 0xffffffff8241a000 5b8      dtmalloc.ko
11    1 0xffffffff8241b000 1898     dtnfscl.ko
12    1 0xffffffff8249f000 1d31     fbt.ko
13    1 0xffffffff824a1000 53360    fasttrap.ko
14    1 0xffffffff8241d000 bfc      sdt.ko
15    1 0xffffffff824f5000 6d80     systrace.ko
16    1 0xffffffff824fc000 6d48     systrace_freebsd32.ko
17    1 0xffffffff82503000 f9c      profile.ko
18    1 0xffffffff82504000 41f0     linprocfs.ko
19    1 0xffffffff82509000 237c     nullfs.ko
20    1 0xffffffff8250c000 37528    linux.ko
21    1 0xffffffff82544000 1820     fdescfs.ko


I’ll enter that 1c cannot find the file in the proc linux folder, linux crasy on the files in procfs ))! Help with truss I think I can handle and help many people who love freebsd to deliver 1c! I will definitely lay out the manul for setting up the 1c server if I can handle it!
 

Kevin

New Member


Messages: 14

used -f and truss: could not find thread ! I’m just trying to tread Mlyn, I would find what's the matter! By the way, I use linux64 1c x86_64 sorry forgot to write!
 

shkhln

Son of Beastie

Reaction score: 1,163
Messages: 2,547

As much as I love FreeBSD, I agree with shkhln , run this software on CentOS 7.5.

Oh, I know about the official Linux server, I don't necessarily trust it to be stable or have feature parity with Windows version. (Although this is not based on personal experience.)

Help with truss I think I can handle and help many people who love freebsd to deliver 1c! I will definitely lay out the manul for setting up the 1c server if I can handle it!

Just tracing the damn thing would be a multi-100 hour effort.
 

Kevin

New Member


Messages: 14

SirDice!
Believe it is trite, of course, I have already installed and even changed several functions in glibc (ifaddr and getaddrinfo) so that it starts everything works it remains only to find this error!
 

Kevin

New Member


Messages: 14

About truss in general, so that people know it is not needed to debug system calls!The recipe is as follows:
compile /usr/src/sys/modules/linux_common
compile /usr/src/sys/modules/linux64
compile /usr/src/sys/modules/linux
modules with debag option
Code:
make DEBUG=true -C /usr/src/sys/modules/linux_common clean cleandepend
make DEBUG=true -C /usr/src/sys/modules/linux_common
make DEBUG=true -C /usr/src/sys/modules/linux_common install

make DEBUG=true -C /usr/src/sys/modules/linux clean cleandepend
make DEBUG=true -C /usr/src/sys/modules/linux
make DEBUG=true -C /usr/src/sys/modules/linux install

make DEBUG=true -C /usr/src/sys/modules/linux64 clean cleandepend
make DEBUG=true -C /usr/src/sys/modules/linux64
make DEBUG=true -C /usr/src/sys/modules/linux64 install

kldunload linprocfs linsysfs linux linux64 linux_common
cd /boot/modules; kldload ./linux_common.ko ./linux64.ko ./linux.ko
Next debug log in /var/log/messages or dmesg
 

Kevin

New Member


Messages: 14

Found that 1c can not read data from temporary files mktmp types :
/tmp/tmp.*
. The question is still open! As something will find accomplish your goal!
 

Kevin

New Member


Messages: 14

Hello to all! I found the problem!The problem in flock in Linux is that it blocks and gives a label saying that general access does not work in freebsd in linuxator! Now I think they have a flock in GLIBC or a system call as well! And how does the flock work in freebsd and how does it differ from Linux?
 

checkpoint

Member

Reaction score: 11
Messages: 22

Kevin, please provide a solution here for 1C. Got to run that beast on FreeBSD as well, facing same issue.
 

checkpoint

Member

Reaction score: 11
Messages: 22

Ok, for those who are interested in how to run 1C:Enterprice proprietary software on FreeBSD under linuxulator, here is a solution: you have to disable one of the file lock mechanisms, either fcntl(F_SETLK) or flock(). This can be achieved by intercepting syscalls of a linux binary (1cv8c) and ignore one of the syscalls. To help with that I have written a simple tool nosyscall, you can get it here: https://github.com/Fabmicro-LLC/nosyscall

Usage for 1C users:
nosyscall -v -s 72:1=6 ./opt/1C/v8.3/x86_64/1cv8c

While running the binary it ignores linux syscall #72 (fcntl) when it is called with argument #1 equals to 6 (F_SETLK).
 
Top