[VPN] [GUIDE] Setting up nordvpn with systemd

Since I haven't seen specific guide to setting up nordvpn for archlinux with systemd, I thought I should write them up what I have done. This might be useful for those unfamiliar with systemd. Simply connecting with provided *.ovpn file do not update the DNS correctly and the command
sudo systemctl start [email protected] do not work.
1. Follow nordvpn's connecting with shell instruction at https://nordvpn.com/tutorials/linux/linux-openvpn/ and make sure you can manually connect by typing:
sudo openvpn vpn_at_nordvpn_tcp.ovpn
2. Create unit systemd for a server
sudo nano /etc/systemd/system/nordvpn.service
[Unit]
Description=OpenVPN connection to yourovpn.ovpn
[Service]
Type=forking
ExecStart=/usr/bin/openvpn --cd /etc/openvpn --config /etc/openvpn/yourovpn.ovpn --daemon [email protected] --writepid /run/[email protected]
PIDFile=/run/[email protected]
[Install]
WantedBy=multi-user.target
replace yourovpn with the desired server.
For whatever reason, the following modified /usr/lib/systemd/system/[email protected] do not work.
[Unit]
Description=OpenVPN connection to %i
[Service]
Type=forking
#ExecStart=/usr/bin/openvpn --cd /etc/openvpn --config /etc/openvpn/%i.conf --daemon openvpn@%i --writepid /run/openvpn@%i.pid
ExecStart=/usr/bin/openvpn --cd /etc/openvpn --config /etc/openvpn/%i.ovpn --daemon openvpn@%i --writepid /run/openvpn@%i.pid
PIDFile=/run/openvpn@%i.pid
[Install]
WantedBy=multi-user.target
3. The DNS was not updated. So use the guide from the wiki and add these to your .ovpn file
# auto update /etc/resolv.conf
script-security 2
up /etc/openvpn/update-resolv-conf.sh
down /etc/openvpn/update-resolv-conf.sh
the shell script is found at https://raw.githubusercontent.com/maste … lv-conf.sh
One issue I found is that you do not get that "Initialization Sequence Completed" to indicate a successful vpn connection. I had to either google my public ip address or type:
ip addr show | grep tun0
Any feedback or improvisations are appreciated.

Since I haven't seen specific guide to setting up nordvpn for archlinux with systemd, I thought I should write them up what I have done. This might be useful for those unfamiliar with systemd. Simply connecting with provided *.ovpn file do not update the DNS correctly and the command
sudo systemctl start [email protected] do not work.
1. Follow nordvpn's connecting with shell instruction at https://nordvpn.com/tutorials/linux/linux-openvpn/ and make sure you can manually connect by typing:
sudo openvpn vpn_at_nordvpn_tcp.ovpn
2. Create unit systemd for a server
sudo nano /etc/systemd/system/nordvpn.service
[Unit]
Description=OpenVPN connection to yourovpn.ovpn
[Service]
Type=forking
ExecStart=/usr/bin/openvpn --cd /etc/openvpn --config /etc/openvpn/yourovpn.ovpn --daemon [email protected] --writepid /run/[email protected]
PIDFile=/run/[email protected]
[Install]
WantedBy=multi-user.target
replace yourovpn with the desired server.
For whatever reason, the following modified /usr/lib/systemd/system/[email protected] do not work.
[Unit]
Description=OpenVPN connection to %i
[Service]
Type=forking
#ExecStart=/usr/bin/openvpn --cd /etc/openvpn --config /etc/openvpn/%i.conf --daemon openvpn@%i --writepid /run/openvpn@%i.pid
ExecStart=/usr/bin/openvpn --cd /etc/openvpn --config /etc/openvpn/%i.ovpn --daemon openvpn@%i --writepid /run/openvpn@%i.pid
PIDFile=/run/openvpn@%i.pid
[Install]
WantedBy=multi-user.target
3. The DNS was not updated. So use the guide from the wiki and add these to your .ovpn file
# auto update /etc/resolv.conf
script-security 2
up /etc/openvpn/update-resolv-conf.sh
down /etc/openvpn/update-resolv-conf.sh
the shell script is found at https://raw.githubusercontent.com/maste … lv-conf.sh
One issue I found is that you do not get that "Initialization Sequence Completed" to indicate a successful vpn connection. I had to either google my public ip address or type:
ip addr show | grep tun0
Any feedback or improvisations are appreciated.

