Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

FATAL: attempted to create non-posix thread; clone_flags == 00004111 #16

Open
Saikatsaha1996 opened this issue Jul 12, 2022 · 56 comments
Open
Labels
bug Something isn't working help wanted Extra attention is needed wontfix This will not be worked on

Comments

@Saikatsaha1996
Copy link

Screenshot_2022-07-12-12-12-55-540_com termux

@Saikatsaha1996

This comment was marked as duplicate.

@ZhymabekRoman
Copy link
Owner

Which distribution do you use ? Debian 11? The problem seems to be closely related to the operating system.

@Saikatsaha1996
Copy link
Author

Saikatsaha1996 commented Jul 12, 2022

Which distribution do you use ? Debian 11? The problem seems to be closely related to the operating system.

No useing termux
And your ExaGear cache.. but yes debian 11 is your proot

@Saikatsaha1996
Copy link
Author

Which distribution do you use ? Debian 11? The problem seems to be closely related to the operating system.

And also facing problem when i creat ExaGear.obb ExaGear app opening but when i run the application.. not happen anything.. help appreciate thank you

@Saikatsaha1996
Copy link
Author

Which distribution do you use ? Debian 11? The problem seems to be closely related to the operating system.

How can I install Ubuntu can you help me?

@Saikatsaha1996
Copy link
Author

Saikatsaha1996 commented Jul 13, 2022

Which distribution do you use ? Debian 11? The problem seems to be closely related to the operating system.

Which distribution do you use ? Debian 11? The problem seems to be closely related to the operating system.

Only working debian i386 version? Aarch64 will not work?
ubuntu-aarch64-pd-v3.0.1.tar.xz ?

With another roofts getting this error every time

Screenshot_2022-07-13-07-16-22-814_com termux
Screenshot_2022-07-13-06-49-15-075_com termux

@ZhymabekRoman
Copy link
Owner

ZhymabekRoman commented Jul 13, 2022

With another roofts getting this error every time

It's normal

Only working debian i386 version?

Yes. Because you use Exagear, not proot.

How can I install Ubuntu can you help me?

Last Ubuntu wont works, only Ubuntu 18, but it now not supported and not receive updates (End of life - EOL)

@Saikatsaha1996
Copy link
Author

With another roofts getting this error every time

It's normal

Only working debian i386 version?

Yes. Because you use Exagear, not proot.

How can I install Ubuntu can you help me?

Last Ubuntu wont works, only Ubuntu 18, but it now not supported

Ohhh actually today i build wine 7.0 obb with this but when I installed it android.. GPU driver not available

@ZhymabekRoman
Copy link
Owner

GPU driver not available

Compile LLVMpipe drivers

@Saikatsaha1996
Copy link
Author

Saikatsaha1996 commented Jul 13, 2022

GPU driver not available

Compile LLVMpipe drivers

LLVM Driver not good.. can i build turnip - zlink?

But when i installed virtio-GPU driver copy from another obb and installed.. same GPU driver not available..

@Saikatsaha1996
Copy link
Author

GPU driver not available

Compile LLVMpipe drivers

Can you add support experimental build for aarch64 chroot ?
Because now wine available also for aarch64

@ZhymabekRoman
Copy link
Owner

LLVM Driver not good.. can i build turnip - zlink?

At your discretion, I suggested one of the options

Can you add support experimental build for aarch64 chroot ?

Add support for aarch64 to what? To Exagear? There is a proot, use it

Because now wine available also for aarch64

Wine has long been available for arm (aarch64, armhf), but it emulates Windows RT, i.e. you will not be able to run normal applications written for Intel processors. Understand this already, you need to use everything for i386, and Exagear performs as Intel processor emulator on top of arm

I should build driver with aarch64 -linux-gnu or i386-linux-gun ?

i386, because Exagear emulates i686 (yes, i686)

Same error on debian

This is normal, the most important thing is that you decompress the tar archive with the command I wrote, then these errors will not affect anything

Can you guide me please?

0) Uncoment deb-src in sources.list file
1) apt-get build-dep mesa
2) apt install llvm
3) install last python 3
4) pip3 install flex bison mako meson ninja 
5)

For old meson version < 20:

mkdir build/
cd build/
meson -D llvm=true -D shader-cache=true -D gles1=false -D gles2=false -D gallium-drivers= -D egl=false -D gbm=false -D platforms=x11 -D vulkan-drivers=  -D dri-drivers= -D gallium-extra-hud=false -D lmsensors=false

For meson >= 20:

