I want to know if my server was shutdown and time that is shutting down in - ubuntu-server

i have a server hp with ubuntu server
I want to know if my server was shutdown and time that is shutting down in
there are something to know a logs of my server

You can try the last reboot command to get some basic information about the most recent reboots and the uptime between them.
# last reboot
reboot system boot 2.6.32-431.3.1.e Fri Mar 14 07:02 - 01:51 (8+18:49)
reboot system boot 2.6.32-431.3.1.e Sun Feb 16 02:15 - 06:59 (26+03:44)
reboot system boot 2.6.32-431.3.1.e Sun Jan 26 16:21 - 06:59 (46+13:38)
reboot system boot 2.6.32-358.11.1. Sun Oct 13 18:53 - 16:18 (104+22:25)
reboot system boot 2.6.32-358.11.1. Sun Oct 6 10:10 - 18:50 (7+08:40)
reboot system boot 2.6.32-358.11.1. Sat Jun 29 09:28 - 10:06 (99+00:38)
reboot system boot 2.6.32-358.11.1. Sat Jun 29 09:06 - 09:25 (00:19)
reboot system boot 2.6.32-358.6.2.e Sat Jun 29 08:46 - 09:01 (00:15)

Related

clamav-daemon doesn't create /var/run/clamd.ctl [closed]

