wolfcw / libfaketime

libfaketime modifies the system time for a single application
https://github.com/wolfcw/libfaketime
GNU General Public License v2.0
2.62k stars 319 forks source link

symbol lookup error on debian 12.1 (@armv7l) #437

Open florianHarmuth opened 9 months ago

florianHarmuth commented 9 months ago

Hello all, I am trying to use libfaketime (0.9.10-2.1) on a debian based system but it doesn't work as expected.

root@me:~# date; LD_PRELOAD=/usr/lib/arm-linux-gnueabihf/faketime/libfaketime.so.1 FAKETIME='2010-10-10 01:01:01' date;
Thu Oct 12 14:27:49 CEST 2023
Thu Oct 12 14:27:49 CEST 2023

After adding LD_DEBUG flags I see the following output:

LD_DEBUG=libs LD_PRELOAD=/usr/lib/arm-linux-gnueabihf/faketime/libfaketime.so.1 FAKETIME='2010-10-10 01:01:01' date;
     12959:     find library=libc.so.6 [0]; searching
     12959:      search cache=/etc/ld.so.cache
     12959:       trying file=/lib/arm-linux-gnueabihf/libc.so.6
     12959:
     12959:     find library=libm.so.6 [0]; searching
     12959:      search cache=/etc/ld.so.cache
     12959:       trying file=/lib/arm-linux-gnueabihf/libm.so.6
     12959:
     12959:
     12959:     calling init: /lib/ld-linux-armhf.so.3
     12959:
     12959:
     12959:     calling init: /lib/arm-linux-gnueabihf/libc.so.6
     12959:
     12959:
     12959:     calling init: /lib/arm-linux-gnueabihf/libm.so.6
     12959:
     12959:
     12959:     calling init: /usr/lib/arm-linux-gnueabihf/faketime/libfaketime.so.1
     12959:
     12959:     /usr/lib/arm-linux-gnueabihf/faketime/libfaketime.so.1: error: symbol lookup error: undefined symbol: __ftime (fatal)
     12959:     /usr/lib/arm-linux-gnueabihf/faketime/libfaketime.so.1: error: symbol lookup error: undefined symbol: pthread_cond_timedwait, version GLIBC_2.2.5 (fatal)
     12959:     /usr/lib/arm-linux-gnueabihf/faketime/libfaketime.so.1: error: symbol lookup error: undefined symbol: pthread_cond_timedwait, version GLIBC_2.3.2 (fatal)
     12959:     /usr/lib/arm-linux-gnueabihf/faketime/libfaketime.so.1: error: symbol lookup error: undefined symbol: pthread_cond_init, version GLIBC_2.3.2 (fatal)
     12959:     /usr/lib/arm-linux-gnueabihf/faketime/libfaketime.so.1: error: symbol lookup error: undefined symbol: pthread_cond_destroy, version GLIBC_2.3.2 (fatal)
     12959:     /usr/lib/arm-linux-gnueabihf/faketime/libfaketime.so.1: error: symbol lookup error: undefined symbol: timer_settime, version GLIBC_2.2 (fatal)
     12959:     /usr/lib/arm-linux-gnueabihf/faketime/libfaketime.so.1: error: symbol lookup error: undefined symbol: timer_settime, version GLIBC_2.3.3 (fatal)
     12959:     /usr/lib/arm-linux-gnueabihf/faketime/libfaketime.so.1: error: symbol lookup error: undefined symbol: timer_gettime, version GLIBC_2.2 (fatal)
     12959:     /usr/lib/arm-linux-gnueabihf/faketime/libfaketime.so.1: error: symbol lookup error: undefined symbol: timer_gettime, version GLIBC_2.3.3 (fatal)
     12959:
     12959:     initialize program: date
     12959:
     12959:
     12959:     transferring control: date
     12959:

Any ideas how to solve this problem?

This problem can also be reproduced in a docker container:

WARNING: The requested image's platform (linux/arm/v7) does not match the detected host platform (linux/amd64) and no specific platform was requested
root@3bf66527018b:/# apt-get update
Get:1 http://deb.debian.org/debian bookworm InRelease [151 kB]
Get:2 http://deb.debian.org/debian bookworm-updates InRelease [52.1 kB]
Get:3 http://deb.debian.org/debian-security bookworm-security InRelease [48.0 kB]
Get:4 http://deb.debian.org/debian bookworm/main armhf Packages [8493 kB]
Get:5 http://deb.debian.org/debian bookworm-updates/main armhf Packages [6388 B]
Get:6 http://deb.debian.org/debian-security bookworm-security/main armhf Packages [74.5 kB]
Fetched 8825 kB in 4s (2067 kB/s)
Reading package lists... Done
root@3bf66527018b:/# apt-get install faketime
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  libfaketime
The following NEW packages will be installed:
  faketime libfaketime
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 63.8 kB of archives.
After this operation, 259 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://deb.debian.org/debian bookworm/main armhf libfaketime armhf 0.9.10-2.1 [46.4 kB]
Get:2 http://deb.debian.org/debian bookworm/main armhf faketime armhf 0.9.10-2.1 [17.4 kB]
Fetched 63.8 kB in 0s (357 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package libfaketime:armhf.
(Reading database ... 6092 files and directories currently installed.)
Preparing to unpack .../libfaketime_0.9.10-2.1_armhf.deb ...
Unpacking libfaketime:armhf (0.9.10-2.1) ...
Selecting previously unselected package faketime.
Preparing to unpack .../faketime_0.9.10-2.1_armhf.deb ...
Unpacking faketime (0.9.10-2.1) ...
Setting up libfaketime:armhf (0.9.10-2.1) ...
Setting up faketime (0.9.10-2.1) ...
root@3bf66527018b:/# LD_DEBUG=libs LD_PRELOAD=/usr/lib/arm-linux-gnueabihf/faketime/libfaketime.so.1 FAKETIME='2010-10-10 01:01:01' date;
       347:     find library=libc.so.6 [0]; searching
       347:      search cache=/etc/ld.so.cache
       347:       trying file=/lib/arm-linux-gnueabihf/libc.so.6
       347:
       347:     find library=libm.so.6 [0]; searching
       347:      search cache=/etc/ld.so.cache
       347:       trying file=/lib/arm-linux-gnueabihf/libm.so.6
       347:
       347:
       347:     calling init: /lib/ld-linux-armhf.so.3
       347:
       347:
       347:     calling init: /lib/arm-linux-gnueabihf/libc.so.6
       347:
       347:
       347:     calling init: /lib/arm-linux-gnueabihf/libm.so.6
       347:
       347:
       347:     calling init: /usr/lib/arm-linux-gnueabihf/faketime/libfaketime.so.1
       347:
       347:     /usr/lib/arm-linux-gnueabihf/faketime/libfaketime.so.1: error: symbol lookup error: undefined symbol: __ftime (fatal)
       347:     /usr/lib/arm-linux-gnueabihf/faketime/libfaketime.so.1: error: symbol lookup error: undefined symbol: pthread_cond_timedwait, version GLIBC_2.2.5 (fatal)
       347:     /usr/lib/arm-linux-gnueabihf/faketime/libfaketime.so.1: error: symbol lookup error: undefined symbol: pthread_cond_timedwait, version GLIBC_2.3.2 (fatal)
       347:     /usr/lib/arm-linux-gnueabihf/faketime/libfaketime.so.1: error: symbol lookup error: undefined symbol: pthread_cond_init, version GLIBC_2.3.2 (fatal)
       347:     /usr/lib/arm-linux-gnueabihf/faketime/libfaketime.so.1: error: symbol lookup error: undefined symbol: pthread_cond_destroy, version GLIBC_2.3.2 (fatal)
       347:     /usr/lib/arm-linux-gnueabihf/faketime/libfaketime.so.1: error: symbol lookup error: undefined symbol: timer_settime, version GLIBC_2.2 (fatal)
       347:     /usr/lib/arm-linux-gnueabihf/faketime/libfaketime.so.1: error: symbol lookup error: undefined symbol: timer_settime, version GLIBC_2.3.3 (fatal)
       347:     /usr/lib/arm-linux-gnueabihf/faketime/libfaketime.so.1: error: symbol lookup error: undefined symbol: timer_gettime, version GLIBC_2.2 (fatal)
       347:     /usr/lib/arm-linux-gnueabihf/faketime/libfaketime.so.1: error: symbol lookup error: undefined symbol: timer_gettime, version GLIBC_2.3.3 (fatal)
       347:
       347:     initialize program: /usr/bin/date
       347:
       347:
       347:     transferring control: /usr/bin/date
       347:
Thu Oct 12 12:38:10 UTC 2023

Regards, flo

dkg commented 8 months ago

I'm not seeing this problem when i try it on x86-64, though i do see some surprising complaints from LD_DEBUG=libs, which i don't understand):

0 dkg@alice:~$ date; LD_DEBUG=libs LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1 FAKETIME='2023-10-10 01:01:01' date
Fri Oct 20 05:41:22 PM EDT 2023
   2395154: find library=libc.so.6 [0]; searching
   2395154:  search cache=/etc/ld.so.cache
   2395154:   trying file=/lib/x86_64-linux-gnu/libc.so.6
   2395154: 
   2395154: find library=libm.so.6 [0]; searching
   2395154:  search cache=/etc/ld.so.cache
   2395154:   trying file=/lib/x86_64-linux-gnu/libm.so.6
   2395154: 
   2395154: 
   2395154: calling init: /lib64/ld-linux-x86-64.so.2
   2395154: 
   2395154: 
   2395154: calling init: /lib/x86_64-linux-gnu/libc.so.6
   2395154: 
   2395154: 
   2395154: calling init: /lib/x86_64-linux-gnu/libm.so.6
   2395154: 
   2395154: 
   2395154: calling init: /usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1
   2395154: 
   2395154: /usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1: error: symbol lookup error: undefined symbol: __ftime (fatal)
   2395154: /usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1: error: symbol lookup error: undefined symbol: timer_settime, version GLIBC_2.2 (fatal)
   2395154: /usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1: error: symbol lookup error: undefined symbol: timer_gettime, version GLIBC_2.2 (fatal)
   2395154: 
   2395154: initialize program: date
   2395154: 
   2395154: 
   2395154: transferring control: date
   2395154: 
Tue Oct 10 01:01:01 AM EDT 2023
0 dkg@alice:~$ 

I can try to dig up access to a 32-bit armel machine if that would be useful for testing.

am11 commented 3 months ago

Having same issue with armv7:

# ✅ amd64
$ docker run --rm --platform linux/amd64 debian bash -c \
    'apt update &> /dev/null && apt install -y faketime &>/dev/null && faketime "2030-11-02 12:47:00" date'

Sat Nov  2 12:47:00 UTC 2030

# ✅ arm64
$ docker run --rm --platform linux/arm/v8 debian bash -c \
    'apt update &> /dev/null && apt install -y faketime &>/dev/null && faketime "2030-11-02 12:47:00" date'

Sat Nov  2 12:47:00 UTC 2030

# ❌ arm32
$ docker run --rm --platform linux/arm/v7 debian bash -c \
    'apt update &> /dev/null && apt install -y faketime &>/dev/null && faketime "2030-11-02 12:47:00" date'

Sat Mar 30 00:06:22 UTC 2024