mkdir build/
cd build/
meson -D llvm=enabled -D shader-cache=enabled -D gles1=disabled -D gles2=disabled -D gallium-drivers= -D egl=disabled -D gbm=disabled -D platforms=x11 -D vulkan-drivers=  -D dri-drivers= -D gallium-extra-hud=disabled -D lmsensors=disabled

@Saikatsaha1996
Copy link
Author

LLVM Driver not good.. can i build turnip - zlink?

At your discretion, I suggested one of the options

Can you add support experimental build for aarch64 chroot ?

Add support for aarch64 to what? To Exagear? There is a proot, use it

Because now wine available also for aarch64

Wine has long been available for arm (aarch64, armhf), but it emulates Windows RT, i.e. you will not be able to run normal applications written for Intel processors. Understand this already, you need to use everything for i386, and Exagear performs as Intel processor emulator on top of arm

I should build driver with aarch64 -linux-gnu or i386-linux-gun ?

i386, because Exagear emulates i686 (yes, i686)

Same error on debian

This is normal, the most important thing is that you decompress the tar archive with the command I wrote, then these errors will not affect anything

Can you guide me please?

0) Uncoment deb-src in sources.list file
1) apt-get build-dep mesa
2) apt install llvm
3) install last python 3
4) pip3 install flex bison mako meson ninja 
5)

For old meson version < 20:

mkdir build/
cd build/
meson -D llvm=true -D shader-cache=true -D gles1=false -D gles2=false -D gallium-drivers= -D egl=false -D gbm=false -D platforms=x11 -D vulkan-drivers=  -D dri-drivers= -D gallium-extra-hud=false -D lmsensors=false

For meson >= 20:

mkdir build/
cd build/
meson -D llvm=enabled -D shader-cache=enabled -D gles1=disabled -D gles2=disabled -D gallium-drivers= -D egl=disabled -D gbm=disabled -D platforms=x11 -D vulkan-drivers=  -D dri-drivers= -D gallium-extra-hud=disabled -D lmsensors=disabled

Thank you for your all answer

Now i understand 😃..

@Saikatsaha1996
Copy link
Author

Saikatsaha1996 commented Jul 14, 2022

@ZhymabekRoman one more time i am disturbing you sorry for that..

Help appreciate thank you 🙂

Every time getting error when i am running ninja..

FATAL: attempted to create non-posix thread; clone_flags == 00004111

can't build mesa driver in this environment..

Screenshot_2022-07-14-11-33-01-962_tech ula

@ZhymabekRoman ZhymabekRoman reopened this Jul 14, 2022
@ZhymabekRoman
Copy link
Owner

  1. What version of Android do you use?
  2. Phone model
  3. Termux version
  4. uname -a command output in Termux

@Saikatsaha1996
Copy link
Author

Saikatsaha1996 commented Jul 14, 2022

  1. What version of Android do you use?
  2. Phone model
  3. Termux version
  4. uname -a command output in Termux

Android 12
Termux 0.118
But i am not useing termux..
I am using userland, under termux getting extract error..

Screenshot_2022-07-14-23-18-53-112_tech ula

But yes really just awesome project appreciate your work... Just like real virtual machine..

@ZhymabekRoman
Copy link
Owner

Try to install Termux and run Exagear-For-Termux inside it, UserLand works differently although it is based on Termux. I can't understand what's wrong now - either Android 12 added new restrictions, because of it clone does not work correctly, or your firmware kernel version, but it is new enough, I don't think the problem is in it, but everything is possible, or UserLand

@Saikatsaha1996
Copy link
Author

Saikatsaha1996 commented Jul 15, 2022

Try to install Termux and run Exagear-For-Termux inside it, UserLand works differently although it is based on Termux. I can't understand what's wrong now - either Android 12 added new restrictions, because of it clone does not work correctly, or your firmware kernel version, but it is new enough, I don't think the problem is in it, but everything is possible, or UserLand

Getting same error on android 8

FATAL: attempted to create non-posix thread; clone_flags == 00004111
/dev/pts is mounted?

@ZhymabekRoman
Copy link
Owner

Getting same error on android 8

UserLand?

@Saikatsaha1996
Copy link
Author

Saikatsaha1996 commented Jul 15, 2022

Getting same error on android 8

UserLand?

No userland not working.. with android 8 && termux-exagear
Android 8 useing Termux

And also tried to mount -t /dev exagear-fs/dev
But getting error operation not implemented

Also tried to rootlocalhost:/# ls dev permission denied

@ZhymabekRoman
Copy link
Owner

Thanks for all informations !
Can you show output command uname -o in Userland?

@Saikatsaha1996
Copy link
Author

Thanks for all informations ! Can you show output command uname -o in Userland?

