Files in the virtualbox share show wrong timestamp

On my openSUSE Tumbleweed system (bare metal)

Operating System: openSUSE Tumbleweed 20240225
KDE Plasma Version: 5.27.10
KDE Frameworks Version: 5.115.0
Qt Version: 5.15.12
Kernel Version: 6.7.6-1-default (64-bit)
Graphics Platform: X11

I use virtualbox

# zypper se -si virtual*
Loading repository data...
Reading installed packages...

S  | Name                   | Type    | Version               | Arch   | Repository
---+------------------------+---------+-----------------------+--------+------------------
i  | virtualbox             | package | 7.0.14-3.1            | x86_64 | (System Packages)
i+ | virtualbox-kmp-default | package | 7.0.14_k6.7.6_1-3.2   | x86_64 | (System Packages)
i+ | virtualbox-qt          | package | 7.0.14-3.1            | x86_64 | (System Packages)
#

One guest is an openSUSE Tumbleweed 20240225 system with

# zypper se -si virtualbox*
Loading repository data...
Reading installed packages...

S  | Name                   | Type    | Version             | Arch   | Repository
---+------------------------+---------+---------------------+--------+------------------
i+ | virtualbox-guest-tools | package | 7.0.14-3.1          | x86_64 | (System Packages)
i+ | virtualbox-kmp-default | package | 7.0.14_k6.7.6_1-3.2 | x86_64 | (System Packages)
#

The host shares a directory (/mnt/Lokal/VM_share) with the guest.

On the host system I have (in my home directory) a file

> ls -la *.jpg
-rw-r--r-- 1 A users 40749 Mar  3  2023 Opensuse_beer_label.jpg

when I copy this file to the shared directory

> cp -a Opensuse_beer_label.jpg /mnt/Lokal/VM_share/

everything looks fine (on the host)

> ls -la /mnt/Lokal/VM_share/
total 64
drwxr-xr-x 3 A   users  4096 Feb 27 09:51 .
drwxr-xr-x 7 root root   4096 Jan  3  2022 ..
-rw-r--r-- 1 A   users 40749 Mar  3  2023 Opensuse_beer_label.jpg
>

but on the guest system I see

> ls -la
total 64
drwxrwx--- 1 root vboxsf  4096 Jan  1  1970 .
dr-xr-xr-x 5 root root    4096 Feb 27 09:40 ..
-rwxrwx--- 1 root vboxsf 40749 Feb 27 09:44 Opensuse_beer_label.jpg
>

The timestamps in the share of the VM don’t make sense to me.

This happens to all files copied to the share.

Even when I copy files in the guest to the share their timestamps are changed (in the share) to the current date . However when I look at those files on the host they do have the correct date; i.e. the date of the original file in the guest.

On MS Windows 11 (bare metal) with virtualbox 7.0.14 and openSUSE Tumbleweed 20240225 as guest I see the same behaviour.

Kubuntu (as guest) does not show this behaviour although it uses VBoxGuestAdditions_7.0.14 as well.

Does anyone else see this (so that I have to create a bug report) or is this just a problem of my individual setup?

Any help much appreciated.

First thing that comes in mind are mount options in different systems.

The mount of the shared folder (inside the guest) is handled by virtualbox. I just supply the source directory (on the host) and the destination directory (on the guest) but no mount options.

It would be helpful if you could be more specific.

It is not only the timestamp, but also the ownership (user and group) and the permission bits that differ. Looks like a complete different inode.

BTW I know almost nothing about Virtualbox, I just noticed this.

Show timedatectl for both the host and the VM

The date 1970 shows, that there is a non/or misinterpretation. of data that are the same for all systems. uid are mostly not the same on every system, I assume (/mnt/Lokal/VM_share) is mounted in every system, I would prefer a net-share smb/nfs.

The virtualbox manual says

… Access to an automatically mounted shared folder is granted to everyone in a Windows guest, including the guest user.

For Linux and Oracle Solaris guests, access is restricted to members of
the group vboxsf and the root user.

So I guess that the user/group values are OK.

host (openSUSE Tumbleweed)

> timedatectl
               Local time: Tue 2024-02-27 16:21:08 CET
           Universal time: Tue 2024-02-27 15:21:08 UTC
                 RTC time: Tue 2024-02-27 15:21:08
                Time zone: Europe/Berlin (CET, +0100)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no
>

guest (openSUSE Tumbleweed)

> timedatectl
               Local time: Tue 2024-02-27 16:20:46 CET
           Universal time: Tue 2024-02-27 15:20:46 UTC
                 RTC time: Tue 2024-02-27 15:20:46
                Time zone: Europe/Copenhagen (CET, +0100)
System clock synchronized: no
              NTP service: inactive
          RTC in local TZ: no
>

I forgot to mention in my first post:

Because not only my private systems show this problem using a different virtualization method (kvm, …) or a different share option (like network shares) is not an option.

