Search code examples
tizenrpmbuildxmlsecxmlsec1

Tizen : GBS, error in initializing cryptographic library (xmlsec) when building tizen using gbs


When trying to build (generate rpms) for a tizen project using gbs, I set up gbs, install mic and set up the .gbs.conf file with the appropriate profiles, repos and urls.

when i try to build for target architecture (armv7l) using

sudo gbs build -A armv7l --debug --clean

when it tries to sign the builds in the temp folder, it tries to generate author signature and distributor signature and it fails with [542s] Error: xmlsec crypto intialization failed. Following is the log.

> [541s] Sign as platform level
> [541s] Generate Author Signature
> [541s] Key type rsa
> [541s] Package is a directory
> [542s] func=xmlSecOpenSSLAppLoadRANDFile:file=app.c:line=1499:obj=unknown:subj=RAND_load_file:error=4:crypto library function failed:file=/home/abuild/.rnd
> [542s] func=xmlSecOpenSSLAppInit:file=app.c:line=68:obj=unknown:subj=xmlSecOpenSSLAppLoadRANDFile:error=1:xmlsec library function failed: 
> [542s] func=xmlSecAppCryptoInit:file=crypto.c:line=26:obj=unknown:subj=xmlSecCryptoAppInit:error=1:xmlsec library function failed: 
> [542s] Error: xmlsec crypto intialization failed.
> [542s] Error: initialization failed
> [542s] Usage: xmlsec <command> [<options>] [<files>]
> [542s] 
> [542s] xmlsec is a command line tool for signing, verifying, encrypting and
> [542s] decrypting XML documents. The allowed <command> values are:
> [542s]   --help       display this help information and exit
> [542s]   --help-all   display help information for all commands/options and exit
> [542s]   --help-<cmd> display help information for command <cmd> and exit
> [542s]   --version    print version information and exit
> [542s]   --keys       keys XML file manipulation
> [542s]   --sign       sign data and output XML document
> [542s]   --verify     verify signed document
> [542s]   --sign-tmpl  create and sign dynamicaly generated signature template
> [542s]   --encrypt    encrypt data and output XML document
> [542s]   --decrypt    decrypt data from XML document
> [542s] 
> [542s] 
> [542s] Report bugs to http://www.aleksey.com/xmlsec/bugs.html
> [542s] 
> [542s] Written by Aleksey Sanin <[email protected]>.
> [542s] 
> [542s] Copyright (C) 2002-2016 Aleksey Sanin <[email protected]>. All Rights Reserved..
> [542s] This is free software: see the source for copying information.
> [542s] 
> [542s] Failed to generate Author Signature. [1]
> [542s] Generate Distributor Signature
> [542s] Key type rsa
> [542s] Package is a directory
> [542s] func=xmlSecOpenSSLAppLoadRANDFile:file=app.c:line=1499:obj=unknown:subj=RAND_load_file:error=4:crypto library function failed:file=/home/abuild/.rnd
> [542s] func=xmlSecOpenSSLAppInit:file=app.c:line=68:obj=unknown:subj=xmlSecOpenSSLAppLoadRANDFile:error=1:xmlsec library function failed: 
> [542s] func=xmlSecAppCryptoInit:file=crypto.c:line=26:obj=unknown:subj=xmlSecCryptoAppInit:error=1:xmlsec library function failed: 
> [542s] Error: xmlsec crypto intialization failed.
> [542s] Error: initialization failed
> [542s] Usage: xmlsec <command> [<options>] [<files>]
> [542s] 
> [542s] xmlsec is a command line tool for signing, verifying, encrypting and
> [542s] decrypting XML documents. The allowed <command> values are:
> [542s]   --help       display this help information and exit
> [542s]   --help-all   display help information for all commands/options and exit
> [542s]   --help-<cmd> display help information for command <cmd> and exit
> [542s]   --version    print version information and exit
> [542s]   --keys       keys XML file manipulation
> [542s]   --sign       sign data and output XML document
> [542s]   --verify     verify signed document
> [542s]   --sign-tmpl  create and sign dynamicaly generated signature template
> [542s]   --encrypt    encrypt data and output XML document
> [542s]   --decrypt    decrypt data from XML document
> [542s] 
> [542s] 
> [542s] Report bugs to http://www.aleksey.com/xmlsec/bugs.html
> [542s] 
> [542s] Written by Aleksey Sanin <[email protected]>.
> [542s] 
> [542s] Copyright (C) 2002-2016 Aleksey Sanin <[email protected]>. All Rights Reserved..
> [542s] This is free software: see the source for copying information.
> [542s] 
> [542s] Failed to generate Distributor Signature. [1]
> [542s] error: Bad exit status from /var/tmp/rpm-tmp.2K6qZw (%install)
> [542s] 
> [542s] 
> [542s] RPM build errors:
> [542s]     Bad exit status from /var/tmp/rpm-tmp.2K6qZw (%install)

Solution

  • The 'buildroot' folder in gbs.conf should be a folder owned by root or you should run the build as root.

    "unable to write to /dev/null" is an error you'll likely see in your logs when you're not the root. this is the same reason why the xmlsec crypto initialization fails (unable to load RAND file and unable to sign signature1.xml, author-signature.xml file).

    so the solution or at least a work around could be changing the 'buildroot' to /tmp/ or any other folder under root.