Missing libtdsodbc.so in freetds-dev - MSSQL on Ubuntu - sql-server

I'm trying to get MSSQL working on Ubuntu 12.04 via ODBC, and I've followed these steps to the letter:
http://jamesrossiter.wordpress.com/2011/03/08/connecting-to-microsoft-sql-server-using-odbc-from-ubuntu-server/
However, this omits both of these files that are pointed at in odbcinst.ini:
Driver = /usr/lib/odbc/libtdsodbc.so
Setup = /usr/lib/odbc/libtdsS.so
So, I googled a bit and found this:
http://ubuntuforums.org/showthread.php?t=433435&page=2
So I followed those instructions and put libtdsodbc.so in /usr/lib/odbc/, but I still get this error:
Can't open lib '/usr/lib/odbc/libtdsodbc.so' : file not found, SQL state 01000 in SQLConnect
But...
root#ubuntu:/usr/lib/odbc# ls -la
total 552
drwxr-xr-x 2 root root 4096 Aug 19 20:12 .
drwxr-xr-x 62 root root 12288 Aug 19 19:41 ..
-rwxrwxr-x 1 root root 270608 Aug 19 20:00 libtdsodbc.so
I tried chmod 775 on that file, which explains the permissions. Still no luck.
Any ideas? I'm stumped. Would really love to get this working on my Linux box.
EDIT: I'm using Ubuntu 64-bit. I'm betting this is the problem. Hope that helps...
EDIT2: I tried manually getting the 64-bit package from here:
http://www.ubuntuupdates.org/package/core/precise/main/base/tdsodbc
And then I saw there was a file called this:
/usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so
Woo, maybe a 64-bit version, right?
So I pointed odbcinst.ini at it, and it didn't work.

sudo apt-get install freetds-dev
or
sudo apt-get install tdsodbc
now for 32-bit look in:
/usr/lib/i386-linux-gnu/odbc/libtdsodbc.so
or 64-bit:
/usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so

I have this solution:
# apt-get install stuff......
# Then:
LIBTDSODBC_FILE="$(find / | grep libtdsodbc.so | head -1)"
export LIBTDSODBC_FILE
echo "LIBTDSODBC_FILE: '$LIBTDSODBC_FILE'"
LIBTDSS_FILE="$(find / | grep libtdsS.so | head -1)"
export LIBTDSS_FILE
echo "LIBTDSS_FILE: '$LIBTDSS_FILE'"
printf "[freetds]\nDescription = MS SQL database access with Free TDS\nDriver = %s\nSetup = %s\nUsageCount = 1\n" "${LIBTDSODBC_FILE}" "${LIBTDSS_FILE}" >> /etc/odbcinst.ini \
&& printf '[mssql]\nDescription = Microsoft SQL Server\nDriver = freetds\nDatabase = database_name\nServerName = mssql\nTDS_Version = 8.0\n' >> /etc/odbc.ini \
&& printf '\n[mssql]\n' >> /etc/freetds/freetds.conf \
&& printf " host = %s\n" "${TDSHOST}" >> /etc/freetds/freetds.conf \
&& printf " port = %s\n" "${TDSPORT}" >> /etc/freetds/freetds.conf \
&& printf " tds version = %s\n" "${TDSVER}" >> /etc/freetds/freetds.conf \
&& cat /root/.odbc.ini \
&& cat /etc/odbc.ini \
&& cat /etc/odbcinst.ini
It's working well inside a Docker that is being compiled for AMD64 and ARM64

I ended up solving it with the help of this listserv post:
http://mailman.unixodbc.org/pipermail/unixodbc-support/2008-November/001842.html
Except:
Driver = TDS
Should be:
Driver = FreeTDS
That weird 64-bit driver I had to manually find was also relevant, and ignoring freetds.conf was the way to go.
Fun stuff.

Related

Unable to allocate new TLS context

