canonical / canonical/core-base

some snaps fail when $HOME is managed by systemd-homed

Open
#368 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Shell
Stars
37
Forks
53
Avg merge
1d 19h
Merged PRs (30d)
12

Description

I have two accounts on my laptop . One account has $HOME as a normal directory. My main account (login `stu`) has $HOME managed by [systemd-homed](https://systemd.io/HOME_DIRECTORY/). When I use this account some snaps do not work. The cause is probably that `/etc/nsswitch.conf` does not have `systemd` in the `passwd`, `group`, `shadow` and `gshadow` databases. The snaps work when I use my account with a normal $HOME. I can also make them work by adding an entry for `stu` in `/etc/passwd`. You are not meant to do this however because the uid can change and account is meant to be fully managed by homed. Could support for systemd-homed be added to snaps? I presume that it would have to be done in core [as was done for mdns](https://github.com/canonical/core20/pull/102). I am running Ubuntu 25.04 (see below). firefox works but I have had some problems saving files without the workaround.

drawio prints an error message and does not open a window. I reported the [bug to drawio](https://github.com/jgraph/drawio-desktop/issues/2182) but that was perhaps the wrong place.
```
laptop% snap info drawio
name: drawio
summary: draw.io
publisher: draw.io (jgraph✓)
store-url: https://snapcraft.io/drawio
license: unset
description: |
draw.io desktop
commands:
- drawio
snap-id: 84JReQ8pcNGJyAbT0gSDiW7OpDkrdaXp
tracking: latest/stable
refresh-date: today at 10:43 CEST
channels:
latest/stable: 28.1.2 2025-08-30 (253) 131MB -
latest/candidate: ↑
latest/beta: ↑
latest/edge: 28.1.2 2025-08-29 (253) 131MB -
installed: 28.1.2 (253) 131MB -
laptop% snap run --shell drawio
% getent passwd $USER || echo $USER not found; exit
stu not found
exit
laptop% /snap/bin/drawio
A JavaScript error occurred in the main process
Uncaught Exception:
SystemError [ERR_SYSTEM_ERROR]: A system error occurred: uv_os_get_passwd returned ENOENT (no such file or directory)
at Object.userInfo (node:os:305:11)
at file:///snap/drawio/253/resources/app.asar/node_modules/atomically/dist/constants.js:10:29
at ModuleJob.run (node:internal/modules/esm/module_job:343:25)
at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:647:26)
at async node:electron/js2c/browser_init:2:135238
at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:132:5)
```
Same thing with element-desktop. It works with my account with $HOME as a normal directory but fails unable to open a window with $HOME mounted by homed.
```
laptop% snap info element-desktop
name: element-desktop
summary: A feature-rich client for Matrix.org
publisher: Ken VanDine✪
store-url: https://snapcraft.io/element-desktop
contact: ken@vandine.org
license: unset
description: |
Element is both a secure messenger and a productivity team collaboration app that is ideal for
group chats while remote working. This chat app uses end-to-end encryption to provide powerful
video conferencing, file sharing and voice calls.

Element’s features include:
- Advanced online communication tools
- Fully encrypted messages to allow safer corporate communication, even for remote workers
commands:
- element-desktop
snap-id: nZQQXb6Hap0I2ZF3ZsTeFeh80gXHN8DQ
tracking: latest/stable
refresh-date: 10 days ago, at 00:43 CEST
channels:
latest/stable: 1.11.109 2025-08-19 (166) 189MB -
latest/candidate: ↑
latest/beta: ↑
latest/edge: 1.11.110 2025-08-28 (168) 189MB -
installed: 1.11.109 (166) 189MB -
laptop% snap run --shell element-desktop
% getent passwd $USER || echo $USER not found; exit
stu not found
exit
laptop% /snap/bin/element-desktop
A JavaScript error occurred in the main process
Uncaught Exception:
SystemError [ERR_SYSTEM_ERROR]: A system error occurred: uv_os_get_passwd returned ENOENT (no such file or directory)
at Object.userInfo (node:os:305:11)
at file:///snap/element-desktop/166/opt/Element/resources/app.asar/node_modules/atomically/dist/constants.js:10:29
at ModuleJob.run (node:internal/modules/esm/module_job:329:25)
at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:644:26)
at async node:electron/js2c/browser_init:2:135156
```
```
laptop% uname -srvmpio && cat /etc/issue
Linux 6.14.0-28-generic #28-Ubuntu SMP PREEMPT_DYNAMIC Wed Jul 23 12:05:14 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
Ubuntu 25.04 \n \l

laptop% cat /etc/nsswitch.conf
# /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc-reference' and `info' packages installed, try:
# `info libc "Name Service Switch"' for information about this file.

passwd: files systemd sss
group: files systemd sss
shadow: files systemd sss
gshadow: files systemd

hosts: files mdns4_minimal [NOTFOUND=return] dns
networks: files

protocols: db files
services: db files sss
ethers: db files
rpc: db files

netgroup: nis sss
automount: sss
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the failure with `snap run --shell`, `getent passwd $USER`, and the affected drawio or element-desktop command, then compare the confined environment with `/etc/nsswitch.conf`. Review the core snap approach referenced by the core20 mdns change. Done means homed-managed users resolve inside affected snaps and both applications launch without an `/etc/passwd` workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux
Domain
operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.