Installing a headless VNC server on Bananian? - headless

I started this project with a Raspberry Pi, but realized that the Banana's hardware set is a much better fit for what I'm doing. Unfortunately, it appears that, even though LeMaker (the group behind the BPi) offers just about every OS imaginable pre-optimized for the Banana, only Bananian supports all the hardware that I need, and it doesn't come with a GUI of any kind.
So, given a Debian-derivative on an ARM chip that will never see a physical display and has root SSH functional by default, how can I make it boot to an auto-logged-in VNC server?
Here's what I've done so far, as root over SSH:
# bananian-config
# bananian-update
# apt-get update
# apt-get upgrade
# adduser pi
# passwd root
# apt-get install task-lxde-desktop
(the first two are announced in the SSH welcome message and are used to initially setup the generic image for this variation of the board)
Then I uncommented these lines in /etc/lightdm/lightdm.conf:
autologin-user=pi
autologin-user-timeout=0
[VNCServer]
enabled=true
command=Xvnc
port=5900
width=1024
height=768
depth=8
At this point, I rebooted and tried to connect with VNC, but the client gave the same error as when the server doesn't exist. SSH still works as root and now the "pi" user also, except that the "pi" user doesn't know sudo.
At this point, I'm lost. I don't know if there's a desktop waiting for me on the HDMI plug or not, or whether I need an explicit VNC server like x11vnc or tightvnc, or if there's something else wrong.
This is all I've done so far. I can re-flash the image if needed; I want to make this part work before adding anything project-specific.

Okay, I noticed in LeMaker's own instructions to make Wifi work that they included Android and Lubuntu too, and that someone on their forum had made VNC work on Lubuntu. I didn't see before that some other OS's would support the WiFi chip.
So I switched to Lubuntu, which already has a working desktop, installed x11vnc per its instructions, and it basically just worked.
Then I backed up the SD card and spent all of Saturday trying different ways to make it a WiFi access point, which usually resulted in kicking myself out and restoring the backup to try again. And finally that works too. So I backed up the card again and now I can work on the real functionality.

Related

How to avoid using sudo for certain programs under xrdp in Raspbian?

