[SOLVED] systemd: create a service file that loads a kernel module

Hi, I have a daemon that I want to convert to a service unit of systemd.
The daemon tests if a module is loaded, and if not, modprobes it.
I do not want to load that module at boot up, only if the service is launched.
Is there a "proper" way to add something like RequiredModule=xxx to a service unit?
Thanks!
Last edited by Wasser (2012-09-03 08:58:02)

Maybe simply run modprobe with ExecStartPre. The command succeeds even if the module was already loaded.

Similar Messages

  • [SOLVED]Create .service file to load powertop settings at startup.

    Hi I installed powertop and ran it
    sudo powertop -html
    and the recommendations I got, i pasted them in a file, and saved it as startup.sh, and made it executable.
    Now with init, i could write it in /etc/rc.local so that it would be called automatically at startup, but with systemd,
    I think one would need to create a systemd service file which could be enabled for startup,and would call the startup.sh file.
    Can anyone help with creating the .service file, or alternatively, suggest a simpler method for loading powertop's reccomendations at startup? Thanks!
    Last edited by aaditya (2013-09-04 18:29:53)

    Really, this should be done with the tools that are inherently in the system.  So it should be achieved with module options, udev rules, sysctl.d/sysctl.conf, and in some cases, tmpfiles.d.
    See this wiki page to get an idea of how to get this stuff going.
    You can use some kind of rc.local service if you want.  But it is probably moer appropriate to have these things load only if necessary.  For example, if there is a power saving option for my ethernet card, but I choose to only load the module when I need it (therefore blacklist it) in order to really save power, it would be silly to have a script that tries to write values to a directory in /sys/class/net that doesn't exist.
    Alternatively, you could use something like laptop-mode-tools, which allows one to have these settings turned on or off depending on the A/C state of the machine. But I really think that with machines these days, there is really not much of a difference whether these power saving functions are on or off, in terms of an average users computing experience.

  • [Solved] Make systemctl find .service file in /usr/lib/systemd/user?

    I thought this had always worked, but it seems that systemctl cannot see `.service` files that are in my `/usr/lib/systemd/user` folder and I can't figure out why:
    $ locate redshift-gtk.service
    /usr/lib/systemd/user/redshift-gtk.service
    $ systemctl status redshift-gtk
    ● redshift-gtk.service
    Loaded: not-found (Reason: No such file or directory)
    Active: inactive (dead)
    I have already looked at https://wiki.archlinux.org/index.php/Systemd/User which seems to tell me to check sytemctl --user status but that appears to be loaded and working fine, I have a feeling I'm missing something obvious but can't figure out what it is. How do I make systemctl include this directory?
    $ systemctl --user status
    ● michael-work
    State: running
    Jobs: 0 queued
    Failed: 0 units
    Since: Tue 2014-08-05 11:24:32 BST; 11min ago
    CGroup: /user.slice/user-1000.slice/[email protected]
    ├─730 /usr/lib/systemd/systemd --user
    └─731 (sd-pam)
    Any ideas?
    Last edited by crashandburn4 (2014-08-05 11:09:45)

    systemctl --user status redshift-gtk.service

  • ITS 620 - how to create a service file for SAPGUI for HTML option

    Hi,
    We have the following configuration :
    ITS 620 installed
    IIS webserver
    NTLM Authentication on webserver
    SAP 46C
    We have some reports that use the IACs option of creating ITS reports and we are able to create the service files using webstudio where we can save a service id and password so that when the ITS page is called, it logs on the user directly into the system.
    Now, we are trying to create a new ITS page for a custom Z transaction and would like to use the SAPGUI for HTML option so that we do not have to use Webstudio to create and modify the HTML pages.
    When I call the ITS page for the new transaction, it brings up the logon screen for the user, which we want to avoid. If I create a new service file for this Z transaction without any HTML pages then I get an error.
    Is there a way to copy the WEBGUI.SRVC file to a custome SRVC file, I tried to create to copy it to a test file called ZTEST.SRVC for my test transaction called ZTEST and now I get an error.
    thanks in advance
    N.S.

    Hello N.S.
    You can create a service file, like ZSERVICE.SRVC.  The parameters should be:
    ~webgui 1
    ~transaction ztransaction
    ~client  001
    ~login   username
    ~password  password
    ~language  EN
    The "~webgui 1" allows the ITS to use the Webgui to dynamically generate the page (no IAC needed.)
    The "~transaction" is the transaction code of your service.
    The "~client" is the client number.
    The "~login" is the username.
    The "~password" is the user's password.
    the "~language" is the language for the users.
    Note that the last four are required for automatic logon.  If end users use a variety of languages though the ~language can be prepended to the URL to support different languages.  (Leave it blank in the srvc file then.)
    Edgar

  • How do I create a .llb file that holds all the subVIs used in a VI?

    Hi
    I wish to create a .llb file that holds all the subVIs(~200) used in my main VI.
    When I open my main VI, and look into the 'show VI hierarchy' I see a lot of subVIs, so to copy all these subVIs into the library file is going to be really time consuming. I am hoping there is an option in Labview by which I could automatically put all these subVIs into one library file?
    Thank you
    Gautham Radhakrishnan
    Dept. Of Physics
    University of Toronto

    In your toplevel VI, go to "File..save with options".
    Now select "Development distribution", press save, and give it a name for the llb.
    LabVIEW Champion . Do more with less code and in less time .

  • Okay, so I try to download and every time it says "There was an error creating a temporary file that is needed to complete the installation".   Anyone know how to fix this?

    Okay, so I try to download and every time it says "There was an error creating a temporary file that is needed to complete the installation".
    Anyone know how to fix this?
    Please help. I can't get it to work. I've tried uninstalling and it says the same thing. Is there anyway anyone can help me?

    HELP!!!! PLEASE!!!!!

  • How do I create a pdf file that is 300 dpi in Adobe Acrobat XI?

    How do I create a pdf file that is 300 dpi in Adobe Acrobat XI?

    PDF files do not have a "resolution" - they aren't images. The pages are a mix of vector art and text, and raster (pixel-based) graphics. The raster items on a page can (and often do) have different resolutions.

  • How do I create a .llb file that includes only the subVIs used in a VI?

    hi....
    can anybody help me ...i wanna creat a library file that holds only the sub-VIs that are running in particular main VI .
    are there options for that in labview??

    I don't think understand the answer. From just the top level VI, do like I said and an llb will be created with the top level and all subVIs. You can also edit the llb (Tools>Edit VI Library) and make your main VI top level. A note of caution. An llb was originally designed as a means of storing VIs with extended names. With modern OS's allowing long file names, an llb is less useful except as a convenient means of distributing a group of VIs from one location to another. This would be done as a final distribution such as an instrument driver or to another developer who would then convert the llb to a folder. There are several problems with keeping the development VIs in an llb. One is that it doesn't work with any form of source code cont
    rol. Another is that a corrupt VI in an llb can and has made the entire llb unreadable so unless you are absolutely religous about backups, you made find yourself in deep trouble some day.

  • I am having trouble bouncing and creating an aiff file that plays back. I've checked my output settings, and although I am able to create MP3s, the aiffs are blank. The happens when I try to export a track as an aiff file - it's blank.

    I am having trouble bouncing and creating an aiff file that plays back. I've checked my output settings which appear to be correct. Although I am able to create MP3s, the aiffs are blank. The happens when I try to export a track as an aiff file - it's blank.

    When bouncing, do you use the Key Command or the button on the Output Channel Strip? The Key Command only bounces from the Stereo Output. The bounce button bounces from the Channel Strip it is on. So if you want to bounce out outputs 3-4 or higher, don't use the key command, but the button.
    The strange thing here is that Logic, when it bounces an MP3, first bounces an AIFF, which at the end of the bounce process is being converted to MP3, so I can't imagine how you can get a silent AIFF and a normal MP3.
    How have you listened to those bounces? iTunes? Quicklook? Quicktime?

  • How do I  create a pdf file that is only part of an existing pdf file??

    How do I  create a pdf file that is only part of an existing pdf file??

    Use Adobe Acrobat. ExportPDF does not do this, or claim to do this.

  • Create a batch file that will loop a copy command that will call it as a task from another application

    I've created a script to copy large files from one system to another system. Unfortunately the transaction language of that system isn't feature rich, so I can't code a loop to copy multiple files to move concurrently. My goal is to create a batch file that
    will do the loop of copying multiple files, after being called by the application that is copying the large files one at a time. Can I get some pointer on how to do this? Basically, the code is like this:
    Copy from  \\Server_1\directory\sent_file.xyz
    To   \\Server_2\Directory\received_file.abc
    So the purpose is to perform the successful copy, then if the copy is good, execute the loop until completed.

    Might look around here.
    http://gallery.technet.microsoft.com/scriptcenter/site/search?f%5B0%5D.Type=RootCategory&f%5B0%5D.Value=storage&f%5B0%5D.Text=Storage
    Or ask over here.
    MSDN Scripting forum
    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows]
    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees , and confers no rights.

  • Unable to load the kernel module 'nvidia.ko' [SOLVED]

    After my most recent kernel upgrade, I can't get my GUI to run. I've tried reinstalling the nvidia driver to no avail.
    Any insight would be greatly appreciated. I'm using a GeForce 8400 GS
    cat /var/log/nvidia-installer.log
    ERROR: Unable to load the kernel module 'nvidia.ko'. This happens most
    frequently when this kernel module was built against the wrong or
    improperly configured kernel sources, with a version of gcc that differs
    from the one used to build the target kernel, or if a driver such as
    rivafb/nvidiafb is present and prevents the NVIDIA kernel module from
    obtaining ownership of the NVIDIA graphics device(s), or NVIDIA GPU
    installed in this system is not supported by this NVIDIA Linux graphics
    driver release.
    Please see the log entries 'Kernel module load error' and 'Kernel
    messages' at the end of the file '/var/log/nvidia-installer.log' for
    more information.
    -> Kernel module load error: insmod: error inserting './usr/src/nv/nvidia.ko':
    -1 No such device
    -> Kernel messages:
    NVRM: This can occur when a driver such as nouveau, rivafb,
    NVRM: nvidiafb, or rivatv was loaded and obtained ownership of
    NVRM: the NVIDIA device(s).
    NVRM: Try unloading the conflicting kernel module (and/or
    NVRM: reconfigure your kernel without the conflicting
    NVRM: driver(s)), then try loading the NVIDIA kernel module
    NVRM: again.
    NVRM: No NVIDIA graphics adapter probed!
    NVRM: The NVIDIA probe routine was not called for 1 device(s).
    NVRM: This can occur when a driver such as nouveau, rivafb,
    NVRM: nvidiafb, or rivatv was loaded and obtained ownership of
    NVRM: the NVIDIA device(s).
    NVRM: Try unloading the conflicting kernel module (and/or
    NVRM: reconfigure your kernel without the conflicting
    NVRM: driver(s)), then try loading the NVIDIA kernel module
    NVRM: again.
    NVRM: No NVIDIA graphics adapter probed!
    NVRM: The NVIDIA probe routine was not called for 1 device(s).
    NVRM: This can occur when a driver such as rivafb, nvidiafb or
    NVRM: rivatv was loaded and obtained ownership of the NVIDIA
    NVRM: device(s).
    NVRM: Try unloading the rivafb, nvidiafb or rivatv kernel module
    NVRM: (and/or reconfigure your kernel without rivafb/nvidiafb
    NVRM: support), then try loading the NVIDIA kernel module again.
    NVRM: No NVIDIA graphics adapter probed!
    ERROR: Installation has failed. Please see the file
    '/var/log/nvidia-installer.log' for details. You may find suggestions
    on fixing installation problems in the README available on the Linux
    driver download page at www.nvidia.com.
    Last edited by wsims (2010-06-22 15:06:04)

    if you used the packages from repos, the blacklist is done automatically in nvidia,
    $ pacman -Qo /etc/modprobe.d/nouveau_blacklist.conf
    /etc/modprobe.d/nouveau_blacklist.conf is owned by nvidia 195.36.31-1
    $ cat /etc/modprobe.d/nouveau_blacklist.conf
    blacklist nouveau
    but i guess you just want to mess your system by using unsupported and very bad ways and you are way smarter than the devs if you used that installer
    Last edited by wonder (2010-06-22 14:10:01)

  • Failed to load nvidia kernel module

    When I try to start x it outputs the following error
    Failed to load nvidia kernel module
    I'm trying to use the new nvidia-beta drivers from AUR but the same error occurs with ordinary nvidia drivers and the nv drivers. Under xorg.conf I currently have 'nvidia' next to driver and I've also put nvidia in the modules section of rc.conf
    when I try to modprobe nvidia is just outputs 'module nvidia not found'

    Ended up booting into gnome using the vesa driver (max resolution was 800x600) and downloading the new nvidia beta setup from the nvidia website then going back into terminal and running it. Just had to download make from pacman and it compiled a new nvidia kernel module for me it seems. All works well with the new driver now.
    Thanks.

  • Systemd - help with creating a service file

    Hi, I am trying to make a service file to execute "devmon --no-mount --exec-on-audio abcde". Basicly I want abcde to run when an audio cd is inserted into a headless computer. I have tried some udev rules but had no luck with that.
    I then found udevil and devmon, and it seems to do exectly what I want.
    So Ive made a systemd service file and put it in to /usr/lib/systemd/system
    here is it:
    /usr/lib/systemd/system/abcde-auto.service
    [Unit]
    Description=Virtual Distributed Ethernet
    [Service]
    Type=simple
    ExecStart=/usr/bin/devmon --no-mount --exec-on-audio abcde
    [Install]
    WantedBy=multi-user.target
    I have started this with
    systemctl start abcde-auto.service
    and I see that a devmon process has started with the same arguments I gave in the service file, so all is good.
    But now, I am not too sure about the "Type" in the service file, devmon starts abcde, but:
    systemctl stop abcde-auto.service
    does not stop abcde, only devmon.
    Is there a way to setup the service file so that abcde will end as well as devmon?
    *Edit
    Ive read this http://www.freedesktop.org/software/sys … rvice.html but Im still not too sure. Dont really know what most of it means.
    Last edited by jrussell (2012-10-20 18:09:23)

    I use type 'oneshot' and add an ExecStop= to start and stop scripts.
    Like here is the unit file I use to start and stop arno-iptables-firewall
    [Unit]
    Description=Arno iptables firewall
    [Service]
    Type=oneshot
    RemainAfterExit=yes
    ExecStart=/usr/sbin/arno-iptables-firewall start
    ExecStop=/usr/sbin/arno-iptables-firewall stop
    [Install]
    WantedBy=multi-user.target

  • Creating interactive swf files that contain flash files that don't play once loaded on server

    I am creating an interactive swf file that contains a  flash movie f4v file and when I preview the page in ID it plays, but once I export the InDesign file to swf, insert that on a html page using Dreamweaver (so I can send a link and not a file out) the movie doesn't play, just the first frame of the clip.  I have uploaded the f4v file to our server and linked in the original ID file and it still doesn't play.  Any suggestions or similar issues?

    I have left the page up for quite a while to see if it is just taking longer to load that clip and that doesn't seem to be it.  I am just stumped and honestly not knowledgable on how websites and servers work - just know how to get my documents up so I can send links.

Maybe you are looking for

  • HP LaserJet Pro 400 M401dn

    Good time of day. I have a problem with the printer. It should be the latest firmware of the printer. The printer goes into standby mode. Send a print job, the printer comes out of sleep mode. And for a long time thinking and prints. About page per m

  • Creation of OLAP Variable for Master data

    Dear BW Experts, How to Create OLAP Variable for Master data  in SAP BW? What is the use of OLAP Variable?

  • Png transparency issues in IE6

    I've had an absolutely lovely time today trying to make my header logo (a transparent .png) display correctly in IE6. I guess I might be better off giving up on it, but at this point I don't want to let go of it (plus I'd like the page to look better

  • Transform xml in column

    Hi, I wrote a Clr who returns an SqlXml object that i need to transform, here's the query and the result i have Select top 1 id_RefPdr, RefCln, Ncl, IT.dbo.Clr_NclSplitByMask(MasqeTri, Ncl, AM_R2.dbo.FN_NCL_NCLUNQPOS(Ncl)) From dbo.REFS_PDR Where Lib

  • Resizing at run time

    Hello, I am creating the mastermind game. at runtime user specifies the level of difficulty and ass per specified level number of columns to play with increases. So, number of components in the panels inside the frame increases. how do i change the s