Closed. This question is not about programming or software development. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 3 days ago.
Improve this question
I installed clamav-daemon on Debian 11 and when I try to start it, it doesn't create the LocalSocket /var/run/clamd.ctl.
LocalSocket in my /etc/clamav/clamd.conf:
LocalSocket /var/run/clamav/clamd.ctl
systemctl status clamav-daemon.service brings:
● clamav-daemon.service - Clam AntiVirus userspace daemon
Loaded: loaded (/lib/systemd/system/clamav-daemon.service; enabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/clamav-daemon.service.d
└─extend.conf, override.conf
Active: active (running) since Fri 2023-02-17 15:55:18 CET; 34min ago
Docs: man:clamd(8)
man:clamd.conf(5)
https://docs.clamav.net/
Process: 37394 ExecStartPre=/bin/mkdir -p /run/clamav (code=exited, status=0/SUCCESS)
Process: 37395 ExecStartPre=/bin/chown clamav /run/clamav (code=exited, status=0/SUCCESS) Main PID: 37396 (clamd)
Tasks: 1 (limit: 1129)
Memory: 489.8M
CPU: 52.996s
CGroup: /system.slice/clamav-daemon.service
└─37396 /usr/sbin/clamd --foreground=true
Feb 17 15:55:18 cc700x-irmler systemd[1]: clamav-daemon.service:
Consumed 11.193s CPU time. Feb 17 15:55:18 cc700x-irmler systemd[1]:
Starting Clam AntiVirus userspace daemon... Feb 17 15:55:18
cc700x-irmler systemd[1]: Started Clam AntiVirus userspace daemon.
So, it seems everything to be fine. But:
systemctl status clamav-daemon.socket brings:
Unit clamav-daemon.socket could not be found.
/var/log/clamav/clamav.log brings (when starting):
Fri Feb 17 15:55:19 2023 -> +++ Started at Fri Feb 17 15:55:19 2023
Fri Feb 17 15:55:19 2023 -> Received 0 file descriptor(s) from
systemd. Fri Feb 17 15:55:19 2023 -> clamd daemon 0.103.7 (OS:
linux-gnu, ARCH: x86_64, CPU: x86_64) Fri Feb 17 15:55:19 2023 -> Log
file size limited to 4294967295 bytes. Fri Feb 17 15:55:19 2023 ->
Reading databases from /var/lib/clamav Fri Feb 17 15:55:19 2023 -> Not
loading PUA signatures. Fri Feb 17 15:55:19 2023 -> Bytecode: Security
mode set to "TrustSigned". Fri Feb 17 16:08:12 2023 -> Loaded 8652992
signatures.
/var/log/clamav/clamav-milter.log brings (as the /var/run/clamav/clamd.ctl is missing):
Fri Feb 17 16:27:05 2023 -> WARNING: No clamd server appears to be
available Fri Feb 17 16:28:05 2023 -> WARNING: No clamd server appears
to be available Fri Feb 17 16:29:04 2023 -> WARNING: No clamd server
appears to be available Fri Feb 17 16:30:03 2023 -> WARNING: No clamd
server appears to be available Fri Feb 17 16:31:02 2023 -> WARNING: No
clamd server appears to be available Fri Feb 17 16:32:01 2023 ->
WARNING: No clamd server appears to be available
The permissions for /var/run/ is set for the user "clamav" and group "root". clamav is also the user who runs the process:
ps aux | grep clamav
clamav 500 0.0 0.0 58248 704 ? Ss 14:22 0:00
/usr/bin/freshclam -d --foreground=true clamav 31064 0.0 0.0
349480 52 ? Ssl 14:55 0:00 /usr/sbin/clamav-milter
--config-file=/etc/clama v/clamav-milter.conf clamav 37396 2.2 42.5 1395520 425952 ? Ds 15:55 0:55 /usr/sbin/clamd --foreground=true root 38870 0.0 0.0 6244 700 pts/1 S+ 16:36 0:00 grep clamav
I tried already to purge/install and also --reinstall clamav and clamav-daemon and I also tried a dpkg-reconfigure on clamav-daemon. And I also tried a clean reboot. Nothing changed the situation.
I have no idea what else I could try. Has anyone an idea?
Thanks a lot!

Error in Bluetooth Status - Raspberry Pi - "Failed to set privacy: Rejected (0x0b)"

I'm in the very early stages of doing some Bluetooth Mesh work on my Raspberry Pi 4.
From the instructions I have found that a rebuild of the Kernel is required to enable the Crypto APIs that Mesh requires.
I am starting with
pi#pi-4:~ $ uname -a
Linux pi-4 5.10.63-v7l+ #1459 SMP Wed Oct 6 16:41:57 BST 2021 armv7l GNU/Linux
pi#pi-4:~ $ bluetoothd -v
5.55
And rebuilt the kernel using
git clone --depth=1 https://github.com/raspberrypi/linux
cd linux
KERNEL=kernel7l
make bcm2711_defconfig
vi .config # to customize the local name of the kernel build
make menuconfig
Of note, I have seen varying documents on which kernel options to set so I went with the superset of options. Set via a combination of vi and the UI. The resulting edits were
CONFIG_EXPERT=y
CONFIG_TIMERFD=y
CONFIG_EVENTFD=y
CONFIG_NET=y
CONFIG_BT=y
CONFIG_BT_RFCOMM=y
CONFIG_BT_RFCOMM_TTY=y
CONFIG_BT_BNEP=y
CONFIG_BT_BNEP_MC_FILTER=y
CONFIG_BT_BNEP_PROTO_FILTER=y
CONFIG_BT_HIDP=y
CONFIG_RFKILL=y
CONFIG_CRYPTO_USER=y
CONFIG_CRYPTO_USER_API_HASH=y
CONFIG_CRYPTO_USER_API_SKCIPHER=y
CONFIG_CRYPTO_MD5=y
CONFIG_CRYPTO_SHA1=y
CONFIG_KEY_DH_OPERATIONS=y
CONFIG_CRYPTO_USER_API_AEAD=y
CONFIG_CRYPTO_USER_API_HASH=y
CONFIG_CRYPTO_AES=y
CONFIG_CRYPTO_CCM=y
CONFIG_CRYPTO_AEAD=y
CONFIG_CRYPTO_CMAC=y
I also edited the statup command line option to turn off the SAP plug-in to get rid of that startup error.
KERNEL=kernel7l
make -j4 zImage modules dtbs
sudo make modules_install
sudo cp arch/arm/boot/dts/*.dtb /boot/
sudo cp arch/arm/boot/dts/overlays/*.dtb* /boot/overlays/
sudo cp arch/arm/boot/dts/overlays/README /boot/overlays/
sudo cp arch/arm/boot/zImage /boot/$KERNEL.img
pi#pi-4-x:~/ell-0.9/linux $ sudo reboot now
Connection to pi-4-x closed by remote host.
Connection to pi-4-x closed.
.
. reconnect
.
pi#pi-4:~ $ uname -a
Linux pi-4 5.10.90-v7l-With-BlueZ-Crypto+ #2 SMP Fri Jan 14 16:00:58 EST 2022 armv7l GNU/Linux
Now I am looking at this error when I check the status. This error is the SAME when using the BlueZ shipped with the distribution (5.55) and when rebuilding from source (5.63).
Any ideas?
Failed to set privacy: Rejected (0x0b)
pi#pi-4:~/linux $ sudo service bluetooth status
● bluetooth.service - Bluetooth service
Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2022-01-18 11:32:44 EST; 11min ago
Docs: man:bluetoothd(8)
Main PID: 1726 (bluetoothd)
Status: "Running"
Tasks: 1 (limit: 3715)
CPU: 59ms
CGroup: /system.slice/bluetooth.service
└─1726 /usr/libexec/bluetooth/bluetoothd --noplugin=sap
Jan 18 11:32:44 pi-4 systemd[1]: Starting Bluetooth service...
Jan 18 11:32:44 pi-4 bluetoothd[1726]: Bluetooth daemon 5.55
Jan 18 11:32:44 pi-4 systemd[1]: Started Bluetooth service.
Jan 18 11:32:44 pi-4 bluetoothd[1726]: Starting SDP server
Jan 18 11:32:44 pi-4 bluetoothd[1726]: Excluding (cli) sap
Jan 18 11:32:44 pi-4 bluetoothd[1726]: Bluetooth management interface 1.18 initialized
Jan 18 11:32:44 pi-4 bluetoothd[1726]: Failed to set privacy: Rejected (0x0b)
Jan 18 11:32:44 pi-4 bluetoothd[1726]: Endpoint registered: sender=:1.21 path=/MediaEndpoint/A2DPSink/sbc
Jan 18 11:32:44 pi-4 bluetoothd[1726]: Endpoint registered: sender=:1.21 path=/MediaEndpoint/A2DPSource/sbc

CentOS 7 - boot order needs to be changed in order for sge to start automatically

It seems like sge tries start before lustre is mounted when the server boots, which brings an error to start automatically when it reboots.
Can somebody tell me how to change the order when it boots, so sge starts after lustre is mounted?
Error message from the log:
Aug 12 11:46:21 dragen1 systemd: Configuration file /usr/lib/systemd/system/sge_execd.service is marked executable. Please remove executable permission bits. Proceeding anyway.
Aug 12 11:46:40 dragen1 sge_execd: error: SGE_ROOT directory "/cm/shared/apps/sge/2011.11p1" doesn't exist
Aug 12 11:46:40 dragen1 systemd: sge_execd.service: control process exited, code=exited status=1
Aug 12 11:46:40 dragen1 systemd: Unit sge_execd.service entered failed state.
Aug 12 11:46:40 dragen1 systemd: sge_execd.service failed
I added in the following under [Unit] from the sge service
RequiresMountsFor=(Mount Point)
This fixed the problem.

Can't start newly installed PostgreSQL on Fedora

I just installed PostgreSQL (9.3) on my Linux Fedora (21) - Shown below
yum installer returns 'already installed' as this is the second time I run it, to get a screengrab for you.
systemctl enable postgresq, seems to work. At least it returns no errors.
systemctl start postgresql fails. The log says "data directory "/ConfigDir" does not exist" So I guess that's the key.
But the /ConfigDir do exis. It's /usr/local/pgsql/data as is default on a Fedora PostgreSQL instalation. It is tough owned by user:postgres
I guess that the start of the postgres server service fails because it somehow can't see the directory, likely because it's not trying as user:postgres.
But I don't know how to check this, nor how to mend it.
[martin#helium ~]$ sudo yum install postgresql-server postgresql-contrib
[sudo] password for martin:
Loaded plugins: langpacks
Package postgresql-server-9.3.9-1.fc21.x86_64 already installed and latest version
Package postgresql-contrib-9.3.9-1.fc21.x86_64 already installed and latest version
Nothing to do
[martin#helium ~]$ sudo systemctl enable postgresql
[martin#helium ~]$ sudo systemctl start postgresql
Job for postgresql.service failed. See "systemctl status postgresql.service" and "journalctl -xe" for details.
[martin#helium ~]$ journalctl -xn
-- Logs begin at Fri 2014-12-26 16:16:25 CET, end at Sun 2016-02-07 14:35:11 CET. --
Feb 07 14:35:06 helium.hvidberg.net sudo[3466]: martin : TTY=pts/0 ; PWD=/home/martin ; USER=root ; COMMAND=/bin/systemctl start postgresql
Feb 07 14:35:06 helium.hvidberg.net sudo[3466]: pam_unix(sudo:session): session opened for user root by martin(uid=0)
Feb 07 14:35:06 helium.hvidberg.net pg_ctl[3476]: FATAL: data directory "/ConfigDir" does not exist
Feb 07 14:35:11 helium.hvidberg.net pg_ctl[3476]: pg_ctl: could not start server
Feb 07 14:35:11 helium.hvidberg.net pg_ctl[3476]: Examine the log output.
Feb 07 14:35:11 helium.hvidberg.net systemd[1]: postgresql.service: control process exited, code=exited status=1
Feb 07 14:35:11 helium.hvidberg.net systemd[1]: Failed to start PostgreSQL database server.
-- Subject: Unit postgresql.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit postgresql.service has failed.
--
-- The result is failed.
Feb 07 14:35:11 helium.hvidberg.net systemd[1]: Unit postgresql.service entered failed state.
Feb 07 14:35:11 helium.hvidberg.net systemd[1]: postgresql.service failed.
Feb 07 14:35:11 helium.hvidberg.net sudo[3466]: pam_unix(sudo:session): session closed for user root
[martin#helium ~]$
Change to root to be able to see the postgresql data directory
[root#helium data]# pwd
/usr/local/pgsql/data
[root#helium data]# ls -l
total 100
drwx------. 5 postgres postgres 4096 Feb 6 19:00 base
drwx------. 2 postgres postgres 4096 Feb 6 19:03 global
drwx------. 2 postgres postgres 4096 Feb 6 19:00 pg_clog
-rw-------. 1 postgres postgres 4476 Feb 6 19:00 pg_hba.conf
-rw-------. 1 postgres postgres 1636 Feb 6 19:00 pg_ident.conf
drwx------. 2 postgres postgres 4096 Feb 6 19:03 pg_log
drwx------. 4 postgres postgres 4096 Feb 6 19:00 pg_multixact
drwx------. 2 postgres postgres 4096 Feb 6 19:03 pg_notify
drwx------. 2 postgres postgres 4096 Feb 6 19:00 pg_serial
drwx------. 2 postgres postgres 4096 Feb 6 19:00 pg_snapshots
drwx------. 2 postgres postgres 4096 Feb 6 19:05 pg_stat
drwx------. 2 postgres postgres 4096 Feb 6 19:05 pg_stat_tmp
drwx------. 2 postgres postgres 4096 Feb 6 19:00 pg_subtrans
drwx------. 2 postgres postgres 4096 Feb 6 19:00 pg_tblspc
drwx------. 2 postgres postgres 4096 Feb 6 19:00 pg_twophase
-rw-------. 1 postgres postgres 4 Feb 6 19:00 PG_VERSION
drwx------. 3 postgres postgres 4096 Feb 6 19:00 pg_xlog
-rw-------. 1 postgres postgres 20733 Feb 7 10:26 postgresql.conf
-rw-------. 1 postgres postgres 47 Feb 6 19:03 postmaster.opts
[root#helium data]#

Failing to start systemd service

I have written the following systemd service to login at the wireless at boot:
[Unit]
Description=Wireless network connectivity (%i)
Wants=network.target
Before=network.target
BindsTo=sys-subsystem-net-devices-%i-device
After=sys-subsystem-net-devices-%i-device
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/ip link set dev %i up
ExecStart=/usr/bin/wpa_supplicant -B -i %i -c /etc/wpa_supplicant/wpa_supplicant.conf
ExecStart=/usr/bin/dhcpcd %i
ExecStop=/usr/bin/ip link set dev %i down
[Install]
WantedBy=multi-user.target
I then enable it but I get the following error every time I boot my computer:
[abc#arch ~]$ systemctl --failed
UNIT LOAD ACTIVE SUB DESCRIPTION
● network-wireless#wlp3s0.service loaded failed failed Wireless network connectivity (wlp3s0)
However if I manually start this service after boot with:
systemctl start network-wireless#xlp3s0
the service starts as expected.
This is the content of wpa_supplicant.conf
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=wheel
network={
ssid="TeliaGateway30-91-8F-1C-B2-29"
#psk="A80871A90A"
psk=b4d8a1e9ad665eed0178fea6f141134e795e15183a661848b371a41bb73a6844
}
Why is this services starting ok when starting it manually but not at boot and how can I change it to start at boot?
EDIT: Added error output:
This is what error im getting:
[abc#arch ~]$ journalctl -b -u network-wireless#wlp3s0.service
-- Logs begin at Sat 2015-08-22 12:50:42 CEST, end at Sun 2015-08-23 22:15:26 CEST. --
Aug 23 21:23:36 arch systemd[1]: Starting Wireless network connectivity (wlp3s0)...
Aug 23 21:23:36 arch ip[274]: Cannot find device "wlp3s0"
Aug 23 21:23:36 arch systemd[1]: network-wireless#wlp3s0.service: Main process exited, code=exited, status=1/FAILURE
Aug 23 21:23:36 arch systemd[1]: Failed to start Wireless network connectivity (wlp3s0).
Aug 23 21:23:37 arch systemd[1]: network-wireless#wlp3s0.service: Unit entered failed state.
Aug 23 21:23:37 arch systemd[1]: network-wireless#wlp3s0.service: Failed with result 'exit-code'.
Aug 23 21:25:11 arch systemd[1]: Starting Wireless network connectivity (wlp3s0)...
Aug 23 21:25:11 arch dhcpcd[424]: wlp3s0: waiting for carrier
Aug 23 21:25:16 arch dhcpcd[424]: wlp3s0: carrier acquired
Aug 23 21:25:16 arch dhcpcd[424]: DUID 00:01:00:01:1d:6b:6b:e6:10:0d:7f:b7:30:f3
Aug 23 21:25:16 arch dhcpcd[424]: wlp3s0: IAID c1:c4:73:e0
Aug 23 21:25:16 arch dhcpcd[424]: wlp3s0: soliciting an IPv6 router
Aug 23 21:25:16 arch dhcpcd[424]: wlp3s0: rebinding lease of 192.168.1.85
Aug 23 21:25:21 arch dhcpcd[424]: wlp3s0: leased 192.168.1.85 for 3600 seconds
Aug 23 21:25:21 arch dhcpcd[424]: wlp3s0: adding route to 192.168.1.0/24
Aug 23 21:25:21 arch dhcpcd[424]: wlp3s0: adding default route via 192.168.1.1
Aug 23 21:25:21 arch dhcpcd[424]: forked to background, child pid 477
Aug 23 21:25:21 arch dhcpcd[424]: wlp3s0: waiting for carrier
Aug 23 21:25:21 arch dhcpcd[424]: wlp3s0: carrier acquired
Aug 23 21:25:21 arch dhcpcd[424]: DUID 00:01:00:01:1d:6b:6b:e6:10:0d:7f:b7:30:f3
Aug 23 21:25:21 arch dhcpcd[424]: wlp3s0: IAID c1:c4:73:e0
Aug 23 21:25:21 arch dhcpcd[424]: wlp3s0: soliciting an IPv6 router
Aug 23 21:25:21 arch dhcpcd[424]: wlp3s0: rebinding lease of 192.168.1.85
Aug 23 21:25:21 arch dhcpcd[424]: wlp3s0: leased 192.168.1.85 for 3600 seconds
Aug 23 21:25:21 arch dhcpcd[424]: wlp3s0: adding route to 192.168.1.0/24
Aug 23 21:25:21 arch dhcpcd[424]: wlp3s0: adding default route via 192.168.1.1
Aug 23 21:25:21 arch dhcpcd[424]: forked to background, child pid 477
Aug 23 21:25:21 arch systemd[1]: Started Wireless network connectivity (wlp3s0).
Aug 23 21:25:28 arch dhcpcd[477]: wlp3s0: no IPv6 Routers available
Aug 23 22:15:09 arch dhcpcd[477]: wlp3s0: carrier lost
Aug 23 22:15:09 arch dhcpcd[477]: wlp3s0: deleting route to 192.168.1.0/24
Aug 23 22:15:09 arch dhcpcd[477]: wlp3s0: deleting default route via 192.168.1.1
Aug 23 22:15:13 arch dhcpcd[477]: wlp3s0: carrier acquired
Aug 23 22:15:14 arch dhcpcd[477]: wlp3s0: IAID c1:c4:73:e0
Aug 23 22:15:14 arch dhcpcd[477]: wlp3s0: soliciting an IPv6 router
Aug 23 22:15:14 arch dhcpcd[477]: wlp3s0: rebinding lease of 192.168.1.85
Aug 23 22:15:19 arch dhcpcd[477]: wlp3s0: leased 192.168.1.85 for 3600 seconds
Aug 23 22:15:19 arch dhcpcd[477]: wlp3s0: adding route to 192.168.1.0/24
Aug 23 22:15:19 arch dhcpcd[477]: wlp3s0: adding default route via 192.168.1.1
Aug 23 22:15:19 arch dhcpcd[477]: wlp3s0: removing route to 192.168.1.0/24
Aug 23 22:15:26 arch dhcpcd[477]: wlp3s0: no IPv6 Routers available
EDIT:
I have found one potetential error, it seems as if the network interface changes name from wlan0 during boot, however i have tried starting the service with wlan0 but with no change in the result.
The reason the service stops at boot is because the ip command cannot find the interface. According to the man page for systemd services that is enough reason to fail the service.
As you noticed yourself the interface gets renamed or is not ready yet at boot.
You can check if you need to add an After= statement
You can check with the systemd-analyze command if the ordering at boot is correct
You could split up the service and make it more robust. Most daemons can start fine even if the interface is not ready yet.
Personally I would make dhcpd and wpa_supplicant separate services and use systemd's networkd or an udev rule to bring up the interface (if that is even needed). There are a lot examples of unit files for wpa_supplicant and dhcpd online maybe have look at those?

Resources