calico-node rkt returns stage1-fly.aci.asc: no such file or directory - coreos

I have a CoreOS beta (1185.2.0) installed.
I have the following systemd service file to start calico-node:
[Unit]
Description=Calico per-host agent
Requires=network-online.target
After=network-online.target
[Service]
Slice=machine.slice
PermissionsStartOnly=true
Environment=ETCD_CA_CERT_FILE=/etc/ssl/etcd/ca.pem
Environment=ETCD_CERT_FILE=/etc/ssl/etcd/etcd1.pem
Environment=ETCD_KEY_FILE=/etc/ssl/etcd/etcd1-key.pem
Environment=CALICO_DISABLE_FILE_LOGGING=true
Environment=HOSTNAME=10.79.218.2
Environment=IP=10.79.218.2
Environment=FELIX_FELIXHOSTNAME=10.79.218.2
Environment=CALICO_NETWORKING=true
Environment=NO_DEFAULT_POOLS=true
Environment=ETCD_ENDPOINTS=https://coreos-2.tux-in.com:2379,https://coreos-3.tux-in.com:2379
ExecStartPre=/bin/mkdir /var/run/calico
ExecStart=/usr/bin/rkt run --inherit-env --stage1-from-dir=stage1-fly.aci --volume=var-run-calico,kind=host,source=/var/run/calico --volume=modules,kind=host,source=/lib/modules,readOnly=false --mount=volume=modules,target=/lib/modules --volume=dns,kind=host,source=/etc/resolv.conf,readOnly=true --volume=etcd-tls-certs,kind=host,source=/etc/ssl/etcd,readOnly=true --mount=volume=dns,target=/etc/resolv.conf --mount=volume=etcd-tls-certs,target=/etc/ssl/etcd --mount=volume=var-run-calico,target=/var/run/calico --trust-keys-from-https quay.io/calico/node:v0.22.0
KillMode=mixed
Restart=always
TimeoutStartSec=0
[Install]
WantedBy=multi-user.target
welp.. the systemd fails with:
● calico-node.service - Calico per-host agent
Loaded: loaded (/etc/systemd/system/calico-node.service; enabled; vendor preset: disabled)
Active: failed (Result: start-limit-hit) since Tue 2016-10-25 04:51:15 UTC; 9min ago
Process: 1970 ExecStart=/usr/bin/rkt run --inherit-env --stage1-from-dir=stage1-fly.aci --volume=var-run-calico,kind=host,source=/var/
Process: 4307 ExecStartPre=/bin/mkdir /var/run/calico (code=exited, status=1/FAILURE)
Main PID: 1970 (code=exited, status=1/FAILURE)
Oct 25 04:51:15 coreos-2.tux-in.com systemd[1]: Failed to start Calico per-host agent.
Oct 25 04:51:15 coreos-2.tux-in.com systemd[1]: calico-node.service: Unit entered failed state.
Oct 25 04:51:15 coreos-2.tux-in.com systemd[1]: calico-node.service: Failed with result 'exit-code'.
Oct 25 04:51:15 coreos-2.tux-in.com systemd[1]: calico-node.service: Service hold-off time over, scheduling restart.
Oct 25 04:51:15 coreos-2.tux-in.com systemd[1]: Stopped Calico per-host agent.
Oct 25 04:51:15 coreos-2.tux-in.com systemd[1]: calico-node.service: Start request repeated too quickly.
Oct 25 04:51:15 coreos-2.tux-in.com systemd[1]: Failed to start Calico per-host agent.
Oct 25 04:51:15 coreos-2.tux-in.com systemd[1]: calico-node.service: Unit entered failed state.
Oct 25 04:51:15 coreos-2.tux-in.com systemd[1]: calico-node.service: Failed with result 'start-limit-hit'.
I tried setting the environment variables on terminal and running the rkt command and I got the error message
image: using image from file /usr/lib/rkt/stage1-images/stage1-fly.aci
run: open /usr/lib/rkt/stage1-images/stage1-fly.aci.asc: no such file or directory
I think that error may relate to the following configuration file at /etc/rkt/paths.d/paths.json
{
"rktKind": "paths",
"rktVersion": "v1",
"stage1-images": "/usr/lib/rkt/stage1-images"
}
I need the paths configuration file later on for kubernetes.
any ideas? the asc file really doesn't exist there.

