• info@bizmate.biz

Author Archive

OCR Scan on Linux Ubuntu using Fujitsu ScanSnap S1300i and NAPS2

How to Fix a Fujitsu ScanSnap S1300i and Set Up Single-Click OCR on Ubuntu Linux

Getting a premium document scanner like the Fujitsu ScanSnap S1300i to play nicely with Linux can be a daunting task. Out of the box, Ubuntu recognizes the USB hardware, but scanning utilities will fail to detect it. This is because the scanner requires a proprietary firmware file (.nal) initialized upon startup to bridge communication.
Furthermore, default Linux scanning utilities like Simple Scan often lack robust, automatic Optical Character Recognition (OCR) features.
This comprehensive guide will walk you through installing the missing ScanSnap drivers, deploying NAPS2 (Not Another PDF Scanner 2) via a standalone .deb package, and configuring it to output fully text-searchable PDFs in one go.

Part 1: Install the ScanSnap S1300i Firmware Driver

Because the device driver firmware is copyrighted property of Fujitsu, Linux distributions cannot distribute it natively. We must download it from a community-maintained repository and map it into the SANE (Scanner Access Now Easy) backend.

1. Download and Place the Firmware

Open your Ubuntu terminal and run the following commands to create the target directory and fetch the correct 1300i_0D12.nal file from the updated repository source:
sudo mkdir -p /usr/share/sane/epjitsu
sudo wget -O /usr/share/sane/epjitsu/1300i_0D12.nal https://github.com/stevleibelt/scansnap-firmware/raw/refs/heads/master/1300i_0D12.nal

2. Configure the SANE Backend

Next, configure the epjitsu driver to reference the newly downloaded file. Open the configuration script in the terminal text editor:
sudo nano /etc/sane.d/epjitsu.conf

Scroll down to the Fujitsu section (or append this to the bottom of the file if it doesn’t exist) to map your hardware parameters:
# Fujitsu ScanSnap S1300i
firmware /usr/share/sane/epjitsu/1300i_0D12.nal
usb 0x04c5 0x128d

Press Ctrl+O, then Enter to save, and Ctrl+X to exit.

3. Grant USB Permissions (udev Rules)

To prevent your scanner from requiring root or sudo access every time you try to launch it, you need to grant the local user group permission to interact with the device.
Create a hardware rule entry:
sudo nano /etc/udev/rules.d/79-scanner.rules

Paste the following configurations into the empty file:
# Fujitsu ScanSnap S1300i
ATTRS{idVendor}=="04c5", ATTRS{idProduct}=="128d", MODE="0664", GROUP="scanner", ENV{libsane_matched}="yes"

Save and exit (Ctrl+O, Enter, Ctrl+X).

4. Reload System Hardware Rules

Make sure your user account belongs to the scanner user group, and reload the background rules:
sudo usermod -a -G scanner $USER
sudo udevadm control --reload-rules && sudo udevadm trigger

Crucial Step: Unplug your ScanSnap’s USB connection cable, wait five seconds, and plug it back in. Test if Ubuntu sees the scanner now by executing:
scanimage -L

If configured properly, the scanner’s flashing blue light will stabilize and the terminal will print a line confirming a successful connection to the epjitsu device.

Part 2: Install NAPS2 via Standalone Linux Package

Sandboxed Flatpak versions of NAPS2 often fail to see custom SANE paths on Linux. Installing the native .deb package ensures it communicates smoothly with the hardware rules you configured in Part 1.
Execute these commands to download and deploy the native package file directly from the official NAPS2 project server:
# 1. Download the native package (at https://www.naps2.com/download )
wget https://github.com/cyanfish/naps2/releases/download/v8.3.2/naps2-8.3.2-linux-x64.deb 

# 2. Deploy it locally along with system environment dependencies
sudo apt install ./naps2-8.3.2-linux-x64.deb

# 3. Safely delete the installation setup file
rm naps2-8.3.2-linux-x64.deb


Part 3: Configure Single-Click OCR

