Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix cc_keyboard in mantic #4361

Merged
merged 2 commits into from
Aug 25, 2023
Merged

Conversation

TheRealFalcon
Copy link
Member

Proposed Commit Message

Fix cc_keyboard in mantic

localectl set-x11-keymap is currently broken for new debian based
installs. Workaround it by writing /etc/default/keyboard directly

LP: #2030788

Additional Context

https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/2030788
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1038762
man 5 keyboard

Test Steps

I haven't been able to verify this manually, so it may be worth asking the submitter to verify first

localectl set-x11-keymap is currently broken for new debian based
installs. Workaround it by writing /etc/default/keyboard directly

LP: #2030788
f'XKBVARIANT="{variant}"',
f'XKBOPTIONS="{options}"',
"",
'BACKSPACE="guess"', # This is provided on default installs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be a nitpick... Is it possible to allow the user to configure this, but still default to "guess" incase they do not configure this option.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While a good thought, the implementation is highly debian-specific given that this implementation is writing directly to /etc/default/keyboard. Surfacing such and option is something that won't be supportable easily on any other distribution that is calling localectl directly, because that command doesn't support setting backspace values.

@blackboxsw blackboxsw added the priority Fix soon label Aug 19, 2023
@blackboxsw blackboxsw self-assigned this Aug 21, 2023
Copy link
Collaborator

@blackboxsw blackboxsw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs fixing for 0o644. I'll push a commit to resolve this and test on stable releases.

util.write_file(
filename="/etc/default/keyboard",
content=contents,
mode=644,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mode here needs to be octal not decimal, this resulted in some very bad behavior on mantic when cloud-init wrote the file with perms 1204 :)

root@testlocale-manticdaily:~# localectl status
Could not get properties: Access Denied

root@testlocale-manticdaily:~# ls -l /etc/default/keyboard 
-rw-r----T 1 root root 120 Aug 25 02:31 /etc/default/keyboard

More details in the bug

Copy link
Collaborator

@blackboxsw blackboxsw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed behavior on stable releases is retained and keyboard/map is set properly on Focal, Jammy and Lunar as well as mantic while writing /etc/default/keyboard directly.

@blackboxsw blackboxsw merged commit b06f6f5 into canonical:main Aug 25, 2023
25 checks passed
@TheRealFalcon TheRealFalcon deleted the fix-keyboard branch August 28, 2023 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority Fix soon
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants