Back In Time backup não inicia via anacron por causa de "Não é possível abrir o arquivo de timestamp para o trabalho ..."

0

O Back In Time está configurado para iniciar os backups diariamente assim que o disco externo for conectado. Isso resulta em uma regra do udev que inicia um anacron com um arquivo de configuração gerado pelo Back In Time. Infelizmente os backups não rodam, pois o anacron sempre lança um erro anacron: Can't open timestamp file for job 1_Main_profile: Read-only file system (visto no syslog). O comando que o Back In Time gerou como regra do udev é executado corretamente, se iniciado manualmente (iniciado como root user e como o usuário comum jdoe ). (Além disso, o backup é executado corretamente quando iniciado manualmente via GUI).

Eu ficaria feliz em descobrir pelo menos qual arquivo exatamente o anacron não pode abrir, e é claro porque.

udev rule:

ACTION=="add", ENV{ID_FS_UUID}=="dd68d7f7-054b-dae0-a4a2-4315acad138a", RUN+="/bin/su - 'jdoe' -c 'test -x /usr/sbin/anacron && test -e /home/jdoe/.config/backintime/anacrontab-dd68d7f7-054b-dae0-a4a2-4315acad138a && /usr/sbin/anacron -s -t /home/jdoe/.config/backintime/anacrontab-dd68d7f7-054b-dae0-a4a2-4315acad138a -S /home/jdoe/.local/share/backintime/anacron' &"

anacrontab , modificado agora para fazer apenas o registro, o arquivo original (sem logger "… " || ) fez o backup de inicialização quando executado manualmente, mas não automaticamente:

$ cat /home/jdoe/.config/backintime/anacrontab-dd68d7f7-dae0-4315-a4a2-054bacad138a
SHELL=/bin/bash
PATH=/home/jdoe/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
DISPLAY=:0.0
1   0   1_Main_profile  /usr/bin/logger "would start backup now, but exiting, as you set in anacrontab :-)" || /usr/bin/nice -n 19 /usr/bin/ionice -c2 -n7 /usr/bin/backintime --backup-job >/dev/null 2>&1

arquivos / pastas (os direitos de '1_Main_profile' são configurados assim executando o comando anacron de udev rule):

$ ls -ld /home/jdoe/.local/share/backintime/anacron/
drwxrwxrwx 2 jdoe jdoe 4096 Jul 18 10:41 /home/jdoe/.local/share/backintime/anacron/
$ ls -l /home/jdoe/.local/share/backintime/anacron/
insgesamt 8
-rw------- 1 jdoe jdoe 9 Jul 18 10:42 1_Main_profile
$ groups jdoe
jdoe : jdoe adm cdrom sudo dip plugdev lpadmin sambashare vboxusers
$ ls -ld /var/spool/anacron/
drwxrwxr-x 2 root adm 4096 Apr 30  2016 /var/spool/anacron/
$ ls -l /var/spool/anacron/
insgesamt 12
-rw------- 1 root root 9 Jul 18 10:20 cron.daily
-rw------- 1 root root 9 Jun 29 09:07 cron.monthly
-rw------- 1 root root 9 Jul 18 10:24 cron.weekly