On Linux, NAPS2 can run into a common internal bug where it encounters background permission restrictions when downloading or calling its built-in text-recognition engines. You can resolve this issue entirely by providing NAPS2 a global fallback system engine.

1. Fix the Linux OCR Priority Bug

Run this command to build the system framework fallback layer over Ubuntu’s package repository:
sudo apt install tesseract-ocr tesseract-ocr-eng

2. Configure NAPS2 OCR Behavior

Launch NAPS2 from your Ubuntu Application Dock. To establish automatic text extraction:
  1. Click on Profiles -> Add to create a connection profile. Link your detected Fujitsu device here, set your resolution preference (300 DPI is optimal for clear OCR processing), and save the profile.
  2. Click the OCR button on the main layout toolbar.
  3. Check the box to “Make PDFs searchable using OCR“.
  4. Set your target text language from the dropdown menu (e.g., English).
  5. Ensure that the option “Automatically run OCR after scanning” or “Pre-emptively run OCR after scanning“. NAPS2 will seamlessly handle the text rendering automatically during the final step. Click **OK**.

3. Scan and Save

Place a document into the ScanSnap sheet feeder slot and click Scan.
Note: You will not see selectable text inside the square preview thumbnails layout. NAPS2 queues this background process for performance efficiency.
Click Save PDF on the toolbar. You will see a processing bar flash briefly across your screen—this indicates that NAPS2 is actively nesting your digital text layer. Open the resulting output file inside a web browser or default PDF viewer, and you can now search, copy, and paste text directly out of the document image!

—

Disclaimer: This guide is provided for educational and troubleshooting purposes with no warranty or guarantee of any kind. The firmware files mentioned are hosted by third-party community repositories and are not officially affiliated with or endorsed by Fujitsu. Always make sure to back up your system configuration files before executing commands with root (`sudo`) privileges.

Bizmate

Automating Remote Backups: A Robust Rsync Retention & Pruning Script

Managing remote backups is a critical task for any sysadmin or developer, but the real challenge isn’t just moving the data—it’s managing the storage. Without a proper retention policy, remote servers can quickly become cluttered with outdated archives, leading to storage overages and manual cleanup headaches.

Free rsync based remote retention script by Bizmate Solutions Ltd

solve the “sync and prune” challenge, we have developed a specialized bash script designed to handle incremental backups via rsync while maintaining a strict retention policy on the remote target.

At Bizmate Solutions Ltd, we prioritise automation and efficiency. To solve the “sync and prune” challenge, we have developed a specialised bash script designed to handle incremental backups via rsync while maintaining a strict retention policy on the remote target.

The Problem: The Infinite Growth of Backups

Standard rsync commands are excellent for mirroring data, but they don’t inherently manage historical versions or clean up old files on a remote destination without risk. Manual pruning is prone to human error and often gets overlooked until a “Disk Full” alert triggers.

The Solution: Sync & Prune

Our latest addition to the bash-essentials library automates this entire life-cycle. The script ensures that:

  1. Data is synchronized securely via SSH.

  2. Incremental logic is applied to save bandwidth and time.

  3. Automatic Pruning kicks in after the sync, keeping only a specified number of the most recent backups.

Key Features

  • Configurable Retention: Easily set how many backup rotations you want to keep.

  • Secure Execution: Leverages SSH for encrypted data transfer.

  • Detailed Logging: Clear output for monitoring and troubleshooting.

  • Dry-Run Support: Test your pruning logic before committing to deletions.

Getting Started

The script is open-source and available on our GitHub repository. You can integrate it into your CRON jobs to achieve a “set and forget” backup strategy.

View the documentation and script here: Bash Essentials: Rsync Remote Retention

Efficient infrastructure starts with smart automation. If your team needs assistance optimising DevOps workflows or data management strategies, visit us at www.bizmate.biz.

Bizmate

Minecraft Scratch Game

Bizmate

Things to do when visiting Mauritius

