ungoogled-software / ungoogled-chromium

Google Chromium, sans integration with Google
BSD 3-Clause "New" or "Revised" License
20.8k stars 844 forks source link

Chromium Headless snap.chromium.chromium (enforce) #3096

Closed richardsonoge closed 1 week ago

richardsonoge commented 1 week ago

OS/Platform

Debian, Ubuntu, and derivatives

Installed

https://ungoogled-software.github.io/ungoogled-chromium-binaries/

Version

Chromium 130.0.6723.116 snap

Have you tested that this is not an upstream issue or an issue with your configuration?

Description

Chromium Headless snap.chromium.chromium (enforce)

How to Reproduce?

I've tried everything and done a lot of research to fix this problem, but nothing works. My goal was to convert my HTML file to PDF with Chromium Headless, but I got this error:

johndoe@domain:/var/www$ chromium --headless --disable-gpu --no-sandbox --no-pdf-header-footer --print-to-pdf='/home/johndoe/407163caf78c6deedcb8bf732e7e1326-fr.pdf' 'https://files.domain.com/docs/407163caf78c6deedcb8bf732e7e1326.html' && mv '/home/johndoe/407163caf78c6deedcb8bf732e7e1326-fr.pdf' '/var/www/files.domain.com/docs/' && echo 'files.transladocs.com/docs/407163caf78c6deedcb8bf732e7e1326-fr.pdf'
[17035:17192:1111/053835.545588:ERROR:object_proxy.cc(576)] Failed to call method: org.freedesktop.DBus.ListActivatableNames: object_path= /org/freedesktop/DBus: org.freedesktop.DBus.Error.AccessDenied: An AppArmor policy prevents this sender from sending this message to this recipient; type="method_call", sender=":1.71" (uid=1000 pid=17035 comm="/snap/chromium/2992/usr/lib/chromium-browser/chrom" label="snap.chromium.chromium (enforce)") interface="org.freedesktop.DBus" member="ListActivatableNames" error name="(unset)" requested_reply="0" destination="org.freedesktop.DBus" (bus)                                      
[17035:17192:1111/053835.604277:ERROR:object_proxy.cc(576)] Failed to call method: org.freedesktop.DBus.ListActivatableNames: object_path= /org/freedesktop/DBus: org.freedesktop.DBus.Error.AccessDenied: An AppArmor policy prevents this sender from sending this message to this recipient; type="method_call", sender=":1.73" (uid=1000 pid=17035 comm="/snap/chromium/2992/usr/lib/chromium-browser/chrom" label="snap.chromium.chromium (enforce)") interface="org.freedesktop.DBus" member="ListActivatableNames" error name="(unset)" requested_reply="0" destination="org.freedesktop.DBus" (bus)                                      
754773 bytes written to file /home/john/407163caf78c6deedcb8bf732e7e1326-fr.pdf                                        
files.domain.com/docs/407163caf78c6deedcb8bf732e7e1326-fr.pdf                     
johndoe@domain:/var/www$ 

I couldn't use Google Chrome Headless, because my server is an ARM64 server and Google Chrome Headless doesn't support ARM64 but rather AMD64.

and after these errors that it has been converted. I could try to leave it like that but when I try to use it directly in my site nothing with PHP code works.

Here's my PHP code:


<?php
$command = "chromium --headless --disable-gpu --no-sandbox --no-pdf-header-footer --print-to-pdf='/home/joedoe/407163caf78c6deedcb8bf732e7e1326-fr.pdf' 'https://files.domain.com/docs/407163caf78c6deedcb8bf732e7e1326.html' && mv '/home/joendoe/407163caf78c6deedcb8bf732e7e1326-fr.pdf' '/var/www/files.domain.com/docs/' && echo 'files.domain.com/docs/407163caf78c6deedcb8bf732e7e1326-fr.pdf'";

$output = [];
$returnStatus = 0;

// Execute the command and capture the output and status
exec($command . ' 2>&1', $output, $returnStatus);

// Display output and status for debugging
echo "Return Status: $returnStatus\n";
echo "Output:\n" . implode("\n", $output);