/usr/lib is a dynamic link to /usr/lib64. rkt configured there not to search for certificates for container images at /usr/lib64 and not /usr/lib.
it seems that by default this configuration is already set properly, so just removing the file /etc/rkt/paths.d/paths.json resolves the issue.
full answer at https://github.com/coreos/rkt/issues/3320

Related

sshd service fails to start : ssh.service failed because the control process exited with error code

I'm not sure why it isn't starting or why its preventing me from connecting, i get this error:
root#vmi: "# sudo service ssh status
ssh.service OpenBSD Secure Shell server
Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sun 2022-11-27 09:47:47 CST; 4min 58s ago
Docs: man: sshd (8) man: sshd_config(5)
Process: 446 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=255/EXCEPTION)
Nov 27 09:47:47 vmi.contaboserver.net systemd[1]: ssh.service: Scheduled restart job, restart>
Nov 27 09:47:47 vmi.contaboserver.net systemd[1]: Stopped OpenBSD Secure Shell server.
Nov 27 09:47:47 vmi.contaboserver.net systemd[1]: ssh.service: Start request repeated too qui>
Nov 27 09:47:47 vmi.contaboserver.net systemd[1]: ssh.service: Failed with result 'exit-code'.
Nov 27 09:47:47 vmi.contaboserver.net systemd[1]: Failed to start OpenBSD Secure Shell server. lines 1-12/12 (END)
Please provide more precise log information, just restart sshd service then use journalctl -xe or vim /var/log/secure (if The storage location of the sshd logs has not been changed)

Control python script like linux cli applicaitons