Very basic and straightforward list

  1. Catamaran trip in the south – swim with dolphins
  2. Undersea walk in belle mare
  3. Visit to 7 coloured earth channel
  4. Crocodile park
  5. Seven waterfalls
  6. Trip to Ile aux cerfs island
  7. Helicopter tour of the undersea waterfall. (I saw it from the plane going to Madagascar)
  8. Visit to the sleeping volcano – becareful of monkeys
  9. Local markets: Flacq or mahebourg
  10. Trou aux cerfs island visit/catamaran
  11. Sunrise watching in the east (belle mare) or sunset in the west ( flic en Flac or Mon Choisy)
  12. Casela safari tour
  13. Visit of the sugar cane mill (l’aventure du sucre)
  14. Rhum tour – in the south at Aubin
  15. Visit to Bois Cheri tea factory
Bizmate

ubuntu kernel updates and unstable nvidia drivers

Notice this page is an informal log of some of the debugging and troubleshooting for Nvidia drivers and Kernel updates problems. Nvidia provides Linux/Ubuntu drivers out of the box. Installing them is really easy such as running

`sudo ubuntu-drivers install` .

Quite often though these drivers might not be compatible or still have problems so here we go with some troubleshooting.

Ubuntu drivers not fully installed.

Sometimes despite ubuntu-drivers install suggesting the drivers are indeed already installed we might be in an unstable situation where a new kernel has been installed but when drivers are updated the kernel relative modules are not. As such we could run

`sudo dkms autoinstall && reboot`

 

Check if driver is indeed installed

Running nvidia-smi gives you an output of the currently installed drivers. If this application is not installed then the proprietary drivers are missing

$ nvidia-smi
Thu Dec 7 11:28:46 2023 
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 535.129.03 Driver Version: 535.129.03 CUDA Version: 12.2 |
|-----------------------------------------+----------------------+----------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+======================+======================|
| 0 NVIDIA GeForce RTX 2070 Off | 00000000:09:00.0 On | N/A |
| 0% 49C P8 22W / 175W | 1142MiB / 8192MiB | 1% Default |
| | | N/A |
+-----------------------------------------+----------------------+----------------------+

+---------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=======================================================================================|
| 0 N/A N/A 6270 G /usr/lib/xorg/Xorg 497MiB |
| 0 N/A N/A 6433 G /usr/bin/gnome-shell 105MiB |
| 0 N/A N/A 7347 G /usr/bin/nextcloud 1MiB |
| 0 N/A N/A 7519 G cairo-dock 5MiB |
| 0 N/A N/A 7691 C+G ...83750398,4784756152597305294,262144 276MiB |
| 0 N/A N/A 26615 G ...zmate/jcef_26128.log --shared-files 13MiB |
| 0 N/A N/A 28209 G ...,WinRetrieveSuggestionsOnlyOnDemand 86MiB |
| 0 N/A N/A 40478 G /usr/lib/thunderbird/thunderbird 150MiB |
+---------------------------------------------------------------------------------------+

Troubleshooting errors by checking system messages

Very often boot up or start up errors are also recorded and they could help explaining why there is an error or conflict causing your Nvidia card from not working correctly, for instance displaying/detecting only one of the two monitors plugged in with your card. Journalctl is a great tool to check these errors. To debug from this messages buffer you can

journalctl -kb | less

In many cases you can see errors like

[   5.004707] nvidia-gpu 0000:05:00.3: i2c timeout error e0000000

You can then search for an error. Quite often some errors are indeed conflicts with other boot/start up processes. As such these modules can be blacklisted by adding modprobe specific entries such as blacklisting the ic2_nvidia_gpu if it errors

echo "blacklist i2c_nvidia_gpu" > /etc/modprobe.d/blacklist_i2c-nvidia-gpu.conf

Other troubleshooting commands

  • Hardware lister – sudo lshw
  • PCI devices listing – sudo lspci
  • DMI Table decoder – sudo dmidecode -t bios
  • RANDR cli tool – xrandr

Change Kernels

In some cases you might have an old or new kernel and the nvidia driver might be not fully compatible with this kernel. You can use a tooling called mainline, that installed on linux/ubuntu allows to install and set as the main kernel another one other than the one currently installed.

Bizmate

