Bug 71578

Summary: status=217/USER for service with dash in USER
Product: systemd Reporter: Sergey Zolotorev <sergey.zolotorev>
Component: generalAssignee: systemd-bugs
Status: RESOLVED INVALID QA Contact: systemd-bugs
Severity: major    
Priority: medium    
Version: unspecified   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Sergey Zolotorev 2013-11-13 15:18:23 UTC
systemd will not start any service for user which name contains dash ("-"). systemd will exit with status 217.

Reproduced on version 208-2.

Steps to reproduce:

1. Enable service for user (for example btsync-autoconfig or dropbox) for user with dashes in name: systemctl enable dropbox@test-user.service
2. Try to start: systemctl start dropbox@test-user.service
3. See status: systemctl status dropbox@test-user.service

Status contains something like this:

dropbox@test-user.service - Dropbox
Loaded: loaded (/usr/lib/systemd/system/dropbox@.service; enabled)
Active: failed (Result: start-limit) since Ср 2013-11-13 13:38:26 MSK; 3s ago
Process: 16923 ExecStart=/usr/bin/dropboxd (code=exited, status=217/USER)
Main PID: 16923 (code=exited, status=217/USER)

For user "test" all works.
Comment 1 Dave Reisner 2013-11-13 20:56:37 UTC
Marking this as invalid, as discussed at https://bugs.archlinux.org/task/37755
Comment 2 Ryan Bair 2014-12-29 20:40:26 UTC
I believe this bug may be valid. Service files which use 'User=%i' still fail with the same error. I've also tried to manually set a username containing a dash:

User=test-user
or 
User=test\x2duser

... and still receive the same error.
Comment 3 Ryan Bair 2014-12-29 21:14:02 UTC
Disregard. It looks like it's something with how I'm creating my users through sss local.
Comment 4 Sergey Zolotorev 2014-12-30 00:00:12 UTC
(In reply to Ryan Bair from comment #2)
> I believe this bug may be valid. Service files which use 'User=%i' still
> fail with the same error. I've also tried to manually set a username
> containing a dash:
> 
> User=test-user
> or 
> User=test\x2duser
> 
> ... and still receive the same error.

It looks like you can not create user "foo.bar" anymore... But now you (with systemd) you can not create use user "foo-bar" too. =)
Comment 5 Zbigniew Jedrzejewski-Szmek 2015-01-01 03:56:41 UTC
(In reply to Sergey Zolotorev from comment #4)
> It looks like you can not create user "foo.bar" anymore... But now you (with
> systemd) you can not create use user "foo-bar" too. =)
For the sake of people who stumble upon this bug report:
tl;dr: There's no problem with using a user name with a dash.

When specified directly (e.g. User=test-user) there's no issue.

When specifying the name as the instance argument, User=%i must be used, and User=%I does not work because dashes are "unescaped" to slashes (as was explained in https://bugs.archlinux.org/task/37755).

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.