Shared Folders on Linux Guest OS in VMware (Fusion/Workstation/Player)

Having VMs running around you will eventually need to pass some files between your host and guest OSes. This could be achieved in a number of ways, one of which (and the most convenient long term in my opinion) is to have a shared folder between the host and the guest.

This writeup was compiled on Mac running Sierra thus VMware Fusion was used. However basically the same steps could be applied to Player or Workstation running on Windows as a host OS. Here is the version I used specifically:

Screen Shot 2017-07-07 at 20.57.11

0. You are working with VMware, not VirtualBox, keep that in mind

Believe it or not but because I was so used to VirtualBox, first of all I installed “VirtualBox Guest Additions” for Linux guest OS and was wondering why the damned thing does not work. Spent quite some time until it hit me that I was trying to load VirtualBox stuff on VM that is being run by VMware…

1. Make sure OpenVM packages are not installed

You would need tools from VMware in order to have shared folders functionality, I learned it the hard way so you don’t have to. OpenVM does not support file system for mounting VMware shared folders.

Make sure this package is not installed on your guest Linux OS:
Screen Shot 2017-07-07 at 21.01.09

2. Install VMware Tools

Select your VM from Virtual Machines Library and use VMware menu item called “Virtual Machine”, you will see “Install VMware Tools” or “Reinstall VMware Tools” there, click on it.
Screen Shot 2017-07-07 at 21.02.59
Please note that it has to be done while VM is running.

Almost immediately you should see VMware Tools CD image being mounted inside your guest Linux OS:
Screen Shot 2017-07-07 at 20.58.45

See the tar.gz archive there? You should copy it somewhere, for example to Downloads folder in your home dir and unpack. Once you’re done unpacking, please run as superuser.
Restart your guest OS.

3. Create a folder on host OS and share it with VM

You could create a folder anywhere you can write to on your host filesystem. Then go to VM settings->Sharing, enable folder sharing and browse to your newly created folder. To make sharing as painless as possible please refrain from using spaces in shared folder name.
Screen Shot 2017-07-07 at 20.56.23

4. Enjoy the fruits of your labour

/mnt/hgfs on your guest should contain the shared folder now:
Screen Shot 2017-07-07 at 21.05.03

Running CRON Jobs That Require GUI

I am using FreeFileSync utility for mirroring contents of several HDDs, call it software RAID if you must :) This software can be run in batch mode however unlike many Linux native utilities this one is not text mode by default and require more than just a terminal to run.
By any means this fact is not exceptional if you run FreeFileSync manually from some window manager, however things might not work as smoothly if you wish to run FreeFileSync at regular intervals with the help of cron for instance. That was exactly my case that I intend to describe here.

First of all I created a single script that should be called regularly by cron, the script contains all the FreeFileSync calls I need in one place. To test how the script works I added it to crontab and made it scheduled to be executed every minute:
crontab -e
Now just to be on the safe side I restarted cron daemon:

Looking good, now inspecting the logs in /var/log/syslog:


However I did not see any activity on FreeFileSync part and my disks were left unsynchronised.. What gives? What is important to know here is that cron sends you an e-mail in case it has some error to report but in order to get this mail you have to install mail server and some mail client. I went with one of the most popular choices: postfix for server with local-only configuration and mailutils package for text-based client which is called by executing mail command. Both postfix and mailutils should be available in your distro of choice, in case of Debian based flavours sudo apt-get install to the rescue!

Here is what I saw in the e-mail sent to me by cron:

It turns out the issue could be resolved with a simple trick – initialising DISPLAY variable inside the crontab itself. Here we need to remember that cron runs jobs with very limited environment and it is very common that jobs fail because of some environment variable is missing. Below I am setting the proper DISPLAY and make sure my command runs once a day instead of once per minute:

That was all I needed to successfully schedule my cron job. The takeaway is this: mind the environment working with cron, make sure to inspect syslog log and also have the local mail server properly setup in order to get mail from cron in case of issues running the jobs. By the way your inbox should be located in /var/spool/mail/ and the format of the file is human readable so maybe you won’t need mailutils, just postfix.