Checking and rolling back migrations with doctrine.

This is a quick note on how to work with doctrine migrations

When a change in the mapping is done you can run

I have no name!@7efd2339724b:/var/www/html$ bin/console doctrine:schema:validate

Mapping
-------


[OK] The mapping files are correct. 


Database
--------


[ERROR] The database schema is not in sync with the current mapping file.

This will show if the mapping files are correct and if indeed the mapping matches the current schema status.

If the status is not in sync then you might need to update, run or generate a migration.

To generate a migration run…

I have no name!@7efd2339724b:/var/www/html$ bin/console doctrine:migrations:diff 
Generated new migration class to "/var/www/html/src/Infrastructure/Persistence/Doctrine/Migrations/Version20231127094706.php"

This new migration will have the new definitions for the schema to upgrate the state to the current state. It is generally a good practice to review it.

However if you want to rollback and run a specific migration this can be done by first checking the migrations status …

I have no name!@7efd2339724b:/var/www/html$ bin/console doctrine:migrations:status
+----------------------+------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------+
| Configuration |
+----------------------+------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------+
| Storage | Type | Doctrine\Migrations\Metadata\Storage\TableMetadataStorageConfiguration |
| | Table Name | doctrine_migration_versions |
| | Column Name | version |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Database | Driver | Symfony\Bridge\Doctrine\Middleware\Debug\Driver |
| | Name | devdb |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Versions | Previous | 0 |
| | Current | MyApp\YelpBundle\Infrastructure\Persistence\Doctrine\Migrations\Version20230605164531 |
| | Next | MyRApp\ReviewsConfigBundle\Infrastructure\Persistence\Doctrine\Migrations\Version20230118085703 |
| | Latest | MyApp\YelpBundle\Infrastructure\Persistence\Doctrine\Migrations\Version20230605164531 |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Migrations | Executed | 1 |
| | Executed Unavailable | 0 |
| | Available | 2 |
| | New | 1 |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Migration Namespaces | MyApp\ReviewsConfigBundle\Infrastructure\Persistence\Doctrine\Migrations | /var/www/html/src/Infrastructure/Persistence/Doctrine/Migrations |
| | MyApp\YelpBundle\Infrastructure\Persistence\Doctrine\Migrations | /var/www/html/vendor/bizmate/myreviews-yelp-reviews/src/Infrastructure/Persistence/Doctrine/Migrations |

Then you can rollback the migrations by notice in the command line you will need to escape the backward slashes or the migration will not be identified.

I have no name!@7efd2339724b:/var/www/html$ bin/console doctrine:migrations:execute MyApp\\ReviewsConfigBundle\\Infrastructure\\Persistence\\Doctrine\\Migrations\\Version20230118085703 --down

WARNING! You are about to execute a migration in database "devdb" that could result in schema changes and data loss. Are you sure you wish to continue? (yes/no) [yes]:
> yes

[notice] Executing MyApp\ReviewsConfigBundle\Infrastructure\Persistence\Doctrine\Migrations\Version20230118085703 down
[notice] finished in 46.2ms, used 18M memory, 1 migrations executed, 23 sql queries

[OK] Successfully migrated version(s): 
MyApp\ReviewsConfigBundle\Infrastructure\Persistence\Doctrine\Migrations\Version20230118085703: [DOWN]

NOTICE if multiple bundles are registered, to keep track of the other bundles migrations status.

 

Bizmate

Give meaningful names to your Natwest bank statements using bash and phptotext

Why are certain banks so bad when it comes to naming your e-statements from your accounts?

Why when you download a statement from your account you get a PDF names like “b5862f22-c86f-4195-a756-8ea2e009da85.pdf“.

Would it help if the file had a more meaningful name such as “MYACCOUNT-NAME_ACCOUNT-NUMBER_YYYYMMDD.pdf” where you know from the name exactly what account this belongs to and a date that the file is related too?

Try a bash script to rename all files after you download them

Well Natwest in the UK does not care about fixing this small but simple problem and so here comes a small script written in bash and using pdftotxt to find the end date of the statement and give a meaningful name to your Natwest statements.

