smoser / pdftk

Unofficial mirror of pdftk - imported using git-ubuntu
10 stars 2 forks source link

snap "pdftk" is not compatible with --classic #7

Open swissguest opened 5 years ago

swissguest commented 5 years ago

After googling numerous issues regarding "pdftk no longer available on Ubuntu 18.04", and having learned about the snapd confinement policies, I decided that it would be best for our server setup (where we cannot provide the files in /home/ or /media/) to install the pdftk snap with the --classic option.

However, the --classic confinement option fails on our server:

ubuntu@bla:~$ sudo snap install --classic pdftk
error: snap "pdftk" is not compatible with --classic

Is this an option that you would need to support with your snap? Or is there any other reason I am seeing this error? I am also aware of user gspettel, commented on Oct 11, 2018 on issue #3, suggesting exactly the same procedure, this makes me wonder if something broke just recently?

Please note that a "sudo snap install pdftk" without the --classic option works just fine. However, the runtime would then fail to access our files due to the known confinement restrictions, as already discussed elsewhere.

swissguest commented 5 years ago

I am just reading through the snapcraft.yaml docs. If there is only one choice (of Strict, Classic, Devmode) per published snap, would it be an option to publish two snaps, e.g.: pdftk-classic pdftk-confined ?

Wikinaut commented 5 years ago

Unusable on LinuxMint 19.1 due to these file access issues.

Wikinaut commented 5 years ago

Solution: https://wilransz.com/pdftk-on-ubuntu-18-04/

grafik

swissguest commented 5 years ago

Did you verify that this works with files outside your home (or media) dir?

Wikinaut commented 5 years ago

@swissguest I tried this, too. Negative. I got (almost) crazy.

Only the trick as described above helped finally.

Wikinaut commented 5 years ago

BTW: I would prefer to compile pdftk by myself, not using snap, did this many times before, but this time on my new machine (LinuxMint 19.1) I failed.

swissguest commented 5 years ago

BTW: I would prefer to compile pdftk by myself, not using snap, did this many times before, but this time on my new machine (LinuxMint 19.1) I failed.

The issue is not to compile pdftk, but compiling gcj. This is the missing dependency, and its development had been discontinued. That's why some people have started a pure-java porting effort.

Wikinaut commented 5 years ago

Uh, yes, it looked so.

swissguest commented 5 years ago

I have now verified the suggestion, and this does fix the issue on my Ubuntu 18.04 desktop: sudo ln -s /snap/pdftk/current/usr/bin/pdftk /usr/bin/pdftk

On the sever side, I cannot verify, since we had already moved forward with the installation of an older pdftk deb package (hackish, but worked for us).

swissguest commented 5 years ago

Should I close this issue? Or does somebody still require the pdftk snap to install in --classic mode (for other reason)?

Wikinaut commented 5 years ago

My comment was off-topic here -- it was related to the closed file issues!

I could not activate "snap pdftk" with --classic.

hacmieu commented 2 years ago

I have now verified the suggestion, and this does fix the issue on my Ubuntu 18.04 desktop: sudo ln -s /snap/pdftk/current/usr/bin/pdftk /usr/bin/pdftk

On the sever side, I cannot verify, since we had already moved forward with the installation of an older pdftk deb package (hackish, but worked for us).

Thanks! At my side sudo ln -s /snap/pdftk/current/usr/bin/pdftk /usr/bin/pdftk sudo rm /snap/bin/pdftk sudo ln -s /usr/bin/pdftk /snap/bin/pdftk

Kulgar commented 1 year ago

@hacmieu : thanks, your solution worked for me! :-)

bizmate commented 5 months ago

the above does not fix it for me, it has been a long time since the last suggestion but I am stuck as such

$ pdftk eStatement_Acc_6479_20240430.pdf 12345 ouput eStatement_Acc_647920240430.pdf Error: Unexpected Exception in open_reader() Unhandled Java Exception in main(): java.lang.NullPointerException at gnu.gcj.runtime.NameFinder.lookup(libgcj.so.16) at java.lang.Throwable.getStackTrace(libgcj.so.16) at java.lang.Throwable.stackTraceString(libgcj.so.16) at java.lang.Throwable.printStackTrace(libgcj.so.16) at java.lang.Throwable.printStackTrace(libgcj.so.16)