Struggling with packaging a very simple Perl script


This is my second attempt trying to package a snap. The first one was Gnuradio, which has proved to be too complex for a start.

Now I am trying to package a simple Perl application, and I am facing another range of problems:

  • Locale warnings, which I could not get rid of
  • INC path issue

Here is the snapcraft:

name: regripper
version: '2.8'
summary: Utility for Windows registry DFIR inverstigation
description: |
  RegRipper is an open source forensic software application developed by Harlan Carvey. RegRipper, written in Perl, is a Windows Registry data extraction tool.
base: core18
confinement: strict
grade: stable

    command: perl $SNAP/RegRipper/

    plugin: dump
      '*' : RegRipper/
      - perl-base
      - libparse-win32registry-perl
      - language-pack-fr

Output after install:

% regripper 
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = "fr_FR",
	LC_ALL = (unset),
	LC_TIME = "fr_FR.UTF-8",
	LC_ADDRESS = "fr_FR.UTF-8",
	LC_NAME = "fr_FR.UTF-8",
	LC_NUMERIC = "fr_FR.UTF-8",
	LC_PAPER = "fr_FR.UTF-8",
	LANG = "fr_FR.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
Can't locate Parse/ in @INC (you may need to install the Parse::Win32Registry module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.26.1 /usr/local/share/perl/5.26.1 /usr/lib/x86_64-linux-gnu/perl5/5.26 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.26 /usr/share/perl/5.26 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at /snap/regripper/x8/RegRipper/ line 29.
BEGIN failed--compilation aborted at /snap/regripper/x8/RegRipper/ line 29.

Thank you for any help.

I am really struggling and getting discouraged… :frowning:

perl is a bit tricky to package since it needs the include paths handed over. you can do that with a wrapper like (in scripts/launcher):

… or through environemnt: entries in the apps section of your snapcraft.yaml … like in:


I tried the second option, but still same error. Environment seems to be ignored.

I did that:

      LC_ALL: "C.UTF-8"
      PERL5LIB: "$SNAP/usr/share/perl5/"
    command: perl -I $SNAP/usr/share/perl5/ $SNAP/RegRipper/

Really, it’s strange because the error message shows that @INC inside Snap includes : /usr/share/perl5

So, it should be fine because this is where the required libs are supposed to be (at leat on my host, I have no idea how to debug a snap) : /usr/share/perl5/Parse/

a confined snap can not access the host libs, your inclusion of libparse-win32registry-perl in stage-packages makes sure gets installed inside the snap, the PERL5LIB variable should list all include paths relative to the $SNAP directory, then all modules should be found. try to copy the whole PERL5LIB line from the snapcraft.yaml i linked above.

Thank you, I did that (copying the entire line) but no luck.

I know about the isolation, but I meant that the host and the snap are based on the same distro/core (Ubuntu 18.04), so I would expect the same behaviour and the same path for libs after installing it from apt.

Even the LC_All variable remains empty.

I am.very used to Docker, but here it looks more obscure and harder to debug.

Have you tried using The perl-launch launcher: Fix Perl applications in the snap runtime ?

1 Like

well, my suspicion is that the subdir is an issue here, appending $SNAP/usr/share/perl5/Parse to the PERL5LIB path list might be needed…

I had try it too I believe, and just made sure again. I really can’t get what’s happening.

I am trying now, but it brings new issues like the script must be executable.

Unfortunately, it is not documented what problem it’s really solving…

By the way, the official documentation is not up-to-date, regarding the install scriptlet which has been outdated by override-build.

@ogra Ok, I finally understood.

I had to use it:

 PERL5LIB:  "$SNAP/rr/usr/share/perl5/"

Because this is where I move what is download from the git, but it also moves everything else (/etc, /usr).

But, now, I have more questions, because I really don’t understand the logic:

  1. Why does it move other folders? It’s like a chroot, when my intent was to just move the git repo.

  2. Isn’t there a better way to dowload the git repo for my case (no perl plugin)?

it does not move anything, it unpacks the deb packages (and their dependencies) that you defined in your stage-packages entry. These packages contain files in /usr and /etc so the dirs end up inside your snap package.

the regripper part in your snapcraft.yaml above looks pretty clean to me :slight_smile: , how much smaller would you expect it to become with some perl plugin ?

The perl-launch stage snap is meant to make it easier to run perl apps, though admittedly I haven’t tried it out so I can’t speak to it’s usefulness for your application specifically.

Which docs are you referring to that says to use the install scriptlet? We will make sure to get those updated

Note that the organize keyword also applies to the files installed by the stage-packages of the same part. Thus you should avoid using '*': somewhere-else/ if your part has specifying stage-packages, or move its declaration to another pseudo part.

Here’s the source, which essentially sets and inserts most (if not all) Perl library paths into the PERL5LIB environment variable.


Not really smaller, but it does not seem intuitive to me. Especially, I do not understand why I need this intermediate rr .

Anyway, I have a much better understanding now and I can continue. Notably, I will need a launcher script anyway as the application needs to be executed from inside its install directory.

In other words, I need to change the working directory, and it seems there is no keyword for that.

Thank you a lot, your help was precious. Very much appreciated! :slight_smile:


I am refering to this page, where I landed at first:

install is still there, and without any indication that it’s deprecated.

Also, if I may leave you a more global feedback on the documentation, it’s perfect for hands on with simple stuff but:

  • it lacks more overview on the technology (architecture, key items, paths, etc.)
  • it also lacks some troubleshooting tips

Fortunately, this forum is great and you are all very nice.

Without it, I was stuck with no clues on easy but essential stuff.
And I am very used to Docker and have already packaged some of my apps for that, so my journey should have been much easier (conceptually, it is quite similar).


It requires the script to be executable, so I would have to chmod it.
Which implies even more work, like editing the script, because this application is not very nicely developped (which is of course a big motivation for snapping it!).

Can’t this extra-step be avoided?

You can always command: bin/perl-launch perl path/to/script