Android 8 && 12 showing

GNU/LINUX

@Saikatsaha1996
Copy link
Author

Thanks for all informations ! Can you show output command uname -o in Userland?

You can understand more with this screenshot..
Screenshot_2022-07-15-20-46-52-982_tech ula

ExaGear for Termux by Zhymabek_Roman
Version: 2.4
Copyright (c) 2013-2019 'Elbrus Technologies' LLC. All rights reserved.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


Writing resolv.conf file (NS 8.8.8.8/8.8.4.4)...

System memory configuration is determined as 3g

Your environment is defined as proot

[Starting x86 environment]

root@localhost:/# ls
bin   dev  home  lib64  mnt  proc  run   srv      sys  usr
boot  etc  lib   media  opt  root  sbin  storage  tmp  var
root@localhost:/# ls dev
ls: cannot open directory 'dev': Permission denied
root@localhost:/# ls sys
ls: cannot open directory 'sys': Permission denied
root@localhost:/# ls lib
cpp  i386-linux-gnu  init  ld-linux.so.2  lsb  systemd  terminfo  udev
root@localhost:/# ls proc
ls: cannot access 'proc/fb': Permission denied
ls: cannot access 'proc/mv': Permission denied
ls: cannot access 'proc/mtd': Permission denied
ls: cannot access 'proc/keys': Permission denied
ls: cannot access 'proc/kmsg': Permission denied
ls: cannot access 'proc/misc': Permission denied
ls: cannot access 'proc/iomem': Permission denied
ls: cannot access 'proc/locks': Permission denied
ls: cannot access 'proc/swaps': Permission denied
ls: cannot access 'proc/NVTSPI': Permission denied
ls: cannot access 'proc/crypto': Permission denied
ls: cannot access 'proc/vmstat': Permission denied
ls: cannot access 'proc/cgroups': Permission denied
ls: cannot access 'proc/cmdline': Permission denied
ls: cannot access 'proc/devices': Permission denied
ls: cannot access 'proc/ioports': Permission denied
ls: cannot access 'proc/loadavg': Permission denied
ls: cannot access 'proc/modules': Permission denied
ls: cannot access 'proc/nvt_raw': Permission denied
ls: cannot access 'proc/consoles': Permission denied
ls: cannot access 'proc/kallsyms': Permission denied
ls: cannot access 'proc/mipi_reg': Permission denied
ls: cannot access 'proc/nvt_diff': Permission denied
ls: cannot access 'proc/softirqs': Permission denied
ls: cannot access 'proc/zoneinfo': Permission denied
ls: cannot access 'proc/buddyinfo': Permission denied
ls: cannot access 'proc/config.gz': Permission denied
ls: cannot access 'proc/diskstats': Permission denied
ls: cannot access 'proc/key-users': Permission denied
ls: cannot access 'proc/schedstat': Permission denied
ls: cannot access 'proc/interrupts': Permission denied
ls: cannot access 'proc/kpagecount': Permission denied
ls: cannot access 'proc/kpageflags': Permission denied
ls: cannot access 'proc/partitions': Permission denied
ls: cannot access 'proc/timer_list': Permission denied
ls: cannot access 'proc/execdomains': Permission denied
ls: cannot access 'proc/filesystems': Permission denied
ls: cannot access 'proc/kpagecgroup': Permission denied
ls: cannot access 'proc/last_mcrash': Permission denied
ls: cannot access 'proc/sched_debug': Permission denied
ls: cannot access 'proc/tp_selftest': Permission denied
ls: cannot access 'proc/vmallocinfo': Permission denied
ls: cannot access 'proc/nvt_baseline': Permission denied
ls: cannot access 'proc/nvt_selftest': Permission denied
ls: cannot access 'proc/pagetypeinfo': Permission denied
ls: cannot access 'proc/nvt_test_data': Permission denied
ls: cannot access 'proc/sysrq-trigger': Permission denied
ls: cannot access 'proc/nvt_fw_version': Permission denied
ls: cannot access 'proc/uevents_records': Permission denied
ls: cannot access 'proc/perflock_records': Permission denied
ls: cannot access 'proc/tp_lockdown_info': Permission denied
ls: cannot access 'proc/uid_time_in_state': Permission denied
ls: cannot access 'proc/alarmtimer_records': Permission denied
ls: cannot access 'proc/sys_app_time_in_state': Permission denied
ls: cannot access 'proc/nvt_xiaomi_config_info': Permission denied
ls: cannot access 'proc/uid_concurrent_active_time': Permission denied
ls: cannot access 'proc/uid_concurrent_policy_time': Permission denied
ls: cannot access 'proc/sys_app_concurrent_active_time': Permission denied
ls: cannot access 'proc/sys_app_concurrent_policy_time': Permission denied
22410               interrupts              pressure
22428               iomem                   sched_debug
22433               ioports                 schedstat
22463               irq                     scsi
22468               kallsyms                sdx55m_cpuid
22470               key-users               sdx55m_secureboot
22473               keys                    self
23665               kmsg                    shs
23666               kpagecgroup             softirqs
23686               kpagecount              stat
23780               kpageflags              swaps
NVTSPI              last_mcrash             sys
alarmtimer_records  loadavg                 sys_app_concurrent_active_time
asound              locks                   sys_app_concurrent_policy_time
ath_pktlog          meminfo                 sys_app_time_in_state
buddyinfo           millet                  sysrq-trigger
bus                 mipi_reg                thread-self
cgroups             misc                    timer_list
cld                 modules                 tp_lockdown_info
cmdline             mounts                  tp_selftest
config.gz           mtd                     tty
consoles            mv                      tzdbg
cpuinfo             net                     uevents_records
crypto              nvt_baseline            uid_concurrent_active_time
debugdriver         nvt_diff                uid_concurrent_policy_time
device-tree         nvt_fw_version          uid_cputime
devices             nvt_raw                 uid_io
diskstats           nvt_selftest            uid_procstat
driver              nvt_test_data           uid_time_in_state
dynamic_debug       nvt_xiaomi_config_info  uptime
execdomains         package                 version
fb                  pagetypeinfo            vmallocinfo
filesystems         partitions              vmstat
fs                  perflock_records        zoneinfo
root@localhost:/#

