CESNET / netopeer2

NETCONF toolset
BSD 3-Clause "New" or "Revised" License
291 stars 186 forks source link

Installation issues #1480

Open Karl-ZhangBD opened 9 months ago

Karl-ZhangBD commented 9 months ago

Hi, michalvasko: I'm very sorry to need your help with a problem again, I've recently been trying to install netopeer2 version 1.1.7 I've installed libyang (v1.0.130), libnetconf2 (v1.1.7) and sysrepo (v1.4.2) as mentioned in the readme.md and at the end to the netopeer2's server, the following error was reported.

cmake log: karl@ubuntu:~/work/cross-compile/netopeer2-1.1.7/server/arm_build$ cmake -DENABLE_CONFIGURATION=OFF -DCMAKE_TOOLCHAIN_FILE=/home/karl/work/cross-compile/arm_linux_setup.cmake -DSYSREPO_INCLUDE_DIR=/usr/aarch64-linux-gnu/include -DSYSREPO_LIBRARY="/usr/aarch64-linux-gnu/lib/libsysrepo.so" .. -- libnetconf2 was compiled with support of up to 6 threads -- Found LibSSH: /usr/aarch64-linux-gnu/lib/ (Required is at least version "0.7.0") -- Configuring done -- Generating done -- Build files have been written to: /home/karl/work/cross-compile/netopeer2-1.1.7/server/arm_build

make logo: karl@ubuntu:~/work/cross-compile/netopeer2-1.1.7/server/arm_build$ make Scanning dependencies of target serverobj [ 9%] Building C object CMakeFiles/serverobj.dir/common.c.o [ 18%] Building C object CMakeFiles/serverobj.dir/netconf.c.o /home/karl/work/cross-compile/netopeer2-1.1.7/server/netconf.c: In function ‘np2srv_rpc_editconfig_cb’: /home/karl/work/cross-compile/netopeer2-1.1.7/server/netconf.c:247:14: error: too many arguments to function ‘sr_apply_changes’ rc = sr_apply_changes(session, NP2SRV_DATA_CHANGE_TIMEOUT, NP2SRV_DATA_CHANGE_WAIT); ^~~~ In file included from /home/karl/work/cross-compile/netopeer2-1.1.7/server/netconf.c:26:0: /usr/aarch64-linux-gnu/include/sysrepo.h:963:5: note: declared here int sr_apply_changes(sr_session_ctx_t *session, uint32_t timeout_ms); ^~~~ CMakeFiles/serverobj.dir/build.make:86: recipe for target 'CMakeFiles/serverobj.dir/netconf.c.o' failed make[2]: [CMakeFiles/serverobj.dir/netconf.c.o] Error 1 CMakeFiles/Makefile2:136: recipe for target 'CMakeFiles/serverobj.dir/all' failed make[1]: [CMakeFiles/serverobj.dir/all] Error 2 Makefile:129: recipe for target 'all' failed make: *** [all] Error 2

jktjkt commented 9 months ago

You're trying to install obsolete and long-unmaintained versions of the NETCONF/YANG stack. Is there a reason why you are not using the latest release?

Karl-ZhangBD commented 9 months ago

I'm cross-compiling, and I found a cross-compilation process shared by someone else on the internet that is based on this version, and I want to follow the example of someone else who has succeeded in learning and then installing the latest version.

@.***

