Fedora 25 Tigervnc displays Black screen - x11

The system is Fedora 25. The issue is vncviewer is displaying a black screen. By comparison the vnc package list is the same as those in a Fedora 24 system where vnc viewer is displaying correctly.The same client system is used to access the server.
Other threads with this issue have been reviewed and tried, specifically vnc package requirements, $HOME//.vnc/xstartup permissions, and suggestions for the xstartup script.
Below is the xstartup script:
#!/bin/sh
# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
exec gnome-session
# --session=gnome-fallback
# exec /etc/X11/xinit/xinitrc
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
startx &
Below is the output from systemctl status vncserver:
vncserver#:2.service - Remote desktop service (VNC)
Loaded: loaded (/etc/systemd/system/vncserver#:2.service; enabled; vendor
preset: disabled)
Active: active (running) since Fri 2017-01-13 07:05:58 PST; 1h 18min ago
Process: 25119 ExecStop=/usr/bin/vncserver -kill %i (code=exited,
status=0/SUCCESS)
Process: 25152 ExecStart=/usr/bin/vncserver %i (code=exited,
status=0/SUCCESS)
Process: 25147 ExecStartPre=/usr/bin/vncserver -kill %i (code=exited,
status=2)
Main PID: 25161 (Xvnc)
Tasks: 186 (limit: 4915)
CGroup: /system.slice/system-vncserver.slice/vncserver#:2.service
├─25161 /usr/bin/Xvnc :2 -auth /home/dan/.Xauthority -desktop server:2
(dan) -fp catalogue:/etc/X11/fontpath.d -geometry 1024x
├─25168 /usr/bin/vncconfig -nowin
├─25170 /usr/libexec/gnome-session-binary
├─25177 dbus-launch --autolaunch 98c684d1ace64647a9df44e5b61d8590 --
binary-syntax --close-stderr
├─25178 /usr/bin/dbus-daemon --syslog-only --fork --print-pid 5 --
print-address 7 --session
├─25182 dbus-launch --exit-with-session /usr/libexec/gnome-session binary
├─25183 /usr/bin/dbus-daemon --syslog --fork --print-pid 5 --print-
address 7 --session
├─25191 /usr/libexec/at-spi-bus-launcher
├─25196 /bin/dbus-daemon --config-file=/usr/share/defaults/at-
spi2/accessibility.conf --nofork --print-address 3
├─25199 /usr/libexec/at-spi2-registryd --use-gnome-session
├─25203 /usr/libexec/gvfsd
├─25222 /usr/bin/gnome-keyring-daemon --start --components=secrets
├─25242 /usr/libexec/gnome-settings-daemon
├─25252 /usr/bin/pulseaudio --start --log-target=syslog
├─25296 /usr/libexec/tracker-extract
├─25301 /usr/libexec/tracker-store
├─25318 /usr/libexec/tracker-miner-apps
├─25320 /usr/libexec/evolution/evolution-alarm-notify
├─25324 /usr/libexec/deja-dup/deja-dup-monitor
├─25329 /usr/libexec/gsd-printer
├─25335 /usr/libexec/imsettings-daemon
├─25336 /usr/libexec/tracker-miner-user-guides
├─25378 abrt-applet
├─25418 /usr/libexec/tracker-miner-fs
├─25438 /usr/libexec/gvfs-udisks2-volume-monitor
├─25462 /usr/bin/seapplet
├─25529 /usr/libexec/gvfs-gphoto2-volume-monitor
├─25559 /usr/bin/ibus-daemon -r --xim
There were several threads a few years back. Those have been reviewed and tried. They do not seem applicable to this situation.

You can find an answer here: https://www.server-world.info/en/note?os=Fedora_25&p=desktop&f=6 - on my case the replacement at /home/USER/.vnc/xstartup
...
# end line: comment out and add like follows
#exec /etc/X11/xinit/xinitrc
#exec /usr/bin/mate-session
exec /usr/bin/gnome-session
so I used gnome-session instead of mate-session as I am using gnome-desktop.
No more blank screen (wait some time until transmitted).

I am using Fedora 27 and having the same issue "Black Screen". I tried a lot of 'workaround', none of them works for me. then I switched to use MATE desktop environment, and got it working in seconds. if you had struggled with the issue for a long time, i would suggest to try MATE desktop.
if you don't have MATE installed, you should install MATE:
dnf -y group install "MATE Desktop"
here is the help of installing MATE.
update xstartup as follows.
#!/bin/sh
#def
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
exec /usr/bin/mate-session
remember to restart VNC service, it should work.
#systemctl start vncserver#:1.service
Hope it helps somebody.