Similar Messages

  • Unable to set up networking with systemd-networkd

    I'm trying to set up networking on a VPS I purchased.
    When I boot off the arch install image, the networking set up is configured via DHCP and everything seems to work perfectly.
    This is the configuration I see from the
    ip addr
    and
    ip route
    commands:
    http://i.imgur.com/yeLFO6x.png
    I proceeded to follow the instructions at the systemd-networkd page, and enabled the right services.
    I also created an ethernet.network file in the correct directory.
    You can see the contents of the file in the following screenshot, along with the ouput of some of the ip commands in the following screenshot.
    http://i.imgur.com/hJNIZrJ.png
    I'm unable to ping google, but somehow I'm able to curl successfully download the google.com page via curl.
    I've demonstrated this in the following screenshot. I cannot fathom how this is possible.
    http://i.imgur.com/YokAKog.png
    I'll be happy to provide any other information that could be useful, and would really appreciate some help getting to the bottom of this.
    Thanks a tonne.
    -- mod edit: read the Forum Etiquette and only post thumbnails http://wiki.archlinux.org/index.php/For … s_and_Code [jwr] --

    That subnet is not only odd - it should not work.
    A /32-subnet is perfect for localhost and the like. It basically means you can't reach any other IP than your own.
    Also the gateway from your provider's DHCP-server (first screenshot) ist very far away from your own IP. I'm too lazy to calculate, but in order to reach that gateway with that IP, the netmask would have to be between 16 and 8.
    In short: I can easily tell you why it wouldn't work - what I don't get is why it worked with curl in your setup or your provider's DHCP and/or what your provider did there.
    In any case: talk to your provider - they might be able to give you the correct addresses/masks and maybe shed some light (I'm really very curious).
    Last edited by PaterSiul (2015-04-19 18:40:57)

  • [Solved] Automating btrfs scrub with systemd

    I have a single disk laptop (no RAID) and would like to have btrfs scrub run automatically on some interval and to be automatically emailed if any errors are found.  (My data is backed up online and I can attempt a manual fix.)  I'm trying to set this up with systemd and the btrfs tools.  Here's what I figure I need:
    A systemd service to run btrfs scrub on my entire filesystem.
    A systemd timer to schedule this job weekly.
    systemd services to pause and resume a running btrfs scrub when the machine suspends and wakes up.
    A script to run btrfs status when the previous service has finished, parse the output for the number of errors, and email me if the number is greater than 0.
    A systemd service to run that script when the scrub service has completed.
    What I have so far is below.  I'm sure there are problems with it all, and I'm especially uncertain about #5, since I don't know if the After attribute of one service waits until another has completed or just started.  If anyone could take a look and give me some pointers I'd appreciate it very much.  (The python script is a hack but I'm more concerned with the systemd at the moment, unless you see obvious problems or improvements you'd like to suggest.)
    Attempt at 1 and 2:
    /etc/systemd/system/btrfs_scrub.service
    [Unit]
    Description=Run btrfs scrub on filesystem
    [Service]
    Type=forking
    ExecStart=btrfs scrub start /home
    /etc/systemd/system/btrfs_scrub.timer
    [Unit]
    Description=Weekly btrfs scrub
    [Timer]
    OnCalendar=weekly
    Persistent=true
    [Install]
    WantedBy=timers.target
    Attempt at 3:
    /etc/systemd/system/btrfs_cancel.service
    [Unit]
    Description=Pause a running btrfs scrub on suspend
    Before=suspend.target
    [Service]
    Type=oneshot
    ExecStart=btrfs scrub cancel /home
    [Install]
    WantedBy=suspend.target
    /etc/systemd/system/btrfs_resume.service
    [Unit]
    Description=Resume a paused btrfs scrub after suspend
    After=suspend.target
    [Service]
    Type=oneshot
    ExecStart=btrfs scrub resume /home
    [Install]
    WantedBy=suspend.target
    Attempt at 4:
    /home/username/Code/Scripts/btrfs_results.py
    #Runs btrfs scrub and looks for an indication of errors found, upon
    #which an email is sent.
    import subprocess
    import smtplib
    from email.mime.text import MIMEText
    def email_alert():
    text = "btrfs scrub found errors"
    addr = 'myemail@address'
    username = 'myusername'
    password = 'mypassword'
    msg = MIMEText(text)
    msg['Subject'] = 'btrfs errors'
    msg['From'] = addr
    msg['To'] = addr
    server = smtplib.SMTP('smtp.gmail.com', '587')
    server.starttls()
    server.login(username,password)
    server.sendmail(addr, addr, msg.as_string())
    server.quit()
    print('email sent')
    def main():
    cmd = ['btrfs', 'scrub', 'status', '/home']
    output = subprocess.check_output(cmd)
    output_str = output.decode("utf-8")
    output_words = output_str.split(' ')
    for w in range(0, len(output_words)):
    if output_words[w].find('error') > -1:
    if int(output_words[w - 1]) > 0:
    email_alert()
    main()
    Attempt at 5:
    /etc/systemd/system/btrfs_results.service
    [Unit]
    Description=Parse output from btrfs scrub
    Requires=btrfs_scrub.service
    After=btrfs_scrub.service
    [Service]
    Type=oneshot
    ExecStart=/usr/bin/python /home/username/Code/Scripts/btrfs_results.py
    [Install]
    WantedBy=multi-user.target
    Last edited by 0112358 (2014-09-16 01:26:21)

    0112358 wrote:I have a single disk laptop (no RAID) and would like to have btrfs scrub run automatically on some interval and to be automatically emailed if any errors are found.  (My data is backed up online and I can attempt a manual fix.)  I'm trying to set this up with systemd and the btrfs tools.  Here's what I figure I need:
    0112358 wrote:
    A systemd service to run btrfs scrub on my entire filesystem.
    A systemd timer to schedule this job weekly.
    Should not be hard.
    0112358 wrote:systemd services to pause and resume a running btrfs scrub when the machine suspends and wakes up.
    This happens automatically with s2disk. Am I missing something?
    0112358 wrote:A script to run btrfs status when the previous service has finished, parse the output for the number of errors, and email me if the number is greater than 0.
    You might want to integrate that in the main btrfs scrub script, just after scrub is completed you will run this. Right?
    0112358 wrote:A systemd service to run that script when the scrub service has completed.
    0112358 wrote: What I have so far is below.  I'm sure there are problems with it all, and I'm especially uncertain about #5, since I don't know if the After attribute of one service waits until another has completed or just started.  If anyone could take a look and give me some pointers I'd appreciate it very much.  (The python script is a hack but I'm more concerned with the systemd at the moment, unless you see obvious problems or improvements you'd like to suggest.)
    0112358 wrote:
    Attempt at 1 and 2:
    /etc/systemd/system/btrfs_scrub.service
    [Unit]
    Description=Run btrfs scrub on filesystem
    [Service]
    Type=forking
    ExecStart=btrfs scrub start /home
    /etc/systemd/system/btrfs_scrub.timer
    [Unit]
    Description=Weekly btrfs scrub
    [Timer]
    OnCalendar=weekly
    Persistent=true
    [Install]
    WantedBy=timers.target
    Yes, why not wrap this in some sort of main bash (or python) script.
    0112358 wrote:
    Attempt at 3:
    /etc/systemd/system/btrfs_cancel.service
    [Unit]
    Description=Pause a running btrfs scrub on suspend
    Before=suspend.target
    [Service]
    Type=oneshot
    ExecStart=btrfs scrub cancel /home
    [Install]
    WantedBy=suspend.target
    /etc/systemd/system/btrfs_resume.service
    [Unit]
    Description=Resume a paused btrfs scrub after suspend
    After=suspend.target
    [Service]
    Type=oneshot
    ExecStart=btrfs scrub resume /home
    [Install]
    WantedBy=suspend.target
    Why not do nothing at all? Just let the fs continue after resume. Or is s2disk cancelling this process?
    0112358 wrote:
    Attempt at 4:
    /home/username/Code/Scripts/btrfs_results.py
    #Runs btrfs scrub and looks for an indication of errors found, upon
    #which an email is sent.
    import subprocess
    import smtplib
    from email.mime.text import MIMEText
    def email_alert():
    text = "btrfs scrub found errors"
    addr = 'myemail@address'
    username = 'myusername'
    password = 'mypassword'
    msg = MIMEText(text)
    msg['Subject'] = 'btrfs errors'
    msg['From'] = addr
    msg['To'] = addr
    server = smtplib.SMTP('smtp.gmail.com', '587')
    server.starttls()
    server.login(username,password)
    server.sendmail(addr, addr, msg.as_string())
    server.quit()
    print('email sent')
    def main():
    cmd = ['btrfs', 'scrub', 'status', '/home']
    output = subprocess.check_output(cmd)
    output_str = output.decode("utf-8")
    output_words = output_str.split(' ')
    for w in range(0, len(output_words)):
    if output_words[w].find('error') > -1:
    if int(output_words[w - 1]) > 0:
    email_alert()
    main()
    Ok
    0112358 wrote:
    Attempt at 5:
    /etc/systemd/system/btrfs_results.service
    [Unit]
    Description=Parse output from btrfs scrub
    Requires=btrfs_scrub.service
    After=btrfs_scrub.service
    [Service]
    Type=oneshot
    ExecStart=/usr/bin/python /home/username/Code/Scripts/btrfs_results.py
    [Install]
    WantedBy=multi-user.target
    Yeah, why not wrap 1,2,4 and 5 into one script/service. Why the fine granularity?

  • [solved] Setting up a "persistent" ramdisk with systemd

    I have been doing much thinking in terms of using a ramdisk (tmpfs) to mitigate, or rather postpone SSD write limit issues as well as to enhance system performance. After following the steps described in the Ramdisk wiki page to no avail, I realized I have a systemd setup. I have also found another topic describing how to "hack" init scripts into the systemd build but I am not sure this is the "right" (or most elegant) way. Essentially I would like to move/copy several folders to a ramdisk and have its contents written back to disk after system suspend/shutdown. Just general guidelines would suffice!
    (1) How should I go about setting up a "persistent" ramdisk with systemd? How would I setup "before" and "after" hooks?
    (2) From what I have gathered so far, it appears that for the above, using rsync rather than cp would be a more efficient way to write ramdisk contents to disk. Is this true?
    (3) The example described in the Ramdisk wiki page loads pacman cache and lib into a ramdisk. How about completely putting /var to a ramdisk?
    (4) Will doing what I have described above (including /var) possibly leave my system in an inconsistent state?
    I am trying to get this running on a computer with 8 GB of RAM on which memory usage rarely goes above 2 GB. I am not too worried about power failures as what I intend to put on the ramdisk is not mission critical (with the possible exception of /var).
    I apologize in advance if I posted my concerns in the wrong subforum as I am both a Linux rookie and an Arch noob; I have also tried using the search function but I may have formulated my query improperly (the answers seemed irrelevant!) Thanks in advance for your time and please let me know if I have omitted important details.
    Last edited by ndejay (2012-10-31 13:50:02)

    #create 'ramdisksave' directory using terminal
    mkdir /home/ramdisksave
    #edit grub config or custom_40. This allocates max ram for ramdisks
    kernel /vmlinuz ramdisk_size=2048000
    #edit rc.local add these lines to create & mount ramdisk at boot
    mke2fs -t ext2 /dev/ram1 2048000
    mount /dev/ram1 /home/ramdisksave
    #copies 'ramdisksave' contents to ramdisk save as *.sh make exe!
    cp -a /home/ramdisksave/.  /mnt/ram1
    #saves ramdisk contents to ramdisksave folder save as *.sh make exe!
    cp -a /mnt/ram1/.  /home/ramdisksave/
    #deletes ramdisk contents save as *.sh make exe!
    cd /mnt && rm -rf ram1/*
    #deletes ramdisksave contents save as *.sh make exe! DANGEROUS!!
    cd /home && rm -rf ramdisksave/*
    for safety better to create ramdisksave on another partition.  Scripts can be crontabbed, can add tar compression options to save space, use rsync to copy only  new etc etc.......script lines can be added to r.sysinit for startup and rc.shutdown for load and save at startup and shutdown.
    Last edited by st.emsee (2013-06-22 11:23:44)

  • Help with systemd problems/reply to closed thread

    @Everyone; as the previopus topic was closed, I am opening a new one here, partly to reply to some things that was said to me in the previous thread/topic (and I do not like to leave people hanging), but mainly to try and get some help with my systemd config (that I was not able to find help with in the wiki or manpages).
    @czubek; eww, that sounds rather similiar to some other operating systems I've heard of (not just, but obviously including, windows)... For me, subjectively, that is not very attractive, as being able to have a single application do a single thing, and then mixing and matching as I personally see fit is a great thing.
    @tomegun: I can indeed see your point, but if I made direct quotes on all the things I reply too, my posts would reach biblical proportions.
    Mmm-hmm, I do indeed know of "the Arch Way"; however, the system that you expose can be of varying complexity as well, and I found that the system that was presented to me by way of Sysvinit/initscripts was a way simpler system than that presented to me by systemd.
    Indeed, and I do like that; I enjoy knowing how my system works and learning more about it; however, the truth is that reading manpages and the wiki isn't always enough. And I use the numbers instead of letters in certain places as a jest, please, do not get offended by that; if you have to, get offended by my opinions.
    Ah, I have now scanned the wiki, the manpages, and have already faced problems. While part of me is saddened by this fact (as I was hoping for a smooth transition to systemd), part of me is glad that I can at least prove that everything isn't quite as simple as some people would make it out to be. More on this later in this post, as I do need help with the problems I have faced.
    And I wouldn't say that the new and old way are equally trivial, as I immediatley faced problems with "the new way". More on this later.
    Ok, I find that if the debate is polarized, then there is nothing wrong with describing it as such. I spell what I see.
    Oh my... Ignored as a matter of principle? I would say that that is an excellent way to stagnate; by that logic, moviemakers, gamemakers etcetera should ignore any and all criticism they recieve, as the critics are not contributing.... Wouldn't that lead to a complete halt in development? Isn't criticism (so long as it is constructive, obviously) a key component of (media/software) evolution?
    Ah, I see, then I  misunderstood the current state of the install media
    "Some adjustements"... Well, I guess we'll have to see how that goes, then. Hopefully it'll be smooth.
    @Everyone; Awebb possesses stunning accuracy as far as his observations go.
    @zb3; My point exactly.
    @tomegun; I believe you to be wrong; complaining (but not whining) is the first step towards improvement, as I think that I and zb3 has shown.
    Further, your last point (where you talk about "deep understanding of Y" and whatnot) is basically saying that only devs and programmers can contribute, so zb3's observation would be correct.
    Also, making suggestions is part of constructive criticism; you can do that even if you can't code, e.g. by saying "X works badly because it makes Y crash; couldn't we replace X with something akin to Z?". This is a valid point even if you have no intricate understanding of X, Y or Z, and if it is impossible to replace X for one reason or the other, it's not hard to reply with "Replacing X is impossible because of reason Q", and then see if someone can solve reason Q etcetera.
    zb3's example is obviously helping; for one, it would allow people to know taht they can't boot with systemd in certain cases, or that installing/runing systemd can break their system. I would consider that rather important information.
    @Everyone; Now then, to see if I can (or rather, if I can get help to) shed some light on some problems I've been having.
    My transition to systemd went pretty smooth (besides the fact that I couldn't use 'systemctl' to set anything, and neither duckduckgo nor any posts in the forums could help me (the error I continously got was "Failed to issue method call: Launch helper exited with unknown return code 1") and that there are no manpages/tips on how to configure the files for "localtime" and "adjtime", which would've been good considering some syntax have changed) to about halfway through, to the point where I was supposed to start using systemd for my daemons.
    Now then, to the main problem; first, I tried running
    "systemctl enable syslog-ng.service"
    and got the following message;
    "ln -s '/usr/lib/systemd/system/syslog-ng.service' '/etc/systemd/system/syslog.service'
    ln -s '/usr/lib/systemd/system/syslog-ng.service' '/etc/systemd/system/multi-user.target.wants/syslog-ng.service'"
    Since it doesn't exclusively say that something went wrong (at least as far as I can understand), I pondered the message a bit, but moved on to try and start dbus by issuing
    "systemctl enable dbus.service",
    to which I got the reply
    "The unit files have no [Install] section. They are not meant to be enabled using systemctl."
    This I can only assume is an error message of some sort, especially seeing as it says "not meant to be enabled using systemctl", but the wiki rather explicitly states that that is what I am supposed to do.
    I dare not move on (or attempt to start other daemons) without further advice, as I fear I might break my system. Any ideas as to how to solve this would be greatly appreciated.

    tcmdvm wrote:
    The message;
    "ln -s '/usr/lib/systemd/system/syslog-ng.service' '/etc/systemd/system/syslog.service'
    ln -s '/usr/lib/systemd/system/syslog-ng.service' '/etc/systemd/system/multi-user.target.wants/syslog-ng.service'"
    indicates that running "systemctl enable syslog.service" is now enabled.
    If you try running sytemtctl enable <whatever>.service and get
    "The unit files have no [Install] section. They are not meant to be enabled using systemctl." means there is no <whatever>.service file available to enable.
    The dbus.service as far as I know is already enabled when installing systemd and doesn't require any action.
    Ah, right, systemd is chatty (I'm of the old skool; if nothing is/goes wrong, a program should keep quiet).
    Oh ok, then I should dare more on.
    ZekeSulastin wrote:To be a bit more precise, it means the service is there but it's only used as a dependency for something else; the [Install] section of the file is what tells systemctl where to link it and such.  Also, where exactly in the wiki were you told explicitly to 'systemctl enable dbus.service'?  I can easily point you to the sections in both installation guides that tell you how to set things like /etc/localtime et. al (also `man 7 archlinux`), but not the one that said to manually enable dbus.
    Ah, I see; and well, I was told right here, going from the top, to "Enable Daemons formerly listed in rc.conf [...] For a translation of the daemons from /etc/rc.conf to systemd services, see: List of Daemons and Services.", and, using the list, dbus is mentioned there, as you can see. Since I started from the top, I did not know that you didn't need to enable that service. Perhaps it could be added to the descriptions of the relevant services in the Wiki which ones are autostarted?
    ZekeSulastin wrote:Lastly, I don't think trying to continue conversations from a closed thread is a very good idea, let alone doing it in a giant undivided wall of text that makes it quite difficult to pick out much any single topic.
    Meh, I directly refer to the relevant people, they can easily see their own old posts in the previous thread, etcetera... I think te ones who have something to say will be able to find my replies to their previous statements (or so I hope). For now, as everyone can see, I quote stuff (but man might I make some huge posts if I ever post again in the future, if I quote what I reply to).
    fsckd wrote:This is not really a technical support subforum. Moving from Arch Discussion to Newbie Corner.
    Ah ok, thanks (or perhaps a cautious thanks? Moving it to "newbie corner" might, after all, be a subtle insult...).
    tomegun wrote:It is not really possible to follow your message as you don't quote what you are replying to. Moreover, as the thread was closed I think that means we should stop the discussion ;-)
    Hmm, I think it means cop-out for lack or proper arguments/responses... But ok, I'll let it slide, for now (mainly as I can't do much else).
    tomegun wrote:You are not meant to enable dbus.service as it is enabled unconditionally. To check the enabled/disabled state of your services try "systemctl list-unit-files". "static" means that you are not supposed to enabled/disable it.
    Ah ok, thank you. Now, having abandoned all hope, I'll start configuring again and see how it goes... May the void protect me. If I die, grieve not for me, but remember me in the fight against hard-to-configure applications.
    (edit/addon)
    Actually, what am I supposed to do with "hwclock"? the List of Daemons only says that I shouldn't run that in tandem with ntpd, but I'm not running ntpd, so... How do I get hwclock with systemd?
    Edited for additional question.
    Last edited by incassum (2012-11-07 08:44:42)

  • ViewKind Parameter Ignored in ProjectItem.Open if ProjectItem is Set to Open With Default External Editor

    Hi all,
    In my VS2010 extension, I have just encountered a situation which I can find no workaround for. As always, I went to Carlos Quintero's MZ-Tools first to see if I could find an answer. In this excellent article of his (http://www.mztools.com/articles/2007/mz2007027.aspx),
    he discusses how to get "the ProjectItem in the desired view using ProjectItem.Open(viewKind), which returns an EnvDTE.Window object."
    This is the behavior I have experienced until I noticed that if a user selects "Open With..." and sets a default external program to open a given item with, I can no longer programmatically open the item in the text editor (this is required
    functionality for my extension, since I am not setting the Window to visible, anyway). The screenshot below illustrates my point, even though I am working with my own custom extensions.
    In this case, calling ProjectItem.Open with every available ViewKind value will cause Program.cs to open in Notepad rather than the text editor. The Window returned from the Open call is always null in this case.
    Is there any way I can force an item to open in the text editor, regardless what its default program/viewer is? Thanks for your help,
    -Mike

    I don't think that is a bug but a limitation of the automation model.
    As workaround, you can use the following method:
    IVsUIShellOpenDocument.OpenSpecificEditor
    If you want something somewhat more palatable you can use the following method:
    VsShellUtilities.OpenDocumentWithSpecificEditor
    Editor guids are stored in the registry entry HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0_Config\Editors, but since you are only interested in the text editor guid, you are lucky because there is already a constant defined Microsoft.VisualStudio.VSConstants.GUID_TextEditorFactory.
    There is also a constant defined for the logical view: Microsoft.VisualStudio.VSConstants.LOGVIEWID.TextView_guid.
    So, even if text files are set to open with Notepad, this code should open them in the text editor:
             string fullPath;
             Guid editorGuid;
             Guid logicalViewGuid;
             IVsWindowFrame windowFrame;
             fullPath = projectItem.get_FileNames(0);
             editorGuid = Microsoft.VisualStudio.VSConstants.GUID_TextEditorFactory;
             logicalViewGuid = Microsoft.VisualStudio.VSConstants.LOGVIEWID.TextView_guid;
             windowFrame = Microsoft.VisualStudio.Shell.VsShellUtilities.OpenDocumentWithSpecificEditor(this, fullPath, editorGuid, logicalViewGuid);
             if (windowFrame != null)
                windowFrame.Show();
    * My new blog about VSX: http://www.visualstudioextensibility.com * Twitter: https://twitter.com/VSExtensibility * MZ-Tools productivity extension for Visual Studio: http://www.mztools.com.

  • Set JArray values with invalid key value: "LastUpdatedTime" on new alert rule creation

    Hey all!
    I'm trying to create a new alert rule using version 0.9.11 of the Monitoring Library and am getting this error on alertsClient.rules.CreateOrUpdate:
    "Set JArray values with invalid key value: "LastUpdatedTime". Array position index expected."
    That's interesting because LastUpdatedTime is a DateTime object, and whether I set it or I don't, if I set a breakpoint, it does set itself correctly, but the API appears to be expecting a JSON hash?
    I've tested alertsClient and I'm able to get existing alerts (also metrics with metrics client), so I don't believe it's an access issue.
    Any ideas?
    The full code I'm using for the test (borrowed virtually verbatim from the Cloud Cover video
    here): 
    Rule newRule = new Rule
        Name = "CPU Over 90%",
        Id = Guid.NewGuid().ToString(),
        Description = "CPU Has been over 90% for 5 minutes",
        IsEnabled = true,
        LastUpdatedTime = DateTime.Now,
        Condition = new ThresholdRuleCondition
            Operator = Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.ConditionOperator.GreaterThan,
            Threshold = 90,
            WindowSize = TimeSpan.FromMinutes(5),
            DataSource = new RuleMetricDataSource
                MetricName = "Percentage CPU",
                ResourceId = "",
                MetricNamespace = ResourceIdBuilder.BuildCloudServiceResourceId(<cloudservicename>, <deploymentname>)
    RuleAction action = new RuleEmailAction
        SendToServiceOwners = true,
    newRule.Actions.Add(action);
    OperationResponse alertResponse = alertsClient.Rules.CreateOrUpdate(new
    RuleCreateOrUpdateParameters { Rule = newRule });
    Console.WriteLine("Create alert rule response: " + alertResponse.StatusCode);

    Hi Greg,
    Thanks for your post!
    Error "JArray" has been fixed in the latest nugget package.
    Refer to:
    http://www.nuget.org/packages/Microsoft.WindowsAzure.Management.Monitoring/
    Hope this helps!
    Regards,
    Sadiqh

  • Problem setting up WDS with MSI RG54GS2 & Motorola WR850g

    Problem setting up WDS with WR850g & MSI RG54GS2
    Hi,
    I'm trying to bridge 2 routers: Motorola WR850g & MSI RG54GS2 .
    I set the MSI as the main router (it works better for me as a router than the Moto), and the Moto is the repeater. I have set it up exactly as the guide on Broadbandreports.com for the Motorola , and on Tom's Networking http://www.tomsnetworking.com/2004/04/14/how_to_wds_bridge/
    The Moto sees the MAC of the MSI (Status is UP), the MSI doesn't have a page that shows WDS MACs . I know the routers are connected because when I connect a laptop to the Moto wireless network, it gets an IP (and the DHCP on the Moto is disabled) and the default gateway of the connection is the IP of the main (MSI) router.
    The problem is I can't surf anywhere. I can't even ping the MSI router - which should be possible if the WDS works properly.The Moto Wireless Bridge Operation is set properly to Access Point/Wireless Bridge .
    Can anyone solve this?
    Thanks.

    David, welcome to the discussions.
    Are you refering to Airport Extreme Setup as the Extreme base.
    Or are you using a 3rd party Router as your primary Base, or the Express as the primary base.
    Read the supplied link, Not all 3rd party routers are WDS compatible.
    http://discussions.apple.com/thread.jspa?messageID=2785566
    Who is you Internet Service Provider?
    What brand and Model Modem did they furnish?
    Are you using Dial-Up...DSL...or Cable?
    http://docs.info.apple.com/article.html?artnum=303595
    See if there is any help from this link.
    http://discussions.apple.com/thread.jspa?messageID=607414
    Cheers Don

  • [Solved] Running mpd as user mpd with systemd without using mpd.conf

    Maybe this is tivial, but I searched about an hour without any results. I want to run mpd as user mpd. I cant use the mpd config file since mpd set the UID and GID explicitely resulting in mpd not having the necessary supplementary groups to access the locally shared music on my pc. Well I tried to run mpd with systemd by
    # systemctl start mpd
    and  the systemd contains the user mpd
    $ cat /etc/systemd/system/default.target.wants/mpd.service
    [Unit]
    Description=Music Player Daemon
    After=network.target sound.target
    [Service]
    User=mpd
    ExecStart=/usr/bin/mpd --no-daemon
    # allow MPD to use real-time priority 50
    LimitRTPRIO=50
    LimitRTTIME=-1
    # move MPD to a top-level cgroup, as real-time budget assignment fails
    # in cgroup /system/mpd.service, because /system has a zero real-time
    # budget; see
    # http://www.freedesktop.org/wiki/Software/systemd/MyServiceCantGetRealtime/
    ControlGroup=cpu:/mpd
    # assign a real-time budget
    ControlGroupAttribute=cpu.rt_runtime_us 500000
    [Install]
    WantedBy=default.target
    but it did not run as mpd.
    Well how can I run mpd as mpd? Is there a way to do it like with dropbox: dropbox@<user>.service
    Last edited by manuelschneid3r (2015-03-25 12:52:52)

    Glad you solved it. Was just typing a response and I'll still add two remarks:
    The ps|grep output showed that you run grep as root, not mpd itself (which won't have a space in the command -- the second time it only worked because the mpd group is preceded by a space).
    It sounds like it took you a while to find the drop-in configuration snippet in the mpd.service.d directory. These drop-in are shown in `systemctl status`, which is something you'd normally check in situations like these, and that might help to discover them more quickly.
    Last edited by Raynman (2015-03-25 12:58:36)

  • HT3546 So i recently bought an Apple AirPort Extreme BaseStation (the mushroom shaped one) and was wondering if someone could tell me where and how to find a power cord and how to set it up with my Macintosh (2011 edition with 1.7.5) Thankyou! :)

    So i recently bought an Apple AirPort Extreme BaseStation (the mushroom shaped one) and was wondering if someone could tell me where and how to find a power cord and how to set it up with my Macintosh (2011 edition with 1.7.5) Thankyou!

    Welcome!
    Last question first, as we need to know what operating system that the Mac is using.
    If you are not sure, click the Apple icon in the upper left corner of the screen, then click About This Mac, and post back with the OS X Version number that you see there.
    Two possible solutions on the power cord
    ORIGINAL OEM APPLE AIRPORT EXTREME BASE STATION POWER SUPPLY AC ADAPTER A1202 if you want a white power supply and white power cord to match up with the Apple device
    AC adapter for Apple AirPort A1034 Extreme B... if you don't care what color the supply and cord might be
    If you don't already have a Setup Guide.....look here:
    AirPort Extreme Base Station Setup Guide v4.2 (Manual)

  • How to configure BIND (chroot) with systemd

    Hello,
    I'm following guide https://wiki.archlinux.org/index.php/BIND_(chroot). In the end there is only said how to enable service in sysvinit environment. Could someone please tell me how to do this with systemd?
    Thanks

    @toogy: what do you mean exactly by creating a systemd service?
    EDIT: for example, I've this one (in /etc/systemd/system/mynamed.service)
    [Unit]
    Description=Internet domain name server
    After=network.target
    [Service]
    ExecStart=/usr/bin/named -f -u named -4
    ExecReload=/usr/bin/rndc reload
    ExecStop=/usr/bin/rndc stop
    [Install]
    WantedBy=multi-user.target
    And according to 'man named', you can use the '-t' parameter if you want named to run in a chroot (I've never tried it):
    -t directory: Chroot to directory after processing the command line arguments, but before reading the configuration file.
    Warning: This option should be used in conjunction with the -u option, as chrooting a process running as root doesn't enhance security on most systems; the way chroot(2) is defined allows a process with root privileges to escape a chroot jail.
    Last edited by scar (2014-03-18 16:24:55)

  • [SOLVED] samba does not start properly again -this time with systemd

    Definitely no luck with this one...
    So, today I've switched to a pure systemd init system, and noticed that I have this old issue again.
    (Link to my old thread: https://bbs.archlinux.org/viewtopic.php?id=142704)
    Samba doesn't start properly again, more precisely smbd is launched but not nmbd, so samba is not working as it should (for example smbtreee lists nothing).
    Last time I've solved it by putting samba long before networkmanager in the daemons array, but with systemd I'm a bit confused...
    Anyone has this issue?
    Last edited by scar (2012-11-03 07:05:42)

    I think that nmbd isn't waiting for networkmanager to start on my system, because I'm getting journal entries like
    Oct 31 00:47:21 spacebar winbindd[431]: [2012/10/31 00:47:21.556005, 0] param/loadparm.c:7969(lp_do_parameter)
    Oct 31 00:47:21 spacebar systemd[1]: nmbd.service: main process exited, code=exited, status=1
    Oct 31 00:47:21 spacebar systemd[1]: Unit nmbd.service entered failed state.
    Oct 31 00:47:22 spacebar NetworkManager[391]: <info> (eth0): carrier now ON (device state 20)
    Oct 31 00:47:22 spacebar kernel: r8169 0000:03:00.0: eth0: link up
    Oct 31 00:47:22 spacebar kernel: IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
    Oct 31 00:47:22 spacebar NetworkManager[391]: <info> (eth0): device state change: unavailable -> disconnected (reason 'carrier-changed') [20 30 40]
    Oct 31 00:47:22 spacebar NetworkManager[391]: <info> Auto-activating connection 'Static'.
    Oct 31 00:47:22 spacebar NetworkManager[391]: <info> Activation (eth0) starting connection 'Static'
    Oct 31 00:47:22 spacebar NetworkManager[391]: <info> (eth0): device state change: disconnected -> prepare (reason 'none') [30 40 0]
    Oct 31 00:47:22 spacebar NetworkManager[391]: <info> Activation (eth0) Stage 1 of 5 (Device Prepare) scheduled...
    Oct 31 00:47:22 spacebar NetworkManager[391]: <info> Activation (eth0) Stage 1 of 5 (Device Prepare) started...
    Oct 31 00:47:22 spacebar NetworkManager[391]: <info> Activation (eth0) Stage 2 of 5 (Device Configure) scheduled...
    Oct 31 00:47:22 spacebar NetworkManager[391]: <info> Activation (eth0) Stage 1 of 5 (Device Prepare) complete.
    Oct 31 00:47:22 spacebar NetworkManager[391]: <info> Activation (eth0) Stage 2 of 5 (Device Configure) starting...
    Oct 31 00:47:22 spacebar NetworkManager[391]: <info> (eth0): device state change: prepare -> config (reason 'none') [40 50 0]
    Oct 31 00:47:22 spacebar NetworkManager[391]: <info> Activation (eth0) Stage 2 of 5 (Device Configure) successful.
    Oct 31 00:47:22 spacebar NetworkManager[391]: <info> Activation (eth0) Stage 3 of 5 (IP Configure Start) scheduled.
    Oct 31 00:47:22 spacebar NetworkManager[391]: <info> Activation (eth0) Stage 2 of 5 (Device Configure) complete.
    Oct 31 00:47:22 spacebar NetworkManager[391]: <info> Activation (eth0) Stage 3 of 5 (IP Configure Start) started...
    Oct 31 00:47:22 spacebar NetworkManager[391]: <info> (eth0): device state change: config -> ip-config (reason 'none') [50 70 0]
    Oct 31 00:47:22 spacebar NetworkManager[391]: <info> Activation (eth0) Stage 5 of 5 (IPv4 Configure Commit) scheduled...
    Oct 31 00:47:22 spacebar NetworkManager[391]: <info> Activation (eth0) Stage 3 of 5 (IP Configure Start) complete.
    Oct 31 00:47:22 spacebar NetworkManager[391]: <info> Activation (eth0) Stage 5 of 5 (IPv4 Commit) started...
    Oct 31 00:47:22 spacebar rpc.mountd[462]: Version 1.2.6 starting
    Oct 31 00:47:22 spacebar systemd[1]: Startup finished in 3s 850ms 155us (kernel) + 21s 279ms 972us (userspace) = 25s 130ms 127us.
    Oct 31 00:47:23 spacebar NetworkManager[391]: <info> (eth0): device state change: ip-config -> activated (reason 'none') [70 100 0]
    Oct 31 00:47:23 spacebar ntpd_intres[441]: DNS 0.au.pool.ntp.org -> 116.66.160.39
    Oct 31 00:47:23 spacebar NetworkManager[391]: <info> Policy set 'Static' (eth0) as default for IPv4 routing and DNS.
    Oct 31 00:47:23 spacebar NetworkManager[391]: <info> Activation (eth0) successful, device activated.
    Oct 31 00:47:23 spacebar NetworkManager[391]: <info> Activation (eth0) Stage 5 of 5 (IPv4 Commit) complete.
    Oct 31 00:47:23 spacebar dbus[401]: [system] Activating service name='org.freedesktop.nm_dispatcher' (using servicehelper)
    Oct 31 00:47:20 spacebar smbd[428]: [2012/10/31 00:47:20.771872, 0] param/loadparm.c:7969(lp_do_parameter)
    Oct 31 00:47:20 spacebar smbd[428]: Ignoring unknown parameter "user client driver"
    Oct 31 00:47:20 spacebar smbd[428]: [2012/10/31 00:47:20.794252, 0] lib/interface.c:543(load_interfaces)
    Oct 31 00:47:20 spacebar smbd[428]: WARNING: no network interfaces found
    Oct 31 00:47:20 spacebar smbd[428]: [2012/10/31 00:47:20.805126, 0] smbd/server.c:1109(main)
    Oct 31 00:47:20 spacebar smbd[428]: standard input is not a socket, assuming -D option
    Oh, this started happening after putting a MUCH faster cpu and motherboard in the system, so maybe there's a race-condition there?
    Last edited by MisterAnderson (2012-10-30 04:59:46)

  • Systemd-cron: minimal cron replacement with systemd

    systemd-cron
    systemd-cron is a set of systemd unit files that take advantage of systemd's timer units and calendar events to execute scripts in the standard cron.hourly, cron.daily, cron.weekly, and cron.monthly directories. For simple setups where this is all you need, this allows you to not have to run a cron daemon. Of course this also means it is not a drop-in replacement for a traditional cron daemon and you will not get support for:
    crontab files
    per-user jobs
    executing missed jobs
    emailing job output
    et cetera
    To use, stop and uninstall any existing cron daemon and install the AUR package. Then as root run:
    # systemctl enable cron.target
    # systemctl start cron.target
    Please note the .target suffix.
    More details are available with:
    $ man systemd.cron
    I have been using it successfully on my servers for a week now with no troubles.

    nbvcxz wrote:Haven't tested jet but really nice idea - thumbs up. Any possibilities to make per user jobs in the future?
    That would probably be the next thing I do. As Morrad described above it should be pretty natural with systemd user sessions. After that probably crontab support using generators.

  • Gpg-agent with systemd

    Hey!
    I am a novice Arch user and I am having problems with the latest gpg distribution when used with systemd and ssh-support. Currently, I am using i3 with lightdm, and I am using systemd to start gpg-agent with ssh support. Specifically, I have the following gpg-agent.service file in my ${HOME}/.config/systemd/user/ directory:
    [Unit]
    Description=gpg-agent Daemon with SSH Support
    [Service]
    Type=forking
    ExecStart=/usr/bin/gpg-agent --quiet --daemon --enable-ssh-support
    Restart=on-success
    [Install]
    WantedBy=default.target
    which is expected to restart when exited properly and/or due to a signal. When I enable and start the service with systemctl --user prefix, it works as it is supposed to be. I have the following gpg-agent.conf file:
    default-cache-ttl 600
    default-cache-ttl-ssh 3600
    max-cache-ttl 7200
    max-cache-ttl-ssh 7200
    enforce-passphrase-constraints
    min-passphrase-len 10
    min-passphrase-nonalpha 4
    max-passphrase-days 180
    pinentry-program /usr/bin/pinentry-curses
    and the following excerpt in my .zshrc:
    # GPG configuration
    # Check for the gpg-agent socket, and set SSH_AUTH_SOCK and GPG_TTY
    # environment variables accordingly:
    if [[ -S "${HOME}/.gnupg/S.gpg-agent.ssh" ]]; then
    export GPG_TTY=$(tty)
    if [[ ${SSH_AUTH_SOCK} != "${HOME}/.gnupg/S.gpg-agent.ssh" ]]; then
    export SSH_AUTH_SOCK="${HOME}/.gnupg/S.gpg-agent.ssh"
    fi
    fi
    The problem is, everything is working properly except for one thing: "When I want to ssh to my server, I get an 'Agent admitted failure to sign using the key' error." I mean, the environment variables seem to be fine when I fire up a zsh session (terminal emulator) and/or everything seems ok when I issue systemctl --user status gpg-agent, but I cannot ssh to my server using my gpg-key. However, when I stop the systemd unit and just issue eval $(gpg-agent --quiet --daemon --enable-ssh-support) in a new terminal emulator, ssh works fine. In both of the aforementioned versions, when I issue gpg --clearsign some_file.txt command, I am asked in the terminal emulator for my password (I suppose in the so called curses pinentry program).
    I thank you in advance for your time, and appreciate any suggestions. Best,

    You might need to make a script to start it. Like "/usr/local/bin/gpg-agent-daemon.zsh"
    then in that file have:
    #!/usr/bin/zsh
    gpg-agent --quiet --daemon --enable-ssh-support --write-env-file "${HOME}/.gpg-agent-info"
    And do chmod +x
    And in your gpg-agent.service file:
    [Service]
    Type=forking
    ExecStart=gpg-agent-daemon.zsh
    <...>
    And then in $ZDOTDIR/.zprofile
    # GPG configuration
    # Check for the gpg-agent socket, and set SSH_AUTH_SOCK and GPG_TTY
    # environment variables accordingly:
    if [[ -S "${HOME}/.gnupg/S.gpg-agent.ssh" ]]; then
    export GPG_TTY=$(tty)
    export GPG_TTY
    if [[ ${SSH_AUTH_SOCK} != "${HOME}/.gnupg/S.gpg-agent.ssh" ]]; then
    export SSH_AUTH_SOCK="${HOME}/.gnupg/S.gpg-agent.ssh"
    fi
    if [ -f "${HOME}/.gpg-agent-info" ]; then
    . "${HOME}/.gpg-agent-info"
    export GPG_AGENT_INFO
    fi
    fi

  • [Solved] Numlock on boot (with systemd)

    I recently upgraded to systemd. Everything is working extremely well. Except that I am given to understand that systemd no doesn't use /etc/inittab, where I had added the command from the wiki that turns on numlock on each of the virtual terminals. Unfortunately the wiki doesn't have any method to do it with systemd, only the /etc/inittab method.
    This means that for a brief while, I had to live with the onerous task of hitting numlock manually. It was one of the worst weeks of my life. My index finger is still raw.
    I have come up with a somewhat-solution. I just edited /etc/bash.bashrc and added
    if [[ $( tty ) == /dev/tty? ]]; then
        setleds +num
    fi
    to it, which works quite well. It turns on num lock once you're logged in as long as you are on a virtual terminal and not on one of the /dev/pts/* ones.
    My question is, is there a better place to do this? Maybe some way to get it to turn on before you're even logged in? It doesn't really matter all that much, I'm just trying to make things "correct."
    Last edited by scott_fakename (2012-09-06 20:29:46)

    DSpider wrote:
    https://wiki.archlinux.org/index.php/Ac … _on_Bootup
    Set it in Xorg for whatever DE/WM you use and it will be active when you switch to a tty.
    Don't forget to mark it as solved.
    Yes, I tried that. I use lxdm and xfce, and setting the numlock=1 option in /etc/lxdm/lxdm.conf turns on numlock in xfce and the light in the consoles, but not the actual numlock itself in consoles.
    And Kejpi thanks, I was doing that but when I upgraded to systemd it said those would be taken out "at some point" so I was trying to find out if a permanent solution existed yet. Apparently it does not exist yet, which is fine, I was just curious. So I guess I'll stick with the bashrc method for now.
    Thanks for the replies.
    --Scott

Maybe you are looking for

  • Help needed in EJB - to call AS from EJB a Session Bean

    Hi All , I have been strictly told not to use Web Services as all the applications are on the same server actually I have to make an EJB invocation to an Application Service from the CAF layer from a Session Bean of another EJB Project(Not a CAF Serv

  • Report to show Orders with FOB Destination?

    Is there a canned report available that shows Orders/Shipments by FOB (in 11.0.3)? We're getting hammered on Revenue Recognition and I need to be able to show orders that have anything other than FOB Origin/Factory - especially in the last week of th

  • Why do videos in my camera roll have a circle icon instead of video camera icon?

    The last 2 videos I took last night (I took 11 in total), show a gray circle icon on them instead of the normal camera icon. The running time on those 2 vidoes is not correct, sound is missing in part of the videos, all of the video is not there, and

  • Oracle SQL and ANSI

    Hi, Do you know if the extensions of Oracle SQL - DML error logging - model clause - pivot clause are supported by ANSI SQL (or other RDBMS) ? Thanks for your help

  • RSBBS - Assignment  Details

    Hello, I am developing RRI from Sender to Reciever.Target has a variable on EX: ORDER.And the what i would like is when the user from the Sender query clicks on Order > Go to >reciever query can actually se all teh details without putting any additio