Closed qwyinxiang closed 4 years ago
Hi @qwyinxiang
Thank you, for your feedback. This issue caused by not existing user (thingsboard_gateway), to create it, you can use following commands:
sudo mkdir -p $RPM_BUILD_ROOT/var/lib/thingsboard_gateway || echo "ThingsBoard user home directory already exists"
/usr/bin/getent passwd thingsboard_gateway || /usr/sbin/useradd -c "ThingsBoard-Gateway Service" -r -U -d /var/lib/thingsboard_gateway thingsboard_gateway && passwd -d thingsboard_gateway
/usr/bin/chown thingsboard_gateway:thingsboard_gateway $RPM_BUILD_ROOT/var/lib/thingsboard_gateway -R
the RPM_BUILD_ROOT is what path
@oliver225
Usually, it is a rpmbuild folder in user home directory.
@oliver225
No, you have to run this script, only if the thingsboard_gateway user is existed. The simplest way to run it correctly - install the version from deb/rpm package and create your own package after installation. Installation from deb/rpm will create required user and folders.
@zbeacon ,The following is the commands I executed :
I logged in my CentOS system as ROOT user, so I make a directory in /home directory use
mkdir -p /home/root/rpmbuild
Then I executed the following commands:
mkdir -p /home/root/rpmbuild/var/lib/thingsboard_gateway || echo "thingsboard user home directory already exists" /usr/bin/getent passwd thingsboard_gateway || /usr/sbin/useradd -c "ThingsBoard-Gateway Service" -r -U -d /var/lib/thingsboard_gateway thingsboard_gateway && passwd -d thingsboard_gateway /usr/bin/chown thingsboard_gateway:thingsboard_gateway /home/root/rpmbuild/var/lib/thingsboard_gateway -R
Then, I execute the make_packages.sh. The following errors occurs.
running install_egg_info Copying thingsboard_gateway.egg-info to /opt/tb-gateway/build/bdist.linux-x86_64/rpm/BUILDROOT/thingsboard-gateway-2.3.0.1-1.x86_64/usr/lib/python3.6/site-packages/thingsboard_gateway-2.3.0.1-py3.6.egg-info running install_scripts Installing thingsboard-gateway script to /opt/tb-gateway/build/bdist.linux-x86_64/rpm/BUILDROOT/thingsboard-gateway-2.3.0.1-1.x86_64/usr/bin writing list of installed files to 'INSTALLED_FILES'
RPM 构建错误: /var/tmp/rpm-tmp.vfz8Bw (%build) 退出状态不好 cp: 无法获取"/home/root/rpmbuild/RPMS/noarch/.rpm" 的文件状态(stat): 没有那个文件或目录 mv: 无法获取"thingsboard-gateway-2.3.0.1-1.noarch.rpm" 的文件状态(stat): 没有那个文件或目录 chown: 无法访问".rpm": 没有那个文件或目录
@qwyinxiang
It looks like by some reasons the script didn't execute command cp for_build/etc/systemd/system/thingsboard-gateway.service /home/root/rpmbuild/SOURCES/
correctly. Please check - is file thingsboard-gateway.service exist in the folder /home/root/rpmbuild/SOURCES/ ?
yes, The thingsboard-gateway.service exist.
[root@wlw153 tb-gateway]# cd /home/root/rpmbuild/
[root@wlw153 rpmbuild]# ls
BUILD BUILDROOT RPMS SOURCES SPECS SRPMS var
[root@wlw153 rpmbuild]# cd S
SOURCES/ SPECS/ SRPMS/
[root@wlw153 rpmbuild]# cd SOURCES/
[root@wlw153 SOURCES]# ls
configs.tar.gz thingsboard-gateway-2.3.0.1.tar.gz thingsboard-gateway.service
[root@wlw153 SOURCES]#
The issue in the script - If you use root user to build a package, you need to replace "/home/$CURRENT_USER/..." to "/root/...".
I replaced "/home/$CURRENT_USER/" to "/root/", and my make_packages.sh file looks like below:
Then, I execute the following commands:
sudo mkdir -p /root/rpmbuild/var/lib/thingsboard_gateway || echo "ThingsBoard user home directory already exists"
/usr/bin/getent passwd thingsboard_gateway || /usr/sbin/useradd -c "ThingsBoard-Gateway Service" -r -U -d /var/lib/thingsboard_gateway thingsboard_gateway && passwd -d thingsboard_gateway
/usr/bin/chown thingsboard_gateway:thingsboard_gateway /root/rpmbuild/var/lib/thingsboard_gateway -R
Then I execute the make_packages.sh. The following error occurs:
RPM 构建错误: 没有找到文件:/root/rpmbuild/BUILDROOT/thingsboard-gateway-2.3.0-1.x86_64/etc/systemd/system/thingsboard-gateway.service 没有找到目录:/root/rpmbuild/BUILDROOT/thingsboard-gateway-2.3.0-1.x86_64/etc/thingsboard-gateway 没有找到目录:/root/rpmbuild/BUILDROOT/thingsboard-gateway-2.3.0-1.x86_64/var/log/thingsboard-gateway 没有找到目录:/root/rpmbuild/BUILDROOT/thingsboard-gateway-2.3.0-1.x86_64/var/lib/thingsboard_gateway 没有找到文件:/root/rpmbuild/BUILDROOT/thingsboard-gateway-2.3.0-1.x86_64/usr/local/lib/python3.8 没有找到文件:/root/rpmbuild/BUILDROOT/thingsboard-gateway-2.3.0-1.x86_64/usr/local/bin/thingsboard-gateway cp: 无法获取"/root/rpmbuild/RPMS/noarch/.rpm" 的文件状态(stat): 没有那个文件或目录 mv: 无法获取"thingsboard-gateway-2.3.0.1-1.noarch.rpm" 的文件状态(stat): 没有那个文件或目录 chown: 无法访问".rpm": 没有那个文件或目录 [root@wlw153 tb-gateway]# cd /root/rpmbuild/BUILDROOT/thingsboard-gateway-2.3.0-1.x86_64/ [root@wlw153 thingsboard-gateway-2.3.0-1.x86_64]# ls [root@wlw153 thingsboard-gateway-2.3.0-1.x86_64]# [root@wlw153 thingsboard-gateway-2.3.0-1.x86_64]# [root@wlw153 thingsboard-gateway-2.3.0-1.x86_64]# [root@wlw153 thingsboard-gateway-2.3.0-1.x86_64]# [root@wlw153 thingsboard-gateway-2.3.0-1.x86_64]#
me,too.So how to solve it?
Hi everybody,
To solve this issue, before generation the package you have to has installed all required dependencies on your system, even the yours version of the gateway. Only after all dependencies will be installed in the system, you will be able to generate rpm package.
Describe the bug I clone the latest release of thingsboard-gateway 2.3.0.1 on my centos7.7. and make some changes to the source code. Now I want to generate an rpm package, but when I execute the make_packages.sh file. some errors occurs.
Error traceback (If available):
Versions (please complete the following information):
OS: [CentOS Linux release 7.7.1908 (Core)]
Thingsboard IoT Gateway version [e2.3.0.1]