I also had the issue in F25 with gnome. I just modified the xstartup like the following, and it started working well:
#!/bin/sh
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
exec gnome-session
#exec /etc/X11/xinit/xinitrc

what about to add a config for xstartup in ~/.vcn/
!/bin/sh
#
# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
# exec /etc/X11/xinit/xinitrc
#
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
gnome-session &

Related

Cannot start AEM as a service on Ubuntu 18.04

I'm trying to setup AEM (Adobe Experience Manager) Author as a Service on Ubuntu 18.04 on an AWS EC2 instance.
Script file "aem" at /usr/bin/aem (file permissions to "root")
#!/bin/bash
#
# description: This service manages the Adobe Experience Manager java process.
# processname: aem6
. /lib/lsb/init-functions
SCRIPT_NAME=`basename $0`
AEM_ROOT=/opt/aem/author
AEM_USER=root
########
BIN=${AEM_ROOT}/crx-quickstart/bin
START=${BIN}/start
STOP=${BIN}/stop
STATUS=${BIN}/status
case "$1" in
start)
if [ -f $START ]; then
echo "Starting AEM Service.."
/bin/su -l $AEM_USER -c $START
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/${SCRIPT_NAME}
fi
;;
stop)
if [ -f $STOP ]; then
echo "Stopping AEM Service.."
/bin/su -l $AEM_USER -c $STOP
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/${SCRIPT_NAME}
fi
;;
status)
if [ -f $STATUS ]; then
echo -s "Checking status of $SCRIPT_NAME: "
/bin/su -l $AEM_USER -c $STATUS
RETVAL=$?
[ $RETVAL -eq 0 ] && echo "$SCRIPT_NAME is running"
fi
;;
restart)
/bin/su -l ${AEM_USER} -c ${STOP}
/bin/su -l ${AEM_USER} -c ${START}
;;
reload)
;;
*)
echo "Usage: $0 {start|stop|status|reload}"
RETVAL=1
;;
esac
exit $RETVAL
Service file at /etc/systemd/system/aem.service (file permissions to "root")
[Unit]
Description=Adobe Experience Manager
[Service]
Type=simple
ExecStart=/usr/bin/aem start
ExecStop=/usr/bin/aem stop
ExecReload=/usr/bin/aem restart
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
when checking the service status:
ubuntu#ip-109:~$ sudo systemctl status aem
aem.service - Adobe Experience Manager
Loaded: loaded (/etc/systemd/system/aem.service; enabled; vendor preset: enabled)
Active: active (exited) since Wed 2019-10-23 20:25:21 UTC; 3min 24s ago
Process: 20106 ExecStart=/usr/bin/aem start (code=exited, status=0/SUCCESS)
Main PID: 20106 (code=exited, status=0/SUCCESS)
Oct 23 20:25:21 ip-172-31-14-109 systemd[1]: Started Adobe Experience Manager.
Oct 23 20:25:21 ip-172-31-14-109 aem[20106]: Starting AEM Service..
Oct 23 20:25:21 ip-172-31-14-109 su[20122]: Successful su for root by root
Oct 23 20:25:21 ip-172-31-14-109 su[20122]: + ??? root:root
Oct 23 20:25:21 ip-172-31-14-109 su[20122]: pam_unix(su:session): session opened for user root by (uid=0)
Oct 23 20:25:21 ip-172-31-14-109 aem[20106]: mesg: ttyname failed: Inappropriate ioctl for device
Oct 23 20:25:21 ip-172-31-14-109 su[20122]: pam_unix(su:session): session closed for user root
But cannot see "java" process (using ps -ef | grep java ) or port "4502" being used (using sudo lsof -i -P -n | grep LISTEN).
What am i missing?
Was able to resolve the issue. The problem was with "java" not being available to all users. Installed Oracle Java using default (ubuntu) user, while the aem script was running as root.
Steps to install custom Java.. not the Ubuntu default:
Download the tar.gz file "https://download.oracle.com/otn/java/jdk/8u231-b11/5b13a193868b4bf28bcb45c792fce896/jdk-8u 231-linux-x64.tar.gz"
Copy the file to the server using SCP
Make a directory mkdir /opt/java
Install and copy sudo tar -zxf jdk-8u231-linux-x64.tar.gz -C /opt/java/
Update your environment to allow Java for all users. Run this command
sudo update-alternatives --install /usr/bin/java java /opt/java/jdk1.8.0_231/bin/java 1
Add path to ".bashrc". Open to edit sudo nano ~/.bashrc
Add these lines to the end of the file:
export JAVA_HOME=/opt/java/jdk1.8.0_231
export PATH=${PATH}:${JAVA_HOME}/bin
After this.. start the "aem" service again. It should be working!

