Solved You need to make sure that /usr/local/share/qq/opt/QQ/chrome-sandbox is owned by root and has mode 4755.

see also my Port in https://github.com/FreeBSD-Ask/QQ-Port

QQ is a very popular messaging software in China, with approximately 571 million users in 2024.

After installing my Port, running
/usr/share/qq/opt/QQ/qq
shows the message: “You need to make sure that /usr/local/share/qq/opt/QQ/chrome-sandbox is owned by root and has mode 4755.” However, if I add these two lines in the script:
${CHMOD} 4755 ${STAGEDIR}${PREFIX}/share/qq/opt/QQ/chrome-sandbox

${CHOWN} root:wheel ${STAGEDIR}${PREFIX}/share/qq/opt/QQ/chrome-sandbox

the software loses its environment variables and all dependencies.

Code:
PORTNAME=    qq
PORTVERSION=    ${QQ_VER}.${QQ_BUILD}
CATEGORIES=    net-im linux
MASTER_SITES=    https://dldir1.qq.com/qqfile/qq/QQNT/Linux/
DISTNAME=    QQ_${QQ_VER}_${QQ_DATE}_${LINUX_ARCH_${ARCH}}_${QQ_BUILD}
DISTFILES=    ${DISTNAME}.rpm

MAINTAINER=    yklaxds@gmail.com
COMMENT=    Tencent QQ for Linux
WWW=        https://im.qq.com/linuxqq/

RUN_DEPENDS=    linux_base-rl9>0:emulators/linux_base-rl9

USES=        linux:rl9
USE_LINUX=    xorglibs nss dbus cups-libs alsalib alsa-plugins-oss alsa-plugins-pulseaudio ffmpeg-libs
ONLY_FOR_ARCHS=    aarch64 amd64

SHEBANG_FILES=    opt/QQ/qq

NO_BUILD=    yes
NO_WRKSUBDIR=    yes

QQ_VER=        3.2.17
QQ_DATE=    250521
QQ_BUILD=    01

# Architecture mapping
LINUX_ARCH_amd64=    x86_64
LINUX_ARCH_aarch64=    aarch64

post-extract:
    @${REINPLACE_CMD} -e 's|/opt/QQ/qq|${PREFIX}/share/qq/opt/QQ/qq|' \
        ${WRKSRC}/usr/share/applications/qq.desktop

do-install:
    ${MKDIR} ${STAGEDIR}${PREFIX}/share/qq
    cd ${WRKDIR}/qq-${QQ_VER}.${QQ_BUILD} && ${COPYTREE_SHARE} . ${STAGEDIR}${PREFIX}/share/qq
    cd ${WRKSRC}/usr/share && ${COPYTREE_SHARE} . ${STAGEDIR}${PREFIX}/share
    ${CHMOD} +x ${STAGEDIR}${PREFIX}/share/qq/opt/QQ/qq

.include <bsd.port.mk>

The complete Port is at https://github.com/FreeBSD-Ask/QQ-Port/blob/main/qq. Does anyone know how to solve this issue? Thank you very much.
 
See how other ports (e.g. net-im/linux-discord) handle suid binaries (hint: pkg-plist).

P.S.
/usr/local/share/qq/opt/QQ/
I must admit it's rather weird path, you might want to rethink it, e.g. by dropping opt/QQ/ part.
 
See how other ports (e.g. net-im/linux-discord) handle suid binaries (hint: pkg-plist).

P.S.

I must admit it's rather weird path, you might want to rethink it, e.g. by dropping opt/QQ/ part.

Now the permissions have been set, but the old issue has returned. When I run it, I get the following error:


Code:
ykla@ykla:~ $ /usr/local/share/qq/qq
not mini app.
/usr/local/share/qq/qq: error while loading shared libraries: liblinux_compat.so: cannot open shared object file: No such file or directory
[8550:0603/194636.229874:FATAL:zygote_host_impl_linux.cc(207)] Check failed: . : Invalid argument (22)[preload] succeeded. /usr/local/share/qq/resources/app/major.node
[8552:0603/194636.261770:ERROR:file_path_watcher_inotify.cc(895)] Failed to read /proc/sys/fs/inotify/max_user_watches
Trace/BPT trap (core dumped)


However, if I don’t set the owner to root and the permission to 4755, this error does not occur. It also runs properly as the root user. If I revoke the permissions, the library works fine. So it's not a problem with the library.
 
Failed to read /proc/sys/fs/inotify/max_user_watches
Is linprocfs(5) mounted? Although I'm not sure if it supports /proc/sys/fs.

Don't put these in /etc/fstab though, they should get 'automagically' mounted with linux_enable="YES" in rc.conf.
 
Is linprocfs(5) mounted? Although I'm not sure if it supports /proc/sys/fs.

Don't put these in /etc/fstab though, they should get 'automagically' mounted with linux_enable="YES" in rc.conf.

Here it should just be a warning, not an error. The actual error was caused by:


Code:
/usr/local/share/qq/qq: error while loading shared libraries: liblinux_compat.so: cannot open shared object file: No such file or directory

However, the liblinux_compat.so dependency is actually bundled with the software qq itself. see also https://github.com/FreeBSD-Ask/QQ-Port/blob/main/qq/pkg-plist line 13

As long as I set the owner and permissions of chrome-sandbox, an error occurs. But if I don't set them, the root user can run it normally with the --sandbox parameter.
 
Back
Top