The Problem shows with MS Windows (10+11) as host as well as with openSUSE Tumbleweed as host.

But as far as the guest systems are concerned Kubuntu does not show this problem (on any of the three host systems) but openSUSE shows it on all three.

Based on this I assume either the openSUSE Tumbleweed guests (I configured all of them) are wrongly setup or the openSUSE virtualbox-guesttools cause this invalid behaviour.

May be a simple mount command on Kununtus verse opensuse guest machines and a comparison give hints.
After that testing without guest-additions?

If I understand the virtualbox manual correctly

… With the shared folders feature of Oracle VM VirtualBox, you can access files of your host system from within the guest system. This is similar to how you would use network shares in Windows networks, except that shared folders do not require networking, only the Guest Additions.

the “virtualbox shared folder”-feature works only with the virtualbox guest additions installed in the guest system.

By the way: Do you run a comparable setup without the problem I described in my post #1?

Yes, so for testing whether all guests behave the same.

No, I’m a hobbyist, single user with two win 10 boxes hosting changing vms mostly opensuse, debian via virtualbox and one proxmox server which in future will take my nextcloud now running on a pi. So cloud or USB-disk/stick are in use.

I just tested Tumbleweed host with openSUSE virtualbox 7.0.14 and Windows 10 guest with Oracle’s Guest Additions 7.0.14 and date and time are identical.

I tested Leap 15.5 with Oracles 7.0.14 and Windows 10 guest with Oracle’s Guest Additions 7.0.14 and date and time are identical.

The Windows and Linux guests do not have under System - Enable Hardware Clock in UTC Time checked for time to be the same in host and guest when using Virtualbox Shared Folders.

On Tumbleweed host I installed via zypper in virtualbox virtualbox-kmp-default and anything else need gets installed.

On any OpenSUSE guest you need zypper in virtualbox-kmp-default virtualbox-guest-tools and nothing else.

Set System clock synchronized to yes too. IIRC I’ve seen this on VMs before.

As you can see in my post #1: This is not any of my use cases (no MS Windows guest) …

… nor this one (no openSUSE Leap host).

My use cases are

hosts:
openSUSE Tumbleweed 20240225
MS Windows Windows 10
MS Windows Windows 11

guest:
openSUSE Tumbleweed 20240225 (with all hosts!)
[Kubuntu, only to see if it shows the problem as well; but it does not]

I guess that should be (on the guest)

YaST → System → Date and Time → Hardware Clock Set to UTC

However I tried with and without that setting and it made no difference. The virtualbox shared folder always showed the wrong date.

So did I (see my post #1).

I will try it.

> timedatectl
               Local time: Tue 2024-02-27 21:48:02 CET
           Universal time: Tue 2024-02-27 20:48:02 UTC
                 RTC time: Tue 2024-02-27 20:48:02
                Time zone: Europe/Berlin (CET, +0100)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no
>

The problem still persists:

On the guest all files in the shared folder show as timestamp the date/time of when the VM was started (or the current date/time for files freshly copied to the folder).

Do you have a virtualbox 7.0.14 VM (host) with an openSUSE Tumbleweed 20240225 guest ?

If you happen to have an openSUSE Tumbleweed 20240225 guest in an virtualbox 7.0.14 VM (host OS does not matter) could you please setup a virtualbox shared folder and try?

tumbleweed 20240225

WEGA:~ # cd /media/sf_Ordner
WEGA:/media/sf_Ordner # ls -la
total 0
drwxrwx— 1 root vboxsf 0 Jan 1 1970 .
drwxr-xr-x 1 root root 18 Feb 27 22:49 …
WEGA:/media/sf_Ordner # touch test.txt
WEGA:/media/sf_Ordner # ls -la
total 0
drwxrwx— 1 root vboxsf 0 Jan 1 1970 .
drwxr-xr-x 1 root root 18 Feb 27 22:49 …
-rwxrwx— 1 root vboxsf 0 Feb 27 23:07 test.txt
WEGA:/media/sf_Ordner #

win10pro

C:\Users\Georg\Desktop\Ordner>dir /Q /T
Datenträger in Laufwerk C: ist WIN_10 SYSTEM
Volumeseriennummer: 6CB3-F2D0

Verzeichnis von C:\Users\Georg\Desktop\Ordner

27.02.2024 23:07 Wega\Georg .
27.02.2024 23:07 Wega\Georg …
27.02.2024 23:07 0 Wega\Georg test.txt
1 Datei(en), 0 Bytes
2 Verzeichnis(se), 318.208.516.096 Bytes frei

C:\Users\Georg\Desktop\Ordner>

Seems to work as documented in vbox-documentation.

Thank you very much indeed !

May I ask you one last favour?

Please start up your VM today (if it is still running since yesterday, shut it down and start it again) and then show this

again. In case you already deleted the file test.txt from your share please go to your host system and copy any file (but one with a timestamp older than today!) to your shared folder. Then go to your VM guest and do the above command and show the result.

Thank you very much.