LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-13-2020, 02:43 AM   #1
rhysers
LQ Newbie
 
Registered: Apr 2019
Distribution: Ubuntu
Posts: 12

Rep: Reputation: Disabled
Question Making changes to mariadb.service the right way


Hi,
So long story short, due to issues with running a debian container in LXC, i have to make some changes to the config file to make it run. Now, that's not so bad, but every time it updates, my changes get overwritten (yesterday) and lo and behold, when I was putting them back in today, I noticed the following at the top of the file:
Code:
# It's not recommended to modify this file in-place, because it will be
# overwritten during package upgrades.  If you want to customize, the
# best way is to create a file "/etc/systemd/system/mariadb.service",
# containing
#       .include /usr/lib/systemd/system/mariadb.service
#       ...make your changes here...
# or create a file "/etc/systemd/system/mariadb.service.d/foo.conf",
# which doesn't need to include ".include" call and which will be parsed
# after the file mariadb.service itself is parsed.
#
# For more info about custom unit files, see systemd.unit(5) or
# https://mariadb.com/kb/en/mariadb/systemd/
So my question is how do i format the changes i need into a /usr/lib/systemd/system/mariadb.service file?
I checked the website but found no specifics and I opened the man page, but quickly became overwhelemed.
The changes I need are these:
Code:
[Service]
ProtectHome=false
ProtectSystem=false
PrivateTmp=false
PrivateNetwork=false
PrivateDevices=false
What does the file I need to make need to look like, and do I just add the line .include /usr/lib/systemd/system/mariadb.service to the orig. config file? What keeps the exact same update that wiped out my other changes from wiping out the .include statement?

Thanks,
Rhys
 
Old 08-13-2020, 04:25 AM   #2
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
I am probably confused what your question is. At first, it seems that you want to know how to make a systemd unit file immune against updates. The answer is, copy that unit file to /etc/systemd, make the changes there and run systemctl daemon-reload (or just reboot). But then you ask:

Quote:
Originally Posted by rhysers View Post
So my question is how do i format the changes i need into a /usr/lib/systemd/system/mariadb.service file?
and
Quote:
The changes I need are these:
Code:
[Service]
ProtectHome=false
ProtectSystem=false
PrivateTmp=false
PrivateNetwork=false
PrivateDevices=false
Hmm. I would just add these lines to the [service] section of the mariadb unit file.
Quote:
do I just add the line .include /usr/lib/systemd/system/mariadb.service to the orig. config file? What keeps the exact same update that wiped out my other changes from wiping out the .include statement?
To be honest, I know nothing about an include statement. However, /usr/lib/systemd/system/mariadb.service is the original systemd unit file, and if you want to include it somewhere, it would be in your copy of the unit file under /etc/systemd.

What I would do: Copy the original mariadb.service to /etc/systemd/system, add the above lines under the [Service] section, and you are done. The next update will overwrite /usr/lib/systemd, but not /etc/systemd.
 
  


Reply

Tags
systemd


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] MariaDB version 10.5.4 changes teoberi Slackware 8 06-29-2020 05:59 AM
LXer: KDE Participating in Google Summer of Code 2019, MariaDB Releasing New Open-Source MariaDB Enterprise Server, CentOS Celebrates 15th B LXer Syndicated Linux News 0 02-28-2019 06:50 AM
[SOLVED] MariaDB backing up databases the right way lpallard Linux - Server 4 07-07-2018 01:12 PM
LXer: Technology Changes Us, Changes Society, and Changes Governments LXer Syndicated Linux News 0 10-10-2016 02:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:49 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration