Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.user > #224960 > unrolled thread
| Started by | Richard Hector <richard@walnut.gen.nz> |
|---|---|
| First post | 2020-07-19 11:30 +0200 |
| Last post | 2020-07-19 12:50 +0200 |
| Articles | 4 — 2 participants |
Back to article view | Back to linux.debian.user
systemd and non-existent service instances Richard Hector <richard@walnut.gen.nz> - 2020-07-19 11:30 +0200
Re: systemd and non-existent service instances Andrei POPESCU <andreimpopescu@gmail.com> - 2020-07-19 12:00 +0200
Re: systemd and non-existent service instances Richard Hector <richard@walnut.gen.nz> - 2020-07-19 12:40 +0200
Re: systemd and non-existent service instances Richard Hector <richard@walnut.gen.nz> - 2020-07-19 12:50 +0200
| From | Richard Hector <richard@walnut.gen.nz> |
|---|---|
| Date | 2020-07-19 11:30 +0200 |
| Subject | systemd and non-existent service instances |
| Message-ID | <AudNT-4wI-3@gated-at.bofh.it> |
Hi all, I'm running into a problem with systemd and my openvpn instances. To start a vpn, I run 'systemctl start openvpn-client@foo_host2' or similar. That has to be an underscore, because as far as I can see, using a hyphen/dash will break the instance mechanism. Of course, the actual hostname has to have a hyphen, because you can't have an underscore in the DNS. This means I will inevitably end up typing 'systemctl start openvpn-client@foo-host2' by mistake. When that happens, it appears that systemd will try to start it, and fail because foo-host2.conf doesn't exist - and try for ever. Showing the status of foo_host2 works fine, of course, so I don't notice until I look at the logs. Is this an inherent part of how systemd works, or is there a way to make it return an error message, rather than silently trying the impossible? Thanks, Richard
[toc] | [next] | [standalone]
| From | Andrei POPESCU <andreimpopescu@gmail.com> |
|---|---|
| Date | 2020-07-19 12:00 +0200 |
| Message-ID | <AuegW-4HM-1@gated-at.bofh.it> |
| In reply to | #224960 |
[Multipart message — attachments visible in raw view] — view raw
On Du, 19 iul 20, 21:10:40, Richard Hector wrote: > Hi all, > > I'm running into a problem with systemd and my openvpn instances. > > To start a vpn, I run 'systemctl start openvpn-client@foo_host2' or > similar. That has to be an underscore, because as far as I can see, > using a hyphen/dash will break the instance mechanism. Of course, the > actual hostname has to have a hyphen, because you can't have an > underscore in the DNS. > > This means I will inevitably end up typing 'systemctl start > openvpn-client@foo-host2' by mistake. > > When that happens, it appears that systemd will try to start it, and > fail because foo-host2.conf doesn't exist - and try for ever. Showing > the status of foo_host2 works fine, of course, so I don't notice until I > look at the logs. > > Is this an inherent part of how systemd works, or is there a way to make > it return an error message, rather than silently trying the impossible? Without checking if this is even possible, try 'mask'ing the inexistent instances. Kind regards, Andrei -- http://wiki.debian.org/FAQsFromDebianUser
[toc] | [prev] | [next] | [standalone]
| From | Richard Hector <richard@walnut.gen.nz> |
|---|---|
| Date | 2020-07-19 12:40 +0200 |
| Message-ID | <AueTD-59N-5@gated-at.bofh.it> |
| In reply to | #224961 |
On 19/07/20 9:34 pm, Andrei POPESCU wrote: > On Du, 19 iul 20, 21:10:40, Richard Hector wrote: >> Hi all, >> >> I'm running into a problem with systemd and my openvpn instances. >> >> To start a vpn, I run 'systemctl start openvpn-client@foo_host2' or >> similar. That has to be an underscore, because as far as I can see, >> using a hyphen/dash will break the instance mechanism. Of course, the >> actual hostname has to have a hyphen, because you can't have an >> underscore in the DNS. >> >> This means I will inevitably end up typing 'systemctl start >> openvpn-client@foo-host2' by mistake. >> >> When that happens, it appears that systemd will try to start it, and >> fail because foo-host2.conf doesn't exist - and try for ever. Showing >> the status of foo_host2 works fine, of course, so I don't notice until I >> look at the logs. >> >> Is this an inherent part of how systemd works, or is there a way to make >> it return an error message, rather than silently trying the impossible? > > Without checking if this is even possible, try 'mask'ing the inexistent > instances. Hmm. I know I gave an example of a specific typo, but in the general case there are rather a lot of non-existent possiblities :-) Still, I might investigate this if there aren't better options. Thanks, Richard
[toc] | [prev] | [next] | [standalone]
| From | Richard Hector <richard@walnut.gen.nz> |
|---|---|
| Date | 2020-07-19 12:50 +0200 |
| Message-ID | <Auf3k-5dk-23@gated-at.bofh.it> |
| In reply to | #224960 |
On 19/07/20 9:46 pm, Darac Marjal wrote: > > On 19/07/2020 10:10, Richard Hector wrote: >> Hi all, >> >> I'm running into a problem with systemd and my openvpn instances. >> >> To start a vpn, I run 'systemctl start openvpn-client@foo_host2' or >> similar. That has to be an underscore, because as far as I can see, >> using a hyphen/dash will break the instance mechanism. Of course, the >> actual hostname has to have a hyphen, because you can't have an >> underscore in the DNS. >> >> This means I will inevitably end up typing 'systemctl start >> openvpn-client@foo-host2' by mistake. >> >> When that happens, it appears that systemd will try to start it, and >> fail because foo-host2.conf doesn't exist - and try for ever. Showing >> the status of foo_host2 works fine, of course, so I don't notice until I >> look at the logs. >> >> Is this an inherent part of how systemd works, or is there a way to make >> it return an error message, rather than silently trying the impossible? >> >> Thanks, >> Richard >> > Systemd acknowledges that the string you might want to put in an > instance name isn't always a good string to put in a filename, so it > uses an escaping mechanism detailed at > https://www.freedesktop.org/software/systemd/man/systemd.unit.html#String > Escaping for Inclusion in Unit Names I think I've read that before, yes. But I think instance names might follow slightly different rules from unit names? I don't remember the details; I just remember having problems when I tried to use a hyphen in the instance name (config file name). > Additionally, if you find yourself typing a dash instead of an > underscore, consider training yourself to take advantage of your shell's > completion functions. "systemctl start openvpn-client@foo<tab>" (where > "<tab>" represents pressing the tab key) should complete the string for > you. If there are multiple completions possible, a single tab will not > add any more characters to the command but two tabs in quick succession > will display further possibilities. Generally, you can navigate these > with cursor keys for a rudimentary menu. I do use tab completion extensively (for simple stuff, anyway), but it hasn't been reliable for me for systemd units - perhaps I need to add something for that. When I tried it just now, it wouldn't tab complete anything before the @ sign, and after that, it completed to hostnames - which are the strings I'm trying to avoid :-) Cheers, Richard
[toc] | [prev] | [standalone]
Back to top | Article view | linux.debian.user
csiph-web