From: Jan Kundrát Date: 2023-10-05 19:37 To: CESNET/netopeer2 CC: Karl-ZhangBD; Author Subject: Re: [CESNET/netopeer2] Installation issues (Issue #1480) You're trying to install obsolete and long-unmaintained versions of the NETCONF/YANG stack. Is there a reason why you are not using the latest release? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

jktjkt commented 9 months ago

Cross-compile a newer version, then. Also, use Buildroot or Yocto for cross-compilation.

Karl-ZhangBD commented 9 months ago

I've used another version, passed cmake and make, and it looks like it's about to work, can you help me with the error below, and if it's more difficult to fix, I'll try the latest version again.

karl@ubuntu:~/work/cross-compile/netopeer2-1.1.1/server/arm_build$ cmake -DENABLE_CONFIGURATION=OFF -DCMAKE_TOOLCHAIN_FILE=/home/karl/work/cross-compile/arm_linux_setup.cmake -DSYSREPO_INCLUDE_DIR=/usr/aarch64-linux-gnu/include -DSYSREPO_LIBRARY="/usr/aarch64-linux-gnu/lib/libsysrepo.so" .. -- libnetconf2 was compiled with support of up to 6 threads -- Configuring done -- Generating done -- Build files have been written to: /home/karl/work/cross-compile/netopeer2-1.1.1/server/arm_build karl@ubuntu:~/work/cross-compile/netopeer2-1.1.1/server/arm_build$ make Scanning dependencies of target serverobj [ 9%] Building C object CMakeFiles/serverobj.dir/common.c.o [ 18%] Building C object CMakeFiles/serverobj.dir/netconf.c.o [ 27%] Building C object CMakeFiles/serverobj.dir/netconf_monitoring.c.o [ 36%] Building C object CMakeFiles/serverobj.dir/netconf_server.c.o [ 45%] Building C object CMakeFiles/serverobj.dir/netconf_server_ssh.c.o [ 54%] Building C object CMakeFiles/serverobj.dir/netconf_server_tls.c.o [ 63%] Building C object CMakeFiles/serverobj.dir/netconf_acm.c.o [ 72%] Building C object CMakeFiles/serverobj.dir/netconf_nmda.c.o [ 81%] Building C object CMakeFiles/serverobj.dir/log.c.o [ 81%] Built target serverobj Scanning dependencies of target netopeer2-server [ 90%] Building C object CMakeFiles/netopeer2-server.dir/main.c.o [100%] Linking C executable netopeer2-server [100%] Built target netopeer2-server karl@ubuntu:~/work/cross-compile/netopeer2-1.1.1/server/arm_build$ make install DESTDIR=$PWD/tmp [ 81%] Built target serverobj [100%] Built target netopeer2-server Install the project... -- Install configuration: "debug" -- Installing: /home/karl/work/cross-compile/netopeer2-1.1.1/server/arm_build/tmp/usr/local/bin/netopeer2-server -- Installing sysrepo modules... [WRN] Module "ietf-netconf-acm" is already in sysrepo. [ERR] Module "ietf-netconf@2013-09-29" already installed. sysrepoctl error: Failed to update modules (Item already exists) For more details you may try to increase the verbosity up to "-v3". CMake Error at cmake_install.cmake:63 (message): sysrepoctl failed: sysrepoctl error: Invalid option or missing argument: -C

For more details you may try to increase the verbosity up to "-v3".

Makefile:73: recipe for target 'install' failed make: *** [install] Error 1

jktjkt commented 9 months ago

Use Buildroot or Yocto, do not attempt the cross-compilation and deployment on your own.

Karl-ZhangBD commented 8 months ago

Hi, michalvasko: When I am running netopeer2-server, the following error is reported, before that I have successfully run the commands sysrepoctl -l and netopeer2-cli. Environment: netopeer2 version 2.1.62 Can you explain the source of this error so that I can try to fix it by modifying the makefile, etc.? Environment: netopeer2 version 2.1.62

root@s32g399ardb3:/home/karl/cross_compile/install/usr/local/bin# /home/karl/cross_compile/install/usr/local/sbin/netopeer2-server -d -v3 [INF]: SR: Connection 2 created. [INF]: SR: Session 1 (user "root", CID 2) created. [ERR]: NP: Module "ietf-netconf" feature "writable-running" not enabled in sysrepo. [ERR]: NP: Server init failed. [INF]: NP: Server terminated.

netopeer2 install log : karl@ubuntu:~/cross_compile/netopeer2/build$ make install DESTDIR=/home/karl/cross_compile/install [ 17%] Built target serverobj [ 21%] Built target netopeer2-server [ 25%] Built target test_parallel_sessions [ 29%] Built target test_edit [ 33%] Built target test_subscribe_param [ 37%] Built target test_yang_push [ 41%] Built target test_subscribe_filter [ 45%] Built target test_filter [ 50%] Built target test_nacm [ 54%] Built target test_rpc [ 58%] Built target test_url [ 62%] Built target test_sub_ntf [ 66%] Built target test_with_defaults [ 70%] Built target test_sub_ntf_advanced [ 74%] Built target test_candidate [ 78%] Built target test_error [ 82%] Built target test_sub_ntf_filter [ 86%] Built target test_yang_push_advanced [ 90%] Built target test_confirmed_commit [100%] Built target netopeer2-cli Install the project... -- Install configuration: "Debug" -- Installing: /home/karl/cross_compile/install/usr/local/share/yang/modules/netopeer2 -- Installing: /home/karl/cross_compile/install/usr/local/share/yang/modules/netopeer2/ietf-netconf-nmda@2019-01-07.yang -- Installing: /home/karl/cross_compile/install/usr/local/share/yang/modules/netopeer2/ietf-datastores@2018-02-14.yang -- Installing: /home/karl/cross_compile/install/usr/local/share/yang/modules/netopeer2/ietf-yang-schema-mount@2019-01-14.yang -- Installing: /home/karl/cross_compile/install/usr/local/share/yang/modules/netopeer2/ietf-tls-common@2019-07-02.yang -- Installing: /home/karl/cross_compile/install/usr/local/share/yang/modules/netopeer2/ietf-netconf-monitoring@2010-10-04.yang -- Installing: /home/karl/cross_compile/install/usr/local/share/yang/modules/netopeer2/ietf-network-instance@2019-01-21.yang -- Installing: /home/karl/cross_compile/install/usr/local/share/yang/modules/netopeer2/ietf-subscribed-notifications@2019-09-09.yang -- Installing: /home/karl/cross_compile/install/usr/local/share/yang/modules/netopeer2/ietf-interfaces@2018-02-20.yang -- Installing: /home/karl/cross_compile/install/usr/local/share/yang/modules/netopeer2/ietf-ip@2018-02-22.yang -- Installing: /home/karl/cross_compile/install/usr/local/share/yang/modules/netopeer2/ietf-netconf@2013-09-29.yang -- Installing: /home/karl/cross_compile/install/usr/local/share/yang/modules/netopeer2/iana-crypt-hash@2014-08-06.yang -- Installing: /home/karl/cross_compile/install/usr/local/share/yang/modules/netopeer2/notifications@2008-07-14.yang -- Installing: /home/karl/cross_compile/install/usr/local/share/yang/modules/netopeer2/ietf-tcp-common@2019-07-02.yang -- Installing: /home/karl/cross_compile/install/usr/local/share/yang/modules/netopeer2/ietf-yang-patch@2017-02-22.yang -- Installing: /home/karl/cross_compile/install/usr/local/share/yang/modules/netopeer2/nc-notifications@2008-07-14.yang -- Installing: /home/karl/cross_compile/install/usr/local/share/yang/modules/netopeer2/ietf-netconf-acm@2018-02-14.yang -- Installing: /home/karl/cross_compile/install/usr/local/share/yang/modules/netopeer2/ietf-netconf-server@2019-07-02.yang -- Installing: /home/karl/cross_compile/install/usr/local/share/yang/modules/netopeer2/ietf-tls-server@2019-07-02.yang -- Installing: /home/karl/cross_compile/install/usr/local/share/yang/modules/netopeer2/ietf-ssh-server@2019-07-02.yang -- Installing: /home/karl/cross_compile/install/usr/local/share/yang/modules/netopeer2/ietf-x509-cert-to-name@2014-12-10.yang -- Installing: /home/karl/cross_compile/install/usr/local/share/yang/modules/netopeer2/ietf-tcp-client@2019-07-02.yang -- Installing: /home/karl/cross_compile/install/usr/local/share/yang/modules/netopeer2/ietf-keystore@2019-07-02.yang -- Installing: /home/karl/cross_compile/install/usr/local/share/yang/modules/netopeer2/ietf-truststore@2019-07-02.yang -- Installing: /home/karl/cross_compile/install/usr/local/share/yang/modules/netopeer2/ietf-yang-push@2019-09-09.yang -- Installing: /home/karl/cross_compile/install/usr/local/share/yang/modules/netopeer2/ietf-ssh-common@2019-07-02.yang -- Installing: /home/karl/cross_compile/install/usr/local/share/yang/modules/netopeer2/ietf-tcp-server@2019-07-02.yang -- Installing: /home/karl/cross_compile/install/usr/local/share/yang/modules/netopeer2/ietf-restconf@2017-01-26.yang -- Installing: /home/karl/cross_compile/install/usr/local/share/yang/modules/netopeer2/ietf-crypto-types@2019-07-02.yang -- Installing: /home/karl/cross_compile/install/usr/local/share/netopeer2 -- Installing: /home/karl/cross_compile/install/usr/local/share/netopeer2/setup.sh -- Installing: /home/karl/cross_compile/install/usr/local/share/netopeer2/merge_config.sh -- Installing: /home/karl/cross_compile/install/usr/local/share/netopeer2/remove.sh -- Installing: /home/karl/cross_compile/install/usr/local/share/netopeer2/merge_hostkey.sh -- Installing: /home/karl/cross_compile/install/usr/local/sbin/netopeer2-server -- Set runtime path of "/home/karl/cross_compile/install/usr/local/sbin/netopeer2-server" to "" -- Installing: /home/karl/cross_compile/install/usr/local/share/man/man8/netopeer2-server.8 -- Installing missing sysrepo modules... -- Generating a new RSA host key "genkey" if not already added... -- Merging default server listen configuration if there is none... -- Installing: /home/karl/cross_compile/install/usr/local/bin/netopeer2-cli -- Set runtime path of "/home/karl/cross_compile/install/usr/local/bin/netopeer2-cli" to "" -- Installing: /home/karl/cross_compile/install/usr/local/share/man/man1/netopeer2-cli.1

michalvasko commented 8 months ago

You are cross-compiling, so you must adjust the compilation/installation process accordingly. There is no official guide (and it is not officially supported) but solution to this particular problem is mentioned in the README.

Karl-ZhangBD commented 8 months ago

I'm doing cross-compilation, but this is already compiled, but now the execution reported this error, please can you explain what these errors are related to, I read what you said README.md, may be for the software compilation and installation process is not enough to understand, and did not understand and which part of the relevant

[INF]: SR: Connection 3 created. [INF]: SR: Session 2 (user "root", CID 3) created. [ERR]: NP: Module "ietf-netconf" feature "writable-running" not enabled in sysrepo. [ERR]: NP: Server init failed. [INF]: NP: Server terminated.

michalvasko commented 8 months ago

I really do not know what else to tell you.

If cross-compiling for a different architecture, you will likey want to turn all these options off and then run the scripts setup.sh, merge_hostkey.sh, and merge_config.sh manually.

Karl-ZhangBD commented 8 months ago

Thank you very much for your help, I have now installed server and cli, but it looks like there is a tcp/ip problem, do you have an appropriate solution for this problem. I'll put together an idea for cross-compiling netopeer2 later on, which may help you deal with future questioners!

root@s32g399ardb3:/# /home/karl/cross_compile/install/usr/local/bin/netopeer2-cli get_netconf_dir: Configuration directory "/home/root/.netopeer2-cli" cannot be created: No such file or directory

connect nc ERROR: Unable to connect to localhost:830 (Connection refused). cmd_connect: Connecting to the localhost:830 as user "root" failed.

root@s32g399ardb3:/# /home/karl/cross_compile/install/usr/local/sbin/netopeer2-server -d -v3 [WRN]: SR: Removing event pipe "sr_evpipe3" after a crashed subscription. [WRN]: SR: Removing event pipe "sr_evpipe1" after a crashed subscription. [WRN]: SR: Removing event pipe "sr_evpipe2" after a crashed subscription. [INF]: SR: Datastore copied from to . [INF]: SR: Connection 1 created. [INF]: SR: Session 1 (user "root", CID 1) created. [INF]: SR: Triggering "ietf-subscribed-notifications" "done" event on enabled data. [INF]: SR: Triggering "ietf-netconf-server" "done" event on enabled data. [INF]: SR: Triggering "ietf-netconf-server" "done" event on enabled data. [INF]: SR: Triggering "ietf-netconf-server" "done" event on enabled data. [INF]: SR: Triggering "ietf-netconf-server" "done" event on enabled data. [INF]: SR: Triggering "ietf-netconf-server" "done" event on enabled data. [INF]: SR: Triggering "ietf-netconf-server" "done" event on enabled data. [INF]: SR: Triggering "ietf-netconf-server" "done" event on enabled data. [INF]: SR: Triggering "ietf-netconf-server" "done" event on enabled data. [INF]: SR: Triggering "ietf-netconf-server" "done" event on enabled data. [INF]: SR: Triggering "ietf-netconf-server" "done" event on enabled data. [INF]: SR: Triggering "ietf-netconf-server" "done" event on enabled data. [INF]: SR: Triggering "ietf-netconf-server" "done" event on enabled data. [INF]: SR: Triggering "ietf-netconf-server" "done" event on enabled data. [INF]: SR: Triggering "ietf-netconf-server" "done" event on enabled data. [INF]: SR: Triggering "ietf-netconf-server" "done" event on enabled data. [INF]: SR: Triggering "ietf-netconf-server" "done" event on enabled data. [INF]: SR: Triggering "ietf-netconf-server" "done" event on enabled data. [INF]: SR: Triggering "ietf-netconf-server" "done" event on enabled data. [INF]: SR: Triggering "ietf-netconf-server" "done" event on enabled data. [INF]: SR: Triggering "ietf-netconf-server" "done" event on enabled data. [INF]: SR: Triggering "ietf-netconf-server" "done" event on enabled data. [INF]: SR: Triggering "ietf-netconf-server" "done" event on enabled data. [INF]: SR: Triggering "ietf-netconf-server" "done" event on enabled data. [INF]: SR: Triggering "ietf-keystore" "done" event on enabled data. [INF]: SR: Triggering "ietf-truststore" "done" event on enabled data. [INF]: SR: Triggering "ietf-netconf-acm" "done" event on enabled data. [INF]: SR: Triggering "ietf-netconf-acm" "done" event on enabled data. [INF]: SR: Triggering "ietf-netconf-acm" "done" event on enabled data. [INF]: SR: Triggering "ietf-netconf-acm" "done" event on enabled data.

michalvasko commented 8 months ago

Yes, the solution is the same as before, you have run only setup.sh but you need to run also merge_hostkey.sh and merge_config.sh.