Score:1

Flatpak command in crontab do nothing on Ubuntu 21.10

cn flag
TVG

I've the following command in my crontab to make automatic backups using FreeFileSync. It was working just fine on Ubuntu 20.04 but I've noticed it doesn't work anymore on Ubuntu 21.10.

30 12 * * * DISPLAY=:0 flatpak run org.freefilesync.FreeFileSync /home/toto/Backup.ffs_batch >/dev/null 2>&1

I've first added >/dev/null 2>&1 following the suggestion in this post because I found in /var/log/syslog it generated the following error:

(CRON) info (No MTA installed, discarding output)

I don't have any error anymore in /var/log/syslog after the following line:

(toto) CMD (DISPLAY=:0 flatpak run org.freefilesync.FreeFileSync /home/toto/Backup.ffs_batch >/dev/null 2>&1)

However, nothing seems to happen. FreeFileSync never starts.

It seems that there is a solution here which involves uninstalling the flatpak version of FreeFileSync and reinstalling it from the run-file of FreeFileSync website. I would prefer to keep the flatpak version because it makes automatic updates of the package.

Many thanks for your help.

EDIT: I've replaced >/dev/null by >/home/toto/crontab.log to redirect the error to a log file. Here is the error I get:

bwrap: Can't find source path /tmp/.X11-unix/X0: No such file or directory

There is a discussion about Flatpak involving such error here, but I'm not skilled enough to understand what solution they are suggesting.

vanadium avatar
cn flag
You may need to add the full path to the flatpak executable. cronjobs run in a very limited environment.
TVG avatar
cn flag
TVG
Thanks for your reply. Do you know how can I get the full path to the flatpak executable?
vanadium avatar
cn flag
`which flatpak`
TVG avatar
cn flag
TVG
OK, I see, I thought you meant the full path of the FreeFileSync flatpak executable. Here, you suggest to use the following command: `DISPLAY=:0 /usr/bin/flatpak run org.freefilesync.FreeFileSync /home/toto/Backup.ffs_batch >/dev/null 2>&1`. Is that correct? I've tried like this but it doesn't work either.
hr flag
If you want information on why something is not working, **don't** throw away its error (and output) messages by redirecting them to `/dev/null` - redirect them to a file that you can look at like `/home/toto/crontab.log`
TVG avatar
cn flag
TVG
Thanks for the tip! I get the following error in the log file: `bwrap: Can't find source path /tmp/.X11-unix/X0: No such file or directory`. I'm adding it to the post.
hr flag
So did you verify that your active display is actually `:0`?
TVG avatar
cn flag
TVG
Thank you so much! It is actually `:1`. It is working just fine now!
Score:1
cn flag
TVG

Thanks to the nice people providing useful comments, here is the solution:

The active display was incorrect. I got the actual active display with echo $DISPLAY which returns :1.

Then, the following CRON command is now working:

30 12 * * * DISPLAY=:1 flatpak run org.freefilesync.FreeFileSync /home/toto/Backup.ffs_batch >/home/toto/crontab.log 2>&1
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.