Failed to connect to ClamAV

After a Debian Jessie update clamav-daemon starts spouting out:

(!)connect to /var/run/clamav/clamd.ctl failed, attempt #1: Can't connect to a UNIX socket /var/run/clamav/clamd.ctl: No such file or directory

To correct, edit /etc/clamav/clamd.conf  and comment out (so that it looks like follows)

#AllowSupplementaryGroups true

And then restart the clam daemon with

service clamav-daemon restart

 

Public key in ~/.ssh/authorized_keys ignored

When you add your pubkey to an openssh server’s config in ~/.ssh/authorized_keys permissions are important or it will ignore your login attempt.

Lock down .ssh directory

chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys

 

Lock down home directory

chmod g-w,o-w /home/USERNAME

 

Should let you back in.

Force IPv4 for apt-get

Running an apt-get update or an apt-get install occasionally times out on VMs that I am building before I have setup IPv6.  Instead of waiting the (seemingly) long time for it to timeout, just add:

-o Acquire::ForceIPv4=true

to the end of the apt-get command to force IPv4.

And to make it permanent:

create /etc/apt/apt.conf.d/99force-ipv4 and put in it:

Acquire::ForceIPv4 "true";

Cannot get array info for /dev/md0

When adding a disk back to an mdadm array I got this error for the md0 array which was actually my swap partition.

root@mothership2 ~ # mdadm --manage /dev/md0 --add /dev/sdb1
mdadm: Cannot get array info for /dev/md0

To fix this you have to run:

mdadm --stop /dev/md0
mdadm --assemble --scan

Then you can add the drive to array like so:

mdadm --manage /dev/md0 --add /dev/sdb1
mdadm: added /dev/sdb1
You have new mail in /var/mail/root

Installing iptables-persistent on OVH kimsufi

If you try to sudo apt-get install iptables-persistent on you may get this error:

root@mothership:~# apt-get install netfilter-persistent
Reading package lists... Done
Building dependency tree
Reading state information... Done
netfilter-persistent is already the newest version.
The following package was automatically installed and is no longer required:
  bind9utils
Use 'apt-get autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up netfilter-persistent (1.0.3) ...
update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults
A dependency job for netfilter-persistent.service failed. See 'journalctl -xn' for details.
invoke-rc.d: initscript netfilter-persistent, action "start" failed.
dpkg: error processing package netfilter-persistent (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of iptables-persistent:
 iptables-persistent depends on netfilter-persistent (= 1.0.3); however:
  Package netfilter-persistent is not configured yet.

dpkg: error processing package iptables-persistent (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 netfilter-persistent
 iptables-persistent
E: Sub-process /usr/bin/dpkg returned an error code (1)

Sep 02 18:45:31 mothership.installgentoo.com systemd-modules-load[12122]: Failed to lookup alias 'ipmi_poweroff':
Sep 02 18:45:31 mothership.installgentoo.com systemd-modules-load[12122]: could not open moddep file '/lib/module
Sep 02 18:45:31 mothership.installgentoo.com systemd-modules-load[12122]: Failed to lookup alias 'ipmi_si': Funct
Sep 02 18:45:31 mothership.installgentoo.com systemd-modules-load[12122]: could not open moddep file '/lib/module
Sep 02 18:45:31 mothership.installgentoo.com systemd-modules-load[12122]: Failed to lookup alias 'ipmi_watchdog':
Sep 02 18:45:31 mothership.installgentoo.com systemd[1]: systemd-modules-load.service: main process exited, code=
Sep 02 18:45:31 mothership.installgentoo.com systemd[1]: Failed to start Load Kernel Modules.

To resolve you have to edit the file:

/usr/lib/modules-load.d/ipmievd.conf

and comment out like so:

#ipmi_devintf
#ipmi_msghandler
#ipmi_poweroff
#ipmi_si
#ipmi_watchdog

then reboot

nginx fail to install Debian 8 Jessie

After you sudo apt-get install nginx-full and you get this:

nginx: Setting up nginx-full (1.9.2-1) ...
nginx: Starting nginx: nginx failed!
nginx: invoke-rc.d: initscript nginx, action "start" failed.
nginx: dpkg: error processing nginx-full (--configure):
nginx: subprocess installed post-installation script returned error exit status 1
nginx: dpkg: dependency problems prevent configuration of nginx:
nginx: nginx depends on nginx-full (>= 1.9.2-1) | nginx-light (>= 1.9.2-1) | nginx-extras (>=
1.9.2-1); however:
nginx: Package nginx-full is not configured yet.
nginx: Package nginx-light is not installed.
nginx: Package nginx-extras is not installed.
nginx: nginx depends on nginx-full (<< 1.9.2-1.1~) | nginx-light (<< 1.9.2-1.1~) | nginx-extras
(<< 1.9.2-1.1~); however:
nginx: Package nginx-full is not configured yet.
nginx: Package nginx-light is not installed.
nginx: Package nginx-extras is not installed.
nginx:
nginx: dpkg: error processing nginx (--configure):
nginx: dependency problems - leaving unconfigured
nginx: Errors were encountered while processing:
nginx: nginx-full
nginx: nginx
nginx: E: Sub-process /usr/bin/dpkg returned an error code (1)
Failed nginx install.
Skipped nginx config, due to presence in failed steps
1 steps selected, 1 failed.
Failed steps: nginx

All you need to do is remove:

listen [::]:80 default_server;

from /etc/nginx/sites-enabled/default.

This is caused if you server does not support IPv6 but nignx is trying to listen on it.

node.js on Debian

After installing node.js and npm and you go to run a node application you get this error:

sh: 1: node: not found
npm ERR! error installing chokidar@0.4.0
npm WARN This failure might be due to the use of legacy binary "node" 
npm WARN For further explanations, please read
npm WARN /usr/share/doc/nodejs/README.Debian
npm WARN

This is because in debian nodejs installs to /usr/bin/nodejs while the script/program is looking for /usr/bin/node.

To fix just run:

sudo ln -s /usr/bin/nodejs /usr/bin/node