Linux Tricks: Difference between revisions

From CLONWiki
Jump to navigation Jump to search
Boiarino (talk | contribs)
Created page with "=== Color change when connected remotely === '''Problem:''' after ssh to linux machine from macbook laptop, it keeps asking about some color settings (create color profile et..."
 
Boiarino (talk | contribs)
 
(15 intermediate revisions by the same user not shown)
Line 1: Line 1:
=== Color change when connected remotely ===
=== Color change when connected remotely ===


'''Problem:''' after ssh to linux machine from macbook laptop, it keeps asking about some color settings (create color profile etc), and keeps asking for password; none of passwords actually works, and it keeps asking again and again.
'''Problem:''' after opening vnc session to linux machine from macbook laptop, small window pops up asking about some color settings (create color profile etc), and keeps asking for password; none of passwords actually works, and it keeps asking again and again.


'''Fix:''' on linux machine, create file ''/etc/polkit-1/localauthority/50-local.d/45-allow-colord.pkla'' with permissions 644 and following contents:
'''Fix:''' on linux machine, create file ''/etc/polkit-1/localauthority/50-local.d/45-allow-colord.pkla'' with permissions 644 and following contents:
Line 10: Line 10:
  ResultInactive=no
  ResultInactive=no
  ResultActive=yes
  ResultActive=yes
=== Creating service in systemd (RHEL7 and up) ===
'''NOTES:'''
systemctl list-units | grep -o '.*\.mount'
'''DiagGuiServer example'''
Create file ''/usr/lib/systemd/system/DiagGuiServer.service'' with following contents:
[Unit]
Description=DiagGuiServer
#After=network.target
#Requires=autofs.service
#Requires=nfs-utils.service nfs-lock.service autofs.service
#Requires=autofs.service
#After=network.target apps.mount home.mount usr-clas12.mount usr-local.mount
#After=-.mount
#RequiresMountsFor=/usr/clas12/release/1.4.0/coda/Linux_x86_64/bin
#Wants=remote-fs.target
#After=remote-fs.target
#ConditionPathExists=/usr/clas12/release/1.4.0/coda/Linux_x86_64/bin
[Service]
Type=simple
#ExecStartPre=/usr/bin/test ! -f /usr/clas12/release/1.4.0/coda/Linux_x86_64/bin
#RestartSec=10
User=clasrun
Group=onliners
#EnvironmentFile=/home/clasrun/systemdenv
#Environment="LD_LIBRARY_PATH=/usr/clas12/release/1.4.0/coda/Linux_armv7l/lib:/usr/local/activemq/lib" "SESSION=clasprod" "EXPID=clasrun" "IPC_HOST=clon00" "CLON_PARMS=/usr/clas12/release/1.4.0/parms" "MYSQL_HOST=clondb1"
#ExecStart=/usr/clas12/release/1.4.0/coda/src/rol/Linux_x86_64/bin/DiagGuiServer
ExecStart=/usr/clas12/release/1.4.0/coda/Linux_x86_64/bin/DiagGuiServer init
Restart=on-failure
RestartSec=10
[Install]
WantedBy=multi-user.target
#WantedBy=default.target
## ???
##Create symbolic link:
## ln -s /usr/lib/systemd/system/DiagGuiServer.service /etc/systemd/system/DiagGuiServer.service
Create directory ''/etc/systemd/system/DiagGuiServer.service.d/''
Create file ''/etc/systemd/system/DiagGuiServer.service.d/override.conf'' with following contents:
[Service]
Environment="LD_LIBRARY_PATH=/apps/gcc/8.3.0/lib:/apps/gcc/8.3.0/lib64:/usr/lib:/usr/local/lib:/usr/local/activemq/lib:/usr/clas12/release/1.4.0/coda/Linux_x86_64/lib:/usr/clas12/release/1.4.0/clon/Linux_x86_64/lib:/usr/clas12/release/1.4.0/clon/lib"
Environment="IPC_HOST=clon00"
Environment="MYSQL_HOST=clondb1"
Environment="EXPID=clasrun"
Environment="CLON_PARMS=/usr/clas12/release/1.4.0/parms"
Following commands can be used to control service:
systemctl start DiagGuiServer
systemctl stop DiagGuiServer
systemctl status DiagGuiServer
To start service at boot time, execute command:
systemctl enable DiagGuiServer
following message should come up on screen:
Created symlink from /etc/systemd/system/default.target.wants/DiagGuiServer.service to /usr/lib/systemd/system/DiagGuiServer.service.

