Mateusz's picture

Hello, I have a problem compiling the core version

I would like to build my own version but using the "make" command

------------------------------------------------------------------------------------------

root@tkldev ~# cd /
root@tkldev /# cd turnkey/

root@tkldev /turnkey# cd fab

root@tkldev /turnkey/fab# cd products/

root@tkldev .../fab/products# cd core

root@tkldev .../products/core# make

deck -D build/bootstrap
deck /turnkey/fab/bootstraps/buster build/bootstrap
fab-apply-overlay /turnkey/fab/common/overlays/bootstrap_apt build/bootstrap;
fab-chroot build/bootstrap "echo nameserver 8.8.8.8 > /etc/resolv.conf";
fab-chroot build/bootstrap "echo nameserver 8.8.4.4 >> /etc/resolv.conf";
mkdir -p build/bootstrap/usr/local/share/ca-certificates/;
# temporarily allow cert to not exist
cp /usr/local/share/ca-certificates/squid_proxyCA.crt build/bootstrap/usr/local/share/ca-certificates/ || true;
cp: cannot stat '/usr/local/share/ca-certificates/squid_proxyCA.crt': No such file or directory
fab-chroot build/bootstrap --script /turnkey/fab/common/conf/bootstrap_apt;
fatal: Squid CA cert not found.
make: *** [/usr/share/fab/product.mk:541: build/stamps/bootstrap] Error 1

root@tkldev .../products/core#

------------------------------------------------------------------------------------------

Could someone help me fix this error, in addition, I have a question how to install some packages and upload your startup scripts so that after compiling it can be ready to install and run on the server

Forum: 
Tags: 
Mateusz's picture

I'll add that I'm using version 16.1 because I'm interested in building on debian 10.
I would like to modify the files accordingly to suit my servers.

I uploaded version 17.0rc1 and compilation goes without a problem.

How can this be done to compile on debian 10+ add programs

Jeremy Davis's picture

Yeah, I probably should document how all this works a bit better. Or better still, actually change the way that we do things so this can't happen again in the future (TBH, I don't recall it beign such an issue in the past?!).

Anyway, glad to hear that v17.0rc1 worked ok.

FWIW, I initially wrote this under the understanding that v17.0rc1 wasn't working for you (I was assuming that it was an existing install you had/have so I documented how it should be possible to get it going). Turns out that actually isn't your issue, but here it is anyway:

