postgres installation error post-bootstrap FATAL: invalid byte sequence - postgresql

I'm trying to install Postgres 13 (Windows version), but I always obtain same error (part is in Spanish):
realizando inicializaci¢n post-bootstrap ... 2021-04-30 12:10:54.935 CEST [1224] FATAL: invalid byte sequence for encoding "UTF8": 0xbf
el proceso hijo termin¢ con c¢digo de salida 1
initdb: eliminando el contenido del directorio ®C:/PostgreSQL13/data¯
Called Die(Failed to initialise the database cluster with initdb)...
Failed to initialise the database cluster with initdb
Script stderr:
Program ended with an error exit code
Error al ejecutar C:\WINDOWS\System32\cscript //NoLogo "C:\PostgreSQL13/installer/server/initcluster.vbs" "NT AUTHORITY\NetworkService" "postgres" "****" "C:\Users\user1\AppData\Local\Temp/postgresql_installer_b86f3c1062" "C:\PostgreSQL13" "C:\PostgreSQL13\data" 5432 "English,UnitedStates" 0 : Program ended with an error exit code
Problema al ejecutar el paso post instalación. La instalación no pudo finalizar correctamente
La inicialización del clúster de la base de datos falló.
User user1 has administrator rights. I have also tried to install version 12 instead of 13, but the result is the same.
Any suggestions?