Latest revision as of 15:10, 7 April 2025

Color change when connected remotely

Problem: after opening vnc session to linux machine from macbook laptop, small window pops up asking about some color settings (create color profile etc), and keeps asking for password; none of passwords actually works, and it keeps asking again and again.

Fix: on linux machine, create file /etc/polkit-1/localauthority/50-local.d/45-allow-colord.pkla with permissions 644 and following contents:

[Allow Colord all Users]
Identity=unix-user:*
Action=org.freedesktop.color-manager.create-device;org.freedesktop.color-manager.create-profile;org.freedesktop.color-manager.delete-device;org.freedesktop.color-manager.delete-profile;org.freedesktop.color-manager.modify-device;org.freedesktop.color-manager.modify-profile
ResultAny=no
ResultInactive=no
ResultActive=yes


Creating service in systemd (RHEL7 and up)

NOTES:

systemctl list-units | grep -o '.*\.mount'


DiagGuiServer example

Create file /usr/lib/systemd/system/DiagGuiServer.service with following contents:

[Unit]
Description=DiagGuiServer
#After=network.target
#Requires=autofs.service
#Requires=nfs-utils.service nfs-lock.service autofs.service
#Requires=autofs.service
#After=network.target apps.mount home.mount usr-clas12.mount usr-local.mount
#After=-.mount
#RequiresMountsFor=/usr/clas12/release/1.4.0/coda/Linux_x86_64/bin
#Wants=remote-fs.target
#After=remote-fs.target
#ConditionPathExists=/usr/clas12/release/1.4.0/coda/Linux_x86_64/bin 
[Service]
Type=simple
#ExecStartPre=/usr/bin/test ! -f /usr/clas12/release/1.4.0/coda/Linux_x86_64/bin
#RestartSec=10
User=clasrun
Group=onliners
#EnvironmentFile=/home/clasrun/systemdenv
#Environment="LD_LIBRARY_PATH=/usr/clas12/release/1.4.0/coda/Linux_armv7l/lib:/usr/local/activemq/lib" "SESSION=clasprod" "EXPID=clasrun" "IPC_HOST=clon00" "CLON_PARMS=/usr/clas12/release/1.4.0/parms" "MYSQL_HOST=clondb1"
#ExecStart=/usr/clas12/release/1.4.0/coda/src/rol/Linux_x86_64/bin/DiagGuiServer
ExecStart=/usr/clas12/release/1.4.0/coda/Linux_x86_64/bin/DiagGuiServer init
Restart=on-failure
RestartSec=10
[Install]
WantedBy=multi-user.target
#WantedBy=default.target


## ???
##Create symbolic link:
## ln -s /usr/lib/systemd/system/DiagGuiServer.service /etc/systemd/system/DiagGuiServer.service

Create directory /etc/systemd/system/DiagGuiServer.service.d/

Create file /etc/systemd/system/DiagGuiServer.service.d/override.conf with following contents:

[Service]
Environment="LD_LIBRARY_PATH=/apps/gcc/8.3.0/lib:/apps/gcc/8.3.0/lib64:/usr/lib:/usr/local/lib:/usr/local/activemq/lib:/usr/clas12/release/1.4.0/coda/Linux_x86_64/lib:/usr/clas12/release/1.4.0/clon/Linux_x86_64/lib:/usr/clas12/release/1.4.0/clon/lib"
Environment="IPC_HOST=clon00"
Environment="MYSQL_HOST=clondb1"
Environment="EXPID=clasrun"
Environment="CLON_PARMS=/usr/clas12/release/1.4.0/parms"

Following commands can be used to control service:

systemctl start DiagGuiServer
systemctl stop DiagGuiServer
systemctl status DiagGuiServer

To start service at boot time, execute command:

systemctl enable DiagGuiServer

following message should come up on screen:

Created symlink from /etc/systemd/system/default.target.wants/DiagGuiServer.service to /usr/lib/systemd/system/DiagGuiServer.service.