VMware 12.1.1 and 4.7.0-1

VMware 12.1.1 and 4.7.0-1 [openSUSE Tumbleweed (20160730) (x86_64)]:

1. VMware Virtual ethernet module:

/usr/lib/vmware/modules/source/vmnet-only/netif.c: In function ‘VNetNetifStartXmit’:
/usr/lib/vmware/modules/source/vmnet-only/netif.c:468:7: error: ‘struct net_device’ has no member named ‘trans_start’; did you mean ‘mem_start’?
    dev->trans_start = jiffies;
       ^~

Robert Gadsdon’s solution was to remove that line entirely:
http://rglinuxtech.com/?p=1746

Also virtualbox developers did basically the same:
https://www.virtualbox.org/ticket/15444
https://www.virtualbox.org/changeset/61429/vbox

VMware and 4.6.1-1

Today while trying to compile kernel modules for VMware Workstation 12.1.1 + 4.6.1-1-default [openSUSE Tumbleweed (20160422) (x86_64)] I got two compilation errors:

1. VMware Virtual ethernet module:

/usr/lib/vmware/modules/source/vmnet-only/userif.c:116:13: error: too many arguments to function ‘get_user_pages’
    retval = get_user_pages(current, current->mm, addr,
             ^

2. VMware Virtual machine monitor:

/usr/lib/vmware/modules/source/vmmon-only/linux/hostif.c:1165:13: error: too many arguments to function ‘get_user_pages’
    retval = get_user_pages(current, current->mm, (unsigned long)uvAddr,
             ^

VMware Community member alexsandr1981 has the correct answer in the discussion, which is to replace every get_user_pages call with get_user_pages_remote calls.
After replacing the original tar, the compilation succeeded for me.

VMware and linux 4.0.5-3

Today on openSUSE Tumbleweed, the usual module recompilation with

vmware-modconfig --console --install-all

failed, with

Unable to parse gcc version

This is because the guys releasing Tumbleweed started compiling everything with gcc 5, even the kernel, which made the vmware-modconfig unhappy:

workstation:/tmp # uname -a
Linux workstation 4.0.5-3-desktop #1 SMP PREEMPT Thu Jun 18 15:11:06 UTC 2015 (56152db) x86_64 x86_64 x86_64 GNU/Linux
workstation:/tmp # cat /etc/os-release
NAME=openSUSE
VERSION="20150702 (Tumbleweed)"
VERSION_ID="20150702"
PRETTY_NAME="openSUSE 20150702 (Tumbleweed) (x86_64)"
ID=opensuse
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:opensuse:opensuse:20150702"
BUG_REPORT_URL="https://bugs.opensuse.org"
HOME_URL="https://opensuse.org/"
ID_LIKE="suse"
workstation:/tmp # vmware --version
VMware Workstation 11.1.0 build-2496824
workstation:/tmp # tail -n 6 /tmp/vmware-root/vmware-14006.log
2015-07-07T22:43:30.926+02:00| modconfig| I120: Trying to find a suitable PBM set for kernel "4.0.5-3-desktop".
2015-07-07T22:43:30.926+02:00| modconfig| I120: No matching PBM set was found for kernel "4.0.5-3-desktop".
2015-07-07T22:43:30.926+02:00| modconfig| I120: Found compiler at "/usr/bin/gcc"
2015-07-07T22:43:30.929+02:00| modconfig| I120: Got gcc version "5".
2015-07-07T22:43:30.930+02:00| modconfig| I120: Unable to parse gcc version
2015-07-07T22:43:30.932+02:00| modconfig| I120: We are now shutdown. Ready to die!
workstation:/tmp #

Here is a remedy from rainerklier posted in this vmware community link.

cd /usr/lib/vmware/modules/source
tar -xf vmnet.tar
cd vmnet-only
make
cd ..
tar -xf vmmon.tar
cd vmmon-only
make
cd ..
cp vmmon.o /lib/modules/`uname -r`/misc/vmmon.ko
cp vmnet.o /lib/modules/`uname -r`/misc/vmnet.ko
depmod -a
/etc/init.d/vmware restart

Linux, Flash and DRM content playback

Currently Chromium’s and Chrome’s Pepper Plugin Api (PPAPI) flash doesn’t have DRM support and it looks like a “won’t fix”, so if you want to play DRM-enabled flash content on Linux natively, (and by that I mean without running Windows plugins in Wine like Pipelight does) then you are left with the ancient abandoned Linux Flash plugin.
Since it’s abandoned, it depends on ancient libhal libs, that your current distro probably doesn’t provide, or at a cost of dependency hell.

But, Chris Horler has this project on github, which is a very lightweight, (no dependency hell)

libhal stub library forwarding to UDisks

, basically the library that flashplayer depends on when dealing with DRM -enabled media.

If you don’t want to compile it for yourself, then for openSUSE the usual suspect is the
the libhal1-flash search term on software.opensuse.org

Probably it’s just me, but for Ubuntu the PPA search is hardly usable. Anyhow for my Precise machine I used flash-hal-helper from Chris Coulson’s PPA

Oh and in case you don’t know how to test ( or you don’t even know what I am talking about), then here is _THE_ test case, quote from Chris Horler’s site:

Enter this into your browser:
http://drmtest2.adobe.com:8080/SVP/SampleVideoPlayer_FP.html
Enter this into the form:
http://drmtest2.adobe.com:8080/Content/anonymous.f4v
Press play.

Java: “Your Security Settings Have Blocked A Self Signed Application From Running”

My current employer has a Citrix XenApp solution which requires users to run a self signed Java applet. In most of the cases the Java security settings don’t allow this by default, and display this message:

Your Security Settings Have Blocked A Self Signed Application From Running

To fix this start by accessing the Java Control Panel

DISPLAY=:0.0 jcontrol

alternatively:

export DISPLAY=:0.0
/usr/java/jdk1.8.0_25/bin/ControlPanel

Go to:

Security > Edit Site List > Add

here add the site of your employer like “https://vpn.us.employer.net”
hit OK & Apply and then it should work.

Chromium doesn’t play audio (openSUSE edition)

The usual chromium distributions tend to have audio problems. A good testcase is duolingo where sounds just doesn’t play in contrast to Firefox where everything works like a charm (for the moment).
This seems to be a well know problem among Ubuntu users:
http://askubuntu.com/questions/284202/chromium-doesnt-play-sound

But here is how to do the same thing on openSUSE.:
If you have installed chromium from the network:chromium repo, then don’t install the chromium-beta-ffmpegsumo package, but use the one from google, so go to google’s beta download site pick “64 bit .rpm (Fedora/openSUSE)” download and extract it like this.:

rpm2cpio google-chrome-beta_current_x86_64.rpm \
| cpio -i --to-stdout ./opt/google/chrome-beta/libffmpegsumo.so 2>/dev/null \
> /usr/lib64/chromium/libffmpegsumo.so

Enjoy!

P.S: Here is a web page with tons of test cases to verify correct functioning:

http://tools.woolyss.com/html5-audio-video-tester/

Compiling YCM on Ubuntu with system-libclang

YCM from Valloric is popular among coders. But if you want to compile it on Ubuntu with system-libclang on, it gives a completely useless error message. The issue is that Ubuntu libclang packages doesn’t ship the libclang.so symlink, only libclang.so.1, so you have to create it for yourself.

Symptoms:

~/.vim/bundle/YouCompleteMe$ ./install.sh --clang-completer --system-libclang
/tmp/ycm_build.2bNIhM ~/.vim/bundle/YouCompleteMe
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
Your C++ compiler supports C++11, compiling in that mode.
-- Found PythonLibs: /usr/lib/libpython2.7.so (Required is at least version "2.6")
Using libclang to provide semantic completion for C/C++/ObjC
Using external libclang: TEMP-NOTFOUND
-- Found PythonInterp: /usr/bin/python (found version "2.7.3")
-- Looking for include files CMAKE_HAVE_PTHREAD_H
-- Looking for include files CMAKE_HAVE_PTHREAD_H - found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
TEMP
    linked by target "ycm_core" in directory /home/efergcz/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm

-- Configuring incomplete, errors occurred!

Solution:

root@elx7qgwj12-dr:/usr/lib/llvm-3.5/lib# ls -lah libclang.so.1
lrwxrwxrwx 1 root root 17 Sep  6 09:15 libclang.so.1 -> libclang-3.5.so.1
root@elx7qgwj12-dr:/usr/lib/llvm-3.5/lib# ln -s libclang.so.1 libclang.so
root@elx7qgwj12-dr:/usr/lib/llvm-3.5/lib#

Credit goes tho this github post.

VMware and linux 3.14.0-rc7

# vmware --version
VMware Workstation 10.0.1 build-1379776

#uname -a
Linux workstation 3.14.0-rc7-4-desktop #1 SMP PREEMPT Wed Mar 19 08:35:32 UTC 2014 (d1f1027) x86_64 x86_64 x86_64 GNU/Linux

# head -n1 /etc/SuSE-release
openSUSE 13.1 (x86_64)

#cd /usr/lib/vmware/modules/source/

#cp vmnet.tar vmnet.tar.original

#tar xvf vmnet.tar vmnet-only/filter.c
vmnet-only/filter.c

# patch vmnet-only/filter.c < /tmp/<a href="http://ferenc.homelinux.com/attachments/filter.c.diff">filter.c.diff</a>
patching file vmnet-only/filter.c

# tar -uvf vmnet.tar vmnet-only/filter.c
vmnet-only/filter.c

#rm -rf vmnet-only/

#vmware-modconfig --console --install-all

If something goes wrong then tail the logs:

tail -F /tmp/vmware-root/vmware-modconfig-16234.log

And don’t forget to validate kernel headers:

vmware-modconfig --console --validate-kernel-headers /usr/src/linux-3.14.0-rc7-4-obj/x86_64/desktop/include/

Where should I put my app stuff?

Linux/Unix dev wannabes (like me) often wonder, where the files of the new application should go. Have no fear, FHS is here! The Filesystem Hierarchy Standard is referred from the Linux Standard Base, will give you some guidelines. You can read the current version in HTML here.
Although it does not answer questions like, what if I have a linux telecom cluster, and I need to have a lock file which can be accessed from all the hosts in the cluster, but the nfs expport structure is totally different, and I can’t just link like crazy. Like I said, it’s just a guideline…

Minimal Chat server and client with POSIX socket

Server (to be continued…)

#include <stdio.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <pthread.h>


typedef struct
{
    int socketid;
    pthread_t threadid;
} connection_t;

#define CONNECTION_LIMIT 100
connection_t connections[CONNECTION_LIMIT];

pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;

void *handle_connection(void *);


int main(int argc, char **argv)
{

#if 0
    /* Structure describing a UNIX socket address. sys/socket.h */
    struct sockaddr_un
    {
        sa_family_t sun_family; /* AF_UNIX */
        char sun_path[UNIX_PATH_MAX];   /* pathname */
    };

    /* Structure describing a generic socket address. bits/socket.h */
    struct sockaddr
    {
        __SOCKADDR_COMMON(sa_); /* Common data: address family and length.  */
        char sa_data[14];       /* Address data.  */
    };

#endif
    unsigned int i = 0;
    int sfd = 0;
    char *socket_path = "\0_something_hidden";
    struct sockaddr_un addr;

    /* This casting is necessary from sockaddr_un to sockaddr */

    struct sockaddr *address_pointer = (struct sockaddr *)&addr;
    int socket_listen_queue_length = 5;

    memset(&addr, 0, sizeof(addr));
    addr.sun_family = AF_UNIX;  /* AF_UNIX and AF_LOCAL are the same */
    strncpy(addr.sun_path, socket_path, sizeof(addr.sun_path) - 1);


    if (-1 == (sfd = socket(AF_UNIX, SOCK_STREAM, 0)))
    {
        perror("SOCKET ERROR");
        exit(-1);
    }

    if (-1 == bind(sfd, address_pointer, sizeof(addr)))
    {
        perror("BIND ERROR");
        exit(-1);
    }

    if (-1 == listen(sfd, socket_listen_queue_length))
    {
        perror("LISTEN ERROR");
        exit(-1);
    }

    while (1)
    {
        int cl = 0;

        /* Waiting for incoming connections */
        if ((cl = accept(sfd, NULL, NULL)) == -1)
        {
            perror("ACCEPT ERROR");
            continue;
        }

        for (i = 0; i < CONNECTION_LIMIT; ++i)
        {
            if (0 == connections[i].socketid)
                break;
        }

        if (CONNECTION_LIMIT == i)
        {
            close(cl);
            fprintf(stderr, "CONNECTION LIMIT REACHED: connection closed");
            continue;
        }
        connections[i].socketid = cl;
        pthread_create(&(connections[i].threadid), 0, handle_connection,
                       (void *)&i);


    }
    return 0;

}

void send_to_everyone(char *buf)
{
    unsigned int i;
    pthread_mutex_lock(&mutex);
    /* 
       Here we want to iterate through all the accepted socket file
       descriptors and write the buffer */
    for (i = 0; i < CONNECTION_LIMIT; ++i)
    {
        if (0 != connections[i].socketid)
        {
            write(connections[i].socketid, buf, 256);
        }
    }
    pthread_mutex_unlock(&mutex);
}

void *handle_connection(void *ptr)
{
    unsigned int i = *(unsigned int *)ptr;
    int cl = connections[i].socketid;
    int rc = 0;
    char buf[256];
    char buf2[256];
    char name[16];

    /* Step 0 reading auth data */
    read(cl, name, sizeof(name));
    /* Step 1 send greeting */
    strcpy(buf, "Hello ");
    strcat(buf, name);
    strcat(buf, "!");
    write(cl, buf, sizeof(buf));
    printf("%s is connected!\n", name);

    /* Step 2 start chat */
    while ((rc = read(cl, buf, sizeof(buf))) > 0)
    {
        sprintf(buf2, "[%s] (%i bytes): %.*s", name, rc, rc, buf);
        printf(buf2);
        send_to_everyone(buf2);
    }
    if (-1 == rc)
    {
        perror("READ ERROR");
    }
    else if (0 == rc)
    {
        printf("%s disconnected EOF\n", name);
        close(cl);
    }

    connections[i].socketid = 0;

    return 0;
}

Client

#include <sys/socket.h>
#include <sys/un.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>


void send_some_data(int, char *);

int main(int argc, char **argv)
{
    if (2 > argc)
    {
        printf("Usage:\n %s <name>\n", argv[0]);
        exit(-1);
    }


    int sfd = 0;
    char *socket_path = "\0_something_hidden";
    struct sockaddr_un addr;
    memset(&addr, 0, sizeof(addr));
    addr.sun_family = AF_UNIX;
    strncpy(addr.sun_path, socket_path, sizeof(addr.sun_path) - 1);
    struct sockaddr *address_pointer = (struct sockaddr *)&addr;

    if (-1 == (sfd = socket(AF_UNIX, SOCK_STREAM, 0)))
    {
        perror("SOCKET ERROR");
        exit(-1);
    }
    if (-1 == connect(sfd, address_pointer, sizeof(addr)))
    {
        perror("CONNECT ERROR");
        exit(-1);
    }

    send_some_data(sfd, argv[1]);

    return 0;
}

void *read_some_data(void *ptr)
{
    int sfd = *(int *)ptr;
    char buf[256];
    while (1)
    {
        read(sfd, buf, sizeof(buf));
        printf("%s", buf);
    }

}

void send_some_data(int sfd, char *name)
{
    int rc = 0;
    char buf[256];
    pthread_t reader_thread;

    // Step 0 sending auth data
    write(sfd, name, sizeof(name));

    // Step 1 wait for greeting
    read(sfd, buf, sizeof(buf));
    printf("\nServer says: %s\n", buf);

    // Step 2 start chat
    pthread_create(&reader_thread, 0, read_some_data, (void *)&sfd);
    while ((rc = read(STDIN_FILENO, buf, sizeof(buf))) > 0)
    {
        if (write(sfd, buf, rc) != rc)
        {
            if (rc > 0)
                fprintf(stderr, "partial write");
            else
            {
                perror("WRITE ERROR");
                exit(-1);
            }
        }
    }
}