I have been tasked with running our Windows only software on a Linux distro. So I've decided to run it on wine on Ubuntu 18.04. The Ubuntu is from a net-install, so I pretty much have nothing but X11, openbox, and I configure everything through xterm.

On Windows, our software receives the time from our equipment (running on IRIG-B from GPS satallite) and changes the system time, so that the computer time and the equipment time are in sync. The software verifies and attempts this every 5 minutes.

I left the software running on wine over the weekend with wine "path" without detaching the process from xterm and when I came back I noticed that I had gotten a bunch of these messages in xterm, every 5 minutes or so:

err:ntdll:NtSetSystemTime Cannot set time to Mon Jun 18 09:49:19 2018
, time adjustment -3153: Operation not permitted

So I check the wine source of NtSetSystemTime and see that it's a wrapper for settimeofday. So I look man page of settimeofday and it says that it requires CAP_SYS_TIME. So I setcap with cap_sys_time+ep for wine-stable, wineserver, and the software executable, but it doesn't work.

I have tried a combination of +ep, +ei, and +eip, but that doesn't work either. I've turned off the NTP using timedatectl set-ntp 0 and have tried setting set-local-rtc on and off.

I have also tried changing the system time to about 10 minutes off to see if it would change it, but that didn't uncover anything either.

I have run out of things to try. What am I missing? I just need to be able to get the software to change the system time.


I figured it out. After digging around for more wine related stuff, I realized there's actually a bunch more wine related stuff in /usr/lib/wine.

Even though which wine returns /usr/bin/wine which symlinks to /usr/bin/wine-stable, the one you really want to setcap is /usr/lib/wine/wine.

So all in all, this worked for me:

sudo setcap cap_sys_time+ep /usr/lib/wine/wine

I tested them all, and figured out which ones didn't need cap given to, and have concluded that only that one really needs cap.

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.