Trouble building Turris-OS

I just got a Turris Omnia and am having trouble getting the default configuration to build. I have spent several hours researching but can’t seem to get this error to go away. Please help. Seems like it might be related to the ncurses library but I am a novice at building things in Linux. I did make sure it was installed and updated though.

I changed compilers to gcc-6 and g+±6 but seem to get the same error. The log above has been updated.
Is this a bug that needs to be reported?

You are building it on your native Linux distribution, don’t you? Our fork of OpenWRT has known problems with compiling in systems with newer gcc than 4. That is because it’s based on version of OpenWRT from 2015 and does not include Lede patches solving problems with newer compiler versions. Because of that probably only distribution able to build our fork currently is Ubuntu Trusty. See https://doc.turris.cz/doc/en/howto/turris_os_build. That is why documentation as first thing lists possible container technologies. (You can also download docker container from dockerhub with precompiled sdk)

We are working on Turris OS 4.0 that is based on latest upstream OpenWRT (original lede) so we just have to survive this state for some time before 4.0 is ready.

1 Like

I’ve been finding that out slowly. I guess the documentation would help if it mentioned those things in the build without a container section.

I tried building with 14.04 and it is working much better but I’m now stuck on feeds/turrispackages/lang/python compile stating python2.7 folder is missing which is true.

cp: cannot stat '/home/foo/openwrt/staging_dir/target-arm_cortex-a9+vfpv3_uClibc-0.9.33.2_eabi/host/lib/python2.7': No such file or directory
make[3]: *** [/home/foo/openwrt/staging_dir/target-arm_cortex-a9+vfpv3_uClibc-0.9.33.2_eabi/stamp/.python_installed] Error 1
make[2]: *** [package/feeds/turrispackages/python/compile] Error 2
make[1]: *** [/home/foo/openwrt/staging_dir/target-arm_cortex-a9+vfpv3_uClibc-0.9.33.2_eabi/stamp/.package_compile] Error 2

It is building with gcc 4.8.4

I think I figured out the container thing possibly so I might try that unless this error is something easy to fix that I overlooked. Such a steep learning curve for me. I need some of these custom packages like tgt and/or usbip for a project I’m working on.

Are you using compile_fw script? How many jobs are you using? You might have encountered some race condition.

I did not and I was using 8 on a quad core with HT. I ran in single mode to troubleshoot which part was failing.

Use compile_fw it patches feeds and builds correct configuration for given Turris board. If you want then you can exit it just before it runs compilation (that should be round line 94).

I used the compile_fw which failed the first time then completed the second time. If I change the config and have it saved to .config, does compile_fw build that new config?

I tried flashing the firmware to the router via USB drive but it wouldn’t take. I renamed the NAND package in OpenWRT to be the same name as the downloadable medikit firmware and it seems like it took but the Foris interface returns a 404 error and since the router is reset, I can’t get into LuCi or SSH since the password is the default unknown root password with no way to run the foris setup wizard.

Did I miss something in the build process to build Foris into the firmware?

Thinking about it, I bet I’m supposed to build the final in the turris-os folder, right? Trying right now.

.config is overwritten by compile_fw. You can use it to generate our configuration and then change it before you run make. Or you can add your options to file configs/common.

We are not using OpenWRT root file system creation mechanism. That has to be hand maintained and we have lists for updater for that purpose. Because of that root file systems generated by OpenWRT are not working and instead you should use script updater-medkit.sh (see line 159 in compile_fw).

Please if you don’t want to use compile_fw then at least study it. Otherwise you are just asking questions that can be answered by line number in compile_fw script. It’s not that complicated script.

compile_fw works fine but after some research I guess I have to do the medkit script to get Foris added but now I run into more problems:

How do I compile opkg-trans?

It looks like it’s already compiled if that’s what it’s looking for where do I put it?
./turris-os/bin-nand/mvebu-musl/packages/turrispackages/opkg-trans_60.2.4-2_mvebu.ipk

I’m not familiar with this language. -z "$(which opkg-trans 2>/dev/null)" or -z "$(which pkgupdate)"
What is it looking for? I feel like I’m being dense.

export PATH="staging_dir/host/bin:staging_dir/host/usr/bin:$PATH"
export LD_LIBRARY_PATH="staging_dir/host/lib:staging_dir/host/usr/lib:$LD_LIBRARY_PATH"
if [ -z "$(which opkg-trans 2>/dev/null)" ] || [ -z "$(which pkgupdate)" ]; then
    echo "opkg-trans doesn't seems to be compiled! Please compile it first." >&2
    exit 1
