Build from source issue

Dear all:
I try to build rockstor from source, following document section “Contributing to Rockstor”,
use the following command:

rsync -avz --exclude=.git /root/rockstor/rockstor-core root@192.168.100.123:/root/rockstor/
yum install gcc
yum install gcc-c++
yum install python-devel.x86_64
yum install postgresql-devel

python ./bootstrap.py -c buildout.cfg
./bin/buildout -N -c buildout.cfg

but it seems not work well:

"-- Unit postgresql.service has begun shutting down.
Mar 07 08:16:19 rockstor-build pg_ctl[33466]: pg_ctl: PID file “/var/lib/pgsql/data/postmaster.pid” does not exist
Mar 07 08:16:19 rockstor-build pg_ctl[33466]: Is server running?
Mar 07 08:16:19 rockstor-build systemd[1]: postgresql.service: control process exited, code=exited status=1
Mar 07 08:16:19 rockstor-build systemd[1]: postgresql.service: main process exited, code=exited, status=1/FAILURE
Mar 07 08:16:19 rockstor-build systemd[1]: Unit postgresql.service entered failed state.
Mar 07 08:16:19 rockstor-build systemd[1]: postgresql.service failed.
Mar 07 08:16:19 rockstor-build systemd[1]: Starting PostgreSQL database server…
– Subject: Unit postgresql.service has begun start-up
"

journalctl -xe show this error:

Mar 07 08:16:21 rockstor-build initrock[33361]: File “/root/rockstor/rockstor-core/src/rockstor/system/osi.py”, line 176, in run_command
Mar 07 08:16:21 rockstor-build initrock[33361]: raise CommandException(cmd, out, err, rc)
Mar 07 08:16:21 rockstor-build initrock[33361]: system.exceptions.CommandException: Error running a command. cmd = su - postgres -c psql storageadmin -f /root/rockstor/rockstor-core//conf/storageadmin.sql.in. rc = 1. stdout = [’’]. stde
Mar 07 08:16:21 rockstor-build systemd[1]: Removed slice user-26.slice.

– Unit user-26.slice has begun shutting down.
Mar 07 08:16:21 rockstor-build systemd[1]: rockstor-pre.service: main process exited, code=exited, status=1/FAILURE
Mar 07 08:16:21 rockstor-build systemd[1]: Failed to start Tasks required prior to starting Rockstor.
– Subject: Unit rockstor-pre.service has failed

can anyone help me to solve this problem? thank you

@Marvin, welcome to the community forums. I assume, you are building from source on Tumbleweed or other flavor of OpenSUSE?

Which version of postgresql is the system using before you starting the installation? I have to rely on @phillxnet to confirm that this is still required or not, but there seemed to have been a similar issue early on related to the postgresql version used by default:

in this post:

and specifically here:

Take a look and see whether helps address your issue.

2 Likes

Thanks for reply,
I run rockstor
on Centos, the ISO image of 3.9.1downloaded from this site.
Build from code must running on Opensuse or not?

@Marvin Hello,

As indicated by @Hooverdan our new development targeted is Leap15.1 because it has much newer btrfs back-port and btrfs is supported by the openSUSE developers.

So yes if you wish to contribute to the development it is required to use an openSUSE base, ideally both Leap15.1 and Tumbleweed but mainly Leap15.1 currrently. But also all changes must be tested on CentOS. But our openSUSE notes are currently better.

The following is our up-to-date guide for developers for this newer platform:

Hope that helps.

2 Likes

@phillxnet thanks for reply, I will try openSUSE now.

@Marvin Good luck.

Also note that if you just want to test newest releases (currently not as functional as our CentOS rpms) you also have the option of our ‘Built on openSUSE’ rpm releases. They can also update themselves which a source install cannot.

In case that is also of interest.

Hope that helps.

2 Likes

Hi @phillxnet and @Hooverdan:
I have changed my OS to Leap15.1, following the steps from " Built on openSUSE dev notes and status:

zypper update --no-recommends
systemctl stop apparmor
systemctl disable apparmor
zypper install --no-recommends NetworkManager
Use yast change to network manager
vi /etc/default/grub
GRUB_CMDLINE_XEN_DEFAULT=“vga=gfx-1024x768x16 ipv6.disable=1”
zypper --non-interactive install samba docker docker-compose nut nginx nfs-kernel-server at gcc python-devel gcc-c++ postgresql10-devel postgresql10-server libblkid-devel dnf-yum dnf-plugins-core python2-distro python3-distro firewalld python2-setuptools python2-requests python2-chardet
tar -xzvf 3.9.2-54.tar.gz
python ./bootstrap.py -c buildout.cfg
./bin/buildout -N -c buildout.cfg