I have postfix 3.3.0 and Active Directory on Server 2019. I want the connection to be secure and to validate the server certificate.
When trying to send an email, I am unable to and see this in syslog.
postfix/submission/smtpd[7432]: warning: dict_ldap_set_tls_options: Unable to allocate new TLS context -1: Can't contact LDAP server
Here's the contents of /etc/postfix/ldap-users.cf
bind = yes
bind_dn = {valid bind account}
bind_pw = {valid bind password}
version = 3
timeout = 20
size_limit = 1
expansion_limit = 0
start_tls = yes
tls_require_cert = yes
tls_ca_cert_file = /var/spool/postfix/mydomain.tld.crt
server_host = ldap://dc.mydomain.tld/
search_base = dc=mydomain,dc=tld
scope = sub
query_filter = (&(objectClass=person)(mail=%s))
result_attribute = mail
result_format = %s
With this configuration, postmap -q test#mydomain.tld ldap:/etc/postfix/ldap-users.cf works. openssl s_client -starttls ldap -connect dc.mydomain.tld:389 also works (no validation errors). Even with tls_require_cert = no, it still fails. When start_tls = no, everything works fine.
Before I specified tls_ca_cert_file, I imported my .crt into ca-certificates. The error I received was postfix/postmap[4994]: error: dict_ldap_connect: Unable to set STARTTLS: -11: Connect error. It seems Postfix doesn't read from the computer cert store. After testing with tls_ca_cert_file from my home, it changed to the error I'm getting now, -1. I first tried from /etc/postfix, then now chroot home (based on an Internet suggestion Postfix couldn't access it).
I realized I made the classic mistake of installing from the stock repositories, and ended up with an old version. I ended up compiling Postfix from source.
sudo groupadd postfix
sudo groupadd postdrop
sudo useradd -c "Postfix Daemon User" -d /var/spool/postfix -g postfix -s /bin/false -u 32 postfix
wget http://cdn.postfix.johnriley.me/mirrors/postfix-release/official/postfix-3.6.2.tar.gz
tar xzf postfix-3.6.2.tar.gz
sudo apt-get install libdb-dev gcc m4 make libsasl2-dev openssl libssl-dev libldb-dev libldap2-dev
cd postfix-3.6.2/
make makefiles CCARGS="-I/usr/include/openssl -I/usr/include/sasl/ -DUSE_TLS -DHAS_LDAP -DUSE_SASL_AUTH -DUSE_CYRUS_SASL" AUXLIBS="-lssl -lcrypto -lldap -llber -lsasl2"
make
sudo make install

How to find the scsi_host_template functions for a block device?

I was looking into the IO path of the Linux kernel, and towards the bottom in the function scsi_dispatch_cmd(), the driver code is invoked
rtn = host->hostt->queuecommand(host, cmd);
So, for my block device like /dev/sda/, is there a way to find out which hostt or scsi_host_template it is using. I want to check which function queuecommand is pointing to..
Just as a sketch of reflection on this subject.
In my machine for USB drive I can see this:
$ ls -l /dev/sdg
brw-rw---- 1 root disk 8, 96 Apr 27 01:21 /dev/sdg
$ ll /sys/dev/block/8\:96/device/drive
lrwxrwxrwx 1 root root 0 Apr 27 01:32 /sys/dev/block/8:96/device/driver -> ../../../../../../../../../bus/scsi/drivers/sd
So normally such block devices are handled through the regular Linux scsi disk driver. Which is related with e.g. usb handling:
$ lsmod | grep sd
sd_mod 49152 13
scsi_mod 225280 5 sd_mod,usb_storage,libata,uas,sg
In this particular case we can see the relation between queuecommand and mentioned drive:
$ grep queuecommand /proc/kallsyms
ffffffffc052be60 t uas_queuecommand [uas]
ffffffffc0582ad0 t queuecommand [usb_storage]
Now, being in Linux source dir:
$ grep -rnI '\.queuecommand =' | grep usb
drivers/usb/storage/uas.c:846: .queuecommand = uas_queuecommand,
drivers/usb/storage/scsiglue.c:609: .queuecommand = queuecommand,
Hope this will help you.

snmptrapd logging error- couldn't open udp:162 -- errno 98 ("Address already in use")

I am trying to receive a trap generated by a cisco router on my VM- Ubuntu 14.04. I can do a snmwalk so I guess snmp is working fine but I am not able to receive the traps generated by router on my VM.
a#ubuntu:~$ sudo /etc/init.d/snmpd restart
* Restarting network management services:
a#ubuntu:~$ sudo /etc/init.d/snmpd status
* snmpd is running
* snmptrapd is running
Here is what I have inside files-
/etc/default/snmpd-
export MIBS=
SNMPDRUN=yes
SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid -c /etc/snmp/snmpd.conf'
TRAPDRUN=yes
# snmptrapd options (use syslog).
TRAPDOPTS='-n -On -t -Lsd -p /var/run/snmptrapd.pid'
/etc/snmp/-
snmpd.conf-
rocommunity public
snmptrapd.conf-
disableAuthorization yes
snmp.conf-
mibs:
The command I am running for viewing the traps on VM-
a#ubuntu:/etc/snmp$ sudo snmptrapd -f -Lo -c snmptrapd.conf
couldn't open udp:162 -- errno 98 ("Address already in use")
I am confused since the port is being used by snmptrap itself-
a#ubuntu:~$ cat /etc/services|grep 162
snmp-trap 162/tcp snmptrap # Traps for SNMP
snmp-trap 162/udp snmptrap
a#ubuntu:~$ sudo netstat -lnp| grep 162
udp 0 0 0.0.0.0:162 0.0.0.0:* 6216/snmptrapd
a#ubuntu:~$ ps -ef | grep snmptrapd
root 6216 2076 0 10:43 ? 00:00:00 /usr/sbin/snmptrapd -Lsd -p /var/run/snmptrapd.pid
a 6493 2667 0 11:47 pts/8 00:00:00 grep --color=auto snmptrapd
Generating a trap from windows using SnmpTrapGen.exe leads to the same error.
Is there any way of solving this issue? I have googled a lot and stuck on this for days, any help will be very much appreciated.
Thanks a lot in advance!!
Port 162 can listen only with an application. If you get this error , you have an app already running which listens port 162 , those can be snmptrapd service or your own application for snmp traps. You should close one of the applications.

MinorFS: Installation

Hi i want to install MinorFS 0.3.5 to my computer. My Ubuntu version is 14.04 LTS. But i had some problems while installing the program.
Firstly i installed all fuse modules and gcc and run the script install.pl.
The program is designed for Ubuntu 8. As a result it wants to install fuse module to start the script install.pl.
But there is not a loadable fuse module for Ubuntu 14.04 LTS. I research about it and i see that, for the latest version of Ubuntu, the kernel is configured to include FUSE instead of compiling it as a module. So, i modified the perl code in install.pl and
install the script.(I install fuseiso with command apt-get install fuseiso just in case.)
Everyting is great for the moment. But for the next step, i run the command on terminal "/etc/init.d/minorfs start ".
And i get this error : " The path specified in /var/minorfs/viewfs.startcap is not a valid base dir for minorviewfs
"
This command runs the minorcapfs and minorviewfs i guess.Minorcapfs run succesfully but for minorviewfs i got this error.
The code which gives the Error writen below:(in minorviewfs file)
unless (-d $basepath) {
print STDERR "The path specified in $VARDIR/viewfs.startcap is not a valid base dir for minorviewfs\n";
exit 1;
}
Then for test, i print my " $basepath " and it's : /mnt/minorfs/cap/61ce0488ac06eba530e178a0d1716ec576b47f71
I couldn't solve this error.
Please help me to get rid of this problem.
Thank you!
I solved the problem with manually making a directory with the mkdir command. Now the script work. But now I have a different problem. The output is ;
Starting MinorFs filesystems minorcapfs going into background, consult syslog for information minorviewfs going into background, consult syslog for information.
Then when i run the command ls -la /mnt/minorfs/priv
i should get a links to the folders. But I have nothing.
dr-xr-xr-x 1 root root 0 Jan 1 1970 .
lrwxrwxrwx 1 root root 0 Jan 1 1970 home ->
lrwxrwxrwx 1 root root 0 Jan 1 1970 tmp ->
So i looked the system log file with gedit /var/log/syslog and i see that Error;
Sep 1 13:51:37 burak-UX31A minorcapfs[3581]: Problem in Fuse::main at /usr/local/bin/minorcapfs line 340
Sep 1 13:51:37 burak-UX31A minorcapfs[3581]: user: 0 1001 ; group 104 104 104 104 at /usr/local/bin/minorcapfs line 341
Sep 1 13:51:37 burak-UX31A minorcapfs[3581]: Probably a problem accesing /dev/fuse at /usr/local/bin/minorcapfs line 342
Sep 1 13:52:01 burak-UX31A minorviewfs[3584]: Use of uninitialized value in subroutine entry at /usr/lib/perl5/Fuse.pm line 147, line 26.
And this the MinorCapfs code ; http://codepad.org/nUUJ3b5m
How to get rid of this problems? Thank you.

ELDK gcc linker error in ld.so.1

I have ELDK-3.1 installed in a Ubuntu box working perfectly.
In another machine, running 64 bits OpenSuse 12.1, I cloned the ELDK installation and, for some time it worked very well.
Now when I try to configure my projects I see:
configure: error: C compiler cannot create executables
See `config.log' for more details
And the log shows:
configure:3411: ppc-linux-gcc conftest.c >&5
/opt/ELDK-3.1/usr/bin/../lib/gcc-lib/ppc-linux/3.3.3/../../../../ppc-linux/bin/ld: warning: ld.so.1, needed by /opt/ELDK-3.1//usr/../ppc_8xx/lib/libc.so.6, not found (try using -rpath or -rpath-link)
/opt/ELDK-3.1//usr/../ppc_8xx/lib/libc.so.6: undefined reference to `_dl_lookup_versioned_symbol_skip#GLIBC_PRIVATE'
...
The file ld.so.1 is in the same directory as libc.so.6.
s -l /opt/ELDK-3.1//usr/../ppc_8xx/lib/ld.so.1
lrwxrwxrwx 1 root root 11 Jan 31 11:43 /opt/ELDK-3.1//usr/../ppc_8xx/lib/ld.so.1 -> ld-2.3.1.so
As far as I can see, I am correctly defining all the needed environment and trying to build using exactly the same build system as in the Ubuntu box (the project is "automaked").
So I wrote a script trying to mimic everything my automaked configure does:
#!/bin/bash
if [ ! -f confdefs.c ]; then
cat > confdefs.c << EOF
/* confdefs.h */
#define PACKAGE_NAME "xyz"
#define PACKAGE_TARNAME "xyz"
#define PACKAGE_VERSION "1.00"
#define PACKAGE_STRING "xyz 1.00"
#define PACKAGE_BUGREPORT "<contact#company>"
#define PACKAGE_URL ""
#define PACKAGE "xyz"
#define VERSION "1.00"
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
EOF
fi
ARCH=powerpc
export CROSS_COMPILE=ppc_8xx
TOOLCHAIN=ppc-linux-
TOOLCHAIN_ROOT=/opt/ELDK
LD=`which ${TOOLCHAIN}ld`
CC=`which ${TOOLCHAIN}gcc`
GCC=$CC
export CFLAGS="-Wall -g -I${TOOLCHAIN_ROOT}/ppc_8xx/usr/include/"
export CPPFLAGS=$CFLAGS
# export LDFLAGS="-shared"
$CC $CFLAGS $LDFLAGS confdefs.c -o confdefs
This gives me exactly the same error as configure.
If I uncomment the line export LDFLAGS="-shared", on the other hand, it builds perfectly!.
> ls -l confdefs
-rwxr-xr-x 1 myself users 16136 Fev 1 09:52 confdefs
> file confdefs
confdefs: ELF 32-bit MSB shared object, PowerPC or cisco 4500, version 1 (SYSV), dynamically linked, not stripped
Could anybody here please give me any clue of what I am missing so that my projects work finely on one box and not in the other?
Thanks!
I'm not 100% sure that it solves all problems, but it works for us.
We discovered that symlink "ld.so.1 -> ../../../ppc_8xx/lib/ld.so.1" to eldk-3.1/usr/ppc-linux/lib solves linking error.
I suspect something changed with environment between F15 and F16. Same for OpenSUSE (11->12).
Also bug was submitted against Fedora https://bugzilla.redhat.com/show_bug.cgi?id=754695 which was terminated as intentional ABI changes.

Resources