I probably should add notes to the 17.0rc1 release blog post (I think have added some notes, but it's likely missing parts). IIRC if you ensure that you have the latest cdroots and common and the latest fab package installed, you should be good. I.e.:

# to pull in latest v17.x changes
cd common
git fetch --unshallow
git pull origin master
cd cdroots
git fetch --unshallow
git pull origin master
apt update
apt install -y fab

As it turns out, you were trying to build for v16.x. To get that working, you just need to use the '16.x'/'buster' branches. The changes are somewhat similar:

# to checkout old v16.x common
cd common
git fetch --unshallow
git pull origin master
git checkout 16.x
cd cdroots
git fetch --unshallow
git pull origin master
git checkout buster

I think that should fix a v16.x TKLDev. If you have any further issues, please post back.

Mateusz's picture

Hello,
I was able to compile the debian 11 image on tkldev 17rc1.

Thank you Jeremy Davis for your help as we've already done more things with your help.
------
Drive current: -outdev 'stdio: build / product.iso'
Media current: stdio file, overwriteable
Media status: is blank
Media summary: 0 sessions, 0 data blocks, 0 data, 47.9g free
xorriso: WARNING: -volid text does not comply to ISO 9660 / ECMA 119 rules
Added to ISO image: directory '/' = '/ turnkey / fab / products / core / build / cdroot'
xorriso: UPDATE: 16 files added in 1 seconds
xorriso: UPDATE: 16 files added in 1 seconds
xorriso: UPDATE: 4.48% done
xorriso: UPDATE: 46.36% done
xorriso: UPDATE: 81.51% done
ISO image produced: 175246 sectors
Written to medium: 175246 sectors at LBA 0
Writing to 'stdio: build / product.iso' completed successfully.

isohybrid build / product.iso
root @ tkldev ... / products / core #
-----
but I have a problem because I deleted this iso image "product.iso" and I wanted to regenerate the image and the following things show to me

of course i did umount overley before
----
root @ tkldev ... / products / core # make

Basename: missing operand
Try 'Basename --help' for more information.
Basename: missing operand
Try 'Basename --help' for more information.
cp build / root.sandbox / usr / lib / ISOLINUX / isolinux.bin build / cdroot / isolinux
cp: cannot stat 'build / root.sandbox / usr / lib / ISOLINUX / isolinux.bin': No such file or directory
make: *** [/usr/share/fab/product.mk:499: cdroot-dynamic] Error 1

root @ tkldev ... / products / core #
----

Could someone advise me on how to fix it.

and how can I install my applications and scripts, because when I tried to do it, it also crashed such an error:
Basename: missing operand


and I would like to know how you can add some information and scripts to confconsole.
And how to remodel the screen after installation with password adjustment?

and the start screen where information about the ip address is displayed because I did not see such an option in motd.

nowhere can i find how this can be done.

Jeremy Davis's picture

To clean the build and re-make the iso:

make clean
make

Note that 'make clean' will delete everything and remove all the overlay mounts (if they still exist). So all previous build data will be lost. It essentially cleans the slate.

I note that because I often develop in root.patched (build/root.patched) and if you forget to copy out any changes you've made, it's a real bummer! I'll discuss that more later. I'll post answers to each question separately.

Jeremy Davis's picture

and how can I install my applications and scripts, because when I tried to do it, it also crashed such an error: Basename: missing operand

FWIW this sounds like an error in your code. I guess somewhere in your conf script (conf.d/main), you have 'basename' with nothing after it (or possibly an empty variable)?

One cool thing about bash code is that you can (mostly) test your code by copy/pasting (or typing) it into a command prompt. And you can actually test your code and commands within the appliance filesystem.


When you are developing, I suggest (temporarily) adding 'exit 1' to the bottom of the conf script (i.e. last line; alternatively, before any code you don't want to run yet). You will need to remove that line before building your ISO for final testing, but in the mean time it will make development easier/quicker. The 'exit 1' will make the build fail at the end of 'root.patched' (local conf.d scripts are the last to run). That makes developing, early testing and rebuilding a lot quicker (much quicker than 'make clean' and 'make').


This next bit requires a tool that isn't (yet) included by default. It's possibly easiest to just install the whole tool kit. Do that like this:

cd /usr/local/src/
git clone https://github.com/JedMeister/tkldev-tools.git
cd tkldev-tools/
./install.sh

And it will set itself up.


Now you can move on to testing code. Let me show you how. This is a copy paste from my terminal:

root@tkldev6 .../products/core# echo 'exit 1' >> conf.d/main 
root@tkldev6 .../products/core# cat conf.d/main
#!/bin/sh -ex
echo "do nothing - core requires no post-package configuration commands"
exit 1
root@tkldev6 .../products/core# make
[...]# build output #{...]
fab-chroot build/root.patched --script conf.d/main
+ echo do nothing - core requires no post-package configuration commands
do nothing - core requires no post-package configuration commands
+ exit 1
make: *** [/usr/share/fab/product.mk:569: build/stamps/root.patched] Error 1

Now you can enter the filesystem using 'fab-investigate' and test code and commands. E.g.:

root@tkldev6 .../products/core# fab-investigate build/root.patched
(core chroot)root@tkldev6 /# touch test.file

When you want to leave, 'exit'. I.e.:

(core chroot)root@tkldev6 /# exit
exit
complete
root@tkldev6 .../products/core#

Note that none of the usual services will be running within the chroot. Many you may be able to start (at least ones we use already), but some you will need to find ways to work around (normal services can't run in a chroot).

Note that you can copy files out of the chroot (to include in your overlay for example). Say you wanted that file I created earlier ('test.file') then copy it out of root.patches and into the overlay:

cp build/root.patched/test.file overlay/

That will ensure that the 'test.file' will always be in the root ('/') of the built appliance.

To test your build again, just re-run 'make'. Be sure to copy out any files you want to keep first though!

After re-running make, it should again fail at the 'exit 1' so you can check that the test file (from the overlay) is in the new build:

ls build/root.patched/test.file

And/or re-enter the chroot and test more commands, etc...

Once you are done, remove the 'exit 1' from the bottom of the conf script and run 'make' for a final time to build all the way to product.iso! :)

It was a silly example, but I hope it helped?!

Jeremy Davis's picture

and I would like to know how you can add some information and scripts to confconsole.

You can fairly easily change what is displayed on the main confconsole screen. Have a look at the 'servcices.txt' file (/etc/confconsole/services.txt). Assuming that you are following along from my last post, then the easiest way to make your own is copy the default one out and put it in your overlay, edited to include whatever changes you want. E.g.:

root@tkldev6 .../products/core# cat build/root.patched/etc/confconsole/services.txt 
Web shell:  https://$ipaddr:12320
Webmin:     https://$ipaddr:12321
SSH/SFTP:   root@$ipaddr (port 22)
root@tkldev6 .../products/core# mkdir -p overlay/etc/confconsole
root@tkldev6 .../products/core# cp build/root.patched/etc/confconsole/services.txt overlay/etc/confconsole/

Now you can edit overlay/etc/confconsole/services.txt to how you want. It doesn't allow you to change everything, but hopefully it should be enough for your purposes?!


Confconsole scripts (we call them plugins) are a bit more complicated, but much more powerful. Please see the confconsole plugins docs for how plugins work. You can find the current plugins online, or have a look in the half-built appliance:

ls -la build/root.patched/usr/lib/confconsole/plugins.d/

The easiest way to include your plugins is to just put them in the overlay. I perhaps mentioned earlier, but the overlays are relative to root of your appliance filesystem. So for the plugins, the above path(s) equate to overlay/usr/lib/confconsole/plugins.d/

I hope that makes sense?

Jeremy Davis's picture

And how to remodel the screen after installation with password adjustment?

Sorry, I'm not clear what you mean by this? You'll need to explain a bit more.

and the start screen where information about the ip address is displayed because I did not see such an option in motd.

Assuming you are referring to the MOTD, then ours is created by a script in 'common'. You can view it online here or on your TKLDev by 'cd common'. If you edit that script (or any of the common shared scripts and overlays), then it will be included in all appliances you build. Or you can use the info from that script to build your own code and/or overlay(s) to achevie your ends.

I hope that all helps.

Also, please note that there are plenty of TKLDev docs online. Some of them are quite old and they're not organised as well as they probably could be, but there's lots there. Whilst there have been some changes (mostly improvements I'd hope) but overall, things haven't changed that much.

Mateusz's picture

ok thanks for the explanation, it will help a lot to build the distribution Really thank you for explaining what and how.

about that

------

and I would like to know how you can add some information and scripts to confconsole.
And how to remodel the screen after installation with password adjustment?

-----

 

It is about triggering the option with a query for e-mail and backup, so that you only enter the password and the main confconsole window is displayed
Jeremy Davis's picture

and I would like to know how you can add some information and scripts to confconsole.

Confconsole supports "plugins" - see the Confconsole docs for info on that.

And how to remodel the screen after installation with password adjustment? It is about triggering the option with a query for e-mail and backup, so that you only enter the password and the main confconsole window is displayed

The questions asked at firstboot are provided by Inithooks - you can find inithooks docs here.


If you are using these for your own purposes, that's fine. But if you plan to distribute these, I ask you to please consider leaving the Hub linkage option. The Hub is our main source of revenue and without it, we couldn't afford to continue to continue production. If you do plan to remove the Hub linkage, then it'd be great if you could consider how your user might be able to contribute back to TurnKey.

Regardless, if you develop anything that you think brings value and/or mightb e of use to others, please share.

Add new comment