systemd

Run gdb inside docker container running systemd

我们两清 提交于 2019-12-11 08:29:03
问题 I was able to start a docker container running systemd using sudo docker run -it -p 8022:22 -e container=docker debug-image /sbin/init However, gdb was not able to debug C processes in this environment, because it lacked the required SYS_PTRACE capability. I tried adding --cap-add=SYS_PTRACE to the docker run command line, but then systemd appeared to hang on startup (it printed nothing to the terminal). The same thing happened when I tried passing --privileged instead. 回答1: This command

Content of /tmp is not visible from PHP-FPM when using Systemd

限于喜欢 提交于 2019-12-11 08:20:03
问题 Directory /tmp is not accessible from PHP-FPM running as Systemd service. Steps to reproduce: <?php print_r(shell_exec('ls /tmp')); ?> 回答1: This is default behaviour set by package maintainers. It's because there is PrivateTmp=true in /usr/lib/systemd/system/php-fpm.service. If you want to change it, you can create /etc/systemd/system/php-fpm.service.d/private-tmp.conf with contents: [Service] PrivateTmp=false 来源: https://stackoverflow.com/questions/21615786/content-of-tmp-is-not-visible-from

python initiated with systemd cannot start subprocess

半世苍凉 提交于 2019-12-11 06:39:08
问题 I have a python script inside a virtualenv which is started using systemd. [Unit] Description=app After=network.target [Service] Type=simple User=user Group=user Environment=VIRTUAL_ENV=/home/user/Projects/app/venv Environment=PATH=$VIRTUAL_ENV/bin:$PATH WorkingDirectory=/home/user/Projects/app ExecStart=/home/user/Projects/app/venv/bin/python app.py [Install] WantedBy=multi-user.target The thing is that the script uses subprocess.Popen(['python', 'whatever.py']) to open another python script

高并发与负载均衡-lvs-3种模型推导

試著忘記壹切 提交于 2019-12-11 06:14:57
[root@centos7-1 ~]# ifconfig ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.159.10 netmask 255.255.255.0 broadcast 192.168.159.255 inet6 fe80::20c:29ff:fe99:5ef2 prefixlen 64 scopeid 0x20<link> ether 00:0c:29:99:5e:f2 txqueuelen 1000 (Ethernet) RX packets 1137094 bytes 1121340388 (1.0 GiB) RX errors 101 dropped 0 overruns 0 frame 0 TX packets 293297 bytes 21587168 (20.5 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 device interrupt 19 base 0x2000 lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid

Systemctl dependency failure, stop dependent services

眉间皱痕 提交于 2019-12-11 04:29:33
问题 I have 2 services a.service and b.service. a.service is shown [Unit] Description=My service [Service] Type=forking ExecStart=/bin/sh /home/admin/run.sh Restart=on-failure [Install] WantedBy=multi-user.target, b.service [Unit] Description=My service [Service] Type=forking ExecStart=/bin/sh $HOME/theFolder/run.sh Restart=on-failure [Install] WantedBy=multi-user.target Now, when i start b.service, i'm sure a.service will be started. During runtime, suddenly someone messes with /home/admin/run.sh

docker背景知识1 命名空间

浪子不回头ぞ 提交于 2019-12-11 03:40:04
如下操作都是在centos7上执行,通过cat /proc/version查看系统信息。 Linux namespace linux namespaces是Linux提供的一种内核级别环境隔离的方法,也是Container环境隔离的底层技术,Linux Namespaces共有如下种类 分类 系统调用参数 相关内核版本 Mount namespaces CLONE_NEWNS Linux 2.4.19 UTS namespaces CLONE_NEWUTS Linux 2.6.19 IPC namespaces CLONE_NEWIPC Linux 2.6.19 PID namespaces CLONE_NEWPID Linux 2.6.24 Network namespaces CLONE_NEWNET Linux 2.6.29 User namespaces CLONE_NEWUSER Linux 3.8 Mount: mount表空间隔离,配合chroot系统调用,使程序有自己的文件系统 UTS: hostname和doaminname隔离,使应用有自己独立的主机名 IPC: 隔离进程间通讯 PID: 使程序包括子程序构造一个独立的程序集,最先创建的程序为1号pid Network: 网络空间隔离,支行在此空间的程序拥有独立的网络栈 User: 此空间下有独立的uid

Docker and systemd - service stopping after 10 seconds

﹥>﹥吖頭↗ 提交于 2019-12-11 03:05:49
问题 I'm having trouble getting a Docker container to stay up when it's started by systemd. When I start it manually with sudo docker start containername , it stays up without trouble, but when it's started via systemd with sudo systemctl start containername , it stays up for 10 seconds then mysteriously dies, leaving messages in syslog something like the following: Mar 13 14:01:09 hostname docker[329]: time="2015-03-13T14:01:09Z" level="info" msg="POST /v1.17/containers/containername/stop?t=10"

Unable to get CAP_CHOWN and CAP_DAC_OVERRIDE working for regular user

≡放荡痞女 提交于 2019-12-11 03:00:10
问题 My requirement My python server runs as a regular user on RHEL But it needs to create files/directories at places it doesn't have access to. Also needs to do chown those files with random UID/GID My approach Trying this in capability-only environment, no setuid. I am trying to make use of cap_chown and cap_dac_override capabilities. But am totally lost of how to get it working in systemctl kind of environment At present I have following in the service file: #cat /usr/lib/systemd/system/my

systemd service failing (203/EXEC)

自闭症网瘾萝莉.ら 提交于 2019-12-11 02:47:27
问题 I have a custom systemd service (created using this tutorial to modify my screen resolution to a custom value on startup. I am having issues with the service failing to start (code=203/EXEC). To start, I have tried all solutions to the following existing topics with no luck: Fixing a systemd service 203/EXEC failure (no such file or directory) Systemd service failing on startup Unable to run Gunicorn as service in systemd 203/EXEC My .service file is this: [Unit] Description=Set resolution to

Systemd service failing on startup

余生长醉 提交于 2019-12-10 23:43:40
问题 I'm trying to get a nodejs server to run on startup, so I created the following systemd unit file: [Unit] Description=TI SensorTag Communicator After=network.target [Service] ExecStart=/usr/bin/node /home/pi/sensortag-comm/sensortag.js User=root [Install] WantedBy=multi-user.target I'm not sure what I'm doing wrong here. It seems to fail before the nodejs script even starts, as no logging occurs. My script is dependent on mysql 5.5 (I think this is where I'm running into an issue). Any