fi

_

foo@foo-VirtualBox:~/turris-os$ sudo bash updater-medkit.sh
+ '[' 0 -gt 0 ']'
++ id -u
+ '[' 0 = 0 ']'
+ '[' -d staging_dir ']'
+ export PATH=staging_dir/host/bin:staging_dir/host/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:    /sbin:/bin:/snap/bin
+ PATH=staging_dir/host/bin:staging_dir/host/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
+ export LD_LIBRARY_PATH=staging_dir/host/lib:staging_dir/host/usr/lib:
+ LD_LIBRARY_PATH=staging_dir/host/lib:staging_dir/host/usr/lib:
++ which opkg-trans
+ '[' -z '' ']'
+ echo 'opkg-trans doesn'\''t seems to be compiled! Please compile it first.'
opkg-trans doesn't seems to be compiled! Please compile it first.
+ exit 1

Please help, I’m so close!!!

-z in shell-speak checks if the variable is not defined. In this case it checks for the lack of existence (on the PATH) of opkg-trans or pkgupdate (not the package, but the actual executable). If neither are present, it will print out that message.

I had a feeling it was doing an existence check, thanks. I found a reference to make package/updater-ng/host/install which miraculously makes the opkg-trans package. https://gitlab.labs.nic.cz/turris/openwrt/commit/03680ed740af97e88dae52167244f9f3b74c16fc?view=parallel&w=1

That make command is part of the compile_fw script.

