Ubuntu Server 18.04, droplet on DigitalOcean, works many years as a web server. UFW with some usual rules is installed. Problem: after restarting the server, I can't log in with SSH. There is simply no login prompt, the screen is blank. But - if I than open the Recovery Console (on DigitalOcean), I can log in (as expected). Then I use "ufw disable" and "ufw enable" and log out from Recovery Console. After that, I can always log in with SSH and work as normal. I can't find anything suspicious in log file. Any idea what to check?
JanezKranjski's questions
After a restart of the Ubuntu 18.04 server, I always noticed that services aren't available. If I use: UFW DISABLE and then UFW ENABLE, everything works fine until the next restart. In the log file after a restart, I found:
Jan 20 13:50:57 localhost ufw-init[245]: Problem running '/etc/ufw/user.rules'
Jan 20 13:50:57 localhost systemd[1]: ufw.service: Main process exited, code=exited, status=1/FAILURE
Jan 20 13:50:57 localhost systemd[1]: ufw.service: Failed with result 'exit-code'.
Jan 20 13:50:57 localhost systemd[1]: Failed to start Uncomplicated firewall.
What can be wrong? Is there any way to test user.rules?
I followed this tutorial (https://www.digitalocean.com/docs/networking/ipv6/how-to/enable/) to enable IPv6 on my existing Ubuntu 18.04.3 LTS Droplet on DigitalOcean. My server doesn’t have anything in /etc/netplan, so I followed instructions for Ubuntu 16.04 and change /etc/network/interfaces. I add suggested stuff (with changes to IPv6 addresses I got on DigitalOcean dashboard while enabling IPv6). After the service restart, I got:
Dec 16 06:00:41 localhost systemd[1]: Stopping Raise network interfaces...
Dec 16 06:00:41 localhost dhcpcd[1073]: eth0: deleted default route via 46.101.128.1
Dec 16 06:00:41 localhost dhcpcd[1073]: eth0: deleted IP address 46.101.132.77/18
Dec 16 06:00:41 localhost dhcpcd[1073]: eth0: deleting route to 46.101.128.0/18
Dec 16 06:00:41 localhost ifdown[1457]: RTNETLINK answers: No such process
Dec 16 06:00:41 localhost ifdown[1457]: RTNETLINK answers: Cannot assign requested address
Dec 16 06:00:41 localhost dhcpcd[1073]: eth0: arp if_readrawpacket: Network is down
Dec 16 06:00:41 localhost dhcpcd[1073]: eth0: carrier lost
Dec 16 06:00:41 localhost systemd[1]: Stopped Raise network interfaces.
Dec 16 06:00:41 localhost systemd[1]: Starting Raise network interfaces...
Dec 16 06:00:41 localhost dhcpcd[1073]: eth0: carrier acquired
Dec 16 06:00:41 localhost dhcpcd[1073]: eth0: IAID 86:e5:62:01
Dec 16 06:00:41 localhost dhcpcd[1073]: eth0: adding address fe80::88e6:3b61:12cd:fe3d
Dec 16 06:00:41 localhost dhcpcd[1073]: eth0: using static address 46.101.132.77/18
Dec 16 06:00:41 localhost dhcpcd[1073]: eth0: adding route to 46.101.128.0/18
Dec 16 06:00:41 localhost dhcpcd[1073]: eth0: adding default route via 46.101.128.1
Dec 16 06:00:41 localhost ifup[1544]: RTNETLINK answers: File exists
Dec 16 06:00:41 localhost ifup[1544]: Failed to bring up eth0.
Dec 16 06:00:41 localhost systemd[1]: networking.service: Main process exited, code=exited, status=1/FAILURE
Dec 16 06:00:41 localhost systemd[1]: networking.service: Failed with result 'exit-code'.
Dec 16 06:00:41 localhost systemd[1]: Failed to start Raise network interfaces.
Dec 16 06:00:42 localhost dhcpcd[1073]: eth0: soliciting an IPv6 router
Dec 16 06:00:55 localhost dhcpcd[1073]: eth0: no IPv6 Routers available
- Any idea what can be wrong?
- Why my server still uses the old way of networking (and not netplan)? I can't remember, if it was maybe upgraded in the past?
Regards.
In the bash script, I want to check if it is the first day of the month. Now I have:
if [ $DAY -eq 1 ]; then
rclone copy /tmp/$MONTH-$YEAR.tar.gz.gpg /server2/archive
fi
and I get an error:
[: -eq: unary operator expected
I tried many different syntaxes from the web, but I can't succeed. Any idea what is wrong? Ubuntu Server 18.04
As a Nginx noob, I have a problem which I can't solve. In Nginx website configuration I have:
server {
listen 443;
listen [::]:443;
ssl on;
ssl_certificate /etc/letsencrypt/live/website.eu/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/website.eu/privkey.pem;
server_name website.eu www.website.eu;
index index.html index.htm index.php;
root /var/www/website;
location / {
try_files $uri $uri/ =404;
}
location /pihole {
alias /var/www/html;
try_files $uri $uri/ /admin/index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
}
}
Website works, but the Pihole was installed in /var/www/html
folder.
If I try to access it, I get:
user@website:~$ curl -i https://www.website.eu/pihole
HTTP/1.1 301 Moved Permanently
Server: nginx/1.14.0 (Ubuntu)
Date: Fri, 01 Nov 2019 11:29:13 GMT
Content-Type: text/html
Content-Length: 194
Location: https://www.website.eu/pihole/
Connection: keep-alive
Any idea what is wrong?
We had Apache web server on Ubuntu 18.04 server. After our developers decided to use NGINX, we remove Apache and install NGINX. I had remove Apache with: - apt remove ... - systemctl stop apache2 - systemctl disable apache2 - check if something exists in /etc/systemd/apache* (nothing was there).
It works as it should, but I noticed the next lines in the log:
-- Reboot --
Jun 11 09:33:28 ela1 systemd[1]: Starting LSB: Apache2 web server...
Jun 11 09:33:28 ela1 apache2[892]: /etc/init.d/apache2: 46: .: Can't open /etc/apache2/envvars
Jun 11 09:33:29 ela1 apache2[892]: /etc/init.d/apache2: 57: .: Can't open /etc/apache2/envvars
Jun 11 09:33:29 ela1 systemd[1]: Started LSB: Apache2 web server.
Any idea how to get rid of Apache?
Using Ubuntu server 18.04. When I try with "apt update && apt upgrade", I get a warning:
1 package can be upgraded. Run 'apt list --upgradable' to see it.
If I then try with suggestion, I get:
Listing... Done
libneon27/bionic-updates 0.30.2-3~ubuntu18.04.1 i386 [upgradable from: 0.30.2-2build1]
N: There is 1 additional version. Please use the '-a' switch to see it
What is wrong (if something)?
UPDATE: "apt-cache policy libneon27":
libneon27:
Installed: 0.30.2-2build1
Candidate: 0.30.2-3~ubuntu18.04.1
Version table:
0.30.2-3~ubuntu18.04.1 500
500 http://mirrors.digitalocean.com/ubuntu bionic-updates/main i386 Packages
*** 0.30.2-2build1 500
500 http://mirrors.digitalocean.com/ubuntu bionic/main i386 Packages
100 /var/lib/dpkg/status
My friend asks me to prepare a Node.JS support on his server.
Here is hello.js:
#!/usr/bin/env nodejs
var https = require('https');
var fs = require('fs');
var options = {
key: fs.readFileSync('/etc/letsencrypt/live/xxxxx/privkey.pem'),
cert: fs.readFileSync('/etc/letsencrypt/live/xxxxx/cert.pem'),
ca: fs.readFileSync('/etc/letsencrypt/live/xxxxx/chain.pem')
};
https.createServer(options, function (req, res) {
res.writeHead(200);
res.end("Hello world! Node.js is working correctly on HTTPS!!\n");
}).listen(8000);
console.log('Server running at https://127.0.0.1:8080/');
Here is what is added in Appache site configuration:
ProxyRequests Off
ProxyPreserveHost On
ProxyVia Full
<Proxy *>
Require all granted
</Proxy>
<Location /nodejs>
ProxyPass https://127.0.0.1:8080
ProxyPassReverse https://127.0.0.1:8080
</Location>
"sudo node show hello.js" shows that everything is ok. I'm almost sure that problem is in Apache part of this problem. But what?
UPDATED: Some new details. Maybe someone will see a mistake. Apache .conf files:
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/example.com
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =example.com [OR]
RewriteCond %{SERVER_NAME} =www.example.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
ProxyRequests Off
ProxyPreserveHost On
ProxyVia Full
<Proxy *>
Require all granted
</Proxy>
<Location /nodejs>
ProxyPreserveHost On
ProxyPass https://www.example.com:8000
ProxyPassReverse https://www.example.com:8000
</Location>
<Directory "/var/www/example.com">
AuthType Basic
AuthName "Restricted Content"
AuthUserFile /etc/apache2/.htpasswd
Require valid-user
Options FollowSymLinks
AllowOverride All
</Directory>
</VirtualHost>
********
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerAdmin [email protected]
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/example.com
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
<Directory "/var/www/example.com">
AuthType Basic
AuthName "Restricted Content"
AuthUserFile /etc/apache2/.htpasswd
Require valid-user
</Directory>
</VirtualHost>
</IfModule>
I tried on server and here are two results:
sudo wget --user ime --password geslo https://www.example.com:8000
This WORKS (I get index.html with right response from Node.js app).
sudo wget --user ime --password geslo https://www.example.com/nodejs
This DON'T WORK (I get "nodejs" file with a code for folder contents).
Any idea?
I'm giving up. I tried many changes, but can't find what is wrong. In fstab file I have this line:
https://webdav.pcloud.com /home/pi/pCloud davfs auto,_netdev,rw,user 0 0
If I try to "sudo mount -a", I'm getting an error:
mount: /etc/fstab: parse error at line 9 -- ignored
What is wrong? I tried with changing all parameters (step by step), but nothing helps. Folder is available, web address is available, options are correct, EOF is there ...
Any idea?
After some weeks of working full resolution, now I get 800x600. I didn't change any settings, so it have to be a bug. Another problem is, that I can't change it back to 1920x1080. The dialog in settings is cut at the right (I can choose bigger resolution in dialog, but I don't know what are buttons on right (Apply/ok/Cancel ...)). 1. Can I change resolution with command line? I tried some suggestions, but it looks that 17.10 doesn't have the same technique. 2. Why is this happening so often in Ubuntu? There are many questions (for different versions, GUIs ...) where users fall into this problem. This is (rare) thing where Windows are better :-)
How can I check if OpenVPN is running on my server? I have tried with "sudo systemctl status openvpn", but I'm not sure if everything is ok, because I get: "Active: active (exited) since ..."
● openvpn.service - OpenVPN service
Loaded: loaded (/lib/systemd/system/openvpn.service; enabled; vendor preset: enabled)
Active: active (exited) since Mon 2017-10-23 08:01:05 CEST; 1h 3min ago
Process: 2356 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
Main PID: 2356 (code=exited, status=0/SUCCESS)
Tasks: 0 (limit: 4915)
CGroup: /system.slice/openvpn.service
Why "exited"? The similar occurs two lines bellow (Process and Main PID).
I have one simple .sh script:
#!/bin/bash
echo "Test1"
touch /home/john/test.txt
echo "Test2"
It is executable and available (ugo+x). If I run this script, it works like I expected.
But if I try to run it in crontab, then I don't get any results. I can see in log, that job starts and I get (No MTA installed, discarding output).
AFAIK - this message isn't error? It just means that I don't have a mail (or other output channel)? But why there is no results from script? BTW - in CRONTAB I use next line:
30 * * * * sh file.sh >> /home/john/log.log
Any idea?
I have Mail client installed on my Ubuntu server. I know how to send email from terminal and I know how to read email, if I get it. But - how can I enter in Mail client if I don't have any new mail. To be more understandable - I want to enter the part where can I see commands like alias, alt, copy, cd, ch, dec, delete ... Or maybe - how can I find (read) all sent mails?
UPDATE: I use Mail (GNU Mailutils 2.99.99). If I have a new mail and write "mail" then it opens a program where I can read an email (with inserting a number written before name and subject). I can also type "?" to get more help, where I can see many options (write, save, send, delete ...). This is ok. But - if I don't have any email waiting for me and if I write "mail" in terminal, I get only message "No mail for xxxx". It stays in Linux terminal, but I'm sure, it can open a Mail program somehow.
I'm using Ubuntu 16.04 and until yesterday I used UFW and had only some basic rules. Now I need to have more complex rules and I decided to use iptables (if I understand right, I can't have my firewall rules in file without it).
Now I see an error for netfilter-persistance.service if I run:
sudo systemctl status netfilter-persistent.service
Any idea?
Please leave all security words beside.
I'm the only one who has access to Ubuntu server and I login to it only when I have something to work with system administration. So I know what I'm doing and I'm aware of it. Now my system works with sudo without asking for password. Is it possible that it runs (system) programs without typing sudo?
And once again - I understand that someone can see this as security mistake, but please, don't write about it.
I just installed XUbuntu on my Vmware Workstation.
After I saw, that I can't change display settings (resolution), I try to install VMware Tools. But - after I run vmware-install.pl
, I get a message:
The following VMware kernel modules have been found on your system that were
not installed by the VMware Installer. Please remove them then run this
installer again.
vmci
Execution aborted.
What can I do?
I tried copy.com cloud client on my Lubuntu. I can't find any instructions how to remove it. Any idea?
Maybe this instructions for installation will helps someone: https://copy.zendesk.com/entries/24061068-How-do-I-install-Copy-for-Linux-
How can I disable spell checker in Pidgin? Any idea? I searched on the web, but didn't find anything.
I use Lubuntu and want to set bigger Terminal window (for default). How can I do that?
Maybe in lxterminal.conf but how?
Can someone help how to change default Terminal windows size in XUbuntu?
After some surfing, I found instructions for Gnome. Maybe I don't understand, but XUbuntu doesn't use Gnome?
Thanks in advance.