This is very likely because the database superuser name contains non-ASCII characters.
I don't know exactly how you install PostgreSQL, but this probably happens when you run initdb to create a data directory (which would fit with the "initcluster" script in your message).
If you don't specify a superuser name by using the -U option of initdb (it is customary to use the nae postgres), initdb will name the superuser like your current operating system user. If you are on Windows, that name will be encoded in a Windows encoding like Windows-1252. Now the database doesn't know that, and when it creates the database user, it uses the very bytes of that user name. If that is not correctly encoded UTF-8 (which is won't be if it contains non-ASCII characters), that causes this error.
My suggestion is that you log on to Windows with an operating system user that has all ASCII characters in its name and try again.

Related

copy (...) from program (gzip '..../data.csv.gz') in Postgresql on windows is failed

My data.csv is a large volume and I don't have enough storage in my system for that.
Because of this, I want to import data.csv.gz into a table of the database in PostgreSQL.
I tried the following code to import that file.
copy origin (...) from program 'gzip D:\Download\data.csv.gz' (format CSV);
But I've got this error:
ERROR: program "gzip D:\Download\origin_visit.csv.gz" failed
DETAIL: child process exited with exit code 1
Origin is my table in PostgreSQL.
My OS is Windows 10.
I installed gzip in my system and added its path to the environment.
How can I run the code in PostgreSQL? Is there any way to import data.csv.gz to PostgreSQL?

bash script calling rdiff-backup never ends

I want to run rdiff-backup and then switch of the raspberrypi it was running on.
I use the following script:
#!/bin/sh
date > /home/mik/rdiff-backup.log
echo "rsync start" >> /home/mik/rdiff-backup.log
rdiff-backup -v5 --print-statistics offlinebackup#server::/srv/backup /srv/datenserverBackup/backup >> /home/mik/rdiff-backup.log 2>&1
sync
date >> /home/mik/rdiff-backup.log
echo "rdiff-backup end" >> /home/mik/rdiff-backup.log
df -h >> /home/mik/rdiff-backup.log
sync
halt
The log file looks good (for the rdiff-backup part):
Sat 12 Aug 08:20:59 UTC 2017
rsync start
Unable to import win32security module. Windows ACLs
not supported by filesystem at /srv/backup
escape_dos_devices not required by filesystem at /srv/backup
Warning: name offlinebackup not found on system, dropping ACL entry.
Further ACL entries dropped with this name will not trigger further warnings
Using rdiff-backup version 1.2.8
Executing ssh -C offlinebackup#server rdiff-backup --server
-----------------------------------------------------------------
Detected abilities for source (read only) file system:
Access control lists On
Extended attributes On
Windows access control lists Off
Case sensitivity On
Escape DOS devices Off
Escape trailing spaces Off
Mac OS X style resource forks Off
Mac OS X Finder information Off
-----------------------------------------------------------------
Unable to import win32security module. Windows ACLs
not supported by filesystem at /srv/datenserverBackup/backup/rdiff-backup-data/rdiff-backup.tmp.0
escape_dos_devices not required by filesystem at /srv/datenserverBackup/backup/rdiff-backup-data/rdiff-backup.tmp.0
-----------------------------------------------------------------
Detected abilities for destination (read/write) file system:
Ownership changing On
Hard linking On
fsync() directories On
Directory inc permissions On
High-bit permissions On
Symlink permissions Off
Extended filenames On
Windows reserved filenames Off
Access control lists On
Extended attributes On
Windows access control lists Off
Case sensitivity On
Escape DOS devices Off
Escape trailing spaces Off
Mac OS X style resource forks Off
Mac OS X Finder information Off
-----------------------------------------------------------------
Backup: must_escape_dos_devices = 0
Starting increment operation /srv/backup to /srv/datenserverBackup/backup
Processing changed file .
Incrementing mirror file /srv/datenserverBackup/backup
Processing changed file abc
Incrementing mirror file /srv/datenserverBackup/backup/abc
Processing changed file abc/def
Incrementing mirror file /srv/datenserverBackup/backup/abc/def
Processing changed file abc/def/testfile.dxf
Incrementing mirror file /srv/datenserverBackup/backup/abc/def/testfile.dxf
--------------[ Session statistics ]--------------
StartTime 1502526061.00 (Sat Aug 12 08:21:01 2017)
EndTime 1502527913.72 (Sat Aug 12 08:51:53 2017)
ElapsedTime 1852.72 (30 minutes 52.72 seconds)
SourceFiles 151099
SourceFileSize 386321558216 (360 GB)
MirrorFiles 151097
MirrorFileSize 386321447731 (360 GB)
NewFiles 2
NewFileSize 110485 (108 KB)
DeletedFiles 0
DeletedFileSize 0 (0 bytes)
ChangedFiles 1
ChangedSourceSize 0 (0 bytes)
ChangedMirrorSize 0 (0 bytes)
IncrementFiles 4
IncrementFileSize 0 (0 bytes)
TotalDestinationSizeChange 110485 (108 KB)
Errors 0
--------------------------------------------------
The backup is working, but then the script ends right there.
rdiff-backup.log contains the full report of rdiff-backup. But neither the line "rdiff-backup end", nor the output of "df -h".
How can I make it ran to the end?
Thanks for your answers
I finally found a workaround, that solves my problem.
My sciprt which is called after booting from /etc/init.d is calling the other script which does the actual work (i.e. backup my data, and write the log file) as a background task.
/etc/init.d/CallAfterBoot.sh
#!/bin/sh
sleep 30
/home/me/DoBackup.sh & # '&' starts the script in background
/home/me/DoBackup.sh is the script I posted above which is now runing correctly.
Same script running as the same user now behaves differently. There's got to be some bug somewhere, however, it works for me now.

Trying to add an after-queue mail filter in Postfix on CentOS, get execvp permission denied

So I followed [the guide][1] on how to set up a simple mail filter with Postfix, so that I can do a find-replace in the body of outgoing emails. I created a script at /tmp/mailfilter.sh, and changed the /etc/postfix/master.cf file as instructed
# ==========================================================================
# service type private unpriv chroot wakeup maxproc command + args
# (yes) (yes) (yes) (never) (100)
# ==========================================================================
smtp inet n - n - - smtpd
-o content_filter=filter:dummy
filter unix - n n - 10 pipe
flags=Rq user=filter null_sender=
argv=/tmp/mailfilter.sh -f ${sender} -- ${recipient}
I created a user called filter and made it the owner of the script. But when I tried sending an email, I get the following error:
Jun 7 03:01:53 localhost postfix/qmgr[31288]: 134D944A0673: from=<sender#gmail.com>, size=894, nrcpt=1 (queue active)
Jun 7 03:01:53 localhost pipe[31603]: fatal: pipe_command: execvp /tmp/mailfilter.sh: Permission denied
Jun 7 03:01:53 localhost postfix/pipe[31562]: 134D944A0673: to=<receiver#gmail.com>, relay=filter, delay=8974, delays=8974/0/0/0.01, dsn=4.3.0, status=deferred (temporary failure. Command output: pipe: fatal: pipe_command: execvp /tmp/mailfilter.sh: Permission denied )
Specifically what I'm assuming is relevant is
(temporary failure. Command output: pipe: fatal: pipe_command: execvp /tmp/mailfilter.sh: Permission denied )
/tmp/mailfilter.sh has chmod a+x and is owned by filter. I tried removing everything in it so it's just an empty file, and I still get the permission denied error.
I can't figure out what I'm missing. I've set every permission I can find, but Postfix is doing something arcane that I don't understand.
CentOS uses SELinux as a MAC framework, so maybe you need to set properly the type of your executable. You can check in /var/log/audit/audit.log for any security violation. If SELinux is denying you, you can try this command as root:
chcon -t postfix_pipe_exec_t /tmp/mailfilter.sh
That manual is a good reference: http://linux.die.net/man/8/postfix_selinux

Selinux - File Contexts Look Good, But Selinux Won't Allow Write

I am trying to learn Selinux. With a sandbox and using VSFTPD to experiment with, I have a vsfptd server running in Centos. I have annonmous users to place files in /var/ftp/incoming. On a remote machine I can have the user successfully log in but could not place the file on the remove vsftpd server:
$ftp mysql_server
Connected to mysql_server (192.168.1.31).
220 Welcome to blah FTP service.
Name (mysql_server:root): anonymous
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer ftp> put atd
local: atd remote: atd
227 Entering Passive Mode (192,168,1,31,19,161).
553 Could not create file.
ftp>
On the VSFTPD server, aureport -a report shows:
[root#mysql_server ftp]# aureport -a
AVC Report
========================================================
# date time comm subj syscall class permission obj event
========================================================
4. 04/08/2013 13:30:36 vsftpd unconfined_u:system_r:ftpd_t:s0-s0:c0.c1023 21 dir write system_u:object_r:public_content_t:s0 denied 28
5. 04/08/2013 13:34:57 vsftpd unconfined_u:system_r:ftpd_t:s0-s0:c0.c1023 2 dir write system_u:object_r:public_content_t:s0 denied 47
I checked the directory and the file contexts look good, so I don't understand why Selinux won't allow vsftpd to write to the incoming directory:
[root#mysql_server ftp]# ls -Z
drwx-wx---. root ftp system_u:object_r:public_content_t:s0 incoming
drwxr-xr-x. root root system_u:object_r:public_content_t:s0 pub
[root#mysql_server ftp]#
You need to run the following commands to allow in SELinux upload and edit files:
setsebool -P allow_ftpd_full_access on
setsebool -P ftp_home_dir on
Your SELinux type is not correct. Use 'public_content_rw_t' instead of 'public_content_t'. Read more on http://beginlinux.com/blog/2008/11/vsftpd-and-selinux-on-centos/

Tuning Primer - No Valid Socket File

I am trying to run Tuning Primer using Cygwin on my Windows 7 computer to check some of my databases.
Whenever I try to run it, It gives me the following error:
No valid socket file "" found!
/cygdrive/c/Users/MID-PC/Downloads/tuning-primer.sh: line 109: tput: comando não encontrado
The mysqld process is not running or it is installed in a custom location.
/cygdrive/c/Users/MID-PC/Downloads/tuning-primer.sh: line 109: tput: comando não encontrado
If you are sure mysqld is running, execute script in "prompt" mode or set
/cygdrive/c/Users/MID-PC/Downloads/tuning-primer.sh: line 109: tput: comando não encontrado
the socket= variable at the top of this script
/cygdrive/c/Users/MID-PC/Downloads/tuning-primer.sh: line 109: tput: comando não encontrado
Any Idea of how can I manually set this socket?
(Yes, I do have MySQL running on this machine)