PS: I use a VMware® Workstation 15 Pro to create a Leap15.1 virtual machine for build.
source code is 3.9.2-54.tar.gz

The same error still happen:

– The user manager instance for user 26 has been started. All services queued
– for starting have been started. Note that other services might still be starting
– up or be started at any later time.

– Startup of the manager took 39026 microseconds.
Mar 10 23:55:42 linux-2rf8 su[21647]: pam_unix(su-l:session): session closed for user postgres
Mar 10 23:55:42 linux-2rf8 initrock[21445]: Traceback (most recent call last):
Mar 10 23:55:42 linux-2rf8 initrock[21445]: File “/root/rockstor-rockstor-core-f3f6cd8/bin/initrock”, line 39, in
Mar 10 23:55:42 linux-2rf8 initrock[21445]: sys.exit(scripts.initrock.main())
Mar 10 23:55:42 linux-2rf8 initrock[21445]: File “/root/rockstor-rockstor-core-f3f6cd8/src/rockstor/scripts/initrock.py”, line 375, in main
Mar 10 23:55:42 linux-2rf8 initrock[21445]: run_command([‘su’, ‘-’, ‘postgres’, ‘-c’, “psql storageadmin -f %s/conf/storageadmin.sql.in” % BASE_DIR]) # noqa E501
Mar 10 23:55:42 linux-2rf8 initrock[21445]: File “/root/rockstor-rockstor-core-f3f6cd8/src/rockstor/system/osi.py”, line 176, in run_command
Mar 10 23:55:42 linux-2rf8 initrock[21445]: raise CommandException(cmd, out, err, rc)
Mar 10 23:55:42 linux-2rf8 initrock[21445]: system.exceptions.CommandException: Error running a command. cmd = su - postgres -c psql storageadmin -f /root/rockstor-rockstor-core-f3f6cd8//conf/storageadmin.sql.in. rc = 1. stdout = [’’].>
Mar 10 23:55:42 linux-2rf8 systemd[1]: Stopping User Manager for UID 26…
– Subject: Unit user@26.service has begun shutting down
– Defined-By: systemd
– Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel

postgresql version:
linux-2rf8:~/rockstor-rockstor-core-f3f6cd8 # alternatives --config postgresql
There is only one alternative in link group postgresql (providing /usr/lib/postgresql): /usr/lib/postgresql10
Nothing to configure.
linux-2rf8:~/rockstor-rockstor-core-f3f6cd8 #

Hello @Marvin,

What is the output from running:

su - postgres -c psql storageadmin -f /root/rockstor-rockstor-core-f3f6cd8//conf/storageadmin.sql.in

This may provide more information as to what is going on.

2 Likes

@Marvin Re:

Yes we ‘fixed’ that by specifying the 10 version in the packages list soon after this was discovered. So I think this is OK.

Have you tried not building inside /root ?

Better to chose a directory such as:

/opt/rockstor-dev

Just a though as there are restrictions on /root that may well be upsetting stuff such as some db services that drop their privileges or the like.

I have build successfully a couple of times today on all 3 distro targets (rockstor, openSUSE Leap15.1 and Tumbleweed, all fully updated as of today).

Hope that helps.

1 Like

Thanks for help @phillxnet
It works , I choose /opt/rockstor as build directory. and build success.

systemctl enable rockstor-bootstrap.service &&
systemctl daemon-reload
Updating def-kernel.
def-kernel: Running grubby --set-default=/boot/vmlinuz-‘4.12.4-1.el7.elrepo.x86_64’
/bin/sh: grubby: command not found
Updating start-rockstor.
start-rockstor: Running systemctl stop rockstor-pre &&
systemctl start rockstor

=================================
But , when I use my chrome to access https://192.168.100.125 , I got a Internal Server Error .

I use a VMware® Workstation 15 Pro to create a Leap15.1 virtual machine for build.
source code is 3.9.2-54.tar.gz