How can I fix "bash: screen: command not found" in shell file

Whenever I run this code I always get the error "bash: screen: command not found"
The code's supposed to run spigot.jar, while also doing a few other things (not my code)
I really don't know what to try, but I do think I might have to be using linux (which would be a pain in the ass figuring I only have one computer)
screen -S powercraft/PRISON -p 0 -X stuff "`printf "stop\r"`" ;
screen -S root/PRISON -p 0 -X stuff "`printf "stop\r"`" ;
sleep 10 ;
pkill -f PRISON ;
cp -r /home/ALL/update/plugins-1.8/* plugins ;
cp -r auto/* plugins ;
sleep 1 ;
rm -rf auto/* ;
screen -d -m -S PRISON java -server -Xmx6G -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:MaxGCPauseMillis=30 -XX:+UseBiasedLocking -XX:+OptimizeStringConcat -XX:+UseFastAccessorMethods -XX:+AggressiveOpts -jar spigot.jar
Looking at your code, I can see the command pkill. pkill is a Linux command not available on Windows. You don't have to install linux on your pc. You can use a virtual machine or you can install linux subsystem on windows 10. Instructions on the later can be found here

Running Elasticsearch-7.0 on a Travis Xenial build host

The Xenial (Ubuntu 16.04) image on Travis-CI comes with Elasticsearch-5.5 preinstalled. What should I put in my .travis.yml to run my builds against Elasticsearch-7.0?
Add these commands to your before_install step:
- curl -s -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.0.1-amd64.deb
- sudo dpkg -i --force-confnew elasticsearch-7.0.1-amd64.deb
- sudo sed -i.old 's/-Xms1g/-Xms128m/' /etc/elasticsearch/jvm.options
- sudo sed -i.old 's/-Xmx1g/-Xmx128m/' /etc/elasticsearch/jvm.options
- echo -e '-XX:+DisableExplicitGC\n-Djdk.io.permissionsUseCanonicalPath=true\n-Dlog4j.skipJansi=true\n-server\n' | sudo tee -a /etc/elasticsearch/jvm.options
- sudo chown -R elasticsearch:elasticsearch /etc/default/elasticsearch
- sudo systemctl start elasticsearch
The changes to jvm.options are done in an attempt to emulate the existing config for Elasticsearch-5.5, which I assume the Travis peeps have actually thought about.
According to the Travis docs, you should also add this line to your before_script step:
- sleep 10
This is to ensure Elasticsearch is up and running, but I haven't checked if it's actually necessary.
One small addition to #kthy answer that had me stumbling for a bit. You need to remove - elasticsearch from your services: definition in the .travis.yml otherwise no matter what you put in before_install, the default service will override it!
services:
- elasticsearch
Remove ^^ and then you can proceed with the steps he outlined and it should all work smoothly.
if you want to wait for the elastic search to start (which may be longer or shorter than 10 seconds) replace the sleep 10 with this:
host="localhost:9200"
response=""
attempt=0
until [ "$response" = "200" ]; do
if [ $attempt -ge 25 ]; then
echo "FAILED. Elasticsearch not responding after $attempt tries."
exit 1
fi
echo "Contacting Elasticsearch on ${host}. Try number ${attempt}"
response=$(curl --write-out %{http_code} --silent --output /dev/null "$host")
sleep 1
attempt=$[$attempt+1]
done

How to run some programs which require `source ~/.bashrc` and to be launched inside tmux with upstart?

I have some programs which require source ~/.bashrc and should be launched inside tmux with upstart.
So I've wrote the following test programs and it works when I manually start these daemons by initctl start xxx, but it doesn't at boot-time.
I'm using Ubuntu 12.04.
Does anyone have a solution?
test programs
3 test conf scripts
eisoku#server:~$ cat /etc/init/start-tmux.conf
description "tmux daemon"
start on started network-manager
stop on runlevel [!2345]
umask 022
nice -5
script
sudo -iu eisoku /bin/bash -i -c 'source ~/.bashrc && bash ~/Desktop/util/start-tmux.bash' &
watch -n 100 ls
end script
eisoku#server:~$ cat /etc/init/test-a.conf
description "test a daemon"
start on started start-tmux
stop on stopped start-tmux
umask 022
script
sudo -iu eisoku /bin/bash -i -c "source ~/Desktop/util/tmux-patch.bash && tmux-newwindow test-a htop" &
watch -n 100 ls
end script
eisoku#server:~$ cat /etc/init/test-b.conf
description "test b daemon"
start on started start-tmux
stop on stopped start-tmux
umask 022
script
sudo -iu eisoku /bin/bash -i -c "source ~/Desktop/util/tmux-patch.bash && tmux-newwindow test-b top" &
watch -n 100 ls
end script
util scripts
eisoku#server:~$ cat ~/Desktop/util/start-tmux.bash
#!/bin/bash
SESSION_NAME=`hostname`
tmux new-session -d -s $SESSION_NAME -n tmp
eisoku#server:~$ cat ~/Desktop/util/tmux-patch.bash
#!/bin/bash
tmux-newwindow() {
if [ `tmux list-windows | grep " $1 " | cut -d' ' -f2` ]; then
echo $1 "already exists"
else
tmux new-window -k -n $1 -t `hostname`
tmux send-keys -t `hostname`:$1 ${#:2} C-m
fi
}
tmux-killwindow() {
if [ `tmux list-windows | grep " $1 " | cut -d' ' -f2` ]; then
tmux kill-window -t $1
else
echo $i "not exists"
fi
}
result
eisoku#local-PC:~$ ssh eisoku#server
Welcome to Ubuntu 12.04.5 LTS (GNU/Linux 3.11.0-26-generic x86_64)
eisoku#server:~$ sudo reboot
After reboot,
eisoku#local-PC:~$ ssh eisoku#server
Welcome to Ubuntu 12.04.5 LTS (GNU/Linux 3.11.0-26-generic x86_64)
eisoku#server:~$ tmux list-windows
0: tmp [80x23] [layout b85e,80x23,0,0] (active)
eisoku#server:~$
eisoku#server:~$ initctl status start-tmux
start-tmux start/running, process 1030
eisoku#server:~$ initctl status test-a
test-a start/running, process 1033
eisoku#server:~$ initctl status test-b
test-b start/running, process 1031
test-a and test-b seem not to be worked as I had expected while the status of the daemons is running.
However, it works when I manually start these daemons
eisoku#server:~$ sudo initctl restart test-a
test-a start/running, process 3369
eisoku#server:~$ sudo initctl restart test-b
test-b start/running, process 3461
eisoku#server:~$ tmux list-windows
0: tmp [80x23] [layout b85e,80x23,0,0]
1: test-a [80x23] [layout b85e,80x23,0,0]
2: test-b [80x23] [layout b85e,80x23,0,0] (active)
I've solved my own problem. It is because Upstart run jobs in parallel and Upstart tries to start test-a job just after upstart starts start-tmux job so that tmux, which is launched by start-tmux job in this case, is not completely launched.
I can solve it by using pre-start to wait for tmux to be launched and letting test-b job chain to test-a like this.
eisoku#server:~$ cat /etc/init/test-a.conf
description "test a daemon"
start on started start-tmux
stop on stopped start-tmux
umask 022
pre-start script
/bin/sleep 1
end script
script
sudo -iu eisoku /bin/bash -i -c "source ~/Desktop/util/tmux-patch.bash && tmux-newwindow test-a htop" &
watch -n 100 ls
end script
eisoku#server:~$ cat /etc/init/test-b.conf
description "test b daemon"
start on started test-a
stop on stopped start-tmux
umask 022
pre-start script
/bin/sleep 1
end script
script
sudo -iu eisoku /bin/bash -i -c "source ~/Desktop/util/tmux-patch.bash && tmux-newwindow test-b top" &
watch -n 100 ls
end script

How to run xfce4 on debian on VNC startup?

I have a debian server. It is running the latest stable version of Debian.
The following commands have been entered:
apt-get install xfce4 xfce4-goodies
I have also added startxfce4 to the VNC startup file.
However, I get this black and white dotted screen when I start vnc:
Is there a way to make the xfce4 desktop run properly?
(it's a server, so i dont have the monitor, physical access etc)
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
startxfce4 &
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
#it works for me
Use xfce4-session instead of startxfce4, it's in the package xfce4-session.
vi /root/.vnc/xstartup
#!/bin/sh
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
startxfce4 &
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &

Resources