Mksquashfs is failing

I am trying to burn image to SD using mix firmware and it fails as below. Looks like some invalid options are being passed to mksquashfs. Wondering how I can get the full mksquashfs being used, so that I can debug this further.

venkat@XPS-8930:~/work/pp/nerves/bb/nerves_system_bbb/test_bb$ mix firmware --verbose
==> nerves
==> test_bb

Nerves environment
  MIX_TARGET:   bbb
  MIX_ENV:      dev

Generated test_bb app
|nerves| Building OTP Release...

* [Nerves] validating vm.args
* skipping runtime configuration (config/runtime.exs not found)
* creating _build/bbb_dev/rel/test_bb/releases/0.1.0/vm.args
Updating base firmware image with Erlang release...
Copying rootfs_overlay: /home/venkat/work/pp/nerves/bb/nerves_system_bbb/test_bb/_build/bbb_dev/nerves/rootfs_overlay
Copying rootfs_overlay: /home/venkat/work/pp/nerves/bb/nerves_system_bbb/test_bb/rootfs_overlay
mksquashfs: invalid option

SYNTAX:mksquashfs source1 source2 ...  dest [options] [-e list of exclude
dirs/files]

Filesystem build options:

We very recently fixed this so that it would be easier to see mksquashfs errors, but I don’t think that update will be out until midweek.

You are getting an unexpected error, though. It looks like you’re using Linux. What version of mksquashfs are you using?

Thanks for much for you help.
Yes, I am using Linux (Ubuntu 18.04)
Below is info on version of mksquashfs.

~/work/pp/nerves/bb/test_bb$ mksquashfs -version
mksquashfs version 4.3-git (2014/06/09)

I was trying to debug the mksquashfs error. I think mksquashfs is called from deps/nerves_system_br/scripts/rel2fw.sh.

But when I make changes in that file it doesn’t change the build.

I changed this line
echo "VS Copying rootfs_overlay: $OVERLAY" to add a prefix MyDebug echo "MyDebug Copying rootfs_overlay: $OVERLAY" but when I do ```mix firmware`````` it doesn’t print the addedd prefix MyDebug.

Wondering how can we make changes in this script to add additional debug

I can confirm that this error is due to version of squashfs-tools. Upgraded to a later version of squashfs-tools using procedure below and this fixes the issue.

git clone https://github.com/plougher/squashfs-tools.git
cd squashfs-tools
git checkout 4.6.1
cd squashfs-tools
make
sudo make install

It would still be good, if I can get help on how to add additional debug to the scripts.

Which version of nerves_system_br was being used in this test? The ability to see mksquashfs errors as part of the output was released a while ago and the latest Nerves systems have that included (needs nerves_system_br >= 1.23.1. Likewise, where you were putting those log lines matter. You were most likely not seeing those debug prints because the were behind an if check on rootfs_overlays which are not always present.

Likewise, it seems your error was on this line with merge-squashfs. Looking at your output above, it seems like you were getting the stderr from that:

mksquashfs: invalid option

SYNTAX:mksquashfs source1 source2 ...  dest [options] [-e list of exclude
dirs/files]

Filesystem build options:

Unfortunately, that is from mksquashfs tool directly so up to them for providing helpful out.

rel2fw.sh was the right place to add

deps/nerves_system_br/scripts/rel2fw.sh doesn’t seem to be script that is being used.

I am able to run mix firmware succesfully even after deleting deps/nerves_system_br/scripts/rel2fw.sh
Below are logs.

venkat@XPS-8930:~/work/pp/nerves/ne1/blinky$ rm deps/nerves_system_br/scripts/rel2fw.sh

venkat@XPS-8930:~/work/pp/nerves/ne1/blinky$ ls -al deps/nerves_system_br/scripts/rel2fw.sh
ls: cannot access 'deps/nerves_system_br/scripts/rel2fw.sh': No such file or directory

venkat@XPS-8930:~/work/pp/nerves/ne1/blinky$ mix clean
==> nerves
==> blinky

Nerves environment
  MIX_TARGET:   bbb
  MIX_ENV:      dev

venkat@XPS-8930:~/work/pp/nerves/ne1/blinky$ mix firmware
==> nerves
==> blinky

Nerves environment
  MIX_TARGET:   bbb
  MIX_ENV:      dev

Compiling 2 files (.ex)
Generated blinky app
|nerves| Building OTP Release...

* [Nerves] validating vm.args
* skipping runtime configuration (config/runtime.exs not found)
* creating _build/bbb_dev/rel/blinky/releases/0.1.0/vm.args
Updating base firmware image with Erlang release...
Copying rootfs_overlay: /home/venkat/work/pp/nerves/ne1/blinky/_build/bbb_dev/nerves/rootfs_overlay
Copying rootfs_overlay: /home/venkat/work/pp/nerves/ne1/blinky/rootfs_overlay
Building /home/venkat/work/pp/nerves/ne1/blinky/_build/bbb_dev/nerves/images/blinky.fw...
Firmware built successfully! 🎉

Now you may install it to a MicroSD card using `mix burn` or upload it
to a device with `mix upload` or `mix firmware.gen.script`+`./upload.sh`.

Below is section of output mix deps.tree which show I am using nerves_system_br 1.23.2

venkat@XPS-8930:~/work/pp/nerves/ne1/blinky$ mix deps.tree
...
├── nerves_system_bbb ~> 2.8 (Hex package)
│   ├── nerves ~> 1.6.0 or ~> 1.7.15 or ~> 1.8 (Hex package)
│   ├── nerves_system_br 1.23.2 (Hex package)
│   └── nerves_toolchain_armv7_nerves_linux_gnueabihf ~> 1.8.0 (Hex package)
│       ├── nerves ~> 1.0 (Hex package)
│       └── nerves_toolchain_ctng ~> 1.9.3 (Hex package)
│           └── nerves ~> 1.0 (Hex package)

I found that the script being used is ~/.nerves/./artifacts/nerves_system_bbb-portable-2.18.1/scripts/rel2fw.sh.

By making changes there and also in ~/.nerves/artifacts/nerves_system_bbb-portable-2.18.1/scripts/merge-squashfs I am able to gain insights into how squashfs is being used.