I have a python script which I want to control using linux commands.
e.g. like we control mysql: service mysql restart
How to achieve this kind of functionality.
I saw some bash scripts doing this but don't have any knowledge in bash scripting.
Thanks.
UPDATE:
I have a site_monitor.py script which I included in site_monitor.service in /etc/systemd/system/.
[Unit]
Description=Site Monitor Service
After=multi-user.target
[Service]
Type=simple
Restart=always
ExecStart=/usr/bin/python3 /home/hemantsah/WisdomLeaf/site_monitor/site_monitor.py
[Install]
WantedBy=multi-user.target
After doing systemctl daemon-reload.service, I started the script using systemctl start site_monitor.service
Listing all the services using systemctl list-units --type=service, I can see the service running, but it's not doing anything.
If I run my python script in terminal using python3 site_monitor.py, then it works.
I found just now if I start the service and check the status using sudo service site_monitor status,
I checked after starting the service, it was fine , checking after sometime again gave me this error:
hemantsah#pop-os:/etc/systemd/system$ sudo service site_monitor status
● site_monitor.service - Site Monitor Service
Loaded: loaded (/etc/systemd/system/site_monitor.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2021-11-18 10:47:30 IST; 16s ago
Process: 111989 ExecStart=/usr/bin/python3 /home/hemantsah/WisdomLeaf/site_monitor/site_monitor.py (code=exited, status=1/FAILURE)
Main PID: 111989 (code=exited, status=1/FAILURE)
Nov 18 10:47:30 pop-os systemd[1]: site_monitor.service: Scheduled restart job, restart counter is at 5.
Nov 18 10:47:30 pop-os systemd[1]: Stopped Site Monitor Service.
Nov 18 10:47:30 pop-os systemd[1]: site_monitor.service: Start request repeated too quickly.
Nov 18 10:47:30 pop-os systemd[1]: site_monitor.service: Failed with result 'exit-code'.
Nov 18 10:47:30 pop-os systemd[1]: Failed to start Site Monitor Service.
Nov 18 10:47:34 pop-os systemd[1]: site_monitor.service: Start request repeated too quickly.
Nov 18 10:47:34 pop-os systemd[1]: site_monitor.service: Failed with result 'exit-code'.
Nov 18 10:47:34 pop-os systemd[1]: Failed to start Site Monitor Service.
Running sudo journalctl -u site_monitor.service gave me following error:
Nov 18 10:10:37 pop-os systemd[1]: site_monitor.service: Scheduled restart job, restart counter is at 4.
Nov 18 10:10:37 pop-os systemd[1]: Stopped Site Monitor Service.
Nov 18 10:10:37 pop-os systemd[1]: Started Site Monitor Service.
Nov 18 10:10:37 pop-os python3[111023]: Traceback (most recent call last):
Nov 18 10:10:37 pop-os python3[111023]: File "/home/hemantsah/WisdomLeaf/site_monitor/site_monitor.py", line 3, in <module>
Nov 18 10:10:37 pop-os python3[111023]: from bs4 import BeautifulSoup
Nov 18 10:10:37 pop-os python3[111023]: ModuleNotFoundError: No module named 'bs4'
Nov 18 10:10:37 pop-os systemd[1]: site_monitor.service: Main process exited, code=exited, status=1/FAILURE
Nov 18 10:10:37 pop-os systemd[1]: site_monitor.service: Failed with result 'exit-code'.
I guess you already have systemd in your machine, but in case you don't, you can install it via package manager, e.g. apt:
sudo apt-get install systemd
You can then, create your own systemd service. To do so, just create a new file in /etc/systemd/systemd/, something like /etc/systemd/systemd/your_service_name.service. That file should look like this:
[Unit]
Description= My service
After=multi-user.target
[Service]
Type=simple
WorkingDirectory=/path/to/your/working/dir/
User=<user>
Restart=always
ExecStart=/usr/bin/python3 /path/to/your/script/<script_name>.py
[Install]
WantedBy=multi-user.target
Of course you can use different python 3 binaries instead of /usr/bin/python3. Also, the service configuration itself can be different, the example above is just a basic service structure.
After creating this file (with root permissions), you should reload the daemon with:
sudo systemctl daemon-reload
And if you want to keep your script enabled even if the server/machine restarts, run:
sudo systemctl enable your_service_name.service
Finally, you can start your service using the following:
sudo systemctl start your_service_name.service

Systemd does not activate service?

I need to leave a service on systemd running because it doesn't activate? For what reason this happens since I follow the recommendation of the documentation, below are the codes:
Code of the Service :
# Contents of /etc/systemd/system/quark.service
[Unit]
Description=Quark
After=network.target
[Service]
Type=simple
User=cto
ExecStart=/usr/local/bin/python3.9 /var/net/
Restart=always
[Install]
WantedBy=multi-user.target
Status Code :
● quark.service - Quark
Loaded: loaded (/etc/systemd/system/quark.service; enabled; vendor preset: en
Active: failed (Result: exit-code) since Mon 2021-06-21 15:20:34 UTC; 8s ago
Process: 1467 ExecStart=/usr/local/bin/python3.9 /var/net/ (code=exited, statu
Main PID: 1467 (code=exited, status=1/FAILURE)
Jun 21 15:20:34 webstrucs systemd[1]: quark.service: Main process exited, code=e
Jun 21 15:20:34 webstrucs systemd[1]: quark.service: Failed with result 'exit-co
Jun 21 15:20:34 webstrucs systemd[1]: quark.service: Service RestartSec=100ms ex
Jun 21 15:20:34 webstrucs systemd[1]: quark.service: Scheduled restart job, rest
Jun 21 15:20:34 webstrucs systemd[1]: Stopped Quark.
Jun 21 15:20:34 webstrucs systemd[1]: quark.service: Start request repeated too
Jun 21 15:20:34 webstrucs systemd[1]: quark.service: Failed with result 'exit-co
Jun 21 15:20:34 webstrucs systemd[1]: Failed to start Quark.
The ExecStart should be the command to be executed:
systemd manpages:
ExecStart=
Commands with their arguments that are executed when this service is started.
This stanza:
ExecStart=/usr/local/bin/python3.9 /var/net/
Should be:
ExecStart=/usr/local/bin/python3.9 path_to_python_script.py

How to auto-mount veracrypt device-hosted volume with systemd after login on Linux Mint?

I created /etc/systemd/system/veracrypt-automount-devices.service:
[Unit]
Description=VeraCrypt auto-mount device-hosted volumes
[Service]
Type=forking
ExecStartPre=/bin/sleep 300
ExecStart=/usr/bin/veracrypt --auto-mount=devices /media/veracrypt1
[Install]
WantedBy=multi-user.target
Then I did:
sudo systemctl daemon-reload
sudo systemctl enable veracrypt-automount-devices
sudo systemctl status veracrypt-automount-devices
● veracrypt-automount-devices.service - VeraCrypt auto-mount device-hosted volumes
Loaded: loaded (/etc/systemd/system/veracrypt-automount-devices.service; enabled; vendor preset: enabled)
Active: failed (Result: timeout) since Sat 2020-06-06 17:28:59 CEST; 8min ago
Process: 967 ExecStartPre=/bin/sleep 300 (code=killed, signal=TERM)
Jun 06 17:27:29 username-computername systemd[1]: Starting VeraCrypt auto-mount device-hosted volumes...
Jun 06 17:28:59 username-computername systemd[1]: veracrypt-automount-devices.service: Start-pre operation timed out. Terminating.
Jun 06 17:28:59 username-computername systemd[1]: veracrypt-automount-devices.service: Failed with result 'timeout'.
Jun 06 17:28:59 username-computername systemd[1]: Failed to start VeraCrypt auto-mount device-hosted volumes.
As you can see, it doesn't work.
If I grep syslog, here is what I find:
Jun 6 16:56:08 username-computername systemd[1]: veracrypt-automount-devices.service: Control process exited, code=exited status=1
Jun 6 16:56:08 username-computername veracrypt[969]: Enter password:
Jun 6 16:56:08 username-computername systemd[1]: veracrypt-automount-devices.service: Failed with result 'exit-code'.
Jun 6 17:28:59 username-computername systemd[1]: veracrypt-automount-devices.service: Start-pre operation timed out. Terminating.
Jun 6 17:28:59 username-computername systemd[1]: veracrypt-automount-devices.service: Failed with result 'timeout'.
Basically, what I want is to be asked for the password to decrypt the device-hosted volume after I logged in with my username and password in Linux Mint.
I found how to do it. I put the veracrypt command in ~/.profile to execute the program on login. See https://askubuntu.com/a/270050/787567.

Docker service hosts config failed to start

I have Debian 10 virtual machine.
And I want to be able to connect to the docker API from another host.
I can connect to docker from other host if I start docker deamon from console
dockerd -H unix:///var/run/docker.sock -H tcp://192.168.3.157
If I try to configure /etc/docker/daemon.json like
{
"hosts": ["unix:///var/run/docker.sock", "tcp://192.168.3.157"]
}
The command systemctl start docker fails. The command systemctl status docker have next output
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2019-11-02 11:32:26 MSK; 1min 10s ago
Docs: https://docs.docker.com
Process: 868 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1/FAILURE)
Main PID: 868 (code=exited, status=1/FAILURE)
Nov 02 11:32:24 debian-for-docker systemd[1]: Failed to start Docker Application Container Engine.
Nov 02 11:32:26 debian-for-docker systemd[1]: docker.service: Service RestartSec=2s expired, scheduling restart.
Nov 02 11:32:26 debian-for-docker systemd[1]: docker.service: Scheduled restart job, restart counter is at 3.
Nov 02 11:32:26 debian-for-docker systemd[1]: Stopped Docker Application Container Engine.
Nov 02 11:32:26 debian-for-docker systemd[1]: docker.service: Start request repeated too quickly.
Nov 02 11:32:26 debian-for-docker systemd[1]: docker.service: Failed with result 'exit-code'.
Nov 02 11:32:26 debian-for-docker systemd[1]: Failed to start Docker Application Container Engine.
Nov 02 11:32:53 debian-for-docker systemd[1]: docker.service: Start request repeated too quickly.
Nov 02 11:32:53 debian-for-docker systemd[1]: docker.service: Failed with result 'exit-code'.
Nov 02 11:32:53 debian-for-docker systemd[1]: Failed to start Docker Application Container Engine.
How should I configure the /etc/docker/daemon.json to make my deamon start properly?
I have found the answer.
It's here Unable to start docker after configuring hosts in daemon.json
I have created the file /etc/systemd/system/docker.service.d/override.conf with content
# Disable flags to dockerd, all settings are done in /etc/docker/daemon.json
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd
And then I restarted the service systemctl daemon-reload; systemctl restart docker

Resources