====== Upgrade from KerOS version 3.x to 4.0 with custom liveburner ====== KerOS v4.0 introduces some important modifications (new kernel, rootfsRW, hotfixing) requiring an upgrade with a liveburner when coming from KerOS v3.x firmware. This page will provide a way to do this upgrade with conservation of some elements like the configuration and reinstall some additional packages. ===== Introduction ===== A liveburner package will by default flash the eMMC content and install only the KerOS package. So any packages, data, and configurations will be lost using such upgrade package. \\ This upgrade will be problematic for products already on the field that need to keep a Device Management link up and running before and after the upgrade. To solve this, this procedure will provide: * A way to backup some files (i.e. configurations) before flashing the eMMC and restore them at the end of the upgrade. * A tool to customize a liveburner in order to add some additional packages during the upgrade. This procedure is not applicable to the 4.1 version of KerOS liveburner. More information about the supported migration scenarii is available [[wiki:keros_custo:upgrade#major_firmware_upgrades|here]]\\ Please note that an upgrade is always risky and must be tested and validated before deploying on the products on the field. We also recommend to upgrade products in small batches and not all the products in a row. ===== Upgrade procedure ===== When using this customized liveburner, the following steps are done to achieve the upgrade: - Deploy and install the customized liveburner IPK on the product. - Product will restart on the liveburner upgrade tool. - Execution of the script ''preinst'' to mount a safezone and copy the files to backup on it. - Upgrade of the KerOS system including the eMMC flash and installation of the KerOS package. - Execution of the ''preapps'' and/or ''postapps'' scripts to access to the safezone and restore/merge saved files. - Execution of the ''preapps'' script (if present) to access to the safezone and restore/merge saved files - Installation of the additional packages - Execution of the ''postapps'' script (if present) - Save packages in backup - Execution of the ''prereboot'' script (if present) - Restart on the new KerOS system. ===== Requirements ===== * A desktop Linux machine (native or virtual). //=> It will be used to build the ''liveburner'' package.// * An original KerOS liveburner 4.0 package available in the resources page: [[wiki:resources:resources|Wirnet gateways resources]]. * The ''update_liveburner_package-v4.1.0.tar.gz'' tool available [[wiki:resources:resources#tools|here]]. * The following packages: sudo apt-get install device-tree-compiler cpio binutils tree ===== Limits ===== Some limits are present in this upgrade mechanism: * Safezone space: 2MiB. * Additional packages max size cumulated: 20MiB. * Only Keros liveburner 4.0 is supported. ===== Migrations supported ===== The tool integrates sample scripts in the ''sample_scripts'' directory that will provide some migrations: * System configuration: * From KerOS 3.x product: Network configuration (/etc/network directory) * From KerOS 4.0 product: Sysupgrade configuration (except /var directory) * LoRa configuration: * SPF to CPF v1.0 conversion * CPF configuration * BSCC configuration (for Wanesy Management Center customers) * Secrets and OpenVPN configuration (for Wanesy Management Center customers) ===== Usage ===== ==== Generate a custom liveburner (from a Linux machine)==== === Default process === First, uncompress the ''update_liveburner'' package: #tar -xvzf update_liveburner_package-v4.1.0.tar.gz update_liveburner.sh extract_custom_elements.sh show_ipk_infos.sh functions dumpimage mkimage sample_scripts/ sample_scripts/postapps sample_scripts/preapps sample_scripts/preinst sample_scripts/prereboot spftocpfconf.klk-lpbs spftocpfconf.klk-wifc spftocpfconf.klkgw The package is ready to be used with some integrated [[wiki:keros_custo:upgrade_keros3_to_4#migrations_supported|migrations]]. Then you can launch a generation of ''custom liveburner'' using the following command: #./update_liveburner.sh liveburner_4.0.X_klk-lpbs-signed.ipk sample_scripts/preapps sample_scripts/postapps sample_scripts/preinst sample_scripts/prereboot Liveburner custom-liveburner_4.0.X_klk-lpbs-signed.ipk created Additional packages can be installed simply by adding them as arguments. ./update_liveburner.sh liveburner_4.0.2_klk-lpbs-signed.ipk sample_scripts/preapps sample_scripts/postapps sample_scripts/preinst sample_scripts/prereboot my_package.ipk It is possible to add some information in the description of the package by adding ''-m my_information''. This information will be added in the CONTROL file of the package that you can read using the ''show_ipk_infos.sh'' tool. ./update_liveburner.sh -m my_information liveburner_4.0.2_klk-lpbs-signed.ipk sample_scripts/preapps sample_scripts/postapps sample_scripts/preinst sample_scripts/prereboot === Advanced process with customization (experienced user) === Default upgrade will only keep the ''network'' configuration but it is possible to customize it using the ''preinst'', ''preapps'', ''postapps'' or ''prereboot'' scripts. Please note that some variables/mountpoints are provided: ^ Variable ^ Role ^ Example ^ | ''ROOTFSRW_PATH'' | Root path adapted to the firmware version. For KerOS < 4.0 it will be ''/user/rootfs_rw/'' and for >= 4.0 version it will be ''/'' | ''cp ${ROOTFSRW_PATH}/etc/hosts ${SAFEZONE_MOUNTPOINT}/'' | | ''SAFEZONE_MOUNTPOINT'' | The mountpoint to use to access the safezone | ''cp ${ROOTFSRW_PATH}/etc/hosts ${SAFEZONE_MOUNTPOINT}/'' | | ''/user'' | The mountpoint to use to access the RW USER partiton | ''cp /user/myfile.txt ${SAFEZONE_MOUNTPOINT}/'' | In case of custom upgrade, please note that the management of the content of the safezone needs to be done using the scripts ''preinst'', ''preapps'', ''postapps'', ''prereboot'' like detailed below. The recommended way is at least to clean the safezone content before starting to backup your files. The only files that must be kept in the safezone are ''keros_config.tar.gz'', ''upgrade_logs.tar.gz'' and ''upgrade.log''. == Save == Saving files must be done using the ''preinst'' script. It will be executed before installing the new firmware. As an example, the ''preinst'' script provided will backup the network configuration files in the safezone. \\ To add some files, append them at the end of the script like shown in the commented example line. ++++ File to download - preinst.sh | #!/bin/sh # Description: Script to be executed before a liveburner upgrade. # It will mount a safezone to backup the configuration files BEFORE # the installation of the new firmware. EMMC_DEVICE="NOT_SUPPORTED" SAFEZONE_MOUNTPOINT="/tmp/safezeone" KEROS_CONFIGS_ARCHIVE="keros_config.tar.gz" ROOTFSRW_PATH="/" LOGFILE="${SAFEZONE_MOUNTPOINT}/upgrade.log" USER_LOGFILE=".upgrade.log" USER_LOGFILE_ARCHIVE="${SAFEZONE_MOUNTPOINT}/upgrade_logs.tar.gz" # SPF SPF_CONFILE="/user/spf/etc/global_conf.json" SPF2_CONFILE="/user/spf2/etc/config.json" # CPF LORAD_CONFDIR="/user/etc/lorad" LORAFWD_CONFDIR="/user/etc/lorafwd" CPF_CONFIGS_ARCHIVE="cpf_config.tar.gz" # BSCC BSCC_CONFFILE="/user/bscc/var.xml" # WMC WMC_CONFIGS_ARCHIVE="wmc_config.tar.gz" WMC_CONFIGS_CLIENT_OVPN="etc/openvpn/client-openvpn.conf" WMC_CONFIGS_FILES="\ etc/hosts \ ${WMC_CONFIGS_CLIENT_OVPN} \ etc/firewall.d/iptables_openvpn.rules \ " fatal_error() { echo "$1" touch /.need_reboot exit 1 } detect_emmc() { for i in $(seq 0 9); do if [ -b "/dev/mmcblk${i}" ]; then EMMC_DEVICE="mmcblk${i}" # Update RootFS RW path for system without overlayFS [ ${i} -eq 3 ] && ROOTFSRW_PATH="/user/rootfs_rw/" break fi done if [ "${EMMC_DEVICE}" == "NOT_SUPPORTED" ]; then fatal_error "Emmc device not found. Kernel version: ${KERNEL_VERSION}. Please fix." fi } # Backup the upgrade journal file # backup_previous_logs() { if [ -f /user/${USER_LOGFILE} ]; then echo "Saving /user/${USER_LOGFILE}..." tar -cvzf ${USER_LOGFILE_ARCHIVE} -C /user ${USER_LOGFILE} echo "/user/${USER_LOGFILE} saved" fi } # Initialize (format) the safezone and mount it in ${SAFEZONE_MOUNTPOINT} # create_safezone() { echo "Creating safezone" echo 0 > /sys/block/${EMMC_DEVICE}boot0/force_ro mkfs.ext2 -F /dev/${EMMC_DEVICE}boot0 || fatal_error "Error during safezone format" mkdir -p ${SAFEZONE_MOUNTPOINT} mount /dev/${EMMC_DEVICE}boot0 ${SAFEZONE_MOUNTPOINT} || fatal_error "Error during safezone mount" echo "Safezone created and ready to use" } # Show some information before starting the upgrade for the traces/logs. # get_product_description() { echo "Upgrade started at: $(date '+%f')" echo "Installed packages:" cat /.update/opkg/status } # Backup some KerOS configuration files in the safezone. # Only the /etc/network information are saved. # backup_keros_configurations() { echo "Backuping KerOS configurations in safezone..." if [ -f ${ROOTFSRW_PATH}/etc/sysupgrade.conf ]; then echo "Product support sysupgrade, using it" (find $(sed -ne "/^[[:space:]]*$/d; /^#/d; s@^/var/@@; p" \ /etc/sysupgrade.conf /etc/sysupgrade.d/*.conf 2>/dev/null\ ) /etc/sysupgrade.conf /etc/sysupgrade.d/*.conf \ -type f -o -type l 2>/dev/null; \ ) | sort -u > /tmp/keros_conffiles tar -cvzf ${SAFEZONE_MOUNTPOINT}/${KEROS_CONFIGS_ARCHIVE} -C ${ROOTFSRW_PATH} -T /tmp/keros_conffiles else echo "Product does not support sysupgrade, backuping network" tar -cvzf ${SAFEZONE_MOUNTPOINT}/${KEROS_CONFIGS_ARCHIVE} -C ${ROOTFSRW_PATH} etc/network fi echo "Backup finished" } # Backup SPF/CPF configuration filed in safezone, if present. # backup_lora_configurations() { local conf_found=false local cpf_list_files="" # SPF echo "Backuping SPF configurations in safezone..." for file_to_backup in ${SPF_CONFILE} ${SPF2_CONFILE} do if [ -f ${file_to_backup} ]; then echo "File ${file_to_backup} found in system. Backup it in safezone" cp -f ${file_to_backup} ${SAFEZONE_MOUNTPOINT}/ conf_found=true fi done if [ ${conf_found} = true ]; then echo "Backup SPF finished" else echo "No SPF configuration found. Nothing done." fi # CPF echo "Backuping CPF configurations in safezone..." for dir_to_backup in ${LORAD_CONFDIR} ${LORAFWD_CONFDIR} do if [ -d ${dir_to_backup} ]; then echo "Configuration dir ${dir_to_backup} found in system. Backup it in safezone" cpf_list_files="${cpf_list_files} ${dir_to_backup}" fi done if [ ! -z "${cpf_list_files}" ]; then tar -cvzf "${SAFEZONE_MOUNTPOINT}/${CPF_CONFIGS_ARCHIVE}" -C / ${cpf_list_files} echo "Backup CPF finished" else echo "No CPF configuration found. Nothing done." fi } # Backup BSCC configuration file in safezone, if present. # backup_bscc_configurations() { echo "Backuping BSCC configurations in safezone..." if [ -f ${BSCC_CONFFILE} ]; then echo "File ${BSCC_CONFFILE} found in system. Backup it in safezone" cp -f ${BSCC_CONFFILE} ${SAFEZONE_MOUNTPOINT}/ echo "Backup BSCC finished" else echo "No BSCC configuration found. Nothing done." fi } # Backup Prove&Core SecureStorage information # backup_securestorage() { echo "Backuping assets loaded in Prove&Core SecureStorage..." dd if=/dev/${EMMC_DEVICE} bs=512 skip=10240 count=32768 | gzip > ${SAFEZONE_MOUNTPOINT}/pcore_data.img.gz echo "Backup finished" } # Backup WMC configuration files # backup_wmc_configurations() { echo "Backuping WMC configurations in safezone..." if [ -f "${ROOTFSRW_PATH}/${WMC_CONFIGS_CLIENT_OVPN}" ]; then tar -cvzf ${SAFEZONE_MOUNTPOINT}/${WMC_CONFIGS_ARCHIVE} -C ${ROOTFSRW_PATH} ${WMC_CONFIGS_FILES} echo "Backup WMC configurations finished" else echo "No WMC configurations found. Nothing done." fi } #################### # MAIN KEROS PART #################### detect_emmc create_safezone backup_previous_logs echo -e "\n== START of PREINST script ==\n" 2>&1 | tee ${LOGFILE} get_product_description 2>&1 | tee -a ${LOGFILE} # KerOS configuration backup_keros_configurations 2>&1 | tee -a ${LOGFILE} # LoRa configuration backup_lora_configurations 2>&1 | tee -a ${LOGFILE} # BSCC configuration backup_bscc_configurations 2>&1 | tee -a ${LOGFILE} # SecureStorage information backup_securestorage 2>&1 | tee -a ${LOGFILE} # WMC configuration backup_wmc_configurations 2>&1 | tee -a ${LOGFILE} #################### # MAIN CUSTOMER PART #################### # Example: # cp ${ROOTFSRW_PATH}/etc/hosts ${SAFEZONE_MOUNTPOINT}/ echo -e "\n== End of PREINST script ==\n" 2>&1 | tee -a ${LOGFILE} sync ++++ In the case of custom upgrade blocking problem happens during the execution of this script, it is possible to interrupt the upgrade. To do so, it is possible to use the function **fatal_error** in the custom part of the script like this: cp ${ROOTFSRW_PATH}/etc/non_existant_file ${SAFEZONE_MOUNTPOINT}/ || fatal_error "Error detected! stop the upgrade!!" In addition, customers must take care about the last command launched by the script. If it returns an error, the upgrade will also be aborted. This script is the last chance to stop an upgrade without consequences on the system. After this script, the upgrade is started and errors in other scripts will not stop the process. == Restore == To restore, 2 ways are possible: * Restore using the ''preapps''/''postapps'' scripts. * Use scripts in application packages. The first way is the more simple way. It consist of adapting the ''preapps''/''postapps'' scripts (like for ''preinst''). Kerlink recommends this method. ++++ File to download - preapps.sh | #!/bin/sh # Description: Script to be executed during a liveburner upgrade # but before the installation of the application packages. # It will mount the safezone and restore the files. EMMC_DEVICE="NOT_SUPPORTED" SAFEZONE_MOUNTPOINT="/tmp/safezeone" KEROS_CONFIGS_ARCHIVE="keros_config.tar.gz" LOGFILE="${SAFEZONE_MOUNTPOINT}/upgrade.log" # CPF CPF_CONFIGFILE="${SAFEZONE_MOUNTPOINT}/cpf_config.tar.gz" # BSCC BSCC_CONFFILE="var.xml" # WMC WMC_CONFIGS_ARCHIVE="wmc_config.tar.gz" WMC_SYSUPGRADE_FILE="/etc/sysupgrade.d/openvpn.conf" WMC_OPENVPN_CONFIG="/etc/openvpn/client-openvpn.conf" WMC_FIREWALL_RULES="/etc/firewall.d/iptables_openvpn.rules" WMC_SYSUPGRADE_FILES="${WMC_OPENVPN_CONFIG}" fatal_error() { echo "$1" exit 1 } detect_emmc() { for i in $(seq 0 9); do if [ -b "/dev/mmcblk${i}" ]; then EMMC_DEVICE="mmcblk${i}" break fi done if [ "${EMMC_DEVICE}" == "NOT_SUPPORTED" ]; then fatal_error "Emmc device not found. Kernel version: ${KERNEL_VERSION}. Please fix." fi } # Mount the safezone mountpoint in ${SAFEZONE_MOUNTPOINT} # mount_safezone() { echo "Mounting safezone" echo 0 > /sys/block/${EMMC_DEVICE}boot0/force_ro mkdir -p ${SAFEZONE_MOUNTPOINT} mount /dev/${EMMC_DEVICE}boot0 ${SAFEZONE_MOUNTPOINT} echo "Safezone ready to use" } # Restore configuration saved in safezone by preinst in # the new filesystem. # restore_keros_configurations() { echo "Restoring KerOS configurations from safezone..." if [ -f ${SAFEZONE_MOUNTPOINT}/${KEROS_CONFIGS_ARCHIVE} ] then tar -xvzf ${SAFEZONE_MOUNTPOINT}/${KEROS_CONFIGS_ARCHIVE} -C / echo "Restoration finished" else echo "No restoration files in safezone. Nothing done." fi } # Adapt KerOS system configuration files restored from # previous version. In this version, only the Connman configuration # files are adapted. # adjust_keros_configurations() { echo "Adjusting KerOS configurations..." for service_dir in $(find /etc/network/connman/ -type d \( -name ethernet_* -o -name wifi_* \)) do local settings_file="${service_dir}/settings" if [ -f "${settings_file}" ] then echo "Adjust configuration in ${settings_file}" sed -i '/^Config\.file.*/d' "${settings_file}" sed -i '/^Config\.ident.*/d' "${settings_file}" sed -i 's/^IPv4\.method\=fixed.*/IPv4\.method\=manual/g' "${settings_file}" fi done # Report nameservers for Ethernet interface if [ -f /etc/network/connman/lan.config ] then local nameservers=$(awk -F "=" '$1 ~ "Nameservers" {gsub(",",";",$2);gsub(" ","",$2);print $2}' /etc/network/connman/lan.config) if [ ! -z "${nameservers}" ] then for service_dir in $(find /etc/network/connman/ -type d -name ethernet_*) do local settings_file="${service_dir}/settings" if [ -f "${settings_file}" ] then echo "Apply static nameservers ${nameservers} in ${settings_file}" sed -i '/^Nameservers.*/d' "${settings_file}" echo "Nameservers=${nameservers}" >> "${settings_file}" fi done fi fi # Allow Connman to be configured by webui/restAPI for cnf_file in /etc/network/connman/lan.config /etc/network/connman/wlan.config do [ -f "${cnf_file}" ] && mv "${cnf_file}" "${cnf_file}.keros3" done echo "LAN and WLAN configuration files removed" echo "Adjustements finished" } # Restore SPF/CPF configurations from the content in the # safezone. In case of SPF to CPF upgrade, convert configuration. # restore_lora_configurations() { echo "Restoring CPF configurations from safezone..." if [ -f "${CPF_CONFIGFILE}" ]; then tar -xvzf "${CPF_CONFIGFILE}" -C / echo "CPF configuration restored" else echo "No CPF configuration in safezone. Nothing done." fi } # Restore configuration saved in safezone by preinst in # the new filesystem. # restore_bscc_configurations() { echo "Restoring BSCC configurations from safezone..." if [ -f ${SAFEZONE_MOUNTPOINT}/${BSCC_CONFFILE} ] then mkdir -p /user/bscc/ cp -f ${SAFEZONE_MOUNTPOINT}/${BSCC_CONFFILE} /user/bscc/ echo "Restoration finished" else echo "No restoration files in safezone. Nothing done." fi } # Restore Prove&Core SecureStorage information. restore_securestorage() { echo "Restore Prove&Core SecureStorage..." if [ -f ${SAFEZONE_MOUNTPOINT}/pcore_data.img.gz ]; then gunzip -c ${SAFEZONE_MOUNTPOINT}/pcore_data.img.gz | dd of=/dev/${EMMC_DEVICE} bs=512 seek=10240 echo "Prove&Core SecureStorage restored" else echo "No Prove&Core SecureStorage found. Nothing done." fi } # Adapt WMC configuration files for new firmware (if necessary) # adapt_wmc_configurations() { echo "Adapting WMC configuration files..." # Sysupgrade echo "${WMC_SYSUPGRADE_FILES}" > ${WMC_SYSUPGRADE_FILE} # Tunneling Tools 3.0 modifications # # OpenVPN configuration sed -i 's/^route-up/;route-up/g' ${WMC_OPENVPN_CONFIG} # Firewall rules cat << EOF > ${WMC_FIREWALL_RULES} #Firewall rules to accept OpenVPN traffic *filter -I INPUT -m udp -p udp --sport 1194 --dport 1024:65535 -j ACCEPT -I INPUT -m udp -p udp --sport 30000:35000 --dport 1024:65535 -j ACCEPT -I OUTPUT -m udp -p udp --sport 1024:65535 --dport 1194 -j ACCEPT -I OUTPUT -m udp -p udp --sport 1024:65535 --dport 30000:35000 -j ACCEPT COMMIT EOF # forcibly set lns, snmp & ntp addresses awk -F "\t" ' $2 == "lns" || $2 == "snmp" || $2 == "ntp.ran.com" { next } { print } END { printf "172.17.0.1\tlns\n" printf "172.17.0.1\tsnmp\n" printf "172.17.0.1\tntp.ran.com\n" }' < /etc/hosts > /etc/hosts.new \ && mv -f /etc/hosts.new /etc/hosts echo "Done" } # Restore WMC configuration from safezone restore_wmc_configurations() { echo "Restoring WMC configurations from safezone..." if [ -f ${SAFEZONE_MOUNTPOINT}/${WMC_CONFIGS_ARCHIVE} ] then # Restore the configuration tar -xvzf ${SAFEZONE_MOUNTPOINT}/${WMC_CONFIGS_ARCHIVE} -C / # Adapt for KerOS 4.0 adapt_wmc_configurations echo "Restoration finished" else echo "No restoration files in safezone. Nothing done." fi } #################### # MAIN KEROS PART #################### detect_emmc mount_safezone echo -e "\n== Start of PREAPPS script ==\n" 2>&1 | tee -a ${LOGFILE} # KerOS configuration restore_keros_configurations 2>&1 | tee -a ${LOGFILE} adjust_keros_configurations 2>&1 | tee -a ${LOGFILE} # LoRa configuration restore_lora_configurations 2>&1 | tee -a ${LOGFILE} # BSCC configuration restore_bscc_configurations 2>&1 | tee -a ${LOGFILE} # SecureStorage information restore_securestorage 2>&1 | tee -a ${LOGFILE} # WMC configuration restore_wmc_configurations 2>&1 | tee -a ${LOGFILE} #################### # MAIN CUSTOMER PART #################### # Example: # cp -fR ${SAFEZONE_MOUNTPOINT}/* /etc/ echo -e "\n== End of PREAPPS script ==\n" 2>&1 | tee -a ${LOGFILE} sync ++++ ''preapps'' script will be launched after the installation of the KerOS firmware but before installing any application package. ''postapps'' script will be launched after the installation of all the application packages. The second way to restore files is to add pre/post scripts in the applications packages themselves, The drawback of this method is that application packages will be saved in ''backup''. So the risk is to restore the files in safezone during a restoration of the product! ==== Install a custom liveburner ==== To upgrade your system, follow the software update process. Information [[wiki:keros_custo:sw_updates|here]]. ==== Read custom liveburner information ==== It is possible to extract some information about the content of a previously generated custom liveburner using the tool ''show_ipk_infos.sh'': # ./show_ipk_infos.sh -h Usage: ./show_ipk_infos.sh [-h] -h: this usage custom_liveburner.ipk: custom liveburner to extract elements from For example: # ./show_ipk_infos.sh custom-liveburner_4.0.2_klk-lpbs-signed.ipk == Package content == /tmp/updateliveburner/ipk/ ├── control │ ├── control │ ├── postinst │ └── preinst ├── data │ └── tmp │ └── linux.itb └── debian-binary 3 directories, 5 files == Package CONTROL == Package: liveburner Version: 4.0.2-0-g0d9f3135 Depends: keros (>= 2.0.0) Architecture: klk_lpbs Maintainer: Kerlink Priority: required Section: keros Source: http://www.kerlink.fr Description: Kerlink OS Kerlink OS tunned for klk_lpbs target Sign information: SRK0=0xDBCE282B Files added: lorad_1.0.0-1_klk_lpbs.ipk lorafwd_1.0.1-1_armv7ahf-neon.ipk netsnmphotfix_1.0.0_klk_lpbs.ipk lorasnmp_v3.1_klk_lpbs.ipk bscc_v3.1_klk_lpbs.ipk preinst postapps prereboot preapps == Burner content == /tmp/updateliveburner/ipk/data/tmp/itb/initrd/burner/ ├── bscc_v3.1_klk_lpbs.ipk ├── keros.ipk ├── lorad_1.0.0-1_klk_lpbs.ipk ├── lorafwd_1.0.1-1_armv7ahf-neon.ipk ├── lorasnmp_v3.1_klk_lpbs.ipk ├── netsnmphotfix_1.0.0_klk_lpbs.ipk ├── postapps ├── preapps ├── prereboot └── spftocpfconf 0 directories, 10 files ==== Extract content of a custom liveburner ==== Custom packages and scripts are integrated deeply in the liveburner. A tool is present to extract them easily: # ./extract_custom_elements.sh -h Usage: ./extract_custom_elements.sh [-h] -h: this usage custom_liveburner.ipk: custom liveburner to extract elements from For example: # ./extract_custom_elements.sh custom-liveburner_4.0.2_klk-lpbs-signed.ipk Extracting IPK file "custom-liveburner_4.0.2_klk-lpbs-signed.ipk" in workspace /tmp/updateliveburner... IPK file "custom-liveburner_4.0.2_klk-lpbs-signed.ipk" extracted Extracting Linux ITB "/tmp/updateliveburner/ipk/data/tmp/linux.itb" in workspace /tmp/updateliveburner/ipk/data/tmp... Extracting Kernel... Extracted: Image 0 (kernel@1) Description: Kerlink Linux kernel Created: Mon Apr 1 11:04:03 2019 Type: Kernel Image Compression: uncompressed Data Size: 4668384 Bytes = 4558.97 kB = 4.45 MB Architecture: ARM OS: Linux Load Address: 0x80800000 Entry Point: 0x80800000 Hash algo: md5 Hash value: 932a4133297a29fb9ebb0b65fd8bcd44 Kernel extracted Extracting DTB... Extracted: Image 1 (fdt@1) Description: Kerlink board Flattened Device Tree blob Created: Mon Apr 1 11:04:03 2019 Type: Flat Device Tree Compression: uncompressed Data Size: 32907 Bytes = 32.14 kB = 0.03 MB Architecture: ARM Hash algo: md5 Hash value: ebc1494b4546fa4bb824965abcebac86 DTB extracted Extracting INITRD... Extracted: Image 2 (ramdisk@1) Description: Ramdisk Image Created: Mon Apr 1 11:04:03 2019 Type: RAMDisk Image Compression: gzip compressed Data Size: 55649617 Bytes = 54345.33 kB = 53.07 MB Architecture: ARM OS: Linux Load Address: 0x82000000 Entry Point: 0x82000000 Hash algo: md5 Hash value: b051802e0f1797103a8ab41540edac29 INITRD extracted Linux ITB extracted Extracting INITRD "/tmp/updateliveburner/ipk/data/tmp/itb/initrd.cpio.gz" in workspace /tmp/updateliveburner/ipk/data/tmp/itb... 116753 blocs INITRD extracted == Extracting elements == File bscc_v3.1_klk_lpbs.ipk extracted File keros.ipk extracted File lorad_1.0.0-1_klk_lpbs.ipk extracted File lorafwd_1.0.1-1_armv7ahf-neon.ipk extracted File lorasnmp_v3.1_klk_lpbs.ipk extracted File netsnmphotfix_1.0.0_klk_lpbs.ipk extracted File postapps extracted File preapps extracted File prereboot extracted File spftocpfconf extracted File preinst extracted All elements are extracted in custom-liveburner_4.0.2_klk-lpbs-signed directory == Extraction finished == ==== Upgrade traces ==== Some traces are available after an upgrade in ''/user/.upgrade.log'': ++++ .upgrade.log | == START of PREINST script == Upgrade started at: 2019.04.01-09:05:45 Installed packages: Package: keros Version: 3.4.5-0-g1d8781c3 Status: install user installed Architecture: klk_lpbs Conffiles: /user/rootfs_rw/etc/strongswan.conf cf3d1b642d68b1af384aa0d8adf31deb /user/rootfs_rw/etc/timestamp 388d21c6903889b890300fac5fdff1f0 /user/rootfs_rw/etc/network/netctl.cfg 9aca669e1306572262ef84dec656bf55 /user/rootfs_rw/etc/network/connman/wlan.config 12970b252f6f74ad9e2d6aa951fdcdd8 /user/rootfs_rw/etc/network/connman/settings a2ab33efcebeb5bcfd2fafe6241c3664 /user/rootfs_rw/etc/network/connman/lan.config ab1b3ada039b2a5f9b6edb70bf1db0e7 /user/rootfs_rw/etc/network/connman/main.conf 95c5fdd6595b53d575df41d37531a3ae /user/rootfs_rw/etc/network/networkmonitoring.conf c41c77dbc5f68c2f11f58de00e241d38 /user/rootfs_rw/etc/network/ifplugd/local.conf 3d44653fc4425d091ade75fc9b1df8f4 /user/rootfs_rw/etc/network/ifplugd/local.action a2546d68f405d8d59222aa6482b12247 /user/rootfs_rw/etc/network/fixnetwork.conf 6e63c6334d1e660ab1ecd4e12e56d7a8 /user/rootfs_rw/etc/network/ofono/provisioning e27418f4fa48d772ff1ebd9b0247e31c /user/rootfs_rw/etc/network/udhcpd.conf e0d43b5339045ec7cee8628efdbbefdc /user/rootfs_rw/etc/network/if-pre-up.d/nfsroot 860854f45d519a51115e57ca385cfdab /user/rootfs_rw/etc/network/interfaces 0e79ac68d83a8845f49afc61043c79a5 /user/rootfs_rw/etc/bnm/bnm.conf 9b2452e4a278678c858fcb46acaf4ffb /user/rootfs_rw/etc/hosts 4af6093d05fd4d338a78484bd352927d /user/rootfs_rw/etc/syslog.conf.busybox 540bb318838b630604b5402a215823c4 /user/rootfs_rw/etc/kgpsd.conf 00e7484a7d46e0f1cc6ac37214286b32 /user/rootfs_rw/etc/syslog-startup.conf.busybox 2f3c9dede1fc155ef7483a2da55ce6d7 /user/rootfs_rw/etc/default/useradd 7a57ebc1418d2d642af3be1de10d0aa0 /user/rootfs_rw/etc/default/networking e81d6de8b5acf94aa3e1f046ffb18687 /user/rootfs_rw/etc/default/ntpdate cd14e09db7250943bcc3faa96455b963 /user/rootfs_rw/etc/default/usbd d41d8cd98f00b204e9800998ecf8427e /user/rootfs_rw/etc/default/connman d41d8cd98f00b204e9800998ecf8427e /user/rootfs_rw/etc/default/ssh 18d0a455bee343e830355f8172905e00 /user/rootfs_rw/etc/default/volatiles/01_bootlogd 1702eb9b6085684d59e25b4f161563c4 /user/rootfs_rw/etc/default/volatiles/99_sshd c6ea8ff7e649754524cd9e75c9745692 /user/rootfs_rw/etc/default/volatiles/00_core e5c4a7033f31af5f6d7196438c2b415e /user/rootfs_rw/etc/default/volatiles/99_dbus 8631f479b6e6f2a1b6fd77917318b8c0 /user/rootfs_rw/etc/default/devpts 096b1396d8f56264264ba3a811057e66 /user/rootfs_rw/etc/default/ofono d41d8cd98f00b204e9800998ecf8427e /user/rootfs_rw/etc/default/rcS 168925386cef321719e9444b79dc079f /user/rootfs_rw/etc/default/udev-cache d58a17ab27f6c83f7b5f4a6223aa6cec /user/rootfs_rw/etc/firewall.d/zz_reject.rules 183dbab28e4433c49f2dd645f5b34f52 /user/rootfs_rw/etc/firewall.d/zz_reject.v6rules 43f44cb1d26431afbd895fd06bc26672 /user/rootfs_rw/etc/firewall.d/00_default.v6rules d8c79c7d460bcc7c21b95b367251cda0 /user/rootfs_rw/etc/firewall.d/00_default.rules 4e54f851de9d064bbd9b04a855460532 /user/rootfs_rw/etc/ssh/sshd_config_readonly 75a76714faec7b15e9029ec844a9e3a6 /user/rootfs_rw/etc/ssh/ssh_config d67fa61ccbd8e0dbdfd2fb29d28cf715 /user/rootfs_rw/etc/ssh/sshd_config 1979d17ccbf2f885fda32b1fe8b6c006 /user/rootfs_rw/etc/ssh/moduli b27b6034c05755a41dfec04ce29c09ed /user/rootfs_rw/etc/ipsec.secrets 7e4728359aece845fc087624273f2bd9 /user/rootfs_rw/etc/ipsec.conf 01485a8658db82dd781f9229f4151661 /user/rootfs_rw/etc/monit.d/watchdog 92efa65dabd036060cfdea5831c19191 /user/rootfs_rw/etc/strongswan.d/charon.conf 0672ccc2d2d2b11709b64b5bfadcd203 /user/rootfs_rw/etc/strongswan.d/charon/gcm.conf 13ee7ff0e89523b688a6c46c74e085f2 /user/rootfs_rw/etc/strongswan.d/charon/pubkey.conf 61d9bf247a544d18deca9a2495f8a9bf /user/rootfs_rw/etc/strongswan.d/charon/pem.conf 9c2afa980f36e76a5f11401187789364 /user/rootfs_rw/etc/strongswan.d/charon/kernel-netlink.conf 74f9efb2a9826523db3c774393bffd86 /user/rootfs_rw/etc/strongswan.d/charon/md5.conf 51840e725e3fa3aef815767b7219cd9c /user/rootfs_rw/etc/strongswan.d/charon/constraints.conf e99f94125d99e9b0860af190b539af51 /user/rootfs_rw/etc/strongswan.d/charon/stroke.conf effb1b5bc46a7c849754fada75bae0d2 /user/rootfs_rw/etc/strongswan.d/charon/x509.conf d005d70bf8f9a027d4f63b4022310f89 /user/rootfs_rw/etc/strongswan.d/charon/vici.conf f2900f82fb39ef2539933ca143d53765 /user/rootfs_rw/etc/strongswan.d/charon/pkcs1.conf 9d2fd3f462e24ccd84db7581a6e8a79a /user/rootfs_rw/etc/strongswan.d/charon/xauth-generic.conf a7190a4f18b8947d9fd41b47714790a6 /user/rootfs_rw/etc/strongswan.d/charon/sha2.conf 48b9881b58c374092e72668e8ff89f29 /user/rootfs_rw/etc/strongswan.d/charon/random.conf 8fc0148bfb6efe8033c7cacebe5da452 /user/rootfs_rw/etc/strongswan.d/charon/resolve.conf b66dc6537ea8e97b4fb294549ae36fff /user/rootfs_rw/etc/strongswan.d/charon/gmp.conf 697cf867d66f97ac4b0fdc9b5642b214 /user/rootfs_rw/etc/strongswan.d/charon/fips-prf.conf 0e040afc20ca84907ab0b429e09741b6 /user/rootfs_rw/etc/strongswan.d/charon/socket-default.conf 6d84fb4b6fb735f4a4453085174d069a /user/rootfs_rw/etc/strongswan.d/charon/xcbc.conf 15b9fc5696459acf30ee5702727678b6 /user/rootfs_rw/etc/strongswan.d/charon/cmac.conf fbd1ee81be48f5facce569cd20131848 /user/rootfs_rw/etc/strongswan.d/charon/rc2.conf b40a14dfd4b1752674d7d94f68380c16 /user/rootfs_rw/etc/strongswan.d/charon/dnskey.conf 2eca11a1873d4e5bdf2e9ce9b31c8388 /user/rootfs_rw/etc/strongswan.d/charon/des.conf 72042146faee078d43917d199e4ca1d0 /user/rootfs_rw/etc/strongswan.d/charon/curve25519.conf e0bf280a7f9cc8faf054b9194377ddda /user/rootfs_rw/etc/strongswan.d/charon/pkcs12.conf 99155df25407780627c03317bb86d4bd /user/rootfs_rw/etc/strongswan.d/charon/pkcs7.conf 11efe7f05fb024f7bf0ae0e82c03032c /user/rootfs_rw/etc/strongswan.d/charon/aes.conf f7653385de28b293e155c7257d976162 /user/rootfs_rw/etc/strongswan.d/charon/sha1.conf a233d1540ec2cabf0ff1e53113f3a2fd /user/rootfs_rw/etc/strongswan.d/charon/hmac.conf 96276990445951092f232d92696562bb /user/rootfs_rw/etc/strongswan.d/charon/curl.conf 5df3d2385675d2eee2b04c39c9a14dcf /user/rootfs_rw/etc/strongswan.d/charon/nonce.conf 81985735b2aa564a34d9537dfec47aa1 /user/rootfs_rw/etc/strongswan.d/charon/revocation.conf 6e92a2290c40898265a3a47c5a16e1a9 /user/rootfs_rw/etc/strongswan.d/charon/pkcs8.conf ff23bb9a129a830ff124556cedc100fc /user/rootfs_rw/etc/strongswan.d/charon/openssl.conf 2d9b7f2f3f9655d3c115d40dc1cbf7df /user/rootfs_rw/etc/strongswan.d/charon/updown.conf 241b5341a5537b0864c7f2027d38f37d /user/rootfs_rw/etc/strongswan.d/charon/sshkey.conf 2a454f37202953d289f193ae5e002c10 /user/rootfs_rw/etc/strongswan.d/charon/sqlite.conf c01d77bfd63fb7f62e923f76ac21969a /user/rootfs_rw/etc/strongswan.d/charon/attr.conf 21648bde93f9784652cdbbb306cfd88e /user/rootfs_rw/etc/strongswan.d/charon/pgp.conf 651a092d54d65f0b16ac6a3566fdbde4 /user/rootfs_rw/etc/strongswan.d/charon-logging.conf cffbfccbe86d9791affa7e75c7b288c8 /user/rootfs_rw/etc/strongswan.d/pki.conf cf98e1db88564cf22ed739248e40a641 /user/rootfs_rw/etc/strongswan.d/starter.conf 2ba2784c18e268e34cec179d90e38437 /user/rootfs_rw/etc/cron/crontabs/root a627eda691b84a41fd59db058eeecfc0 /user/rootfs_rw/etc/shadow de7508af2d9419de71bf36037ae8e09c /user/rootfs_rw/etc/udhcpc.d/50default 49bd58c861c2e2a6725b46c37de59336 /user/rootfs_rw/etc/ntp.conf 902e083d1d354b769c19d02aee0ad808 Installed-Size: 45408612 Installed-Time: 1554106886 Package: kerlink-openvpn-config-pki2-klk-lpbs-060240 Version: 1.11-190108 Depends: keros (>= 3.1) Status: install user installed Architecture: cortexa9hf-neon-mx6sx Conffiles: /user/rootfs_rw/etc/firewall.d/iptables_openvpn.rules f6f8c63d4451d410f42f95517d664154 /user/rootfs_rw/etc/openvpn/client-openvpn.conf 6777f803d77e15dbcfce9629d14464b0 /user/rootfs_rw/etc/network/connman/openvpn.config 8c576523f73b19b588c6b629305a2d50 Installed-Size: 9476 Installed-Time: 1554107004 Package: spf2 Version: 5.1.0-klk4_5.1.0-klk5 Depends: keros Conflicts: lorad, kpfd, pkt-forwarder, packet-forwarder-v2 Status: install user installed Architecture: klk_lpbs Conffiles: /user/spf2/etc/config_single_antenna_64ch_US915.json 8573f878cd008c5166f6339ee8f6570f /user/spf2/etc/config_dual_antenna_8ch_AU928.json 093f3fc1821c7fe2a06c191be653a837 /user/spf2/etc/config_single_antenna_16ch_JP920.json 7bf9e34e6a9441e31b384665a8355969 /user/spf2/etc/config_dual_antenna_8ch_JP920.json 6c7e9861b2bcd201e46b625fe7bbe741 /user/spf2/etc/config_single_antenna_64ch_AU928.json 050e7bce9de86f05bf56a9ea11c8fb62 /user/spf2/etc/config_dual_antenna_8ch_EU868.json 992c12d8e77d7e09d6c732a7af0303fc /user/spf2/etc/config_dual_antenna_8ch_US915.json f4c8776152d0079b24ceebfcd1629f30 /user/spf2/etc/config_single_antenna_16ch_EU868.json 5255993ea01a6cd17049e80a6e53e130 /user/spf2/etc/config_single_antenna_16ch_AU928.json e5eb8235f688a9024ef952eed169c0bd /user/spf2/etc/config_single_antenna_16ch_US915.json bdc062e48823fb4d6d2e709c738f096d Installed-Size: 826562 Installed-Time: 1554107009 Package: bscc Version: v3.0.8 Depends: keros (>= 2.1.0) Status: install user unpacked Architecture: klk_lpbs Installed-Size: 343428 Installed-Time: 1554107003 Package: lorasnmp Version: v3.0.8 Depends: keros (>= 2.1.0) Status: install user installed Architecture: klk_lpbs Installed-Size: 1146354 Installed-Time: 1554107009 Backuping KerOS configurations in safezone... Product does not support sysupgrade, backuping network etc/network/ etc/network/connman/ etc/network/connman/settings etc/network/connman/openvpn.config etc/network/connman/lan.config etc/network/connman/main.conf etc/network/connman/vpn_ranintegrationocea_wanesy_fr_ran_com/ etc/network/connman/vpn_ranintegrationocea_wanesy_fr_ran_com/settings etc/network/connman/vpn_ranintegrationocea_wanesy_fr_ran_com/data etc/network/connman/wlan.config etc/network/connman/ethernet_7076ff017771_cable/ etc/network/connman/ethernet_7076ff017771_cable/settings etc/network/connman/ethernet_7076ff017771_cable/data etc/network/interfaces etc/network/if-down.d/ etc/network/ofono/ etc/network/ofono/provisioning etc/network/ifplugd/ etc/network/ifplugd/local.action etc/network/ifplugd/local.conf etc/network/networkmonitoring.conf etc/network/netctl.cfg etc/network/if-up.d/ etc/network/if-up.d/ntpdate-sync etc/network/if-pre-up.d/ etc/network/if-pre-up.d/nfsroot etc/network/udhcpd.conf etc/network/fixnetwork.conf etc/network/if-post-down.d/ Backup finished Backuping SPF configurations in safezone... File /user/spf2/etc/config.json found in system. Backup it in safezone Backup SPF finished Backuping CPF configurations in safezone... No CPF configuration found. Nothing done. Backuping BSCC configurations in safezone... File /user/bscc/var.xml found in system. Backup it in safezone Backup BSCC finished Backuping assets loaded in Prove&Core SecureStorage... 32768+0 records in 32768+0 records out Backup finished Backuping WMC configurations in safezone... etc/hosts etc/openvpn/client-openvpn.conf etc/firewall.d/iptables_openvpn.rules Backup WMC configurations finished == End of PREINST script == == Start of PREAPPS script == Restoring KerOS configurations from safezone... etc/network/ etc/network/connman/ etc/network/connman/settings etc/network/connman/openvpn.config etc/network/connman/lan.config etc/network/connman/main.conf etc/network/connman/vpn_ranintegrationocea_wanesy_fr_ran_com/ etc/network/connman/vpn_ranintegrationocea_wanesy_fr_ran_com/settings etc/network/connman/vpn_ranintegrationocea_wanesy_fr_ran_com/data etc/network/connman/wlan.config etc/network/connman/ethernet_7076ff017771_cable/ etc/network/connman/ethernet_7076ff017771_cable/settings etc/network/connman/ethernet_7076ff017771_cable/data etc/network/interfaces etc/network/if-down.d/ etc/network/ofono/ etc/network/ofono/provisioning etc/network/ifplugd/ etc/network/ifplugd/local.action etc/network/ifplugd/local.conf etc/network/networkmonitoring.conf etc/network/netctl.cfg etc/network/if-up.d/ etc/network/if-up.d/ntpdate-sync etc/network/if-pre-up.d/ etc/network/if-pre-up.d/nfsroot etc/network/udhcpd.conf etc/network/fixnetwork.conf etc/network/if-post-down.d/ Restoration finished Adjusting KerOS configurations... Adjust configuration in /etc/network/connman/ethernet_7076ff017771_cable/settings LAN and WLAN configuration files removed Adjustements finished Restoring CPF configurations from safezone... No CPF configuration in safezone. Nothing done. Restoring BSCC configurations from safezone... Restoration finished Restore Prove&Core SecureStorage... 32768+0 records in 32768+0 records out Prove&Core SecureStorage restored Restoring WMC configurations from safezone... etc/hosts etc/openvpn/client-openvpn.conf etc/firewall.d/iptables_openvpn.rules Adapting WMC configuration files... Done Restoration finished == End of PREAPPS script == == Start of POSTAPPS script == Adapting CPF default files for converted SPF configuration /etc/default/lorad file present, adapting it /etc/default/lorafwd file present, adapting it CPF default files updated Report status in update journal... Done == End of POSTAPPS script == == Start of PREREBOOT script == Converting SPF to CPF Configuration files File /tmp/safezeone/config.json found in safezone. Converting it. SPF configuration converted Report status in update journal... Done == End of PREREBOOT script == ++++ These traces are kept between custom liveburner but are lost in these situations: * restore stock * original liveburner * liveburner without sample scripts In addition, the update journal in ''/user/.update'' is reset when using a liveburner: 2019.04.01-09:06:37 -- Update from keros.ipk: OK 2019.04.01-09:06:55 -- Update from bscc_v3.1_klk_lpbs.ipk: OK 2019.04.01-09:06:56 -- Update from lorad_1.0.0-1_klk_lpbs.ipk: OK 2019.04.01-09:07:01 -- Update from lorafwd_1.0.1-1_armv7ahf-neon.ipk: OK 2019.04.01-09:07:02 -- Update from lorasnmp_v3.1_klk_lpbs.ipk: OK 2019.04.01-09:07:03 -- Update from netsnmphotfix_1.0.0_klk_lpbs.ipk: OK 2019.04.01-09:07:15 -- Update Status : updated 6, failed 0 , partial 0 result : OK