How to run flatpak app as a systemd service? - chromium

I'm using playwright to run automated testing on CentOS 8.
Node script are run as systemd services.
Chromium is used from the rpm package.
But chromium from rpm package has problems with video codec support.
I installed chromium from flatpak and tried to run it...
After the first failure, I went to github playwright repo.
Then I created another question, but already in the flatpack repo.
In short, when I try to start chromium from flatpak from script that is running as a systemd service, I get an error:
Cannot autolaunch D-Bus without X11 $DISPLAY
(zenity:8): Gtk-WARNING **: 17:13:28.767: cannot open display:
As far as I understand, I need to somehow make sure that the script running as a service has a dbus... How to do it?

You need to set correct Environment= inside your unit or export all required variables using
systemctl --user import-environment DISPLAY XAUTHORITY
if command -v dbus-update-activation-environment >/dev/null 2>&1; then
dbus-update-activation-environment DISPLAY XAUTHORITY
fi
See
https://unix.stackexchange.com/a/653101
https://wiki.archlinux.org/title/systemd/User#Environment_variables
After that, even with a basic unit below
~/.config/systemd/user/chromium.service
[Unit]
Description=Chromium
[Service]
ExecStart=/usr/bin/flatpak run org.chromium.Chromium
ExecStop=/usr/bin/flatpak kill org.chromium.Chromium
[Install]
WantedBy=default.target
systemctl --user start chromium will open your browser

Related

Unable to run npm commands with sudo

I've recently installed the balena-cli package via npm (which itself has been installed using nvm) which works fine when accessed from my default user.
However whenever I try to access npm, nvm or balena-cli using sudo they all print the following error
$ sudo npm
sudo: npm: command not found
$ sudo nvm
sudo: nvm: command not found
$ sudo balena
sudo: balena: command not found
I tried using sudo chown on all 3 but to now avail.
Basically, none of the Node related functions can be accessed using root.
Any suggestions on how to resolve this, perhaps by the use of environment variables?
As a stop gap, I found out that running the same command after switching to root works fine with the following command;
$ sudo -s
However, since it's a stop gap, it would be great to find a way to run the same commands without switching back and forth between root.
Basically once do check that have you flashed Balena image correctly and then check the network permissions and login to Balena with root and run commands with su instead of sudo then your issue might clear.

What is going on and how do I fix it?

https://prnt.sc/hlt4ey
I'm trying to get onto the xfce4 client from my chromebook (and it has worked before), however now this error is popping up. How do I fix this error?
My guess is you may not have the right user privileges. According to the error message you provided you are running an Ubuntu Linux environment.
If you haven't tried running the program through the terminal yet, attempt to do so.
The terminal can typically be opened by the key combination Ctrl+Alt+T on ubuntu linux.
Try using sudo command before running the program. This will run the command you enter using root privileges.
For example, if running the program on your terminal is
myName#ubuntu: xfce4
And this encounters an error, try to use sudo beforehand like so:
myName#ubuntu: sudo xfce4
Alternatively you can log in and not have to type sudo before every command.
myName#ubuntu: sudo bash
password:
If this fails you may need to update the package that contains the library. This can be done on the terminal in a fashion similar to:
myName#ubuntu: sudo apt-get install --only-upgrade xfce4

how to ask ambari agent not keep quiet when install packages in ubuntu

I'm installing new service in ambari managed cluster. my connection to hortonwork's repo seems too bad, it took lots of time to install ambari-server and ambari-agent it self (onece i almost thought it was dead).
the problem is that when i'm installing new service (e.g zeppelin, it also requires install other dependencies), the progress bar get stuck at 26% percent. it confused me if the installation get stucked or it's just too slow.
the command
ps -ef|grep apt
shows the the install is still there. only can't track the progress via /var/log/apt/term.log like normal apt-get installation (it shows the download progress).
the command shows the apt-get comes with an "-q" options which prevent me from tracking the log file.
so my question is that is there any place i can change the default behavior?
The -q option is added to "apt-get" command based on log level of ambari-agent. I.e. if log level for ambari-agent is set to DEBUG then apt-get without -q option is executed.
You can edit /etc/ambari-agent/conf/logging.conf, in [logger_root] section comment default line level=WARNING and add level=DEBUG. Then retstart ambari-agent. Now if you install any service them apt-get without -q will be executed.
Note:
If /etc/ambari-agent/conf/logging.conf does not exist then copy it from /etc/ambari-agent/conf/logging.conf.sample
Ambari agent specific changed need to be done on all cluster node

Error running headless Chromium on Ubuntu

I installed Chromium 59.0, and I'm trying to run it in headless mode using the following command:
sudo /opt/google/chrome/chrome --headless --disable-gpu --no-sandbox
but I'm getting the following errors:
[0512/174717.638937:WARNING:audio_manager.cc(295)] Multiple instances of AudioManager detected
[0512/174717.639027:WARNING:audio_manager.cc(254)] Multiple instances of AudioManager detected
Has anyone encountered this and found a way to get past it?
I encountered the exact same thing under dockerized ubuntu running karma.js tests.
You will need to have pulseaudio or similar running.
Try:
apt-get install pulseaudio
And before you run chrome
pulseaudio --daemonize
You can see it in my docker-entrypoint.sh:
https://github.com/codeclou/docker-nodejs-chrome-xvfb
When running with docker you will need to run docker with:
--shm-size=128M
Since chrome will complain about small /dev/shm which is 64MB by default.

Manual Installation of Glassfish on Ubuntu

I just installed Glassfish on my Ubuntu server (No GUI) using THIS tutorial. Everything went well. But now when I'm trying to play with ASADMIN tool it's telling me this:
The program 'asadmin' is currently not
installed. You can install it by
typing: apt-get install glassfishv2
-bash: asadmin: command not found
So, in order to run asadmin tool always need to type:
/opt/glassfish/bin/asadmin start-domain domain1
or go to that folder and run it from there.
So, the question is, what file do i need to edit in order to set this path in to the environment.
You can add the following to your ~/.bashrc file to add all the binaries in /opt/glassfish/bin to your $PATH
export PATH=$PATH:/opt/glassfish/bin
~ expands to /home/your-user - just to be clear.
Just type to CLI:
export PATH=/opt/glassfish/bin/:$PATH