Iniciando o comando fora da regra do udev manualmente (como root via ssh , iniciá-lo sem o " logger "…" || acima irá iniciar o backup):

$ /bin/su - 'jdoe' -c 'strace /usr/sbin/anacron -s -t /home/jdoe/.config/backintime/anacrontab-dd68d7f7-054b-dae0-a4a2-4315acad138a -S /home/jdoe/.local/share/backintime/anacron &> /dev/shm/strace-anacron-backintime'
X11 connection rejected because of wrong authentication.

$ cat /dev/shm/strace-anacron-backintime
execve("/usr/sbin/anacron", ["/usr/sbin/anacron", "-s", "-t", "/home/jdoe/.config/backintime/"..., "-S", "/home/jdoe/.local/share/backin"...], [/* 26 vars */]) = 0
brk(NULL)                               = 0x562556b3c000
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
mmap(NULL, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f75287a6000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=178056, ...}) = 0
mmap(NULL, 178056, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f752877a000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "7ELF
ACTION=="add", ENV{ID_FS_UUID}=="dd68d7f7-054b-dae0-a4a2-4315acad138a", RUN+="/bin/su - 'jdoe' -c 'test -x /usr/sbin/anacron && test -e /home/jdoe/.config/backintime/anacrontab-dd68d7f7-054b-dae0-a4a2-4315acad138a && /usr/sbin/anacron -s -t /home/jdoe/.config/backintime/anacrontab-dd68d7f7-054b-dae0-a4a2-4315acad138a -S /home/jdoe/.local/share/backintime/anacron' &"
$ cat /home/jdoe/.config/backintime/anacrontab-dd68d7f7-dae0-4315-a4a2-054bacad138a
SHELL=/bin/bash
PATH=/home/jdoe/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
DISPLAY=:0.0
1   0   1_Main_profile  /usr/bin/logger "would start backup now, but exiting, as you set in anacrontab :-)" || /usr/bin/nice -n 19 /usr/bin/ionice -c2 -n7 /usr/bin/backintime --backup-job >/dev/null 2>&1
$ ls -ld /home/jdoe/.local/share/backintime/anacron/
drwxrwxrwx 2 jdoe jdoe 4096 Jul 18 10:41 /home/jdoe/.local/share/backintime/anacron/
$ ls -l /home/jdoe/.local/share/backintime/anacron/
insgesamt 8
-rw------- 1 jdoe jdoe 9 Jul 18 10:42 1_Main_profile
$ groups jdoe
jdoe : jdoe adm cdrom sudo dip plugdev lpadmin sambashare vboxusers
$ ls -ld /var/spool/anacron/
drwxrwxr-x 2 root adm 4096 Apr 30  2016 /var/spool/anacron/
$ ls -l /var/spool/anacron/
insgesamt 12
-rw------- 1 root root 9 Jul 18 10:20 cron.daily
-rw------- 1 root root 9 Jun 29 09:07 cron.monthly
-rw------- 1 root root 9 Jul 18 10:24 cron.weekly
$ /bin/su - 'jdoe' -c 'strace /usr/sbin/anacron -s -t /home/jdoe/.config/backintime/anacrontab-dd68d7f7-054b-dae0-a4a2-4315acad138a -S /home/jdoe/.local/share/backintime/anacron &> /dev/shm/strace-anacron-backintime'
X11 connection rejected because of wrong authentication.

$ cat /dev/shm/strace-anacron-backintime
execve("/usr/sbin/anacron", ["/usr/sbin/anacron", "-s", "-t", "/home/jdoe/.config/backintime/"..., "-S", "/home/jdoe/.local/share/backin"...], [/* 26 vars */]) = 0
brk(NULL)                               = 0x562556b3c000
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
mmap(NULL, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f75287a6000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=178056, ...}) = 0
mmap(NULL, 178056, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f752877a000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "7ELF%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%>%pre%%pre%%pre%%pre%0%pre%%pre%%pre%%pre%%pre%"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1685264, ...}) = 0
mmap(NULL, 3791264, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f75281e8000
mprotect(0x7f752837d000, 2093056, PROT_NONE) = 0
mmap(0x7f752857c000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x194000) = 0x7f752857c000
mmap(0x7f7528582000, 14752, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f7528582000
close(3)                                = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f7528778000
arch_prctl(ARCH_SET_FS, 0x7f7528778700) = 0
mprotect(0x7f752857c000, 16384, PROT_READ) = 0
mprotect(0x5625560cc000, 4096, PROT_READ) = 0
mprotect(0x7f75287a9000, 4096, PROT_READ) = 0
munmap(0x7f752877a000, 178056)          = 0
brk(NULL)                               = 0x562556b3c000
brk(0x562556b5d000)                     = 0x562556b5d000
open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=3259968, ...}) = 0
mmap(NULL, 3259968, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f7527ecc000
close(3)                                = 0
open("./", O_RDONLY)                    = 3
chdir("/home/jdoe/.local/share/backintime/anacron") = 0
umask(000)                              = 022
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
close(0)                                = 0
open("/dev/null", O_RDONLY)             = 0
close(1)                                = 0
open("/dev/null", O_WRONLY)             = 1
close(2)                                = 0
open("/dev/null", O_WRONLY)             = 2
clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f75287789d0) = 4473
exit_group(0)                           = ?
+++ exited with 0 +++
%pre%%pre%%pre%%pre%%pre%>%pre%%pre%%pre%%pre%0%pre%%pre%%pre%%pre%%pre%"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=1685264, ...}) = 0 mmap(NULL, 3791264, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f75281e8000 mprotect(0x7f752837d000, 2093056, PROT_NONE) = 0 mmap(0x7f752857c000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x194000) = 0x7f752857c000 mmap(0x7f7528582000, 14752, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f7528582000 close(3) = 0 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f7528778000 arch_prctl(ARCH_SET_FS, 0x7f7528778700) = 0 mprotect(0x7f752857c000, 16384, PROT_READ) = 0 mprotect(0x5625560cc000, 4096, PROT_READ) = 0 mprotect(0x7f75287a9000, 4096, PROT_READ) = 0 munmap(0x7f752877a000, 178056) = 0 brk(NULL) = 0x562556b3c000 brk(0x562556b5d000) = 0x562556b5d000 open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=3259968, ...}) = 0 mmap(NULL, 3259968, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f7527ecc000 close(3) = 0 open("./", O_RDONLY) = 3 chdir("/home/jdoe/.local/share/backintime/anacron") = 0 umask(000) = 022 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 close(0) = 0 open("/dev/null", O_RDONLY) = 0 close(1) = 0 open("/dev/null", O_WRONLY) = 1 close(2) = 0 open("/dev/null", O_WRONLY) = 2 clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f75287789d0) = 4473 exit_group(0) = ? +++ exited with 0 +++
    
por Jaleks 18.07.2017 / 11:06

1 resposta

0

O arquivo de registro de data e hora em questão é /home/jdoe/.local/share/backintime/anacron/1_Main_profile . Por favor, certifique-se que é gravável. Você também pode economizar para removê-lo. A Anacron escreverá uma nova na próxima vez.

Mas também recomendo a atualização para uma versão mais recente do BiT (a versão atual é 1.1.20). Eu substituí a dependência do anacron há um tempo atrás por um código Python puro que tornou esse cronograma mais confiável.

    
por 18.07.2017 / 22:10