@ZhymabekRoman ZhymabekRoman pinned this issue Jul 16, 2022
@ZhymabekRoman ZhymabekRoman changed the title How to solve the error? FATAL: attempted to create non-posix thread; clone_flags == 00004111 Jul 16, 2022
@ZhymabekRoman ZhymabekRoman added bug Something isn't working help wanted Extra attention is needed wontfix This will not be worked on labels Jul 16, 2022
@ZhymabekRoman
Copy link
Owner

ZhymabekRoman commented Dec 14, 2022

Code example, that reproduce error:

#include <stdlib.h>
#include <stdio.h>
#include <string.h>

#include <unistd.h>
#include <spawn.h>
#include <sys/wait.h>


int main(void) {
        pid_t pid;
        extern char **environ;
        char *spawn_argv[] = {"/bin/date", "--utc", NULL};
        if (posix_spawn(&pid, "/bin/date", NULL, NULL,
                        spawn_argv, environ) != 0) {
                perror("spawn");
                return 1;
        }
        int exit_status;
        if (waitpid(pid, &exit_status, 0) != 0) {
                perror("waitpid");
                return 1;
        }
        printf("date exit status was %d\n", exit_status);
}

Idk how solve this error

@Saikatsaha1996
Copy link
Author

Saikatsaha1996 commented Dec 31, 2022

Code example, that reproduce error:

#include <stdlib.h>
#include <stdio.h>
#include <string.h>

#include <unistd.h>
#include <spawn.h>
#include <sys/wait.h>


int main(void) {
        pid_t pid;
        extern char **environ;
        char *spawn_argv[] = {"/bin/date", "--utc", NULL};
        if (posix_spawn(&pid, "/bin/date", NULL, NULL,
                        spawn_argv, environ) != 0) {
                perror("spawn");
                return 1;
        }
        int exit_status;
        if (waitpid(pid, &exit_status, 0) != 0) {
                perror("waitpid");
                return 1;
        }
        printf("date exit status was %d\n", exit_status);
}

Idk how solve this error

What should I do with this code?

gcc .c -o Hello-error -lpthread?

@ZhymabekRoman
Copy link
Owner

What should I do with this code?

Just write this example into error_test.c file and compile using gcc:

gcc error_test.c
./a.out

@Saikatsaha1996
Copy link
Author

What should I do with this code?

Just write this example into error_test.c file and compile using gcc:

gcc error_test.c
./a.out

I have a question from you..
I build my own mesa GPU driver.. how to install in exagear ? Suppose i unpacked exagear obb than how to install ? I compiled with aarch64-linux-gnu

@ZhymabekRoman
Copy link
Owner

Unpack obb with unzip (obb is just zip archive) to any ext* based fs, and using Exagear-For-Termux, or proot, or even chroot (if you have PC/Laptop on linux inside with full root permissions) loggin into your unpacked rootfs image

@Saikatsaha1996
Copy link
Author

Saikatsaha1996 commented Jan 17, 2023

