No space left on device error with ocrmypdf

I have ocrmypdf installed from the repos. Every time I want to ocr a bigger file, I get the following error:

Optimize ratio: 1.00 savings: -0.0%
Image optimization did not improve the file - discarded
An exception occurred while executing the pipeline
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/ocrmypdf/_sync.py", line 373, in run_pipeline
    exec_concurrent(context)
  File "/usr/lib/python3.9/site-packages/ocrmypdf/_sync.py", line 299, in exec_concurrent
    pdf = post_process(pdf, context)
  File "/usr/lib/python3.9/site-packages/ocrmypdf/_sync.py", line 234, in post_process
    return optimize_pdf(pdf_out, context)
  File "/usr/lib/python3.9/site-packages/ocrmypdf/_pipeline.py", line 803, in optimize_pdf
    optimize(input_file, output_file, context, save_settings)
  File "/usr/lib/python3.9/site-packages/ocrmypdf/optimize.py", line 623, in optimize
    pike.save(output_file, **save_settings)
  File "/usr/lib/python3.9/site-packages/pikepdf/_methods.py", line 803, in save
    self._save(
OSError: [Errno 28] No space left on device

I read on the internet that this might be due to the tmp folder being too small. Thus i enlarged it to 5GB using this:

mount -o remount,size=5G /tmp/

But I still get the same error. On other devices where (I think) I have the same Manjaro setup, there is no problem. Maybe someone can help me?

Did you check whether there indeed is still enough free space in your filesystem(s)?:

what does

df -h

look like?

/tmp is in RAM - backed by swap
do you have (enough) swap?

free -h

df -h looks like this:
Filesystem Size Used Avail Use% Mounted on
dev 3,8G 0 3,8G 0% /dev
run 3,8G 1,6M 3,8G 1% /run
/dev/dm-0 930G 294G 589G 34% /
tmpfs 3,8G 431M 3,4G 12% /dev/shm
tmpfs 4,0M 0 4,0M 0% /sys/fs/cgroup
/dev/loop1 409M 409M 0 100% /var/lib/snapd/snap/pycharm-community/238
/dev/loop0 99M 99M 0 100% /var/lib/snapd/snap/core/11081
/dev/loop2 409M 409M 0 100% /var/lib/snapd/snap/pycharm-community/240
/dev/loop3 100M 100M 0 100% /var/lib/snapd/snap/core/11167
tmpfs 5,0G 96M 5,0G 2% /tmp
tmpfs 769M 144K 769M 1% /run/user/1000

I noticed that from /dev/loop1 to/dev/loop3, it’s always 100%. Could this be the problem?

swap looks like this:
.... total used free shared buff/cache available
Mem: 7,5Gi 4,8Gi 436Mi 454Mi 2,2Gi 1,9Gi
Swap: 8,8Gi 2,7Gi 6,1Gi

To me it looks fine - space available everywhere,
yet python complains about no space left …
I have no idea.
Could be related to you using snap’s - I have zero experience with these.

These are the snap packages you installed.
Python related Snaps.
Personally: I’d rather use the same packages from AUR if at all possible.

In conclusion:
I can’t help you. :man_shrugging:

2 Likes

So far, I still can’t solve the problem. Maybe there are other ideas?