Under ubuntu core/core-desktop, /etc/default/locale is not modifiable

Bug #2035122 reported by Sergio Costas
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
systemd (Ubuntu)
New
Medium
Unassigned
Jammy
New
Medium
Unassigned

Bug Description

[Impact]

When working with ubuntu core or ubuntu core desktop, neither */etc/default/locale* nor */etc/default/keyboard* are modifiable, so it's not possible to set the global keyboard or the global language. This is required to allow to set the GDM language, and the default one during installation.

The first half of the solution is to create the folder */etc/writable/default*, and make soft-links from */etc/default/locale* to */etc/writable/default/locale* and from */etc/default/keyboard* to */etc/writable/default/keyboard*, just like it is already being done with */etc/hostname*, */etc/issue*, */etc/localtime*, */etc/motd* and , */etc/timezone*.

This solution, unfortunately, isn't complete. Although any application that just reads the files will work, not all of the applications that write to them will; specifically the systemd utilities that set the contents for those files, because they don't open the file directly; instead, they create first the new file in the same folder than the old one, fill its contents, and only then delete the old one and rename the new one. To solve this, systemd in Ubuntu already has several patches that detect if a file is a soft-link, in which case it replaces the old path with the destination one.

Currently I have in place a patch for Ubuntu Core Desktop that implements both changes for both */etc/default/locale* and */etc/default/keyboard*.

[Test plan]

Using *localectl set-lang LANG="xx_YY.UTF-8"* should change the locale to the specified one. Also, *localectl* should return the current locale.

[Where problems could occur]

In general, applications just read the content of the file and use the DBus interface to set the locale, so only those applications that modify by themselves the */etc/default/keyboard* and/or */etc/default/locale* would present a problem, in which case they would require specific patches. Anyway, those applications neither would work with the current state (with those files in a read-only filesystem).

Related branches

Revision history for this message
Sergio Costas (rastersoft-gmail) wrote :

I have a patch that fixes this. We are already using it in ubuntu core desktop. I'm preparing to upload it to the GIT repo.

Revision history for this message
Nick Rosbrook (enr0n) wrote :

We should really address the root of this problem instead of continuing to patch src:systemd.

Revision history for this message
Nick Rosbrook (enr0n) wrote :

We will definitely need to fix this in Jammy, but I am not sure it makes sense to do so in Mantic given the state of x11 keymap support (see bug 2030788).

Changed in systemd (Ubuntu Jammy):
importance: Undecided → Medium
Changed in systemd (Ubuntu):
importance: Undecided → Medium
tags: added: systemd-sru-next
Revision history for this message
Sergio Costas (rastersoft-gmail) wrote :

In ubuntu core desktop, we need to be able to change these two files to allow to set the GDM keyboard and language.

Revision history for this message
Steve Langasek (vorlon) wrote :

> When working with ubuntu core or ubuntu core desktop, neither /etc/default/locale
> nor /etc/default/keyboard are modificable

They should be. This needs to be fixed in Ubuntu Core, not in systemd.

Revision history for this message
Sergio Costas (rastersoft-gmail) wrote :

The point is that the way of fixing them is to make links to /etc/writable. But the systemd tools modify them by creating a new, temporary file first in the place, and then overwriting the old one with the new. So the patch does the same that was already done for other files: detect if the file is a soft link, and in that case, follow it up to the destination.

Revision history for this message
Sergio Costas (rastersoft-gmail) wrote :

So it requires a fix both in Ubuntu Core and systemd.

description: updated
Revision history for this message
Sergio Costas (rastersoft-gmail) wrote :

This is the patch used in systemd .deb for Ubuntu Core Desktop.

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "UBUNTU-CORE-support-etc-default-in-writable.patch" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.