if [ "$TARGET_BOARD" = "omnia" ]; then
    rm -f $PUB_BIN_DIR/*.ext4 $PUB_BIN_DIR/*sums
    if [ -n "$BUILD_ALL" ]; then
	# Compile host tools
	make package/curl/host/install package/libevent2/host/install package/lua/host/install
	make package/updater-ng/host/install
	# Generate medkit
	BASE_PATH="`pwd`"
	MED_PATH="bin-nand/mvebu-musl/medkit"
	MED_TAR="omnia-medkit-$(date -d "$COMMIT_DATE" +%Y%m%d%H%M).tar.gz"
	mkdir -p "$MED_PATH"
	fakeroot ./scripts/updater-medkit.sh $MED_ARGS bin-nand/mvebu-musl "$MED_PATH/$MED_TAR"
	pushd "$MED_PATH"
	ln -s "$MED_TAR" omnia-medkit-latest.tar.gz
	if [ -f "$HOME"/mime.key ]; then
		"$BASE_PATH"/staging_dir/host/bin/usign -S -m "$MED_TAR" -s "$HOME"/mime.key
		ln -s "$MED_TAR".sig omnia-medkit-latest.tar.gz.sig
	fi
	md5sum "$MED_TAR" > "$MED_TAR".md5
	ln -s "$MED_TAR".md5 omnia-medkit-latest.tar.gz.md5
	sha256sum "$MED_TAR" > "$MED_TAR".sha256
	ln -s "$MED_TAR".sha256 omnia-medkit-latest.tar.gz.sha256
	popd
    fi
fi

Now I get this error, sigh:

++ ls '/packages/base/base-files*.ipk'
++ head -1
ls: cannot access /packages/base/base-files*.ipk: No such file or directory
+ BASE_FILES=
+ opkg-trans -R /tmp/updater-medkit-BvQpYv/root -a ''
ERROR:The uci library is not available. Continuing without it and expecting this is a test run on development PC.
line not found
line not found
line not found
DIE:
[string "transaction"]:437: : No such file or directory
./scripts/updater-medkit.sh: line 83: 25303 Aborted                 (core dumped) opkg-trans -R "$ABSOUT" -a "$BASE_FILES"

Now I have to figure out why that directory is missing -_-

Grrr, what is the value of $OPENWRT_BIN? It’s not defined in updater-medkit.sh
Located the specified ipk in /turris-os/bin-nand/mvebu-musl/packages/base and replaced the variable with the actual path.
Now I get fopkg-trans: command not found

Now I’m getting lost.
Running this modified script but fopkg-trans is still not found. Also had to install fakeroot to run it.

rm -f $PUB_BIN_DIR/*.ext4 $PUB_BIN_DIR/*sums

	# Compile host tools
	make package/curl/host/install package/libevent2/host/install package/lua/host/install
	make package/updater-ng/host/install
	# Generate medkit
	BASE_PATH="`pwd`"
	MED_PATH="bin-nand/mvebu-musl/medkit"
	MED_TAR="omnia-medkit-$(date -d "$COMMIT_DATE" +%Y%m%d%H%M).tar.gz"
	mkdir -p "$MED_PATH"
	fakeroot ./scripts/updater-medkit.sh $MED_ARGS bin-nand/mvebu-musl "$MED_PATH/$MED_TAR"
	pushd "$MED_PATH"
	ln -s "$MED_TAR" omnia-medkit-latest.tar.gz
	if [ -f "$HOME"/mime.key ]; then
		"$BASE_PATH"/staging_dir/host/bin/usign -S -m "$MED_TAR" -s "$HOME"/mime.key
		ln -s "$MED_TAR".sig omnia-medkit-latest.tar.gz.sig
	fi
	md5sum "$MED_TAR" > "$MED_TAR".md5
	ln -s "$MED_TAR".md5 omnia-medkit-latest.tar.gz.md5
	sha256sum "$MED_TAR" > "$MED_TAR".sha256
	ln -s "$MED_TAR".sha256 omnia-medkit-latest.tar.gz.sha256
	popd

It creates an empty medkit file so that’s progress I suppose. If someone could point me in the right direction for understanding fopkg-trans, that would be great. Google has no clue what it is :frowning:

Somehow an f got put there sigh. Should be opkg-trans.

site won’t let me edit anymore.
I’m stuck here:
./scripts/updater-medkit.sh: 75: ./scripts/updater-medkit.sh: cannot create /tmp/sysinfo/model: Permission denied

Going to bed. I’m kind of lost on this one as to where this tmp folder is so I can remove it. It might be locked by root.

How does the medkit normally get made?
I tried running compile_fw omnia BUILD_ALL=1 which should trigger the updater_medkit.sh script as far as I can tell from the script. No errors, no medkit package. This is frustrating.

You have to pass BUILD_ALL variable to environment not to build.

BUILD_ALL=1 ./compile_omnia_fw

You have passed that variable only to build this way (effectively make BUILD_ALL=1). But you want to set it for compile_fw script. If that environment variable is not set then it instead builds just minimal set of packages (something we call test branch) and no medkit is generated.

Updater is using /tmp/sysinfo/model to detect used board. Because of that it has to be mocked/created on your machine too. It’s just temporally workaround (Sign in · GitLab) but because of that you have to have write access to that path as user running updater-medkit.sh.
Also updater-medkit.sh should be run with fakeroot. Otherwise it won’t work (see invocation from compile_fw).

1 Like

my daughter was born around when this became obviously neccesary…
by now she walks and talks :slight_smile:

2 Likes

I went back to my script and ran as fakeroot. I have a different issue with missing files. It was looking for /lists/ in the /mvebu-musl/ folder and didn’t know how to fix it so I copied the folder there but I can’t locate luci-controls.lua, only luci-controls.lua.m4. Running the full script with build all keeps failing. I might try taking make clean out since it restarts every time causing a single job to take many hours to find the issue.

I also don’t understand what the uci library means I tried to install the UCI in OpenWRT but the build fails.
https://wiki.openwrt.org/doc/techref/uci

I might just have to give up on this till 4.0 comes out since I’m trying to migrate my Windows server hosting services to Linux hosting services. But this has been great learning experience none the less.

Here is the error I’m faced with at the moment.

Script('base', 'file:///tmp/updater-medkit-tFcaGV/base.lua')
+ echo Script('cacerts', 'file://bin-nand/mvebu-musl/lists/cacerts.lua')
+ echo Script('luci-controls', 'file://bin-nand/mvebu-musl/lists/luci-controls.lua')
+ echo Script('nas', 'file://bin-nand/mvebu-musl/lists/nas.lua')
+ echo Script('netutils', 'file://bin-nand/mvebu-musl/lists/netutils.lua')
+ pkgupdate --out-of-root --usign=staging_dir/host/bin/usign -R /tmp/updater-medkit-tFcaGV/root --batch file:///tmp/updater-medkit-tFcaGV/entry.lua
ERROR:The uci library is not available. Continuing without it and expecting this is a test run on development PC.
line not found
line not found
line not found
ERROR:
unreachable: bin-nand/mvebu-musl/lists/luci-controls.lua: No such file or directory