Unpack obb with unzip (obb is just zip archive) to any ext* based fs, and using Exagear-For-Termux, or proot, or even chroot (if you have PC/Laptop on linux inside with full root permissions) loggin into your unpacked rootfs image

No actually i compiled my GPU driver with aarch64-linux-gnu .. where i should place my GPU driver? Or what i should replace?

Actually exagear for i386-linux-gnu but my GPU driver is aarch64-linux-gnu that's why asking..

It will work if i place my GPU driver in /usr/local/lib/aarch64-linux-gnu ?

@ZhymabekRoman
Copy link
Owner

Ahhhh, it's not possible. Compile inside Exagear-For-Termux, or if hangs on errors use proot-distro with QEMU user mode inside i386 environment

@Saikatsaha1996
Copy link
Author

Ahhhh, it's not possible. Compile inside Exagear-For-Termux, or if hangs on errors use proot-distro with QEMU user mode inside i386 environment

Okay understood.. driver also need with i386-linux-gnu
But still i am confused because my architecture is aarch64 how my GPU driver working with i386-linux-gnu

@ZhymabekRoman
Copy link
Owner

But still i am confused because my architecture is aarch64 how my GPU driver working with i386-linux-gnu

What is your GPU, and SoC (Processor, Snapdragon, MediaTek)

@Saikatsaha1996
Copy link
Author

Saikatsaha1996 commented Jan 17, 2023

But still i am confused because my architecture is aarch64 how my GPU driver working with i386-linux-gnu

What is your GPU, and SoC (Processor, Snapdragon, MediaTek)

Mediatek 8100
Mali G-610

@Saikatsaha1996
Copy link
Author

Saikatsaha1996 commented Jan 17, 2023

I has some problem like this
I unzip with
unzip my_package.obb -d exagear-fs/
But when i start ..
Screenshot_2023-01-17-09-46-06-734_com termux

@ZhymabekRoman
Copy link
Owner

Mediatek 8100
Mali G-610

Did you try VirGL Overlay?

@ZhymabekRoman
Copy link
Owner

But when i start ..

Yeah, old syntax is deprecated. New syntax:
./start-exagear login

@Saikatsaha1996
Copy link
Author

But when i start ..

Yeah, old syntax is deprecated. New syntax: ./start-exagear login

I want to disable --sysvipc is not possible to disable?
My GPU driver will not work with --sysvipc

@Saikatsaha1996
Copy link
Author

Code example, that reproduce error:

#include <stdlib.h>
#include <stdio.h>
#include <string.h>

#include <unistd.h>
#include <spawn.h>
#include <sys/wait.h>


int main(void) {
        pid_t pid;
        extern char **environ;
        char *spawn_argv[] = {"/bin/date", "--utc", NULL};
        if (posix_spawn(&pid, "/bin/date", NULL, NULL,
                        spawn_argv, environ) != 0) {
                perror("spawn");
                return 1;
        }
        int exit_status;
        if (waitpid(pid, &exit_status, 0) != 0) {
                perror("waitpid");
                return 1;
        }
        printf("date exit status was %d\n", exit_status);
}

Idk how solve this error

root@localhost:~# ls
a.c  a.out
root@localhost:~# ./a.out
clone: FATAL: attempted to create non-posix thread; clone_flags == 00004111

@ZhymabekRoman
Copy link
Owner

ZhymabekRoman commented Feb 20, 2023

Some findings:

  • Problem in the clone operation. I can't say more about clone, I'm not an experienced low-level Linux developer. I need more time to investigate problem.
  • About clone_flags == 00004111 in a nutshell:

The value 00004111 is a hexadecimal representation of the clone_flags parameter for the clone() system call in Linux.

In binary, 00004111 is equal to 00000000000000000100000100010001.

If we break this binary value down into its bits, and use the meaning of each bit, we can interpret the clone_flags parameter as follows:

0000 0000 0000 0000 0001 0000 0100 0100 0001
                                   ^^^^ ^^^^
                                   |||| |||+-- CLONE_FILES
                                   |||| ||+--- CLONE_FS
                                   |||| |+---- CLONE_NEWNS
                                   |||| +----- CLONE_NEWUTS
                                   |||+------- CLONE_SIGHAND
                                   ||+-------- CLONE_THREAD
                                   |+--------- CLONE_VM
                                   ---------- (unused bit)

So the clone_flags parameter with a value of 00004111 sets the following options for the new process or thread being created

