mariabackup: empty backup file - mariadb

I'm trying to automate our backups of some mysql databases in MariaDB Server 10.2.15 on CentOS 7.5:
mariabackup --backup --target-dir=/srv/db_backup --databases="wordpress" --xbstream | \
openssl enc -aes-256-cbc -k mysecretpassword > \
$(date +"%Y%m%d%H").backup.xb.enc
What I expect is a file in /srv/db_backup called $(date +"%Y%m%d%H").backup.xb.enc
What I'm finding is a file called $(date +"%Y%m%d%H").backup.xb.enc in my home directory with file size 0, and the /srv/db_backup dir looks like:
[root#wordpressdb1 ~]# ls -la /srv/db_backup/
total 77868
-rw------- 1 root root 16384 Jul 31 14:30 aria_log.00000001
-rw------- 1 root root 52 Jul 31 14:30 aria_log_control
-rw------- 1 root root 298 Jul 31 14:30 backup-my.cnf
-rw------- 1 root root 938 Jul 31 14:30 ib_buffer_pool
-rw------- 1 root root 79691776 Jul 31 14:30 ibdata1
-rw------- 1 root root 2560 Jul 31 14:30 ib_logfile0
drwx------ 2 root root 19 Jul 31 14:30 wordpress
-rw------- 1 root root 103 Jul 31 14:30 xtrabackup_checkpoints
-rw------- 1 root root 458 Jul 31 14:30 xtrabackup_info
All further attempts to run the mariabackup command fail on:
mariabackup: Can't create/write to file '/srv/db_backup/ib_logfile0' \
(Errcode: 17 "File exists")
mariabackup: error: failed to open the target stream for 'ib_logfile0'.
What have I done wrong?
EDIT
First error was a missing dash in openssl -aes-256-cbc
Now I'm seeing this:
180731 15:18:37 Executing FLUSH NO_WRITE_TO_BINLOG TABLES...
Error: failed to execute query FLUSH NO_WRITE_TO_BINLOG TABLES: Access \
denied; you need (at least one of) the RELOAD privilege(s) for this operation
I've granted both SUPER and RELOAD to root user, still get this error.

Partial answer:
"What I expect is a file in /srv/db_backup called $(date +"%Y%m%d%H").backup.xb.enc" -- Then you need to specify a directory other than the current directory:
mariadbdump ... > \
/srv/db_backup/$(date +"%Y%m%d%H").backup.xb.enc
As for "unable to write", what do you get from
ls -ld /srv/db_backup

You need to use --stream=xbstream , not --xbstream
You backed up into directory, not into stream.

Related

WSL2, Launching R console from Docker

I've started to play with R, and wanted to build a simple custom image. When attempting to launch a new container with the r-base official image, using the instructions provided, it fails.
$ docker run -ti --rm r-base
ERROR: R_HOME ('/usr/lib/R') not found
I'm running Debian 10, on WSL2:
$ uname -r
5.4.72-microsoft-standard-WSL2
$ lsb_release -a
Distributor ID: Debian
Description: Debian GNU/Linux 10 (buster)
Release: 10
Codename: buster
$ docker --version
Docker version 18.09.1, build 4c52b90
Launching a container with bash, there are files in the mentioned lib directory:
$ docker run -ti --rm r-base /bin/bash
root#f27f0139a6be:/# ls -l /usr/lib/R/
total 28
drwxr-xr-x 3 root root 4096 Jul 12 13:23 bin
lrwxrwxrwx 1 root root 33 Jun 23 10:26 COPYING -> ../../share/common-licenses/GPL-2
drwxr-xr-x 2 root root 4096 Jul 12 13:23 etc
drwxr-xr-x 2 root root 4096 Jul 12 13:23 lib
drwxr-xr-x 32 root root 4096 Jul 12 13:23 library
drwxr-xr-x 2 root root 4096 Jul 12 13:23 modules
drwxr-xr-x 4 root root 4096 Jul 12 13:23 site-library
-rw-r--r-- 1 root root 46 Jun 23 10:26 SVN-REVISION
root#f27f0139a6be:/# R
ERROR: R_HOME ('/usr/lib/R') not found
I've played around with a few different recent tags/versions of the image, but same issue. Is this some incompatibility with WSL2? Am I missing an environment variable?

Remove ~$filename.docx files from directory on unix machine

I am trying to delete the following files from a directory of my unix machine:
$ ls -la
total 160
... other files ...
-rw-r--r--# 1 username staff 171 Oct 24 2017 ~$checklist.xlsx
-rw-r--r--# 1 username staff 171 Oct 16 2017 ~$papers.xlsx
-rw-r--r--# 1 username staff 162 Sep 4 2017 ~$rec.docx
-rw-r--r--# 1 username staff 162 Nov 25 21:00 ~$file1.docx
-rw-r--r--# 1 username staff 162 Nov 25 21:01 ~$file2.docx
However, when I attempt to delete them, it won't let me for various reasons. For example:
$ rm ~$checklist.xlsx
rm: ~.xlsx: No such file or directory
$ rm $checklist.xlsx
rm: .xlsx: No such file or directory
$ rm checklist.xlsx
rm: checklist.xlsx: No such file or directory
Why won't my computer let me delete these files? How can I go about deleting them? Thanks!
you need to scape those characters
a simple way to create one:
echo "fileteste" > \~\$file
a simple way to delete one:
rm \~\$file

Why logrotate did nothing but complained no errors?

The answer maybe obvious to you, but I am beginning to run my first logrotate instance.
The configuration in /etc/logrotate.d
/mnt/nginx/logs/access.log {
size 1k
dateext
missingok
rotate 10
compress
delaycompress
notifempty
create 640 root root
sharedscripts
postrotate
[ -f /opt/nginx/logs/nginx.pid ] && kill -USR1 `cat /opt/nginx/logs/nginx.pid`
endscript
}
Then I tested it with
sudo /usr/sbin/logrotate -dvf /etc/logrotate.d/nginx
And got following
reading config file /etc/logrotate.d/nginx
reading config info for /mnt/nginx/logs/access.log
Handling 1 logs
rotating pattern: /mnt/nginx/logs/access.log forced from command line (10 rotations)
empty log files are not rotated, old logs are removed
considering log /mnt/nginx/logs/access.log
log needs rotating
rotating log /mnt/nginx/logs/access.log, log->rotateCount is 10
dateext suffix '-20140724'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
glob finding logs to compress failed
glob finding old rotated logs failed
renaming /mnt/nginx/logs/access.log to /mnt/nginx/logs/access.log-20140724
creating new /mnt/nginx/logs/access.log mode = 0640 uid = 0 gid = 0
running postrotate script
running script with arg /mnt/nginx/logs/access.log : "
[ -f /opt/nginx/logs/nginx.pid ] && kill -USR1 `cat /opt/nginx/logs/nginx.pid`
"
Before test
total 84K
-rw-r--r-- 1 root root 51K Jul 22 15:05 access.log
-rw-r--r-- 1 root root 24K Jul 15 17:02 error.log
After test
total 84K
-rw-r--r-- 1 root root 51K Jul 22 15:05 access.log
-rw-r--r-- 1 root root 24K Jul 15 17:02 error.log
There was exactly nothing changed. And it didn't complain errors.
Can you please help this?
Thanks
I made a mistake.
-d option should not be used.
But since it actions as such, why not call it "dry" run?

Unable to extract tar file - tar: extract not authorized

I am working on Solaris 10 machine. In that i cannot able to untar my file. Logs are given below. Anyone please suggest what may be the issue? I can able to create tar file but unable to untar. :(
bash-3.2# ls -lrth ConfigCheck-120614-KL.out*
-rw-r--r-- 1 root root 144K Jun 12 17:15 ConfigCheck-120614-KL.out
-rwxrwxrwx 1 root root 146K Jun 16 16:49 ConfigCheck-120614-KL.out.tar
bash-3.2# tar xvf ConfigCheck-120614-KL.out.tar
tar: extract not authorized
bash-3.2# tar tvf ConfigCheck-120614-KL.out.tar
-rw-r--r-- 0/0 147377 Jun 12 17:15 2014 ConfigCheck-120614-KL.out
Solaris 11 tar will fail with that error message if you are running as uid 0 but do not have the Media Restore profile set up in the RBAC configuration.
Unless you're trying to restore from backup, you should normally be untarring files as a normal user, not root, to avoid accidentally overwriting critical system files.

403 Error on Stylesheet - Raspberry Pi Webserver

I keep seeing a 403 error for my stylesheet which is hosted on my Rasberry Pi (webserver). I ran ls -al and this is the result:
pi#raspberrypi ~/www $ ls -al
total 16
drwxr-xr-x 2 pi root 4096 Mar 17 20:18 .
drwxr-xr-x 12 root root 4096 Mar 15 16:44 ..
-rw-r--r-- 1 pi root 644 Mar 17 20:18 index.html
-rw------- 1 pi root 329 Mar 17 20:19 stylesheet.css
The index.html data shows up when I point my browser at the ip, but there is no formatting and whenever I try to acess the css file through looking at the source code it keeps telling me theres a 403 error :(
Can anyone help a brother out??
Cheers!
You need proper permissions for the www folder, and that depends on which webserver you are running. For apache on debian the user is www-data, if your webroot is ~/www and you are user pi try these commands
Change owner to apache user recursively
Change Permissions to read for all recursively
chown -R www-data:www-data /home/pi/www
chmod -R 644 /home/pi/www

Resources