<div dir="ltr">Hello everyone,<div><br></div><div>v239 brought in portable services (a good description is at <a href="http://0pointer.net/blog/walkthrough-for-portable-services.html" target="_blank">http://0pointer.net/blog/walkthrough-for-portable-services.html</a>) and while I still cannot make it work (I do not have a /usr/lib/systemd/portablectl despite having systemd --version reporting 239, but this is going to be a separate question) I wanted to understand how to build a minimal portable service.</div><div><br></div><div>A practical example could be dnsmasq. It is provided as a package and depends (apt show dnsmasq) on netbase, dnsmasq-base, init-system-helpers (>= 1.18~), lsb-base (>= 3.0-6). These packages may further depend on something else.</div><div>It also brings in a set of files into the system:</div><div><br></div><div>root@srv ~# dpkg-query -L dnsmasq</div><div>/.</div><div>/etc</div><div>/etc/default</div><div>/etc/default/dnsmasq</div><div>/etc/dnsmasq.conf</div><div>/etc/dnsmasq.d</div><div>/etc/dnsmasq.d/README</div><div>/etc/init.d</div><div>/etc/init.d/dnsmasq</div><div>/etc/insserv.conf.d</div><div>/etc/insserv.conf.d/dnsmasq</div><div>/etc/resolvconf</div><div>/etc/resolvconf/update.d</div><div>/etc/resolvconf/update.d/dnsmasq</div><div>/lib</div><div>/lib/systemd</div><div>/lib/systemd/system</div><div>/lib/systemd/system/dnsmasq.service</div><div>/usr</div><div>/usr/lib</div><div>/usr/lib/resolvconf</div><div>/usr/lib/resolvconf/dpkg-event.d</div><div>/usr/lib/resolvconf/dpkg-event.d/dnsmasq</div><div>/usr/share</div><div>/usr/share/dnsmasq</div><div>/usr/share/dnsmasq/installed-marker</div><div>/usr/share/doc</div><div>/usr/share/doc/dnsmasq</div><div> </div><div>Some of these are existing directories, some new ones and then  there are files (new, but possibly existing as well).</div><div><br></div><div><b>How should I create a filesystem which has only the files required by the packages (= the ones it brings in, as well as all the dependencies)?</b></div><div><br></div><div>I know that I can dbootstrap a new system and install there dnsmasq - and then hopefully use this as the tree to be attached via portablectl. This however means that I do not have a "dnsmasq" portable service but rather a "bionic install with dnsmasq installed on top". The main reason for me to use portable service is to create small packages which encompass my service, to be mounted on a more or less base core OS install (say, minimal bionic). This would allow to get rid of several nspawn containers which do exactly this (base OS + a package installed on top).</div><div><br></div><div>One of the ideas I had (but which seems very wrong) is to have a copy of the core OS, then in another copy install the required packages, and then make a diff of the two directories. But this looks horrible and is hardly maintainable.</div><div><br></div><div>I would very much  appreciate any pointers or hints on how to approach this.</div><div dir="ltr"><div><br></div><div>Wojtek</div></div></div>