How to Boot with UEFI from USB Stick

Nowadays BIOS boot is considered to be “legacy” way of booting and EFI is the emergent default mode. However people still confuse the two and lots of tools for creating bootable media ignore EFI and go with standard BIOS boot.

So, what do you need to boot in (U)EFI mode?

  1. Obtain OS image/zip that is EFI-aware, having directory /boot/efi on the OS distribution is a good indication of EFI support
  2. Format USB stick with GUID(GPT) partition table and create a single FAT32 partition named using only CAPITAL letters
  3. Extract zip or image file into the root folder of your newly formatted USB stick
  4. Place your USB in non USB 3.0 slot, don’t know for sure why but you cannot boot from USB 3.0 slot

On OSX you can use Disk Utility for the above operations and on Linux, GParted comes to the rescue. I am sure you can easily do that on Windows too, either using standard admin tools or something like Partition Magic, however I did not check therefore can’t advise anything specific.

As for booting Windows and Linux in EFI there are guides how to do that, just search. Although the main requirement is GUID Partition Table, the best way of achieving that on your startup disk is to allow the Operating System to partition the drive during the installation as opposed to manual partitioning.

If you need to dual-boot into say Windows and Linux and you installed Linux in MBR mode but Windows in EFI then Grub will be unable to find Windows installation and you will have to select the correct boot drive on each boot, which will drive you mad eventually. Do not despair though, there is a great utility called Boot Repair, just load USB stick with some Live Ubuntu and then apt-get the boot-repair from there and you will have your situation resolved semi-automatically in the matter of minutes. Writing from personal experience as I was in exactly the above mentioned situation with dual-boot, this utility helped me to convert Linux loader into EFI and now it also allows me to select booting into Windows right from the boot menu.


From Plex to Serviio via MiniDLNA

I’ve decided to make a switch – NUC (previously wrote about it here) is replaced by Raspberry Pi 3 B in Media Player role and NUC itself will serve File Server role from now on. In order to do that, I have made some reconfiguration and also installed Plex on my NUC (which has Ubuntu 15.10 at the moment of writing this blog post). It did not go well..

Plex was visible from other devices but as soon as I try accessing files from DLNA-enabled device, Plex occupies all CPU cores almost at 100% and nothing happens, I mean content cannot be accessed. This problem did not go away despite my several attempts at fixing it. Finally I gave up on Plex and went searching for another options.

MiniDLNA was a logical next step as this is quite popular solution for embedded devices and Linux. Well, almost worked – music and videos were all right but collection of photos did not want to show up on Kodi or similar players on any platform. Randomly some photo would display after very long delay but it was so slow to show up to be considered unusable. MiniDLNA log file showed errors like this a lot: “Returning UPnPError 701: No such object error”. Somewhere on the forums I’ve seen people saying the error is insignificant and everything should still work. Unfortunately not my case – I was unable to fix pictures display on any of the media players when MiniDLNA was serving the content.

Serviio came up next in my search after the fiasco with MiniDLNA. It is Java application that runs from terminal by default (with an option to make it a daemon), it is configured by using a web interface (a-la Plex) and to my delight it actually handles all content pretty well, the problem is resolved, thanks, Serviio!

Fixing Screen Tearing on Linux Mint 17.3

I’m on Nvidia GF770 GTX, there is a decent, though proprietary, driver for my GPU from Nvidia but what bothers me a lot is that even despite having the correct driver with 3D-capabilities, able to run demanding 3D games I am still having a trivial issue of screen tearing in games and videos.. I have tried to enable V-Sync wherever I found the setting to no effect: still the same ugly tearing all over the video or a game scene.

After some research on the topic I decided to give Compton a try and because it has resolved the issue for me I stopped at this solution, here is the detailed guide on how to set this thing up:

Raspberry Pi 3 B as Media Center

