/srv/irclogs.ubuntu.com/2020/03/11/#ubuntu-server.txt

lordievaderGood morning07:19
=== Napsterbater is now known as Guest23378
=== Napsterbater_ is now known as Napsterbater
arielfehow can i shut down pycharms database tool connection to a local postgresql from a terminal?11:05
=== bpsecret- is now known as bpsecret
=== Wryhder is now known as Lucas_Gray
coreycbjamespage: for bug 1866361, I think I'm just going to bump python-openstacksdk from 0.26.0 to 0.27.0 for stein inline with upstream. the new minor release only includes the patch for this fix and it includes an API change.13:35
ubottubug 1866361 in Ubuntu Cloud Archive stein "[SRU] Connections to Neutron are not closed properly in v0.26.0" [Undecided,Triaged] https://launchpad.net/bugs/186636113:35
jamespagecoreycb: sounds sensible13:35
=== Wryhder is now known as Lucas_Gray
=== oerheks1 is now known as oerheks
runelind_qhow can I pass environment variables to a user in a systemd startup script? I created /etc/systemd/system/<service>.d/override.conf17:21
runelind_qand put in Environment="VARIABLE=value" in the file17:21
runelind_qbut from what I can tell, it doesn't seem to be passed properly.17:22
sdezielrunelind_q: have you run 'sudo systemctl daemon-reload' ? after creating the override.conf file?17:25
runelind_qI did17:25
sdezielrunelind_q: and restarted the unit in question?17:25
runelind_qcorrect17:26
runelind_qI'm supposed to be able to do systemctl --user show-environment, but I get "Failed to connect to bus: No such file or directory"17:27
sdezielrunelind_q: the override you created is for the system instance, not the user one17:27
runelind_qsorry it is /etc/systemd/system/traefik.service.d/override.conf17:28
runelind_q(I'm working with traefik, obvs)17:28
sdezielrunelind_q: this is still in the system instance, nothing you can see with systemctl --user17:29
sdezielrunelind_q: that said, show-environment won't show you the env vars exported to the unit you overrode17:29
runelind_qah ok, so it looks like I potentially need to do /etc/systemd/system/user@.traefik.d/ ?17:30
sdezielrunelind_q: to see those, you'd probably need to do something like this: sudo grep -a VARIABLE /proc/$traefik_pid/environ17:30
runelind_q(am reading https://wiki.archlinux.org/index.php/Systemd/User#Environment_variables)17:31
runelind_qI'm launching traefik with the traefik user and group17:31
sdezielrunelind_q: right but that traefik unit is run/managed by the system instance of systemd17:32
sdezielrunelind_q: could you pastebin the output of: systemctl cat traefik.service17:33
runelind_qsdeziel: https://pastebin.com/EmYdEZ1717:34
runelind_qit looks like some stuff got cut off, but it appears to be only comments.17:35
runelind_q(copied the startup script from someone else)17:35
sdezielrunelind_q: so I think the issue is that you pass Environment= twice17:35
sdezielrunelind_q: only the last one is effective17:35
runelind_qthe traefik user needs CF_API_EMAIL and CF_API_KEY to be able to run traefik properly17:36
sdezielerr, sorry, I can't read man pages, scratch that17:36
sdezielrunelind_q: since the content of /etc/systemd/system/traefik.service.d/override.conf, I'd recommend tweaking it's ownership/permissions BTW17:36
sdezielrunelind_q: your setup looks sane to me, what exactly makes you conclude it's not 'passing the env vars properly'?17:37
runelind_qbecause traefik complains about missing values for CF_API_EMAIL or CF_API_KEY17:38
runelind_qif I run traefik as root with those values manually exported, everything works fine.17:38
runelind_qsdeziel: interesting if I grep -a CF_API_KEY /proc/22095/environ I do see it, same with EMAIL17:40
runelind_qsdeziel: so I must be doing something else wrong :(17:40
sdezielsudo grep -a CF_API_ /proc/$(systemctl show --value -p MainPID traefik)/environ17:40
sdezielah, I was too slow ;)17:41
runelind_qbut your command was fancier :)17:41
runelind_qI guess I can go ask the traefik peeps17:42
runelind_qoh wait hold on17:44
runelind_qthis is with the manually exported values.  Let me kill my root process and systemctl start it with the traefik user17:44
* runelind_q facepalms17:44
sdezielrunelind_q: word of advise when doing tests as root: any file created when doing your test will be impossible to write by the low-priv user afterwards... which may cause you headaches17:45
runelind_qnoted17:45
runelind_qok, now that I'm running it as the traefik user, I don't see the environment variables at all.17:47
sdezielrunelind_q: what do you get from: sudo grep -a CF_API_ /proc/$(systemctl show --value -p MainPID traefik)/environ17:49
runelind_qnothing in return at all17:49
runelind_qif I just cat it I get some values back17:49
runelind_qLANG=C.UTF-8PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/binHOME=/var/wwwLOGNAME=traefikUSER=traefikINVOCATION_ID=b52587803e364c05beb88ca0dd98914dJOURNAL_STREAM=9:660038317:49
runelind_qbut I definitely got more values back when running as root17:50
sdezielwhen running as root, it probably inherited your whole environment17:50
runelind_qyes17:51
sdezieldoes "systemctl show --value -p Environment traefik" looks sane?17:52
runelind_qalso returns blank17:53
runelind_qbut ps -ax | grep traefik shows a pid of 2829917:53
runelind_qso I did cat /proc/28299/environ17:53
runelind_qand the results were pasted above17:53
sdezieldoes that match the value returned by: systemctl show --value -p MainPID traefik17:54
runelind_qit does17:54
sdezielrunelind_q: I'm out of good ideas, at this point I'd try adding 'ExecStartPre=/usr/bin/env' and see if the env ends up in the unit's logs17:56
sdezielrunelind_q: I just noticed that your override file doesn't have the [Service] header17:58
runelind_qoh, that's a good catch.17:59
runelind_qok, now they show up in systemctl show --value -p Environment traefik :D18:01
sdezielrunelind_q: meanwhile, I got this log message when trying to restrict access to a config file: systemd[1]: Configuration file /etc/systemd/system/foo.service is marked world-inaccessible. This has no effect as configuration data is accessible via APIs without restrictions. Proceeding anyway.18:05
sdezielrunelind_q: because of this, you might want to switch to using EnvironmentFile= pointing to a file that's readable by root only if you care about keeping the API key secret18:08
runelind_qsdeziel: thanks, I'll look into it18:09
sdezielyou are welcome18:10
runelind_qsdeziel: going to wander off and grab some lunch and do further testing in a bit.  Thank you very much for your help!18:10

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!