jamulussoftware / jamulus

Jamulus enables musicians to perform real-time jam sessions over the internet.
https://jamulus.io
Other
997 stars 222 forks source link

Headless deb overwrites systemd service file #1285

Closed ann0see closed 3 years ago

ann0see commented 3 years ago

Describe the bug If you install rc1 make some changes to the systemd service file and afterwards install rc2, the modified file gets rewritten

To Reproduce

  1. Install RC1
  2. Make changes to the systemd file
  3. Install RC2
  4. Look at the systemd service file

Expected behavior

The systemd file should not be rewritten.

Screenshots

Operating system Debian 10

Version of Jamulus Jamulus 3.7.0rc1 and Jamulus 3.7.0rc2 Additional context We could just let the user create the .system file himself or let him rename a generic one (jamulus-headless.service.example) to jamlus-headless.example

Not sure if this is blocking?

hoffie commented 3 years ago

Hrm, at a first glance everything looks correct. We seem to install to lib/systemd/system, which is the proper place for package-provided systemd units.

If users want to override anything, this should go to /etc, which must not be touched by our package (and I don't see indications that it did). systemctl edit ensures this.

ann0see commented 3 years ago

Ok. So should we tell the user to use systemctl edit jamulus-headless ? Probably that's something for the documentation.

ann0see commented 3 years ago

So you'd suggest to comment ExecStart= in the .service file?

ann0see commented 3 years ago

@gilgongo I think we should document this.

hoffie commented 3 years ago

So you'd suggest to comment ExecStart= in the .service file?

The supplied service file should work out of the box, so I don't think we should comment out ExecStart= if that's what you mean?

systemd will allow to override specific values from unit files. There's no need to remove or comment them out in the package-supplied file.

ann0see commented 3 years ago

Ok. For me systemctl raised a warning about two ExecStart= lines after adding ExecStart= to the override file?

hoffie commented 3 years ago

Ok. For me systemctl raised a warning about two ExecStart= lines after adding ExecStart= to the override file?

Hrm, can you share systemctl cat jamulus-headless.service und the exact log messages?

ann0see commented 3 years ago

Ah. Wait a moment. I think it was due to a missing quote in the ExecStart line in the override file.

ann0see commented 3 years ago

Restarting it seemed to solve the issue.

See this error message:

● jamulus-headless.service - Jamulus headless server
   Loaded: loaded (/lib/systemd/system/jamulus-headless.service; enabled; vendor preset: enabled)
  Drop-In: /etc/systemd/system/jamulus-headless.service.d
           └─override.conf
   Active: active (running) since Wed 2021-03-17 13:18:54 CET; 3min 9s ago
 Main PID: 597 (sh)
    Tasks: 3 (limit: 4915)
   Memory: 49.0M
   CGroup: /system.slice/jamulus-headless.service
           ├─597 /bin/sh -c /usr/bin/jamulus-headless -s -n
           └─605 /usr/bin/jamulus-headless -s -n

Mär 17 13:18:54 Pinguin jamulus[597]: - no GUI mode chosen
Mär 17 13:18:54 Pinguin jamulus[597]: could not determine local IPv4 address: "Network unreachable" - using localhost
Mär 17 13:18:54 Pinguin jamulus[597]: Using "127.0.0.1" as external IP.
Mär 17 13:18:54 Pinguin jamulus[597]: Recording state not initialised
Mär 17 13:18:54 Pinguin jamulus[597]:  *** Jamulus, Version 3.7.0rc2
Mär 17 13:18:54 Pinguin jamulus[597]:  *** Internet Jam Session Software
Mär 17 13:18:54 Pinguin jamulus[597]:  *** Released under the GNU General Public License (GPL)
Mär 17 13:20:43 Pinguin systemd[1]: jamulus-headless.service: Current command vanished from the unit file, execution of the command list won't be resumed.
Mär 17 13:21:44 Pinguin systemd[1]: /etc/systemd/system/jamulus-headless.service.d/override.conf:2: Executable name contains special characters: /bin/sh -c '/usr/bin/jamulus-headless -s -n -T'
Mär 17 13:21:48 Pinguin systemd[1]: /etc/systemd/system/jamulus-headless.service.d/override.conf:2: Executable name contains special characters: /bin/sh -c '/usr/bin/jamulus-headless -s -n -T'

After restating it, with systemctl restart jamulus-headless, the override file doesn't seem to get applied:

● jamulus-headless.service - Jamulus headless server
   Loaded: loaded (/lib/systemd/system/jamulus-headless.service; enabled; vendor preset: enabled)
  Drop-In: /etc/systemd/system/jamulus-headless.service.d
           └─override.conf
   Active: active (running) since Wed 2021-03-17 13:24:08 CET; 1s ago
 Main PID: 3040 (sh)
    Tasks: 3 (limit: 4915)
   Memory: 39.0M
   CGroup: /system.slice/jamulus-headless.service
           ├─3040 /bin/sh -c /usr/bin/jamulus-headless -s -n
           └─3041 /usr/bin/jamulus-headless -s -n

Mär 17 13:24:08 Pinguin systemd[1]: Started Jamulus headless server.
Mär 17 13:24:08 Pinguin jamulus[3040]: - server mode chosen
Mär 17 13:24:08 Pinguin jamulus[3040]: - no GUI mode chosen
Mär 17 13:24:08 Pinguin jamulus[3040]: Using "10.24.48.110" as external IP.
Mär 17 13:24:08 Pinguin jamulus[3040]: Recording state not initialised
Mär 17 13:24:08 Pinguin jamulus[3040]:  *** Jamulus, Version 3.7.0rc2
Mär 17 13:24:08 Pinguin jamulus[3040]:  *** Internet Jam Session Software
Mär 17 13:24:08 Pinguin jamulus[3040]:  *** Released under the GNU General Public License (GPL)

$ systemctl cat jamulus-headless.service
# /lib/systemd/system/jamulus-headless.service
[Unit]
Description=Jamulus headless server
After=network.target
StartLimitIntervalSec=0

[Service]
Type=simple
User=jamulus
Group=nogroup
NoNewPrivileges=true
ProtectSystem=true
ProtectHome=true
Nice=-20
IOSchedulingClass=realtime
IOSchedulingPriority=0

#### Change this to publish this server, set genre, location and other parameters.
#### See https://jamulus.io/wiki/Command-Line-Options ####
ExecStart=/bin/sh -c '/usr/bin/jamulus-headless -s -n'

Restart=on-failure
RestartSec=30
StandardOutput=journal
StandardError=inherit
SyslogIdentifier=jamulus

[Install]
WantedBy=multi-user.target

# /etc/systemd/system/jamulus-headless.service.d/override.conf
[Service]

ExecStart="/bin/sh -c '/usr/bin/jamulus-headless -s -n -T'"
gilgongo commented 3 years ago

I get the feeling there's a standard-ish way of handling this with packages (so if you edited the unit file)... This reminds me I've yet to actually try the headless one.