You are not logged in.

#1 2013-08-19 01:19:22

bleomycin
Member
Registered: 2012-10-23
Posts: 20

Stop updates from overwriting .service files?

I've looked for some time and can't seem to find the answer. Every time lirc is updated with pacman it overwrites my custom lirc.service file, the only search result i've found mentions using NoUpgrade with pacman but that was from 2010 and doesn't seem to be in the pacman man file any longer?

Offline

#2 2013-08-19 01:22:52

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: Stop updates from overwriting .service files?

https://wiki.archlinux.org/index.php/Sy … vice_files

A unit file in /etc/systemd/system/ always overrides the same unit in /usr/lib/systemd/system/. Note that when the original unit in /usr/lib/ is changed due to a package upgrade, these changes will not automatically apply to your custom unit file in /etc/.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2013-08-19 01:23:14

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,173

Re: Stop updates from overwriting .service files?

Where are you creating it?

You want to put customised systemd units in /etc/systemd/system e.g. copy /usr/lib/systemd/system/lirc.service to /etc/systemd/system/lirc.service and edit the copy. Or you can add an override file by creating /etc/systemd/system/lirc.service.d/myconfig.conf which can just tweak the particular bits you want to tweak (at least in theory - it hasn't worked great for me so far).


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#4 2013-08-19 01:33:46

bleomycin
Member
Registered: 2012-10-23
Posts: 20

Re: Stop updates from overwriting .service files?

Thanks for the replies. I wasn't aware I should not be editing the original /usr/lib/systemd/system/lirc.service file, i'll switch to your method cfr.

Offline

#5 2013-08-19 01:35:07

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: Stop updates from overwriting .service files?

Drop-in replacements work great for me.  What is nice about them is that you can actually replace a given configuration option.  This is done by first setting the value blank and then putting what you want.  So for example, if you wanted to change the ExecStart line, you would do:

[Service]
ExecStart=
ExecStart=/new/value/here ---with-args ---and-stuff 

Offline

#6 2013-08-19 02:05:50

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,173

Re: Stop updates from overwriting .service files?

Thank you! That's what I needed to get it to accept my conf tweak for cronie - it wouldn't accept a second ExecStart line and it wasn't clear how to override it. I remembered something vaguely but I couldn't find anything easily when I searched. (Is there documentation on this?)

Also, how would you use this to adapt a particular instance of a template? I actually tried this and I have now managed to mess up the getty on tty even though I thought I'd backed out all my changes. So I'm a bit wary.

I tried creating

# getty@.service.d/TTYVTDisallocate-BLOCK.conf 
[Service]
TTYVTDisallocate=no

but it did not work quite as expected. Trying to change it back, I removed this directory etc. but tty1 is still allocated, I think (I can still log in there) and I have no idea why.

I'm actually really not clear how the getty service affects only tty1 anyway except that it seems that tty2-6 are created with generators rather than with this service so it effectively only applies to tty1.

Last edited by cfr (2013-08-19 02:07:42)


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#7 2013-08-19 02:38:23

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: Stop updates from overwriting .service files?

When the gnerators are involved, I really have no idea how it is supposed to work.  There is no real documentation on this that i have been able to find.  So I cannot really give a definitive answer.  I *think* that you should be able to apply things globally in the way you show above.  That is if you use whatever@.service.d.  But I know that you can definitely make it a per instance thing with whatever@instance.service.d.  But again, I have no idea how this will act with the autogeneration services such as getty@.

Offline

#8 2013-08-19 02:58:37

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,173

Re: Stop updates from overwriting .service files?

Now I'm more confused. I didn't think getty@ was a generator. I thought it was called by a generator...


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

Board footer

Powered by FluxBB