`CLONE_VM`: Shares the same memory as the parent process or thread.
`CLONE_FS`: Shares the same file system with the parent process or thread.
`CLONE_FILES`: Shares the same file descriptor table with the parent process or thread.
`CLONE_SIGHAND`: Shares the same signal handlers with the parent process or thread.
`CLONE_THREAD`: Creates a new thread rather than a new process.
`CLONE_NEWNS`: Creates a new mount namespace for the new process.
`CLONE_NEWUTS`: Creates a new UTS namespace for the new process.

Can we fix the problem? I think - probably yes. Why probably - because I don't think we can just fix this problem by patching proot-static. If I'm not able to fix it, I'm going to archive this project.

@ZhymabekRoman
Copy link
Owner

ZhymabekRoman commented Feb 22, 2023

Workaround fix, works only if executable is dynamic linked.

override.c file:

#define _GNU_SOURCE
#include <dlfcn.h>
#include <sys/types.h>
#include <sched.h>

int clone(int (*fn)(void *), void *child_stack, int flags, void *arg, ...)
{    
    /* Call the original clone function */
    int (*original_clone)(int (*)(void *), void *, int, void *, ...) = dlsym(RTLD_NEXT, "clone");
    return original_clone(fn, child_stack, 0, arg);
}

Compile:

gcc -shared -fPIC -o override.so override.c -ldl

And set LD_PRELOAD variable:

export LD_PRELOAD=$(pwd)/override.so

This workaround fixes the problem by resetting all clone flags.

@Saikatsaha1996
Copy link
Author

Workaround fix, works only if executable is dynamic linked.

override.c file:

#define _GNU_SOURCE
#include <dlfcn.h>
#include <sys/types.h>
#include <sched.h>

int clone(int (*fn)(void *), void *child_stack, int flags, void *arg, ...)
{    
    /* Call the original clone function */
    int (*original_clone)(int (*)(void *), void *, int, void *, ...) = dlsym(RTLD_NEXT, "clone");
    return original_clone(fn, child_stack, 0, arg);
}

Compile:

gcc -shared -fPIC -o override.so override.c -ldl

And set LD_PRELOAD variable:

export LD_PRELOAD=$(pwd)/override.so

This workaround fixes the problem by resetting all clone flags.

I will give you update

@Saikatsaha1996
Copy link
Author

@ZhymabekRoman

root@localhost:/# apt update
Hit:1 http://security.debian.org/debian-security bullseye-security InRelease
Hit:2 http://deb.debian.org/debian bullseye InRelease
Hit:3 http://deb.debian.org/debian bullseye-updates InRelease
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
51 packages can be upgraded. Run 'apt list --upgradable' to see them.
root@localhost:/# apt-mark hold udisks2
udisks2 set on hold.
root@localhost:/# apt upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
  udisks2
The following packages will be upgraded:
  bash bsdutils dbus dbus-user-session dpkg fdisk gzip libblkid1
  libbluray2 libc-bin libcryptsetup12 libdbus-1-3 libexpat1 libfdisk1
  libfreetype6 libgmp10 libgnutls30 libgssapi-krb5-2 libk5crypto3
  libkrb5-3 libkrb5support0 liblzma5 libmount1 libpam-modules
  libpam-modules-bin libpam-runtime libpam-systemd libpam0g libpcre2-8-0
  libpolkit-agent-1-0 libpolkit-gobject-1-0 libseccomp2 libsmartcols1
  libssl1.1 libsystemd0 libtasn1-6 libudev1 libudisks2-0 libuuid1 libxml2
  mount openssl systemd systemd-sysv systemd-timesyncd sysvinit-utils
  tzdata udev util-linux zlib1g
50 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
Need to get 0 B/24.1 MB of archives.
After this operation, 186 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
debconf: delaying package configuration, since apt-utils is not installed
(Reading database ... 19367 files and directories currently installed.)
Preparing to unpack .../bash_5.1-2+deb11u1_i386.deb ...
clone: FATAL: attempted to create non-posix thread; clone_flags == 00004111
dpkg: error processing archive /var/cache/apt/archives/bash_5.1-2+deb11u1_i386.deb (--unpack):
 new bash package pre-installation script subprocess returned error exit status 1
update-alternatives: using /usr/share/man/man7/bash-builtins.7.gz to provide /usr/share/man/man7/builtins.7.gz (builtins.7.gz) in auto mode
Errors were encountered while processing:
 /var/cache/apt/archives/bash_5.1-2+deb11u1_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@localhost:/# ls
bin   dev  home  media  opt   root  sbin  storage  tmp  var
boot  etc  lib   mnt    proc  run   srv   sys      usr
root@localhost:/# cd
root@localhost:~# ls
override.c  override.so
root@localhost:~# export LD_PRELOAD=$(pwd)/override.so
root@localhost:~# apt upgrade -y
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
  udisks2