rockstor log:
linux-2rf8:/opt/rockstor-rockstor-core-f3f6cd8/var/log # cat rockstor.log
[11/Mar/2020 08:36:46] DEBUG [scripts.initrock:358] running generic initdb on /var/lib/pgsql/data
[11/Mar/2020 08:36:58] DEBUG [scripts.initrock:400] migrate (–fake-initial) contenttypes
[11/Mar/2020 08:37:01] DEBUG [scripts.initrock:418] migrate (–fake) db=(default) app=(storageadmin) 0001_initial
[11/Mar/2020 08:37:07] DEBUG [scripts.initrock:418] migrate (–fake) db=(smart_manager) app=(smart_manager) 0001_initial
[11/Mar/2020 21:40:43] DEBUG [scripts.initrock:400] migrate (–fake-initial) contenttypes
[11/Mar/2020 08:41:55] DEBUG [scripts.initrock:400] migrate (–fake-initial) contenttypes
[11/Mar/2020 21:47:36] DEBUG [scripts.initrock:400] migrate (–fake-initial) contenttypes
[11/Mar/2020 09:06:49] DEBUG [scripts.initrock:400] migrate (–fake-initial) contenttypes

nginx log:
192.168.100.188 - - [11/Mar/2020:22:50:14 +0800] “GET / HTTP/1.1” 500 141 “-” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36”
192.168.100.188 - - [11/Mar/2020:22:50:14 +0800] “GET /favicon.ico HTTP/1.1” 500 141 “https://192.168.100.125/” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36”
192.168.100.188 - - [11/Mar/2020:22:51:44 +0800] “GET / HTTP/1.1” 500 141 “-” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36”
192.168.100.188 - - [11/Mar/2020:22:51:44 +0800] “GET /favicon.ico HTTP/1.1” 500 141 “https://192.168.100.125/” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36”
nginx error log:
linux-2rf8:/var/log/nginx # cat error.log
2020/03/11 21:41:00 [error] 15038#15038: *3 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.100.188, server: ~^(?.+)$, request: “GET / HTTP/1.1”, upstream: “http://127.0.0.1:8000/”, host: “192.168.100.125”
2020/03/11 21:41:00 [error] 15038#15038: *3 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.100.188, server: ~^(?.+)$, request: “GET /favicon.ico HTTP/1.1”, upstream: “http://127.0.0.1:8000/favicon.ico”, host: “192.168.100.125”, referrer: “https://192.168.100.125/

@Marvin Re:

That’s great, well done. But to avoid others reading this and copying that location my suggestion was:

/opt/rockstor-dev

Do not use /opt/rockstor

That location is reserved for the rpm. A source install can, if desired, be transitioned to an rpm install and if you use "/opt/rockstor’ this will fail badly.

So please do not use “/opt/rockstor” Pretty much anything except that and /root will work but as I stated previously I’d go with:

/opt/rockstor-dev

Not plain rockstor. This facility to move from a source install to an rpm install is particularly important for those developing on rockstor for a short period as they may then wish, once their fix is released in the rpms, to return to a supported self upgrading solution, in place. A database wipe will ensure but it’s still really handy to be able to do this. But using “/opt/rockstor” to build in will break this feature.

Thanks for sharing your success here though. Always good to see another source build, and hopefully development contributions, take palce.

You might like to take a look at our outstanding GitHub issues in case you fancy taking any of them on. Do please indicate on the relevant issue if you do though as that will help to avoid duplication of effort:

Again well done on getting this sorted and also welcome to the development of Rockstor.

2 Likes

@phillxnet , I change build directory to /opt/rockstor-dev, and reinstall leap- 15.1 OS. rebuild rockstor master.
Internal Server Error . still exist.
Any one can help me to solve the problem? Thank you .

I found out I missed a step:
zypper --non-interactive addrepo --refresh -p105 http://download.opensuse.org/repositories/shells/openSUSE_Leap_15.1/ shells
zypper --non-interactive --gpg-auto-import-keys refresh

Is that the reason?Let me retry

Still not work,
image

I finally found the fault,It is a timezone problem:
image
use cmd “ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime” to change timezone.
Rockstor is running:
image
Thanks for your help. @phillxnet @Hooverdan @vesper1978

2 Likes

@Marvin Re:

Fantastic. I was really scratching my head over this so this is a great find. Well done.

Thanks for sharing your findings. Much appreciated. I’ll let you know when we are public beta testing our new installer as it would be great to have this confirmed as working or otherwise within your initially selected timezone.

Nice find and quite a relieve that you now have this up-and-running. Apologies I wasn’t able to help with this last bit though. It was quite a puzzle.

Cheers, and again well done for persevering.