if ($returnStatus !== 0) {
    echo "Command failed.\n";
} else {
    echo "Command succeeded.\n";
}
``
`
**What do you think is going on and what should I do to fix it? Any help or ideas will help me a lot.**

### Actual behaviour

Can you help me?

### Expected behaviour

I'm waiting for these exits to be removed permanently.

### Relevant log output

_No response_

### Additional context

_No response_
PF4Public commented 1 week ago

Why wouldn't you try the normal portable binary for this task?

richardsonoge commented 1 week ago

Why wouldn't you try the normal portable binary for this task?

Thank you so much for your reply. But How can i do that?

PF4Public commented 1 week ago

https://ungoogled-software.github.io/ungoogled-chromium-binaries/releases/linux_portable/64bit/130.0.6723.116-1

richardsonoge commented 1 week ago

I tried to install it this way:

   wget https://github.com/ungoogled-software/ungoogled-chromium-portablelinux/releases/download/130.0.6723.116-1/ungoogled-chromium_130.0.6723.116-1_linux.tar.xz
   tar -xvf ungoogled-chromium_130.0.6723.116-1_linux.tar.xz

   cd ungoogled-chromium

   ./chrome

   ./chrome --headless --disable-gpu --remote-debugging-port=9222

But it doesn't work. So, what should I do in this case?

PF4Public commented 1 week ago

Worksforme:

~ $ chromium --headless --disable-gpu --print-to-pdf=qwe.pdf https://github.com/ungoogled-software/ungoogled-chromium/issues/3096
Warning: disabling flag --expose_wasm due to conflicting flags
[30161:30172:1114/200736.240880:ERROR:ev_root_ca_metadata.cc(162)] Failed to decode OID: 0
181255 bytes written to file qwe.pdf
~ $ head qwe.pdf 
%PDF-1.4
richardsonoge commented 1 week ago

Worksforme:

~ $ chromium --headless --disable-gpu --print-to-pdf=qwe.pdf https://github.com/ungoogled-software/ungoogled-chromium/issues/3096
Warning: disabling flag --expose_wasm due to conflicting flags
[30161:30172:1114/200736.240880:ERROR:ev_root_ca_metadata.cc(162)] Failed to decode OID: 0
181255 bytes written to file qwe.pdf
~ $ head qwe.pdf 
%PDF-1.4

So, did you use the same procedure as me to install it please?

PF4Public commented 1 week ago

It is portable, you don't need to install it, unpacking should suffice.

@clickot I assume your builds should work in Debian (I cannot test it in Debian) and derivatives immediately after unpacking, right?

richardsonoge commented 1 week ago

It is portable, you don't need to install it, unpacking should suffice.

@clickot I assume your builds should work in Debian (I cannot test it in Debian) and derivatives immediately after unpacking, right?

So who, I just have to download it like this wget https://github.com/ungoogled-software/ungoogled-chromium-portablelinux/releases/download/130.0.6723.116-1/ungoogled-chromium_130.0.6723.116-1_linux.tar.xz tar -xvf ungoogled-chromium_130.0.6723.116-1_linux.tar.xz and then do what?

PF4Public commented 1 week ago

and then do what?

Read the fine documentation.

richardsonoge commented 1 week ago

and then do what?

Read the fine documentation.

I read your link. It just showed me how to use the headless but it didn't show me how to install the ".tar.xy" file. So, how do I install it please?

richardsonoge commented 1 week ago
chromium --headless --disable-gpu --print-to-pdf=qwe.pdf https://github.com/ungoogled-software/ungoogled-chromium/issues/3096

Okay, now I've done it and it's giving me this error. So, what should I do?

richardson@goshareit:/var/www/ungoogled-chromium$ chromium --headless --disable-gpu --print-to-pdf=qwe.pdf https://github.com/ungoogled-software/ungoogled-chromium/issues/3096
[335974:336139:1114/221005.052570:ERROR:object_proxy.cc(576)] Failed to call method: org.freedesktop.DBus.ListActivatableNames: object_path= /org/freedesktop/DBus: org.freedesktop.DBus.Error.AccessDenied: An AppArmor policy prevents this sender from sending this message to this recipient; type="method_call", sender=":1.508" (uid=1000 pid=335974 comm="/snap/chromium/2995/usr/lib/chromium-browser/chrom" label="snap.chromium.chromium (enforce)") interface="org.freedesktop.DBus" member="ListActivatableNames" error name="(unset)" requested_reply="0" destination="org.freedesktop.DBus" (bus)
[335974:336139:1114/221005.108504:ERROR:object_proxy.cc(576)] Failed to call method: org.freedesktop.DBus.ListActivatableNames: object_path= /org/freedesktop/DBus: org.freedesktop.DBus.Error.AccessDenied: An AppArmor policy prevents this sender from sending this message to this recipient; type="method_call", sender=":1.510" (uid=1000 pid=335974 comm="/snap/chromium/2995/usr/lib/chromium-browser/chrom" label="snap.chromium.chromium (enforce)") interface="org.freedesktop.DBus" member="ListActivatableNames" error name="(unset)" requested_reply="0" destination="org.freedesktop.DBus" (bus)
[335974:336136:1114/221008.227830:ERROR:headless_command_handler.cc(265)] Failed to write file qwe.pdf: Permission denied (13)
richardson@goshareit:/var/www/ungoogled-chromium$

It doesn't give me the same thing as you, the portable version. So, what should I do?

PF4Public commented 1 week ago

So, what should I do?

  1. You should first attempt solving your difficulties yourself with the help of search engine, stackoverflow, corresponding discussion boards etc.
  2. You shouldn't make issue tracker into a chat of some sort.
  3. You should clearly show how your issue is an issue of ungoogled-chromium.

I'll close this issue as it has nothing to do with ungoogled-chromium and we have nothing to fix here. In case you can identify an issue in ungoogled-chromium feel free to add new information.