The following packages will be upgraded:
  bash bsdutils dbus dbus-user-session dpkg fdisk gzip libblkid1
  libbluray2 libc-bin libcryptsetup12 libdbus-1-3 libexpat1 libfdisk1
  libfreetype6 libgmp10 libgnutls30 libgssapi-krb5-2 libk5crypto3
  libkrb5-3 libkrb5support0 liblzma5 libmount1 libpam-modules
  libpam-modules-bin libpam-runtime libpam-systemd libpam0g libpcre2-8-0
  libpolkit-agent-1-0 libpolkit-gobject-1-0 libseccomp2 libsmartcols1
  libssl1.1 libsystemd0 libtasn1-6 libudev1 libudisks2-0 libuuid1 libxml2
  mount openssl systemd systemd-sysv systemd-timesyncd sysvinit-utils
  tzdata udev util-linux zlib1g
50 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
Need to get 0 B/24.1 MB of archives.
After this operation, 186 kB of additional disk space will be used.
debconf: delaying package configuration, since apt-utils is not installed
(Reading database ... 19367 files and directories currently installed.)
Preparing to unpack .../bash_5.1-2+deb11u1_i386.deb ...
clone: FATAL: attempted to create non-posix thread; clone_flags == 00004111
dpkg: error processing archive /var/cache/apt/archives/bash_5.1-2+deb11u1_i386.deb (--unpack):
 new bash package pre-installation script subprocess returned error exit status 1
update-alternatives: using /usr/share/man/man7/bash-builtins.7.gz to provide /usr/share/man/man7/builtins.7.gz (builtins.7.gz) in auto mode
Errors were encountered while processing:
 /var/cache/apt/archives/bash_5.1-2+deb11u1_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Screenshot_2023-02-22-16-10-54-61_84d3000e3f4017145260f7618db1d683

@Saikatsaha1996
Copy link
Author

Xvnc TigerVNC 1.11.0 - built 2022-01-26 17:59
Copyright (C) 1999-2020 TigerVNC Team and many others (see README.rst)
See https://www.tigervnc.org for information on TigerVNC.
Underlying X server release 12011000, The X.Org Foundation


Wed Feb 22 12:21:10 2023
 vncext:      VNC extension running!
 vncext:      Listening for VNC connections on local interface(s), port 5901
 vncext:      created VNC server for screen 0
3NI3X0 New Xtigervnc server 'localhost:1 (root)' on port 5901 for display :1.
3NI3X0 Use xtigervncviewer -SecurityTypes VncAuth -passwd /root/.vnc/passwd :1 to connect to the VNC server.
/usr/bin/startxfce4: X server already running on display :1
clone: FATAL: attempted to create non-posix thread; clone_flags == 00004111
clone: FATAL: attempted to create non-posix thread; clone_flags == 00004111
The X session exited with status 1!
Killing Xtigervnc process ID 21998...
Wed Feb 22 12:21:21 2023
 ComparingUpdateTracker: 0 pixels in / 0 pixels out
 ComparingUpdateTracker: (1:nan ratio)
 success!

@ZhymabekRoman
Copy link
Owner

Hmmm, yeah, I need more time to debug

@Saikatsaha1996
Copy link
Author

Saikatsaha1996 commented Feb 23, 2023

Mey be documents can help for pthread

https://eli.thegreenplace.net/2018/launching-linux-threads-and-processes-with-clone/

I am not sure but i found something..
In android stock rom kernel sys call is disabled.. mey be it can be issue.. i don't have rooted device that why i can't check with system call implementation..

@ZhymabekRoman
Copy link
Owner

clone operation is available in Android.

@ZhymabekRoman
Copy link
Owner

#define _GNU_SOURCE
#include <signal.h>
#include <sched.h>

static int child_func(void* arg) {
  char* buf = (char*)arg;
  printf("Child sees buf = \"%s\"\n", buf);
  strcpy(buf, "hello from child");
  return 0;
}

int main(int argc, char** argv) {
  // Allocate stack for child task.
  const int STACK_SIZE = 65536;
  char* stack = malloc(STACK_SIZE);
  if (!stack) {
    perror("malloc");
    exit(1);
  }

  // When called with the command-line argument "vm", set the CLONE_VM flag on.
  unsigned long flags = 0;
  if (argc > 1 && !strcmp(argv[1], "vm")) {
    flags |= CLONE_VM;
  }

  char buf[100];
  strcpy(buf, "hello from parent");
  if (clone(child_func, stack + STACK_SIZE, CLONE_VM | SIGCHLD, buf) == -1) {
    perror("clone");
    exit(1);
  }

  int status;
  if (wait(&status) == -1) {
    perror("wait");
    exit(1);
  }

  printf("Child exited with status %d. buf = \"%s\"\n", status, buf);
  return 0;
}