Over the weekend experimented with OpenELEC Linux flavor for Raspberry Pi 1 B. Experimented with wired and wireless connection options, unfortunately in all cases performance was very laggy on high quality HD movies, if 720p was ok in some cases, 1080 was never played at an acceptable level. I compare it with Intel NUC which I setup for media center some time ago and now using it for different purposes – comparison is very bleak, if NUC is fully capable as media center, from playing music and movies to viewing vacation photos then RPi only able to play music somewhat ok. Still I have used Xonar USB audio because embedded sound produced noticeable static when playing music.

I understand that I compare something that costs ~600 EUR to something around ~50 EUR and it does not seem fair.. Anyways, I decided to give a shot at newer model of Raspberry Pi – model 3 B. Just ordered it at Will update this post once I get my hands on what is in the kit, here is the list I got in my mailbox, accompanying my order:

Supreme Kit Including NEW Raspberry Pi 3 Model B
– Includes Raspberry Pi: Raspberry Pi 3 B **R..
– Raspberry Pi Case: Raspberry Pi Foundat..
– Select Case Colour: Official Black and G..
– Micro SD Card Size: 8GB w/ Official Adap..
– Power Supply Select: Black Universal 5V 2..
– Video Cable Select: HDMI – Black – 2m **..
– USB Cable Select: Standard – Black – 1..
– RJ45 Cable Select: Black – 2m **CAB-000..
– Keyboard & Mouse Select: Wireless – Ultra-Min..

It Has Arrived!


Please note that Asus Xonar U3 was not part of the package, I use this external audio card in conjunction with Raspberry because Pi’s internal audio has too much interference and the situation did not change for the better with this newer model, sound output is as noisy as it was on RPi 1.

This new model came with 8GB flash card that had NOOBS installed on it. I have selected OSMC from the list of possible operating systems and installed it. Please note that you have to plug the wire into the Ethernet socket in order to get some other OS different from Raspbian, this is because NOOBS will download the needed OS from Internet, which would have been possible with WiFi too but unfortunately NOOBS does not support wireless and it seems it won’t get such support in foreseeable future, so get your Ethernet ready before powering on the RPi.

What was interesting about the package is this: Rii mini wireless keyboard with touchpad (and laser pointer). From previous experience with standalone media players running Linux, sometimes problems happen that require mouse and keyboard to be hooked to the player in order to fix the issue, so previously I was taking the devices from my workstation, plugging those into the player, fixing the issue and plugging the devices back to the workstation. Not anymore! Rii is going to be very close to the RPi device, always ready to intervene in case of an issue that cannot be solved with Kodi Remote (using Kore on Android phone).



You can configure anything and everything, as I mentioned above I am using additional sound card with RPi and I had no issues setting the sound output to the card instead of RPi analog output or my TV’s HDMI. There was slight annoyance though – I had to increase buffer size because some particularly large videos were not playing smoothly. Just create file called advancedsettings.xml with this code:


And copy the created file to /home/osmc/.kodi/userdata/. Just mind that you have to SSH into your RPi running OSMC and create file there, not on your workstation :) Login / pass for default OSMC installation is osmc / osmc.


Split Traffic Per Process

The task at hand: route traffic from different processes to 2 distinct wifi adapters. First adapter is switched to normal wifi, second to the router with persistent vpn connection. I need an ability to chose which process will use which adapter.

I have searched for solution and found very similar here:

So, just adapted the above solution a little bit to suit my needs and summarized my changes below.

You have to replace several things in this script first of all user name, my username is kr0st, which is not a terrible secret :) Anyway, should be replaced with yours.
My second wifi adapter is called “wlx001ee5ef5604″ by the OS, most likely your second network adapter is named differently.
Finally this is my gateway for the second wifi:, yours could be different as well.

Please note that script resets everything you have in your iptables! Change it if you can’t allow script to do that. The script should be run as root, btw.

As a final step the script runs an instance of Firefox in which you can search “my ip” and see if traffic really goes via this route and not the default one.


mkdir /sys/fs/cgroup/net_cls/vpnonly
cd /sys/fs/cgroup/net_cls/vpnonly
echo 0x00110011 > net_cls.classid

iptables --flush
iptables --table nat --flush
iptables --delete-chain

