Modify `/etc/motd`, `/etc/issue` and other config files in Core18

So, as we all know, Core18’s root directory is mounted as read-only. This is problematic, as I need to change my /etc/issue file to display some information on the login prompt over serial. How do I go about modifying that prompt if /etc/issue is read-only?

i fear you’d need a new interface or extend an existing one for this …

Willard disliked that

Oh jeez, got any docs for that? I feel like this should be an easy thing to do during ubuntu-image snap

Well, first /etc/update-motd.d would have to become a writable dir … then you’d need something like an “update-motd” interface that allows putting a file in there … while both is technically possible and i doubt @jdstrand would oppose it from a security team perspective, it is both non trivial to implement and will take its time … perhaps you could do something via ~/.profile or ~/.bashrc of the user instead ?

Take a look at too

yup, that is how to solve point 1 …

So, the requirements are a bit unusual in that I need this information to display before the user even lays her hands on the keyboard. Thus, I believe I need to edit /etc/issue. Does writable paths work for that?

Also, I found this issue on GitHub about update-motd, but I don’t really understand. Is update-motd supposed to work now? Because it doesn’t seem to be installed and/or doesn’t for me.

well, i see /etc/update-motd.d/00-header being processed on all my core devices so dumping something in there to enhance the motd should always work … but this is indeed after login as you metioned … /etc/issue does not have such a .d/ mechanism at all which means the whole file would have to be writable/modifyable … not sure anything like this is on the plan (also note that core is not typically seen by us as an enduser system where people log in a lot, the ssh port and user account are rather for development and debugging, even adding a second user is already painful by design)

Right, this won’t be a final release thing. This requirement comes from this particular build I’m working on being for devs to work with, so instruction on how to use and interact with the image and the device at login is useful.

So, /etc/system-image/writable-paths is also unwritable. I don’t suppose there is a way to modify it short of ripping the image apart and putting it back together, is there?

this file is generated during build of the core(core18/core20) snap … then when the snap is generated at the end it becomes readonly …

changes to this file are officially only possible via the build scripts …

Are you saying that I’d have to build a custom version of UC18 in order to mod that file? I suppose I could do that, but I’d like to avoid it.

you’d have to submit a PR to the build scripts or, yes, re-pack it yourself … but then it will never get upgraded …

Guess I’ll have to contribute then. I really do think that should be something exposed to modification. I figure it’d be expected for embedded developers to want to display a custom banner or something.

My idea list for Ubuntu Core is already a mile long. inb4 I install Ubuntu on my personal machine.

After about 2 minutes of research I think we literally just need to add motd and issue to this list:

Ship it >>>> :ship::ship::ship::ship::ship::ship::ship::ship::ship::ship::ship::ship::ship::ship::ship::ship::ship::ship::ship:

1 Like

Well, i cant (not in that team anymore), but i’m sure someone will review it …

1 Like

@ogra is it good idea to run a service in gadget snap which will update this default files with the required one.
Like: I had ran a script as a service which was copying Sd-card image to SOC emmc memory.

you mean for putting some config in place ? sure you could do that …

i personally prefer to have a separate snap for this though …
some examples:

indeed all required interfaces need to be auto connected either from the gadget.yaml or via a snap declaration in a brand store.

Exactly, this two snaps are really very helpful if we need to made some changes in filesystem , @willnilges said earlier he need to add banner for user, we can use your sample snap to update the default “/etc/update-motd.d/00-header” file for banner update.
Other wise it will be hectic to made changes in gadget snap or request changes in core snap source.
Once the config snap update the “00-header” file device need to be reboot to affect these chages.

no, you can not (at least on Ubuntu Core) edit this file, simply because it is readonly, it would need a change in the core(18) snap first …

beyond this you would need an interface declaration (for such a file the system-files interface would work) approved in the store first (this last bit is indeed easily done if you have a brand store but will require a public review request for any snap in the global store).

1 Like