Please note that the script is not given with any sort of warranty so please the script description and the license file in the repository.

By using the script you accept the disclaimer.

I hope this script helps.

Bizmate

Mauritius as a Digital Nomad

This page collects some information based on experience and current knowledge of looking into Mauritius as a Digital Nomad to come and live here for periods longer than 90 days.

Do I need a Visa to move to Mauritius as a Digital Nomad?

A tourist can come for approximately 90 days but a digital nomad (someone working remotely from Mauritius) can consider the Premium Visa . The Premium Visa might be applicable to other kind of foreigners interested to move to Mauritius too.

How is broadband on the island?

Mauritius connection is not too bad. You might notice some connection difference but performance is very good in Mauritius too. As far as I know you can get a broadband connection  of up to 1Gb but so far I have been great on a 100 Mb. MyT broadband only offers are available, but you can also check out packages with TV a bundle.

How is the electricity service in Mauritius?

My experience as a ex European citizen is that electricity can drop several times during the month or also during the day. Often these are short drops of current but sometimes during bad weather and cyclones blackout might last longer up to a few hours. This is based on my experience so far. As I could not afford to have my system shut down whist working due to a small drop in electricity I bought a UPS. In Mauritius I could not find a premium UPS provided but found one that I think it is good value for money from Jacey Computers in Port Luis, the capital city of Mauritius. If I experience a blackout I have about 20/30 minutes of up-time. If I see it lasting longer than 15 minutes I usually save my work and shut my systems down.

Where can I find a property to rent?

First of all all the sites I know about property in Mauritius are:

  1. Lexpress Property 
  2. Property Map
  3. Property Cloud

About areas the North is definitely the busiest together with the West with areas like Grand Bay, Flic en flac. However my preference is to have a long public beach where I can do some jogging and this is impossible in most parts of Grand Bay and in Flic en Flac the beach is nice but one of the greatest things I love about some places in Mauritius are beaches like Belle Mare in the East where you can run in between the shadow of the trees, do a nice workout and then enjoy a swim too. It really depends on what you need but this is a 5 min perspective.

Bizmate

linux bash file rename with dates formatted as DD-MM-YYYY to YYYYMMDD

I am often, as I assume several other people, served with files from online services that have rather strange or incomplete formats and information on their name.

Especially for bank accounts I like an element of semantic description, such as “CreditCard”, “{bankName}_statement”, etc. followed by a well formatted date such as YYYYMMDD, standing for year, month and day such as 20230228.

This date formatting helps because despite the file creation time it still allows ordering the files by name and having the year and month before the day will show the files ordered according to this part of the name. For example a file named “CreditCard_30032021.pdf” will show after a file called “CreditCard_29032022.pdf” if ordering by name, even if older.

See example of a run here:

Bash Essentials File Rename with script available on Github

 

As a solution for this specific problem i just created a bash script, supposed to work with bash 4.4 and after, so it should work in any modern linux distribution.

The script is available on github but in show it is just a function that splits the initial DD-MM-YYYY format into day, month and year. It then removes the old date format from the file name and replaces it with YYYYMMDD.

Please give it a try first without confirming any changes/renaming and if you have any questions or comments feel free to contact us.

Bizmate

AWS S3 Cli quick reference

Dreamhosts these days forces use of DreamObjects. This is just a custom wrapper of S3 and so it can be used in a very similar way as you would use the original. Simplified steps

Set up credentials

$ export AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE
$ export AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
$ export AWS_DEFAULT_REGION=us-west-2

List content in the bucket (get the bucket from the Dreamhost panel if needs DreamObjects)

aws –endpoint-url https://objects-us-east-1.dream.io s3 ls

Download whole directory

aws –endpoint-url https://objects-us-east-1.dream.io s3 cp s3://trippinrecords-20220427-dh-data-backup/db_backup . –recursive

Delete directory

aws –endpoint-url https://objects-us-east-1.dream.io s3 rm s3://trippinrecords-20220427-dh-data-backup/ –recursive

Bizmate