iptables -t mangle -A OUTPUT -m cgroup --cgroup 0x00110011 -j MARK --set-mark 11
iptables -t nat -A POSTROUTING -m cgroup --cgroup 0x00110011 -o wlx001ee5ef5604 -j MASQUERADE

#!Run next line only once, all subsequent script calls should have it disabled
#echo 11 vpnonly >> /etc/iproute2/rt_tables

ip rule add fwmark 11 table vpnonly
ip route add default via table vpnonly

for i in /proc/sys/net/ipv4/conf/*/rp_filter; do echo 0 > $i; done

cgcreate -t kr0st:kr0st -a kr0st:kr0st -g net_cls:vpnonly
cgexec -g net_cls:vpnonly firefox&

Weird Mouse Behavior on VMWare Workstation Player 12

Used Linux Mint 17.3 as host and Windows 8.1 as guest.

Problem: dropdown lists seem to scroll to the last item on their own and it does not happen all the time, it appears random.
Cause: not sure if it is the root cause but strangely enough it was not mouse driver or 3D acceleration settings as advised on some forums, in my case it appeared to be keyboard layouts. I had 2 languages for input (on host OS) – English and Russian. So when host switches to Russian language – the problem manifests, when host input is English everything is normal.

To fix it I now work with VM only when my host is set to English and I have also changed keyboard shortcuts for switching languages so they are different in host and guest (guest also has 2 input languages).

I have also noticed that any mouse movement results in scrolling, so you move the mouse and dropdown list scrolls – this is only when host OS input language was not English. That’s it for the problem and resolution, hopefully I will save some time on this thing next time.

Plex, Twonky, XBMC & NUC

DLNA was out there for quite a while now, call me a slowpoke but I finally decided to give it a try!

First question that needs to be answered is WHY? Well, if you have a bunch of stuff like music, movies and photos on your home file server (NAS) it is likely you want to have some convenient way of accessing all those riches preferably from all your devices and in a more or less the same way – this is exactly what DLNA server on your NAS does for you. If you have one that is – some NAS devices come equipped with DLNA server right out of the box but if your file server is not a commercially available NAS but some custom solution, like maybe ageing PC turned into a file server then you have to add DLNA capabilities yourself.

Second question is WHAT? And here is what you need to get going:


Media centre that is able to find available UPnP devices on local network and play the content. Versions of this media centre is available for Linux, Android, Windows and OSX at least. I should note that for OSX I have also tried the alternative - PlugPlayer. Cannot say I was too impressed with it though because mostly I was seeing this screen below while trying to use PlugPlayer:
PlugPlayer dies again

My advise is to stick to XBMC/KODI.

Another very nice thing about XBMC/KODI is the remote control capabilities – you have to enable control over HTTP in the settings menu and after that you will be able to control the playback with Android app for example.

Plex or Twonky

Both of them are quite popular server side solutions that have Linux versions (my file server is running Linux) so I decided to try one of these first and see if I am good or should explore the alternatives.

I have started with Twonky and got a show-stopper issue right out of the box: scaling of the photos did something very ugly to the pictures – everything became very low resolution and blocky, pixelated. There are some solutions to try like this one for example but it did not work for me, after couple of hours of fruitless tinkering I decided to say goodbye to Twonky and move on to the alternatives.

Enter Plex – media server with a very good Web frontend that could do anything really be it playing video, music, browsing photos or configuring the server itself. It worked as expected immediately and you do not really have to create Plex account to use it, so I opted out and still got what I needed.
There was no issues and especially that nasty rescaling of photos was gone, picture quality was great.

Of course other solutions are out there like minidlna, for instance but Plex worked well for me and I decided to not fix what is not broken. There is one feature though that is heavily discussed online – accessing your content outside of your LAN. This is possible via Plex account and paid membership (I think so but did not actually try, so may be wrong). However people also write that you could have something like this done with SSH port forwarding feature just forwarding correct ports from the PC running Plex to your router with external static IP.

XBMC/Plex integration

To get all the content from your server shown on your XBMC/KODI media centre you have to add UPnP source for each of the sections – Music, Video, Pictures. However there is a different way of getting much more significant integration with proper search capabilities like that of a native Plex client. This could ‘theoretically’ be achieved by using PleXBMC addon (installed beta4 version because others gave me errors) I just did not try it yet so probably update the post once I have some positive experience with this addon.

One very annoying thing to keep in mind without the addon – search in XBMC/KODI will not work with your remote server, meaning that searching for anything will give you 0 results whatever you do. What you have to do is use ‘filtering’ instead of searching, meaning you have to get inside the directory on your remote server and once there, use the sliding menu on the left screen border to enter filter, so you get only entries that pass your filter. Not sure why XBMC is not recreating some local version of remote media database for search to work but this is how it is. Maybe I am doing something wrong but I was not able to figure out how to make search work.


The last part of the equation, not required by the way – a dedicated device that is always on, connected to LAN and a TV, hardware media player. There is nothing stopping you from running XBMC/KODI on whatever platform and device like your laptop for example. I just wanted a new toy so decided to try and turn some micro PC into a media player running Linux + XBMC/KODI hooked to my TV.

There definitely are many alternatives to NUC and cheaper ones however NUC is quite powerful, having i5 CPU, supporting 16 gigs of RAM and SSD HDDs. Basically a real PC but very small-sized. Opting for NUC gave me more flexibility to do something more with this little thing later – not just media player. Talking strictly about media player functionality Raspberry Pi would have been a way cheeper choice though very limiting in terms of hardware power and compatibility (it’s ARM, not x86/64 architecture, no normal version of Windows for instance).

I have decided to install Linux Mint 17.2 on my NUC, it is Long Time Support release so I’m all set until 2019! Windows would also work perfectly fine but where’s fun in that? As much as I would enjoy all these new spyware features in Windows 10 I would still prefer gewd ol’ reliable Linux which is also happens to be free as in free beer sense :) By the way even Intel published a guide on making media centre box out of NUC using Linux Mint & XBMC. Didn’t use the guide though but maybe this one will be useful for somebody out there.

The best advice I got about NUC was from some blog post (unfortunately do not remember which post exactly) recommending UEFI boot – that really got NUC booting up instantaneously. Setting up Linux on NUC definitely use UEFI boot partition, search the web for guide on that if you need.

Overall my experience with the whole setup was quite positive but yeah, there are several annoyances, see below.

Annoyance #1: sporadic wake-ups from suspended state, fixed by turning off wake on LAN feature in BIOS.
Annoyance #2
: XBMC simply hangs after running for many hours straight in idle mode (i.e. not being used actively). No real fix for this one for now, seems I am using the latest version of KODI already, so I have just set up a cron job that restarts KODI during the night time.
Annoyance #3
: do not expect NUC to be completely silent during heavy load (using all CPU cores close to 100% utilisation) it has a very little fan and noise level is that of a small laptop. This does not happen during playback though but will happen during some CPU-intensive operations like creating large archives for example.

I would like to end this post with a little photo-session, so please welcome, NUC!



Reusing RDP session on Linux

This continues to be a pain every time I install new Linux distro on some device I need remote access to:

If you install whatever is available on Ubuntu / Mint (and I suspect a number of other Linux flavors) – say xrdp + tightvnc, what you get is non-persistent remote desktop session, meaning once you disconnect, it’s gone and next time fresh new session will be created.

What you have to do is just go there ->
Download this stuff as zip, unpack and run ‘‘. That’s it! It will take care of all dependencies, will compile and install x11rdp for you. I think this is really all you have to do, however you might still need to provide server side of the equation – something like x11vnc - unfortunately do not remember that because did the operation couple of days earlier before writing this post, which shows that writing those posts is a great idea because my memory sux :)

One last thing – if using remmina RDP client you are getting SEGFAULTs, try setting color to 24bpp and/or update.

UPDATE [20.03.2016]: It seems later versions of Ubuntu, after introducing systemd (15.04?) require one last step to make xrdp working, the step is to go to /lib/systemd/system/ folder and delete 2 files: xrdp.service and xrdp-sesman.service. After this step you will be able to control xrdp via /etc/init.d/ as before systemd. More details on the problem and solution here: