Skip to content

jvmcarneiro/largrad-setup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Server configuration for LaR experiments

Follow these instructions after configuring the initial user markX and programming the connected microcontrollers.

It is recommended to also remove read privileges from users' private folders in /home/ with chmod go-rwx.

Made for Ubuntu 18.04 LTS systems.

Install necessary programs

sudo apt install guvcview
sudo apt install xfce4 xfce4-goodies
sudo apt remove xscreensaver

Create users

sudo useradd -m aluno-grad
sudo passwd aluno-grad
sudo useradd -m exp-a
sudo passwd exp-a
sudo usermod -a -G aluno-grad $USER
sudo usermod -a -G exp-a $USER
sudo usermod -a -G video exp-a

Copy configuration files (one at a time to avoid errors)

sudo cp -a home/. /home/
sudo cp -a etc/. /etc/
sudo cp -a usr/. /usr/

Change file owners

sudo chown -R aluno-grad:aluno-grad /home/aluno-grad/
sudo chown -R exp-a:exp-a /home/exp-a/

Make scripts executable

sudo chown root:root /home/exp-a/.local/bin/kill-jtagd
sudo chmod u+s /home/exp-a/.local/bin/kill-jtagd

Install TigerVNC

wget https://sourceforge.net/projects/tigervnc/files/stable/1.11.0/tigervnc-1.11.0.x86_64.tar.gz
tar xzf tigervnc-*.tar.gz
cd tigervnc-*64
sudo chown -R root:root usr
sudo tar czf usr.tgz usr
sudo tar xzkf usr.tgz -C /

Create VNC passwords

Manually log in as each user and execute the vncpasswd command. Basta logar manualmente em cada usuário e executar vncpasswd.

Block sensitive files

sudo chattr -R +i /home/aluno-grad/.config/autostart/
sudo chattr -R +i /home/aluno-grad/.config/menus/
sudo chattr -R +i /home/aluno-grad/.config/xfce4/
sudo chattr -R +i /home/aluno-grad/.local/share/applications/
sudo chattr +i /home/aluno-grad/.vnc/config
sudo chattr +i /home/aluno-grad/.vnc/passwd
sudo chattr +i /home/aluno-grad/Arquivos/virtual_input.v
sudo chattr +i /home/aluno-grad/Arquivos/virtual_input_pins.csv
sudo chattr -R +i /home/exp-a/.config/menus/
sudo chattr -R +i /home/exp-a/.config/xfce4/
sudo chattr -R +i /home/exp-a/.local/share/applications/
sudo chattr +i /home/exp-a/.vnc/config
sudo chattr +i /home/exp-a/.vnc/passwd
sudo chattr +i /home/exp-a/Arquivos/virtual_input.v
sudo chattr +i /home/exp-a/Arquivos/virtual_input_pins.csv

Create VNC connections

Substitute XX and YY for the corresponding numbers set in /usr/etc/tigervnc/vncserver.users.

sudo systemctl start vncserver@:XX
sudo systemctl enable vncserver@:YY

Post installation steps

  1. Clone https://github.com/jvmcarneiro/de2-115-virtual-input and compile following README.md instructions
  2. Copy the compiled file to exp-X user's ~/.local/bin folder, modifying serial access permissions with chown exp-X:dialout and chmod g+s
  3. Block access to folder ~/.local/bin with sudo chattr -R +i
  4. Install Quartus 20.1 in /opt/intelFPGA/ and make the necessary adjustments in order to run ModelSim in Ubuntu environments (modify permissions and parameter values in the executable files; many internet guides explain how to do this)
  5. Create symbolic links to quartus and vsim in /usr/local/bin/
  6. Copy virtual_input.bsf to /opt/intelFPGA/20.1/quartus/libraries
  7. USBBlaster has already been installed when the etc/udev/ folder was copied in previous steps

Once the configuration is complete, you are free to create connections in the Guacamole interface pointing to the VNC addresses.

Configuring additional Experiment connections

  1. Replicate the exp-a user configuration steps for newly-created exp-b, exp-c, etc.
  2. Modify serial port in DEFAULT_DEVICE and desired camera in the guvcview command in de2-115-gui.py (more details in the README
  3. Compile de2-115-gui.py, move to new user's ~/.local/bin/ folder, change ownership and permissions (explained above) and lock folder
  4. Modify Exec and Path fields of de2-115-gui.desktop and exo-file-manager.desktop files in ~/.local/share/applications/ folder with the new username
  5. Modify Exec field in ~/.local/share/applications/guvcview.desktop to guvcview -d /dev/videoX, with X according to v4l2-ctl --list-devices (blocking the folder with chattr when done)
  6. Create VNC password with vncpasswd logged in with new user and lock file ~/.vnc/passwd
  7. Add connections to /usr/etc/tigervnc/vncserver.users
  8. Run and enable the desired vncserver@: services

In order to create a connection for the admin user markX, copy the file ~/.vnc/config from another user and repeat the last 3 steps from the list above.

Troubleshooting

The configuration files in this repository reproduce the instructions for setting up TigerVNC for on demand sessions. This feature, however, is hardware dependent and not always available.

If you, for instance, are not able to simultaneously connect to more than one aluno-grad VNC session, your system may not be compatible with this approach and only one connection is allowed per Linux account. In that case, the alternative is to create new Linux users for each desired connection, following much of the Configuring additional users section, skipping the steps related to the DE2-115 Virtual GUI when configuring virtual-only connections like the aluno-grad.

The downside of this approach, besides the necessary additional configuration, is the fixed computing overhead in comparison to on demand usage. To the final user, however, the experience will be very much the same.