Background: I look after the Raspberry Pi version of Scratch for the Foundation. Mostly this is a matter of Smalltalk programming, VM developing and some very frustrating moments with shell scripts.
Right now I'm baffled and annoyed by what seems likely to be a unix permissions or related issue when using xrdp to connect to a Pi from any other machine. I know that it's not a problem directly with theSqueak VM since google has revealed quite a few other applications having similar looking issues. Part of my problem is that I don't know enough about this area to really know what to search for to narrow things down.
So, problem description -
The current Scratch system runs on the Squeak Cog VM (see https://github.com/OpenSmalltalk/opensmalltalk-vm), which amongst other things uses pthreads and needs to set the thread priority. That used to be something that required modifying some config but more recent (Raspbian) kernels have no problem with it.
Except when using xrdp, which is a pain because I mostly work with my Pi via xrdp to my iMac. To handle this I have to prepend a 'sudo -E' which is tolerable for a developer but not really good for general users.
I have a similar problem with a trivial file copying command used in the VM make process as well, and that doesn't use any thread stuff nor priority work, but does require me to sudo make in a terminal window.
As an experiment I tried using tightvnc, to see if anything might work better. After reading the full install instructions (https://www.raspberrypi.org/documentation/remote-access/vnc/) and adding the auto-startup init.d script etc, it seemed like maybe we were in luck because the sudo isn't needed! Hooray! Of course, I was a bit disappointed by the seemingly slower display handling, but never mind.
Sadly this isn't even close to the end of the story. I've recently been working on completing the support for the X composition input window system that allows Japanese and other non-Latin1 type language users to enter characters more easily. It's pretty clever, once you've installed iBus, Anthy, many fonts and done some setup. But, while it works perfectly well on a Pi with a direct display, and fine on an xrdp display (with the sudo to allow Scratch to run in the first place, of course) it simply won't work via vnc with or without a sudo.
Googling shows a large number of other applications having problems in odd ways with the relevant XCreateIC() call (see https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/Cog/platforms/unix/vm-display-X11/sqUnixX11.c line:1659 for our usage) but nothing I can make much connection to vnc for. To add to the annoyance the combo window appears ok for Terminals!
To summarise-
direct display - no problems for either the pthread priority or the compo window
xrdp - needs sudo for pthreads priority but the compo window works ok
vnc - doesn't need sudo for pthread priority but compo window doesn't work.
What I need: help with finding out what causes these problems and maybe even solutions. A way to configure xrdp to not require 'sudo' would be nice.
To my delight a colleague found what appears to be a very effective answer to this; it seems that the /etc/pam.d/common-session file needs a single line adding.
Edit the file and add
session required pam_limits.so
This allows all the applications I have that previously had permission related problems to run under xrdp. Another Scratch user who had a similar issue using PuTTY reports that it solved that issue as well.

Making bash on ungraphical debian look neat and tidy, like when sshing to it

OH GOD I'M SUCH A NOOB
wait let me explain this.
I am somewhat familiar with linux, and i own a raspberry pi which i use as a ssh server, but i recently got hold on a old Dell Precision M4300 Laptop, so i got a minimal debian installation on that as well.
Howerver, as i logged in directly (as using the display and keyboard on the machine) to the laptop, i discovered a strange thing:
When executing a command resulting in a new menu, for example
nano .bashrc
, and than exiting that menu, the output gets shown where previously only the list of typed in commands and outputs was. This seems somewhat logical, as the "menue" is a "command output" as well, but when sshing to the machine from my windows machine (via gygwin or putty), the "menue" closes and i see the list of prompts and command outputs again, the same happens when sshing to the raspi. Is this a speciality of Putty / Cygwin? Can i make bash on the machine clean up after nano?
Thanks for any replys, i am really out of ideas here, i don't even know the right search term...
The functionality you are talking about is implemented by smcup and rmcup which can be used by editors such as nano and other applications to save and restore the screen when they are invoked and exited. This functionality is known as alternate screen and you can find more documentation regarding it here. Some people actually are quite annoyed by it.
Unfortunately, if you're using the linux virtual console instead of X windows or even connecting into the machine via ssh from another computer, then it seems like this feature is not available, according to this other post.

How do I force a higher resolution on Windows 7?

I have a laptop, and I want to force the native screen to display 1080p. I know the display driver is capable of that because I have connected it to a 1080p screen before and it worked.
I am doing this because I want to establish a remote connection from my Raspberry Pi to the laptop. The Pi (an ARM linux machine) is connected to the 1080p screen. At the moment, the remote connection only covers part of the screen, as the laptop is only displaying 1366x768 (or something).
I want a software solution, if possible. Also, I want a server-side solution (that is, on the windows machine) as finding and using Linux software that works on the pi is a bit of a nightmare!
I am using TightVNC, though am prepared to try any package is free and which works well, as a server for Windows and client for ARM Linux.
Solutions I have tried that don't work:
'show all modes' on control panel (still didn't show the mode 1920x1080, which I know the graphics adapter can do)
ZoneScreen OS (wouldn't let me create a higher resolution)
Demoforge Mirage (um... didn't do anything. Maybe I didn't get how you're supposed to use it)
To force the raspberry pi to have a certain display. Go on boot folder cd /boot/
After that, open the config file with your editor (I use geany sudo apt-get install geany)
sudo geany config.txt
In this file, it should have two line that you have to uncomment it:
framebuffer_width=800
framebuffer_height=600
Just change the values of those variables and save the file.
You may have to reboot your raspberry pi

How do I get a Remote Desktop for Linux (XDMCP, VNC)

I do this all the time using VNC and it is very easy, but I am curious about a few things like XDMCP. As I understand it, this is a way of creating the entire desktop on a remote X-Server which seems fairly elegant.
Several years ago, I worked on a Solaris server and multiple developers had X-Servers running in Windows and we were able to access a full remote X-desktop. All my efforts so far in X based systems seem to indicate that only one instance, remote or local, of the desktop can be loaded, so I guess this Solaris thing was an actual application that "emulated" a desktop, but who knows....
Any input ?
From Windows I've found the best way to do this is using the Xwin command in cygwin.
Steps:
Install Cygwin, making sure to install X11. (Do this by scrolling to the bottom of the list on the "select packages" screen and click on the word "default" to the right of "X11". Give it a second or two and it will change to "install".)
Then, just run the Xwin command like this:
Xwin -query your.unix.system.name
You'll get a full-screen login window from you unix box. That's it!
Btw, sometimes firewalls get in the way of the UDP protocol for XDMCP. If that happens, look up the port numbers (one UDP outgoing, and one TCP incomming) and unblock them. Other xdmcp troubleshooting tips here.
NX will allow you to use a complete remote desktop environment locally, and most Linux distros already have the server available.
As an alternative to full cygwin install you might want to look at Xming. It is quite a bit lighter and should provide the same functionality.
In Xorg/GDM/LightDM options : "listen" should be activated (disabled by default)
In windows, try Xwin32.
In Linux, try Xnest (windowed) or X with "-query" command.
Be careful: it's slow and everything (passwords included) is transmitted in clear. So keep it on local network, tunnel it in SSH or better don't use it.
I found an additional remote desktop implementation which works quite nicely with LXDE:
x2go
Has clients for Windows, Linux and MacOS X.

How can I run an OpenGL application installed on a linux machine from my windows machine?

In the spirit of being helpful, this is a problem I had and solved, so I will answer the question here.
Problem
I have:
An application that has to be installed on on Redhat or SuSE enterprise.
It has huge system requirements and requires OpenGL.
It is part of a suite of tools that need to operate together on one machine.
This application is used for a time intensive task in terms of man hours.
I don't want to sit in the server room working on this application.
So, the question came up... how do I run this application from a remote windows machine?
I'll outline my solution. Feel free to comment on alternatives. This solution should work for simpler environments as well. My case is somewhat extreme.
Solution
I installed two pieces of software:
PuTTY
XMing-mesa The mesa part is important.
PuTTY configuration
Connection->Seconds Between Keepalives: 30
Connection->Enable TCP Keepalives: Yes
Connection->SSH->X11->Enable X11 forwarding: Yes
Connection->SSH->X11->X display location: localhost:0:0
Lauching
Run Xming which will put simply start a process and put an icon in your system tray.
Launch putty, pointing to your linux box, with the above configuration.
Run program
Hopefully, Success!
If you want the OpenGL rendering to be performed on your local machine, using a Windows X server, like Xming is a good solution. However, if you want rendering to be done on the remote end with just images sent to the local machine, you want a specialized VNC system that can handle remote OpenGL rendering, like VirtualGL.
You could also use VNC ( like cross platform remote desktop )
X is more efficent since it only sends draw commands rather than pixels, but if you are using opengl it is likely that most of the data is a rendered image anyway.
Another big advantage of VNC is that you can start the program locally on the server and then connect to it with VNC, drop the connection, reconnect from another machine etc without disturbing the main running program.
For OpenGL, running an X server is definitely a better solution. Just make sure the application is developed to be networked. It should NOT use immediate mode for rendering and textures should be RARELY transferred.
Why is X server a better solution in this case (as opposed to VNC)? Because you get acceleration on workstation, while VNC'ed solution is usually not even accelerated on the mainframe. So as long as data is buffered on the X server (using vertex arrays, vertex buffer objects, texture objects, etc) you should get much higher speed than using VNC, especially with complex scenes since VNC has to analyze, transfer and decode them as pixels.
If you need server glx version 1.2 the free version of Xming (Mesa 2007) works fine. But if your application needs version 1.4, example qt5, the X Server from Cygwin works free to run it use this commands:
[On server]
sudo vi /etc/ssh/ssh_config
Add:
X11Forwarding yes
X11DisplayOffset 10
X11UseLocalHost no
AllowTcpForwarding yes
TCPKeepAlive yes
ClientAliveInterval 30
ClientAliveCountMax 10000
sudo vi ~/.bashrc
Add:
export DISPLAY=ip_from_remote:0
Now restart ssh server
[On Client slide]
Install Cygwin64 (with support to X package) after that run this command:
d:\cygwin64\bin\run.exe --quote /usr/bin/bash.exe -l -c "cd; /usr/bin/xinit /etc/X11/xinit/startxwinrc -- /usr/bin/XWin :0 -ac -multiwindow -listen tcp"
Now execute ssh client:
d:\cygwin64\bin\mintty.exe -i /Cygwin-Terminal.ico -e /usr/bin/ssh -Y user_name#ip_from_server

Resources