@Saikatsaha1996
Copy link
Author

Saikatsaha1996 commented Feb 23, 2023

#define _GNU_SOURCE
#include <signal.h>
#include <sched.h>

static int child_func(void* arg) {
  char* buf = (char*)arg;
  printf("Child sees buf = \"%s\"\n", buf);
  strcpy(buf, "hello from child");
  return 0;
}

int main(int argc, char** argv) {
  // Allocate stack for child task.
  const int STACK_SIZE = 65536;
  char* stack = malloc(STACK_SIZE);
  if (!stack) {
    perror("malloc");
    exit(1);
  }

  // When called with the command-line argument "vm", set the CLONE_VM flag on.
  unsigned long flags = 0;
  if (argc > 1 && !strcmp(argv[1], "vm")) {
    flags |= CLONE_VM;
  }

  char buf[100];
  strcpy(buf, "hello from parent");
  if (clone(child_func, stack + STACK_SIZE, CLONE_VM | SIGCHLD, buf) == -1) {
    perror("clone");
    exit(1);
  }

  int status;
  if (wait(&status) == -1) {
    perror("wait");
    exit(1);
  }

  printf("Child exited with status %d. buf = \"%s\"\n", status, buf);
  return 0;
}

I should create .so file with this ? And need to set as LD_PRELOAD ?

Found more information
https://github.com/DynamoRIO/dynamorio/blob/master/suite/tests/linux/clone.c

@ZhymabekRoman
Copy link
Owner

I should create .so file with this ?

No, it's a clone working test example. Just compile it with gcc and run it. Test it in Android and in Exagear. In Exagear it will not run, in Android it will.

@Saikatsaha1996
Copy link
Author

I should create .so file with this ?

No, it's a clone working test example. Just compile it with gcc and run it. Test it in Android and in Exagear. In Exagear it will not run, in Android it will.

gcc hello.c -o hello
hello.c:7:3: warning: call to undeclared library function 'printf' with type 'int (const char *, ...)'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  printf("Child sees buf = \"%s\"\n", buf);
  ^
hello.c:7:3: note: include the header <stdio.h> or explicitly provide a declaration for 'printf'
hello.c:8:3: warning: call to undeclared library function 'strcpy' with type 'char *(char *, const char *)'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  strcpy(buf, "hello from child");
  ^
hello.c:8:3: note: include the header <string.h> or explicitly provide a declaration for 'strcpy'
hello.c:15:17: warning: call to undeclared library function 'malloc' with type 'void *(unsigned long)'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  char* stack = malloc(STACK_SIZE);
                ^
hello.c:15:17: note: include the header <stdlib.h> or explicitly provide a declaration for 'malloc'
hello.c:17:5: warning: call to undeclared function 'perror'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    perror("malloc");
    ^
hello.c:18:5: warning: call to undeclared library function 'exit' with type 'void (int) __attribute__((noreturn))'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    exit(1);
    ^
hello.c:18:5: note: include the header <stdlib.h> or explicitly provide a declaration for 'exit'
hello.c:23:20: warning: call to undeclared library function 'strcmp' with type 'int (const char *, const char *)'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  if (argc > 1 && !strcmp(argv[1], "vm")) {
                   ^
hello.c:23:20: note: include the header <string.h> or explicitly provide a declaration for 'strcmp'
hello.c:30:5: warning: call to undeclared function 'perror'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    perror("clone");
    ^
hello.c:35:7: warning: call to undeclared function 'wait'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  if (wait(&status) == -1) {
      ^
hello.c:36:5: warning: call to undeclared function 'perror'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    perror("wait");
    ^
9 warnings generated.
~ $ ls
ExaTermux          hello    storage
fs-manager-udroid  hello.c  termux-android12-phantom-fix
~ $ ./he*
Child sees buf = "hello from parent"
Child exited with status 0. buf = "hello from child"
~ $

@ageevp
Copy link

ageevp commented Sep 17, 2023

Which distribution do you use ? Debian 11? The problem seems to be closely related to the operating system.
I confirm this but in different environment.
I've Odroid xu4 armhf SOC with Debian 11 as a host and Exagear Debian 9 as a guest .
I've build Acestreamplayer in guest.
If I start play any file Acestreamplayer crash with that issue.
NOTE. vlc play well
NOTE. Ubuntu version do not have this issue.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working help wanted Extra attention is needed wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants