Including all likely config files in a "packages and files" custom image

Is there any downside to "over-including" configuration files when using the "packages and files" option of image building?

For what I mean by "packages and files," see this comment by mojifax on another post:

The trickiest part for me would be knowing what "all my configuration" was.

These are the two methods I thought of:

  • To learn and know how every action I might take modifies the configuration files and to keep track of the affected files.

  • Simply to include all the likely files.

It turns out that "all the likely files" may not amount to much in terms of size. The /etc directory is only 219KB, for example.

So my plan is to extract whole directories from a "good state" router for inclusion in the custom image to be created, such as:

  • /etc
  • /root
  • /home (for any non-root user I may create)

This is what I mean by "over-inclusion." Can it backfire on me in some way?

afaik all OpenWrt config is stored in /etc/config, everything else is created from that.

Some specific packages might not do that but they are not common and if you use them you will know because you had to connect with ssh and open their config file in their custom location.

All packages you set from UCI or Luci web interface have their config in /etc/config.

There are also some files that exist for custom user configuration, and of course the self-signed certificate and ssh keys

The easiest way to see what is important is to make a backup with OpenWrt's config backup https://openwrt.org/docs/guide-user/troubleshooting/backup_restore and then opening that to see what files are being saved. It is just a tar.gz archive.

By default there is nothing in /root and I'm not sure why you would want to create non-root users since doing most things requires root or a different user from the "users" on OpenWrt

I'm not sure there are drawbacks of cloning everything like that, but I would still try to do it "smarter".

1 Like

Thanks so much!

There is something in /root for me because I install OpenSSH and it creates /root/.ssh for authorized_keys.

"Why install OpenSSH?" That's because I am used to it. If I have to handle some area in two different ways (e.g. OpenSSH plus Dropbear), I tend to make mistakes.

The non-root user too is the same one I use everywhere, even if I have to sudo or sudo -s to get some things done in OpenWrt.

Doing it "smarter." Yes, that will come later I hope. For the present, more afraid of leaving some config out and finding that the image does not work.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.