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

Bug #2035122 reported by Sergio Costas
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
systemd (Ubuntu)
New
Medium
Unassigned
Jammy
Fix Released
Medium
Unassigned
Lunar
Won't Fix
Undecided
Unassigned
Mantic
Won't Fix
Undecided
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 *sudo localectl set-locale xx_YY.UTF-8* in an Ubuntu Core or Ubuntu Core Desktop admin terminal must change the locale to the specified one, which can be checked by reading the */etc/default/locale* file. Also, *localectl* must return the new locale.

Using *sudo dbus-send --system --print-reply --dest=org.freedesktop.locale1 /org/freedesktop/locale1 org.freedesktop.locale1.SetX11Keyboard string:XX string:pc10Y string: string: boolean:true boolean:false" must change the */etc/default/keyboard* file to layout XX and model PC10Y (being Y either 1, 2, 4 or 5). Reading the file allows to check it. Also, *localectl status* must return the layout and model values in "X11 Layout" and "X11 Model" entries.

[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).

[Other info]

For Noble, this will be addressed when we merge systemd v255 from Debian. This is only needed on core, so we don't need to fix for Mantic or Lunar.

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
Nick Rosbrook (enr0n)
description: updated
Nick Rosbrook (enr0n)
Changed in systemd (Ubuntu Lunar):
status: New → Won't Fix
Changed in systemd (Ubuntu Mantic):
status: New → Won't Fix
Revision history for this message
Steve Langasek (vorlon) wrote :

This test plan does not describe in what environment to run the command, or how to check afterwards that the locale has been changed.

Changed in systemd (Ubuntu Jammy):
status: New → Incomplete
Revision history for this message
Sergio Costas (rastersoft-gmail) wrote :

Fixed.

description: updated
Changed in systemd (Ubuntu Jammy):
status: Incomplete → New
Revision history for this message
Brian Murray (brian-murray) wrote :

While the test plan now has information about changing the locale there is nothing which covers the keyboard changes. I'm going to accept this today but please update the test case to include testing the keyboard changes and ensure that is also tested.

Changed in systemd (Ubuntu Jammy):
status: New → Fix Committed
tags: added: verification-needed verification-needed-jammy
Revision history for this message
Brian Murray (brian-murray) wrote : Please test proposed package

Hello Sergio, or anyone else affected,

Accepted systemd into jammy-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/systemd/249.11-0ubuntu3.12 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-jammy to verification-done-jammy. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-jammy. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Revision history for this message
Ubuntu SRU Bot (ubuntu-sru-bot) wrote : Autopkgtest regression report (systemd/249.11-0ubuntu3.12)

All autopkgtests for the newly accepted systemd (249.11-0ubuntu3.12) for jammy have finished running.
The following regressions have been reported in tests triggered by the package:

casync/2+20201210-1build1 (arm64, ppc64el)
exim4/4.95-4ubuntu2.4 (ppc64el)
indicator-session/17.3.20+21.10.20210613.1-0ubuntu1 (armhf)
linux-aws-5.19/5.19.0-1029.30~22.04.1 (arm64)
linux-aws-6.5/6.5.0-1011.11~22.04.1 (arm64)
linux-azure-6.2/6.2.0-1018.18~22.04.1 (arm64)
linux-azure-6.5/6.5.0-1010.10~22.04.1 (arm64)
linux-gcp-5.19/5.19.0-1030.32~22.04.1 (arm64)
linux-gcp-6.2/6.2.0-1019.21~22.04.1 (arm64)
linux-hwe-5.19/5.19.0-50.50 (arm64)
linux-hwe-6.2/6.2.0-39.40~22.04.1 (arm64)
linux-lowlatency-hwe-6.2/6.2.0-1018.18~22.04.1 (arm64)
mediawiki/1:1.35.6-1 (s390x)
mosquitto/2.0.11-1ubuntu1.1 (amd64, arm64, armhf, s390x)
samba/2:4.15.13+dfsg-0ubuntu1.5 (ppc64el)
systemd/unknown (armhf)

Please visit the excuses page listed below and investigate the failures, proceeding afterwards as per the StableReleaseUpdates policy regarding autopkgtest regressions [1].

https://people.canonical.com/~ubuntu-archive/proposed-migration/jammy/update_excuses.html#systemd

[1] https://wiki.ubuntu.com/StableReleaseUpdates#Autopkgtest_Regressions

Thank you!

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

Brian,

Done the changes requested in the Test Plan.

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

Sorry for the delay, I had some trouble these days to build a Core Desktop image mixing our PPA and the "proposed" repository. Finally I've been able to do so and test this, and it seems to work as expected. Thanks!

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

Would this Qemu capture from a Core Desktop terminal be enough? There you can see that the installed .deb for systemd is 249.11-0ubuntu3.12, that /etc/default/keyboard and /etc/default/locale are soft links to the same files at /etc/writable/default, that /etc/writable/default/keyboard file doesn't exist and /etc/writable/default/locale contains C.UTF-8. And after following the test protocol, locale now contains es_ES.UTF-8, and keyboard file exists with es layout and pc105 model.

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

Looking at the attached screenshot, it covers everything in the test plan above.

tags: added: verification-done verification-done-jammy
removed: verification-needed verification-needed-jammy
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package systemd - 249.11-0ubuntu3.12

---------------
systemd (249.11-0ubuntu3.12) jammy; urgency=medium

  * core/device: ignore DEVICE_FOUND_UDEV bit on switching root (LP: #2037281)
    File: debian/patches/lp2037281-core-device-ignore-DEVICE_FOUND_UDEV-bit-on-switching-roo.patch
    https://git.launchpad.net/~ubuntu-core-dev/ubuntu/+source/systemd/commit/?id=00f86f0b20f794f30aabe7181912d2ec2207e292
  * use read-only /etc hack in more places (LP: #2035122)
    File: debian/patches/debian/UBUNTU-Support-system-image-read-only-etc.patch
    https://git.launchpad.net/~ubuntu-core-dev/ubuntu/+source/systemd/commit/?id=c57406e850396a5d446aefe5e70a3aeaad080d72
  * autopkgtest: do not allow qemu to be used on ppc64el.
    Almost every run on ppc64el takes 12 to 24 hours, so do this as a last
    resort to relieve pressure on autopkgtest infrastructure.
    File: debian/tests/upstream
    https://git.launchpad.net/~ubuntu-core-dev/ubuntu/+source/systemd/commit/?id=d125a1ed3f01e59dba2f370c13801bfb76c16f5d

 -- Nick Rosbrook <email address hidden> Tue, 21 Nov 2023 15:57:17 -0500

Changed in systemd (Ubuntu Jammy):
status: Fix Committed → Fix Released
Revision history for this message
Łukasz Zemczak (sil2100) wrote : Update Released

The verification of the Stable Release Update for systemd has completed successfully and the package is now being released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

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.