Problem with fakeroot and qemu

This forum is for discussion about general software issues.

Problem with fakeroot and qemu

Postby mipi » Sun May 03, 2020 9:50 am

Hi,
I created an ARM chroot environment on an Arch Linux x86_64 system using platform images from archlinux.org (I tried out different platforms). qemu (qemu-user-static to be exact) is used to "translate" between the host and the ARM platform. When I tried to build an AUR package in that chroot, I get the error
Code: Select all
semop(1): encountered an error: Function not implemented
directly after makepkg entered fakeroot. I get this for multiple ARM platforms.

I assume that this has something to do with qemu since I get the same error when I try to execute the build in an ARM docker container. I used a docker image from Stefan Agners:
  1. Code: Select all
    docker run --rm -ti agners/archlinuxarm-arm32v7
  2. Installed base-devel in the container
  3. Executed fakeroot (just the command without any argument

Does anybody know why that error occurs or how I can fidn out the cause?

Thanks,
mipi
mipi
 
Posts: 4
Joined: Sun Jul 22, 2018 2:06 pm

Re: Problem with fakeroot and qemu

Postby Noeljunior » Wed May 06, 2020 8:41 pm

I'm stuck at the same point. I'll let you know if I figure something out.

So, it looks like the problem starts at fakeroot.

I've made a simple C program too include and call semop() and semtimedop(): it compiles and runs...

I have no idea how to proceed debugging this as I can't debug if the problem is a configuration (arch linux arm) problem, a qemu problem, fakeroot problem or anything else.
Noeljunior
 
Posts: 3
Joined: Wed May 06, 2020 8:38 pm

Re: Problem with fakeroot and qemu

Postby Noeljunior » Fri May 08, 2020 6:21 pm

News on this.

If I create a new clean aarch64 chroot using archlinux x86_64 helpers (devtools) with alarm's pacman.conf and makepkg.conf from a rapsberry pi 3 image: fakeroot fails with 'semop(1): encountered an error: Function not implemented'

If I extract that same RPI3 image, systemd-nspawn into it and try to execute fakeroot, I have no problems.
Noeljunior
 
Posts: 3
Joined: Wed May 06, 2020 8:38 pm

Re: Problem with fakeroot and qemu

Postby moonman » Fri May 08, 2020 6:23 pm

It is exactly why it is a bad idea to build a package using an emulator. Not all CPU features are implemented, I'm sure there are bugs in emulation etc. There is a high probability whatever you compiled will be broken (if it compiles at all).
Pogoplug V4 | GoFlex Home | Raspberry Pi 4 4GB | CuBox-i4 Pro | ClearFog | BeagleBone Black | Odroid U2 | Odroid C1 | Odroid XU4
-----------------------------------------------------------------------------------------------------------------------
[armv5] Updated U-Boot | [armv5] NAND Rescue System
moonman
Developer
 
Posts: 3323
Joined: Sat Jan 15, 2011 3:36 am

Re: Problem with fakeroot and qemu

Postby elektrofon » Mon May 18, 2020 11:19 am

I got the same problem on the latest ArchLinuxArm update.
My guess is that the new kernel was compiled with a difference in the Kconfig, resulting in missing or incompatible SysV.
The fakeroot that is bundled in base-devel is built with SysV.

My temporary solution was to build fakeroot with TCP instead of SysV.
You can find the build procedure for fakeroot with TCP in the AUR. Search for "fakeroot-tcp".

You have to build fakeroot from source to get this to work. Makepkg depends on fakeroot for packaging, and there is no way to skip the package function. Fakeroot is, and has always been a source of great pain. It solves a real problem, but it has a real tendency to just get in the way.

In the Makepkg commit that implemented fakeroot enforcement – the commit message says that fakeroot could be circumvented with two lines in a wrapper script. I have no idea what this even means. There are no more information given.

Everything works as it should after installing fakeroot with TCP.

To blame QEMU for this error is a very strange approach.
This has nothing to do with the way ARM is emulated.

I'm going to dig deeper and diff the config.gz of the last kernel that worked for me against the new one that caused problems.
I'm pretty sure the fault lies in the kernel config.
elektrofon
 
Posts: 1
Joined: Mon May 18, 2020 11:05 am

Re: Problem with fakeroot and qemu

Postby Noeljunior » Sun May 24, 2020 10:05 pm

That's good news, thanks! I'll test this soon. Let us know if you found the culprit, elektrofon.
Noeljunior
 
Posts: 3
Joined: Wed May 06, 2020 8:38 pm

Re: Problem with fakeroot and qemu

Postby bogen » Mon Jul 20, 2020 1:27 am

Haha, circular dependency...
:lol:
Code: Select all
make[1]: Leaving directory '/home/alarm/fakeroot-tcp/src/fakeroot-1.24'
==> Entering fakeroot environment...
semop(1): encountered an error: Function not implemented
[alarm@aarch64-root-00 fakeroot-tcp]$


Now, to get the package built for a target environment, that needs to be built on the target environment, and I'm not ready to use the target environment in this way yet...
bogen
 
Posts: 5
Joined: Fri Jul 22, 2011 4:59 am

Re: Problem with fakeroot and qemu

Postby bogen » Mon Jul 20, 2020 1:55 am

Code: Select all
# after the build failed
cd src/fakeroot-1.24
sudo make install


Now retrying makepkg...

Oh, earlier I got:
Code: Select all
make[2]: Leaving directory '/home/alarm/fakeroot-tcp/src/fakeroot-1.24'
make[1]: Leaving directory '/home/alarm/fakeroot-tcp/src/fakeroot-1.24'
/home/alarm/fakeroot-tcp/PKGBUILD: line 41: po4a: command not found
==> ERROR: A failure occurred in build().
    Aborting...
[alarm@aarch64-root-00 fakeroot-tcp]$


To work around that I did:
Code: Select all
sudo ln -s /usr/bin/vendor_perl/po4a /usr/bin/
bogen
 
Posts: 5
Joined: Fri Jul 22, 2011 4:59 am

Re: Problem with fakeroot and qemu

Postby bogen » Mon Jul 20, 2020 2:11 am

The fix (manually doing "sudo make install") worked, I can now use makepkg in my qemu virtual environment.
Thanks @elektrofon
bogen
 
Posts: 5
Joined: Fri Jul 22, 2011 4:59 am

Re: Problem with fakeroot and qemu

Postby petermurnik » Wed Aug 05, 2020 6:38 am

manually doing "sudo make install" - this works.
slitherio
petermurnik
 
Posts: 1
Joined: Wed Aug 05, 2020 6:34 am

Next

Return to General

Who is online

Users browsing this forum: No registered users and 2 guests