# # Check also https://www.ensta-bretagne.fr/lebars/Share/unattended.sh, https://www.ensta-bretagne.fr/lebars/Share/Raspbian.txt... # # Multiboot Windows+Ubuntu: see https://www.ensta-bretagne.fr/lebars/computer_prereq_rob.pdf # Installation: set correct date, connect wifi, install 3rd party soft, / primary ext3 or ext4, no swap (a swap file (/swapfile, instead of a dedicated partition) might be created automatically in 18.04 and later, or if needed later configure a swap file with sudo apt install dphys-swapfile, sudo nano /etc/dphys-swapfile, CONF_SWAPSIZE=16384), user (for an Ubuntu Server pi image, it should be possible to change default ubuntu user password expiration (with "expire: false") in /boot/user-data (however changing the user name seems to cause problems with ssh...)...), autologin (if using gdm3 (default for Ubuntu 18.04), see /etc/gdm3/custom.conf later if needed, for lightdm (default for Ubuntu 16.04) add autologin-user=user in [SeatDefaults] section to /etc/lightdm/lightdm.conf), wait a little and reboot after first logon # Change keyboard (if needed) # For Ubuntu Desktop? sudo apt-get install x11-xkb-utils setxkbmap fr # For Ubuntu Server? # Only for the current session sudo loadkeys fr # To make it permanent (configuration takes 5 min...) sudo dpkg-reconfigure keyboard-configuration # Select "Generic 105-key (Intl) PC", then "French" twice. For AltGr key, select "The default for the keyboard layout" then "no compose key"... # Change screen resolution (if needed) sudo xrandr -s 1024x768 # Disable UTC and use Local Time in Ubuntu to avoid conflicts with Windows sudo timedatectl set-local-rtc 1 --adjust-system-clock # Ensure date is correct (if needed) sudo date -s "11 JAN 2024 21:51:00" # System Settings # Displays, Text Entry\keyboard, Brightness & Lock\disable lock and disable require passwords, User Accounts\autologon, Time & Date\location, clock, Appearance\Add show desktop, Software and Updates\Additional Drivers, Power, Screensaver, disable auto download updates # Firefox: set bookmarks, clear all history #dconf dump / > dconf-backup.txt #gsettings set org.gnome.desktop.screensaver lock-enabled false #gsettings set org.gnome.desktop.session idle-delay 0 # Do nothing when closing laptop lid: try gnome-tweaks, otherwise see https://askubuntu.com/questions/15520/how-can-i-tell-ubuntu-to-do-nothing-when-i-close-my-laptop-lid (try sudo nano /etc/UPower/UPower.conf, add IgnoreLid=true, service upower restart...) # Disable sudo password (/etc/sudoers.tmp)... sudo visudo # Add at the end user ALL=NOPASSWD: ALL # Search Passwords and Keys app and enable unlock automatically if problems...? # See also https://askubuntu.com/questions/867/how-can-i-stop-being-prompted-to-unlock-the-default-keyring-on-boot/224777#224777 ... # French versions... ln -s ~/Téléchargements ~/Downloads ln -s ~/Bureau ~/Desktop ln -s ~/Modèles ~/Templates # Bug last line not visible in gedit when maximized: see https://askubuntu.com/questions/1049588/gedit-last-line-obscured-by-status-bar # Raspberry Pi # raspi-config: might need to disable SSH for Ubuntu (use sudo apt install openssh-server instead, the one from raspi-config is "masked"?), expand filesystem if needed... # Ubuntu Mate: links to be similar to standard Ubuntu... #sudo ln -s /usr/bin/mate-terminal /usr/bin/gnome-terminal #sudo ln -s /usr/bin/caja /usr/bin/nautilus #sudo ln -s /usr/bin/pluma /usr/bin/gedit #sudo ln -s /usr/bin/mate-system-monitor /usr/bin/gnome-system-monitor # If bug at-spi-registryd.desktop warning when shutting down: sudo mv -f /usr/lib/at-spi2-core/at-spi2-registryd /usr/lib/at-spi2-core/at-spi2-registryd_bak sudo mv -f /usr/lib/at-spi2-core/at-spi-bus-launcher /usr/lib/at-spi2-core/at-spi-bus-launcher_bak # If related error during sudo apt upgrade #sudo dpkg -i --force-all /var/cache/apt/archives/linux-firmware-raspi2_1.20190215-0ubuntu0.18.04.1_armhf.deb # VMware tools #sudo mkdir -p /media/cdrom #sudo mount /dev/sr0 /media/cdrom tar xfz VMwareTools.x.x.x-xxxx.tar.gz cd vmware-tools-distrib sudo ./vmware-install.pl -f -d # If copy does not work, try sudo killall vmtoolsd ; /usr/bin/vmware-user # Sometimes need to run manually #sudo ./vmware-install.pl -f # Ensure you enable file copy support... # Shutdown, close VMware Player and restart it... # To uninstall sudo /usr/bin/vmware-uninstall-tools.pl # Alternate, recommended since 2020.04...? # sudo apt-get -y install open-vm-tools-desktop # Check in Startup Applications to force it to start immediately if needed (see /etc/xdg/autostart/vmware-user.desktop and run /usr/bin/vmware-user-suid-wrapper &)... # Bug drag and drop 22.04: see https://github.com/vmware/open-vm-tools/issues/592, sudo nano /etc/gdm3/custom.conf and uncomment WaylandEnable=false... # Other bug 22.04 in VMware Player 17: see https://communities.vmware.com/t5/VMware-Workstation-Pro/Ubuntu-22-04-freezes-randomly-on-VMWare-Professional-17/td-p/2942773/page/3 (add keyboard.allowBothIRQs = "FALSE" and keyboard.vusb.enable = "TRUE" to the .vmx file...?) # Shrink partition: vmware-toolbox-cmd disk list, vmware-toolbox-cmd disk shrink [mount-point], if it does not work try before #dd if=/dev/zero of=junk bs=1024k count=10000000 ; sync ; rm junk # and also the host VMware Player Compact Hard disk GUI... # As user and also root if needed... # nautilus: in "Edit\Preferences\Behavior\Executable Text Files" set "Ask each time", show hidden files (in menu or buttons), show Type in list view, arrange by type, show link creation action # gnome-terminal: "Edit\Preferences\Open new terminals" in Tab, unlimited history scrolling... # export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib to add in ~/.bashrc if needed...? # In each network connection, change IPv4 Settings\Additional search domains to ensta-bretagne.fr,ensieta.fr,ensieta.ecole # # Proxy (if needed) # # System Settings Network\Proxy # Firefox: set Preferences\Advanced\Network\auto-detect proxy settings # If needed, if proxy not set in System Settings\Network\Proxy... # As root and also user, comment or uncomment, then relaunch terminal or reboot if needed... nano ~/.bashrc sudo nano /root/.bashrc nano ~/.bashrc sudo nano /root/.bashrc # ENSTA Bretagne proxy (do not set no_proxy/proxy-exceptions if through VPN, MDE proxy is 192.168.1.13:8080, in the school it can be also 192.168.1.17:8080?) export https_proxy=192.168.1.10:3128 export http_proxy=192.168.1.10:3128 export ftp_proxy=192.168.1.10:3128 export socks_proxy=192.168.1.10:822 export no_proxy=localhost,127.0.0.0/8,ensieta.ecole,ensieta.fr,ensta-bretagne.fr dos2unix ~/.bashrc sudo dos2unix /root/.bashrc # In order to take into account some user variables, -E option might be necessary with sudo command... # # apt proxy setup: see http://www.ensta-bretagne.fr/lebars/Share/apt.conf sudo nano /etc/apt/apt.conf Acquire::http::Proxy "http://192.168.1.10:3128"; Acquire::ftp::Proxy "ftp://192.168.1.10:3128"; Acquire::https::Proxy "http://192.168.1.10:3128"; Acquire::socks::Proxy "socks://192.168.1.10:822"; # # git proxy setup: git config --global http.proxy 192.168.1.10:3128 git config --global https.proxy 192.168.1.10:3128 git config --global --unset http.proxy git config --global --unset https.proxy # # Or to directly set current proxy variables for bash, apt and git wget http://www.ensta-bretagne.fr/lebars/Share/proxy_ensieta.sh sudo mv -f proxy_ensieta.sh /usr/local/bin/ sudo chmod 755 /usr/local/bin/proxy_ensieta.sh # and use the command source proxy_ensieta.sh [on|off] (need sudo apt-get -y install augeas-tools), then reboot if needed... source proxy_ensieta.sh on source proxy_ensieta.sh off # Check also /etc/environment , /etc/proxychains.conf if needed... # Sometimes https proxy needs to be set to http...? # # Visual Studio Code proxy setup: #nano $HOME/.config/Code/User/settings.json #{ # "http.proxy": "http://192.168.1.10:3128", # "https.proxy": "https://192.168.1.10:3128", # "http.proxyStrictSSL": false #} # # No proxy support for extensions yet... #augtool #set /augeas/load/Json/lens Json.lns #set /augeas/load/Json/incl /home/user/.config/Code/User/settings.json #load #print /files/home/user/.config/Code/User/settings.json ##set /files/tmp/test.json/dict/entry[. = "workbench.colorTheme"]/string "Visual Studio Light Theme" #set /files/tmp/test.json/dict/entry[. = "http.proxy"]/string "http://192.168.1.10:3128" #set /files/tmp/test.json/dict/entry[. = "https.proxy"]/string "https://192.168.1.10:3128" #set /files/tmp/test.json/dict/entry[. = "http.proxyStrictSSL"]/boolean false #save #quit # # Docker proxy setup: sudo mkdir -p /etc/systemd/system/docker.service.d sudo nano /etc/systemd/system/docker.service.d/proxy.conf # Might require https proxy=http...? [Service] Environment="HTTP_PROXY=http://192.168.1.10:3128/" Environment="HTTPS_PROXY=http://192.168.1.10:3128/" Environment="NO_PROXY=localhost,127.0.0.0/8,ensieta.ecole,ensieta.fr,ensta-bretagne.fr" # sudo systemctl daemon-reload; sudo systemctl restart docker # # svn proxy setup: sudo mkdir -p ~/.subversion/ sudo nano ~/.subversion/servers [global] http-proxy-exceptions = 127.0.0.*, *.ensta-bretagne.fr, *.ensieta.fr, *.ensieta.ecole http-proxy-host = 192.168.1.10 http-proxy-port = 3128 # # tsocks sudo apt-get -y install tsocks cd ~/Downloads wget http://www.ensta-bretagne.fr/lebars/Share/tsocks.conf sudo mv -f tsocks.conf /etc/ #tsocks firefox # RDP server sudo apt install xrdp # Change port in Globals section if needed... sudo nano /etc/xrdp/xrdp.ini # Seems to work out of the box for Raspberry Pi 4 with Ubuntu Mate 20.04... # For Raspberry Pi 3 with Ubuntu Mate 18.04 or Intel Compute Stick, Intel NUCxi5xxK with Ubuntu 18.04, see also https://github.com/neutrinolabs/xrdp/issues/1358... sudo nano /etc/xrdp/startwm.sh # and add to the above of "mate-session" or "Xsession" in /etc/xrdp/startwm.sh unset DBUS_SESSION_BUS_ADDRESS # Possibly use also #!/bin/bash instead of #!/bin/sh in /etc/xrdp/startwm.sh # If black screen, might need one of the following (seems necessary for Intel Compute Stick, Intel NUCxi5xxK) sudo apt-get install xorgxrdp sudo apt-get install xorgxrdp-hwe-18.04 # Ubuntu 18.04 # Restart service sudo systemctl restart xrdp # See also NoMachine problems (especially if slow or black screen, see also /var/log/xrdp-sesman.log...)... # Different desktop, no copy/paste... # Does not work on ThinkPad W700, maybe because of NVIDIA driver...? # Might need to use sudo -E instead of just sudo when trying to run graphical apps... # Shutting down from the remote session might not work... # NoMachine: if needed disable check auto update # If the keyboard layout is not correct in a remote session, go to Control Center\Keyboard\Layouts and add English (US) layout (in addition to French) to be able to choose the correct keyboard layout in the notification bar (click on it several times if needed)... # Changing network settings through NoMachine might not work... # If slow or black screen (for Intel NUCxi5xxK, Intel Compute Stick, it seems to be the display manager service lightdm/gdm3 that has sometimes a problem when there was no screen connected at startup, for a VMware virtual machine, the problem logic is not clear and might not be related to the screen...) sudo service lightdm stop; sudo killall Xorg; sudo /etc/NX/nxserver --restart # Ubuntu 16.04 sudo service gdm3 stop; sudo killall Xorg; sudo /etc/NX/nxserver --restart # Ubuntu 18.04, 20.04 # To run the previous commands automatically at each logon when no screen is detected... #wget http://www.ensta-bretagne.fr/lebars/Share/nx_rdp_noscreen_fix.desktop #mv -f nx_rdp_noscreen_fix.desktop ~/.config/autostart/ # Note that killing the display manager might affect GUI applications launched at startup... # If screen is too small... # Raspberry: change default framebuffer resolution e.g. framebuffer_width=1024 and framebuffer_height=768 when no screen connected, if needed enable hdmi_force_hotplug=1, gpu_mem=256, might need to disable dtoverlay=vc4-fkms-v3d (but might be necessary to be able to use the camera?)... sudo nano /boot/config.txt # On Ubuntu, might be /boot/firmware/config.txt... # Set 128 or 256 in Advanced Options\Memory Split sudo raspi-config # For other systems (see https://askubuntu.com/questions/1056363/how-to-disable-gui-on-boot-in-18-04-bionic-beaver)...? # /etc/default/grub GRUB_GFXMODE=1024x768 #sudo nano /usr/NX/etc/server.cfg #DisplayGeometry "1024x768" # See also https://indilib.org/forum/general/4000-tutorial-how-to-make-sure-your-headless-device-shows-a-desktop.html , https://askubuntu.com/questions/453109/add-fake-display-when-no-monitor-is-plugged-in # Config file scale in display settings for menu and title bar Ubuntu because wrong in nx sometimes... # To try to disable the numerous password prompts in nomachine, do something similar to sudo nano /etc/polkit-1/localauthority/50-local.d/45-allow.pkla [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=yes ResultInactive=yes ResultActive=yes [Allow Network all Users] Identity=unix-user:* Action=org.freedesktop.NetworkManager.enable-disable-network;org.freedesktop.NetworkManager.reload;org.freedesktop.NetworkManager.sleep-wake;org.freedesktop.NetworkManager.enable-disable-wifi;org.freedesktop.NetworkManager.enable-disable-wwan;org.freedesktop.NetworkManager.enable-disable-wimax;org.freedesktop.NetworkManager.network-control;org.freedesktop.NetworkManager.wifi.share.protected;org.freedesktop.NetworkManager.wifi.share.open;org.freedesktop.NetworkManager.settings.modify.own;org.freedesktop.NetworkManager.settings.modify.system;org.freedesktop.NetworkManager.settings.modify.hostname;org.freedesktop.NetworkManager.settings.modify.global-dns;org.freedesktop.NetworkManager.checkpoint-rollback;org.freedesktop.NetworkManager.enable-disable-statistics;org.freedesktop.NetworkManager.enable-disable-connectivity-check ResultAny=yes ResultInactive=yes ResultActive=yes [Allow Power all Users] Identity=unix-user:* Action=org.freedesktop.login1.inhibit-block-shutdown;org.freedesktop.login1.inhibit-delay-shutdown;org.freedesktop.login1.inhibit-block-sleep;org.freedesktop.login1.inhibit-delay-sleep;org.freedesktop.login1.inhibit-block-idle;org.freedesktop.login1.inhibit-handle-power-key;org.freedesktop.login1.inhibit-handle-suspend-key;org.freedesktop.login1.inhibit-handle-hibernate-key;org.freedesktop.login1.inhibit-handle-lid-switch;org.freedesktop.login1.set-self-linger;org.freedesktop.login1.set-user-linger;org.freedesktop.login1.attach-device;org.freedesktop.login1.flush-devices;org.freedesktop.login1.power-off;org.freedesktop.login1.power-off-multiple-sessions;org.freedesktop.login1.power-off-ignore-inhibit;org.freedesktop.login1.reboot;org.freedesktop.login1.reboot-multiple-sessions;org.freedesktop.login1.reboot-ignore-inhibit;org.freedesktop.login1.halt;org.freedesktop.login1.halt-multiple-sessions;org.freedesktop.login1.halt-ignore-inhibit;org.freedesktop.login1.suspend;org.freedesktop.login1.suspend-multiple-sessions;org.freedesktop.login1.suspend-ignore-inhibit;org.freedesktop.login1.hibernate;org.freedesktop.login1.hibernate-multiple-sessions;org.freedesktop.login1.hibernate-ignore-inhibit;org.freedesktop.login1.manage;org.freedesktop.login1.lock-sessions;org.freedesktop.login1.set-reboot-to-firmware-setup;org.freedesktop.login1.set-wall-message ResultAny=yes ResultInactive=yes ResultActive=yes # sudo dos2unix /etc/polkit-1/localauthority/50-local.d/45-allow.pkla # # NVIDIA GPU # See Software and Updates\Additional Drivers # Warning: the system might crash at next boot, rebooting in safe mode will force low graphics mode and should enable to revert changes... sudo add-apt-repository ppa:graphics-drivers/ppa sudo apt-get update # RAID #mdadm --assemble --scan #https://forums.linuxmint.com/viewtopic.php?t=129866 #https://wiki.debian-fr.xyz/Raid_logiciel_(mdadm) # Set dmraid/dmraid=true boot parameter when starting from Ubuntu Live (F6)...? #https://doc.ubuntu-fr.org/tutoriel/comment_utiliser_le_raid_onboard # Panasonic Toughbook CF-19 touchscreen calibration sudo apt-get -y install xinput-calibrator xinput_calibrator sudo nano /usr/share/X11/xorg.conf.d/99-calibration.conf # Touch screens: use Onboard on-screen keyboard (e.g. start it automatically using Startup Applications (gnome-session-properties), in Preferences check Start Onboard hidden if needed), there are specific buttons for the right-clicks... sudo apt-get -y install onboard cd ~/Downloads wget http://www.ensta-bretagne.fr/lebars/Share/onboard.desktop mkdir -p ~/.config/autostart/ mv -f onboard.desktop ~/.config/autostart/ # To start it immediately and detached from the terminal nohup onboard & # Alternative suggested for Raspberry Pi: sudo apt install matchbox-keyboard # Panasonic Toughbook CF-20 MK2 GPS cd ~/Downloads wget http://www.ensta-bretagne.fr/lebars/Share/lte_gps-cf20mk2.desktop mkdir -p ~/.config/autostart/ mv -f lte_gps-cf20mk2.desktop ~/.config/autostart/ wget http://www.ensta-bretagne.fr/lebars/Share/99-lte-cf20mk2.rules sudo mv -f 99-lte-cf20mk2.rules /etc/udev/rules.d/ # Reload the rules (or might need to reboot) sudo udevadm control --reload-rules ; sudo udevadm trigger sleep 10 echo "\$GPS_START" > /dev/lte_gps #cat /dev/lte_gps # 4G sudo snap install modem-manager # If needed... sudo snap disable modem-manager sudo snap enable modem-manager sudo apt-get -y install usb-modeswitch usb-modeswitch-data # Change host name sudo nano /etc/hostname # After reboot, change if needed the entry at 127.0.1.1 with the new hostname in /etc/hosts sudo nano /etc/hosts # Ubuntu 18.04 (and later?) Desktop network profiles: check /etc/NetworkManager/system-connections/ (possibly also /etc/netplan/01-netcfg.yaml, /etc/netplan/50-cloud-init.yaml, /etc/wpa_supplicant/wpa_supplicant.conf, /etc/network/interfaces, but might be overwritten) # Note that the most simple way to configure the network assuming network-manager package is installed (which is the default on Ubuntu Desktop but not on Server version) is to use the GUI, nm-connection-editor alternate GUI, or nmtui command (which works in a terminal) # To associate a specific IP configuration for each Wi-Fi network (ensure /etc/netplan/01-netcfg.yaml (or other file precedent in alphabetical order (but needs a "-" inside the name?) if any) has "version: 2" and "renderer: NetworkManager" inside "network:" section (or maybe just ensure /run/netplan and /etc/netplan are empty...?), and that network-manager package is installed, e.g. it is not the case on the Ubuntu Server version, might need also to define country code by adding REGDOMAIN=FR in /etc/default/crda, see https://gist.github.com/Jiab77/76000284f8200da5019a232854421564, see also https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/2036358 if system startup is slow after enabling NetworkManager (i.e. try systemctl disable --now systemd-networkd.service)), add in /etc/NetworkManager/system-connections/ e.g. a file Livebox-0334 with permissions explicitely set by sudo chmod 600 Livebox-0334 # (higher or lower permissions might not be taken into account by NetworkManager) and content with (see also https://developer.gnome.org/NetworkManager/stable/settings-802-11-wireless-security.html) [connection] id=Livebox-0334 type=wifi [wifi] mode=infrastructure ssid=Livebox-0334 [ipv4] method=auto # # or a file ROBOTICS with [connection] id=ROBOTICS type=wifi [wifi] mode=infrastructure ssid=ROBOTICS [ipv4] method=auto # # or a file SFR-B8D688 with [connection] id=SFR-B8D688 type=wifi [wifi] mode=infrastructure ssid=SFR-B8D688 [wifi-security] auth-alg=open key-mgmt=wpa-psk psk=XXXXXXXX [ipv4] method=auto # # or a file SARDINE-UBNT with [connection] id=SARDINE-UBNT type=wifi # Could be ethernet, in that case remove wifi section [wifi] mode=infrastructure ssid=SARDINE-UBNT [ipv4] address1=192.168.0.150/24,192.168.0.4 #dns=192.168.0.4;8.8.8.8 method=manual # If using Netplan (see https://netplan.io/) without NetworkManager (e.g. Ubuntu 18.04 Server, for first pi boot should be put in /boot/network-config file instead of /etc/netplan/XXX.yaml, Wi-Fi might only work after the second boot, DNS might not work...)... # To debug: sudo netplan --debug try # If validated or sudo netplan apply have been used, if needed check generated files in /run/systemd/network/ # /run/netplan folder is supposed to have priority over /etc/netplan (note that the use of cloud-init e.g. during Ubuntu Server installation might generate files in both folders)... # See limitation https://askubuntu.com/questions/1115529/netplan-multiple-ssids-with-different-static-ip-on-the-same-interface, does not seem to support WEP... sudo nano /etc/netplan/50-cloud-init.yaml # Or other file precedent in alphabetical order (but needs a "-" inside the name?) if any... network: version: 2 renderer: networkd wifis: wlan0: dhcp4: yes optional: true access-points: Livebox-0334: {} ROBOTICS: {} "SFR-B8D688": password: "XXXXXXXX" SARDINE-UBNT: {} ethernets: eth0: dhcp4: no optional: true addresses: [192.168.0.150/24] gateway4: 192.168.0.4 nameservers: addresses: [192.168.0.4, 8.8.8.8] # .deb are temporarily saved in /var/cache/apt/archives (if not, echo 'Binary::apt::APT::Keep-Downloaded-Packages "1";' | sudo tee /etc/apt/apt.conf.d/10apt-keep-download, by default 10apt-keep-download does not exist (e.g. in Ubuntu 22.04)), use sudo apt-get clean; sudo apt-get autoclean to save disk space if needed, as well as sudo apt-get autoremove... Note however that they might be useful for other PCs that would need to install the same software with limited network... # To search for package_name, use sudo apt-cache search package_name... # To reinstall a package without reinstalling its dependencies: sudo apt-get install --reinstall package_name sudo apt-get update # Potentially useful options in case of problems: sudo apt-get -f install --fix-broken --fix-missing -y --allow-remove-essential # Might prompt to accept a license or change configuration files (should do export DEBIAN_FRONTEND=noninteractive and/or export UCF_FORCE_CONFFOLD=1? and check sudo debconf-get-selections)... # Also software-properties-gtk? #sudo apt-get -y install samba ttf-mscorefonts-installer davfs2 # Unattended setup... cd ~/Downloads wget http://www.ensta-bretagne.fr/lebars/Share/unattended.sh chmod +x unattended.sh ./unattended.sh # If low disk space, check https://www.ensta-bretagne.fr/lebars/low_disk_space_ubuntu.pdf # SSH sudo apt-get -y install openssh-client openssh-server #sudo nano /etc/ssh/sshd_config #sudo systemctl status ssh #sudo systemctl enable ssh #sudo systemctl start ssh #sudo service ssh restart #sudo dpkg-reconfigure openssh-server # See https://roboticsbackend.com/install-ubuntu-mate-18-04-on-raspberry-pi-3-b/ # To disable password prompt, on client PC you need to generate a key ssh-keygen -t rsa -b 2048 # To add this key (stored by default in /home/user/.ssh/id_rsa.pub) to the remote PC (it will be added to the file /home/user/.ssh/authorized_keys on the remote PC) ssh-copy-id -i /home/user/.ssh/id_rsa.pub user@192.168.0.1 # To check that no password is asked and add the remote PC to the file /home/user/.ssh/known_hosts on the remote PC, answer yes when asked ssh user@192.168.0.1 # To ignore message about man-in-the-middle attack ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no user@192.168.0.1 # To view active sessions, type w in a ssh session # Configure Share folder, see smb_Share_Ubuntu.txt/smb_Share_Raspbian.txt (if using nautilus local shares, check /var/lib/samba/usershares), change Workgroup (enable WINS support?) sudo apt-get -y install samba nfs-common cifs-utils smbclient mkdir ~/Share sudo chmod -R 777 ~/Share sudo nano /etc/samba/smb.conf # For Raspbian #sudo systemctl restart smbd.service # For Ubuntu sudo /etc/init.d/samba restart #sudo service samba restart # If needed to remove netbios for security, add #disable netbios = yes # in /etc/samba/smb.conf # and #sudo systemctl stop nmbd.service #sudo systemctl disable nmbd.service # Windows compatibility # If installing Windows after Ubuntu and Ubuntu is on an extended partition, the first logical drive is marked as free space, to solve use testdisk and edit partition table and if possible modify as primary the logical drive (select P using left/right arrows in the list of detected partitions (Linux ext2-4 partition type is 0x83)), then from a Live Ubuntu install GRUB on /dev/sdaX if needed sudo grub-install --root-directory=/media/ubuntu/xxxxxxxxxx /dev/sdaX --force # Then, on the installed Ubuntu (need to set both GRUB_HIDDEN_TIMEOUT and GRUB_TIMEOUT?) sudo nano /etc/default/grub sudo update-grub # and on Windows run EasyBCD and add GRUB 2 entry Ubuntu... # To switch easily from one OS to the other, tweak wget https://www.ensta-bretagne.fr/lebars/Share/MBR.zip wget https://www.ensta-bretagne.fr/lebars/Share/UEFI.zip # Avoid GRUB auto reinstall on MBR when there is an apt upgrade...->sudo debconf-show grub-pc, sudo dpkg-reconfigure grub-pc and change the place where it should install, see https://ubuntuforums.org/showthread.php?t=2189643 # To restore Windows MBR (change /dev/sda if needed...): sudo apt-get install syslinux; sudo dd if=/usr/lib/syslinux/mbr/mbr.bin of=/dev/sda # GRUB 2 rescue: https://www.malekal.com/grub-utiliser-le-rescue-shell-pour-corriger-les-erreurs-de-demarrage-linux/ # To access, press ESC or MAJ, then c, then e.g. ls ls (hd0,msdos1) set boot=(hd0,msdos1) set prefix=(hd0,msdos1)/boot/grub insmod normal normal # Then, probably need to run sudo dpkg-reconfigure grub-pc and change what is needed... # To be able to install some Windows apps (includes wine)...? #sudo apt-get install playonlinux # Or get the latest... wget -q "http://deb.playonlinux.com/public.gpg" -O- | sudo apt-key add - sudo wget http://deb.playonlinux.com/playonlinux_xenial.list -O /etc/apt/sources.list.d/playonlinux.list sudo apt-add-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ xenial main' sudo apt-get update sudo apt install --install-recommends winehq-stable sudo apt-get install playonlinux # But download of playonlinux is very slow... # ProViewer 3.6: OK, ProViewer 4.3.1.9526: FAIL, VCtrl: FAIL... # Or? sudo apt install wine wine-mono wine-gecko # To remove rm -Rf ~/.cache/wine ~/.wine ~/.local/share/applications/wine /tmp/.wine* sudo apt-get purge wine* wine-stable wine-devel sudo apt autoremove # OpenCV, Qt, MATLAB/Octave, VSCode, eclipse... to install in /opt if specific versions (give rights to everyone on /opt?) sudo nano ~/.bashrc sudo nano /root/.bashrc # 64 bit export PATH=$PATH:/usr/lib/jvm/jdk1.7.0_80/bin:/opt/eclipse:/opt/maestro-linux:/opt/matlab/R2015a/bin:/opt/matlab/R2010b/bin # 32 bit export PATH=$PATH:/usr/lib/jvm/jdk1.7.0_80/bin:/opt/eclipse:/opt/maestro-linux:/opt/matlab/R2012a/bin # ARM export PATH=$PATH:/opt/maestro-linux # Or instead, update /etc/environment... #sudo nano /etc/environment # OpenCV (if problems with C++/Python2/Python3 default package versions...) # OpenCV 4.2.0 (with contrib) for Ubuntu 18.04 64 bit: http://www.ensta-bretagne.fr/lebars/Share/OpenCV-4.2.0-Ubuntu64.tar.gz, http://www.ensta-bretagne.fr/lebars/Share/OpenCV-4.2.0-Ubuntu64-static.tar.gz # Add -D CPACK_BINARY_DEB=ON to cmake command if you want to use make package, but the .deb does not seem to take into account dependencies... # Change to -D BUILD_SHARED_LIBS=OFF and add -D BUILD_IPP_IW=ON -D BUILD_ITT=ON -D BUILD_JASPER=ON -D BUILD_JPEG=ON -D BUILD_OPENEXR=ON -D BUILD_PNG=ON -D BUILD_PROTOBUF=ON -D BUILD_TBB=ON -D BUILD_TIFF=ON -D BUILD_WEBP=ON -D BUILD_ZLIB=ON -D WITH_EIGEN=OFF -D WITH_GSTREAMER=OFF to build static libraries (if adding also -D WITH_QT=5, will need at build time apt install qt5-default and at runtime libQt5Core.so.5, libQt5Gui.so.5, libQt5Widgets.so.5, libQt5Test.so.5)...? # For OpenCV 4.1.1, need -D ENABLE_PRECOMPILED_HEADERS=OFF to avoid error with Eigen...? cd ~/Downloads wget https://github.com/opencv/opencv/archive/4.2.0.zip -O opencv-4.2.0.zip wget https://github.com/opencv/opencv_contrib/archive/4.2.0.zip -O opencv_contrib-4.2.0.zip unzip -q opencv-4.2.0.zip unzip -q opencv_contrib-4.2.0.zip mkdir build cd build cmake -D CMAKE_BUILD_TYPE=Release -D OPENCV_EXTRA_MODULES_PATH=../opencv_contrib-4.2.0/modules -D OPENCV_ENABLE_NONFREE=ON -D BUILD_opencv_python3=ON -D BUILD_SHARED_LIBS=ON -D BUILD_WITH_DEBUG_INFO=OFF -D BUILD_DOCS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_TESTS=OFF -D BUILD_opencv_world=OFF -D WITH_CUDA=OFF ../opencv-4.2.0 cmake --build . #make package # Change CMAKE_INSTALL_PREFIX e.g. using cmake-gui . to install in a custom directory... sudo make install # Possibly dirty install/uninstall on a pi image... #sudo cp -Rf ./* $RASPBIAN_ROOTFS/usr/local/ #sudo rm -Rf $RASPBIAN_ROOTFS/usr/local/bin/opencv_* $RASPBIAN_ROOTFS/usr/local/bin/setup_vars_opencv4.sh $RASPBIAN_ROOTFS/usr/local/include/opencv4 $RASPBIAN_ROOTFS/usr/local/lib/cmake/opencv4 $RASPBIAN_ROOTFS/usr/local/lib/libopencv_* $RASPBIAN_ROOTFS/usr/local/share/opencv4 $RASPBIAN_ROOTFS/usr/local/share/licenses/opencv4 # Ibex, Codac # To make a package after install... mkdir -p ibex/bin/ ibex/include/ ibex/lib/ ibex/share/pkgconfig/ cp -Rf /usr/local/bin/*ibex* ibex/bin/ cp -Rf /usr/local/include/ibex* ibex/include/ cp -Rf /usr/local/lib/*ibex* ibex/lib/ cp -Rf /usr/local/share/*ibex* ibex/share/ cp -Rf /usr/local/share/pkgconfig/*ibex* ibex/share/pkgconfig/ tar cfz ibex.tar.gz ibex mkdir -p codac/bin/ codac/include/ codac/lib/ codac/share/pkgconfig/ codac/share/doc/ cp -Rf /usr/local/include/codac* codac/include/ cp -Rf /usr/local/lib/*codac* codac/lib/ cp -Rf /usr/local/share/*codac* codac/share/ cp -Rf /usr/local/share/pkgconfig/*codac* codac/share/pkgconfig/ cp -Rf /usr/local/share/doc/*codac* codac/share/doc/ tar cfz codac.tar.gz codac # libmodbus static cd ~/Downloads wget https://github.com/stephane/libmodbus/archive/v3.0.6.zip -O libmodbus-3.0.6.zip unzip -q libmodbus-3.0.6.zip cd libmodbus-3.0.6 ./autogen.sh ./configure --with-pic --enable-static --enable-shared=no --prefix=/opt/libmodbus-3.0.6-static make install # Qt Creator 5.12.6 cd ~/Downloads # Qt Linux 64 bit wget https://download.qt.io/archive/qt/5.12/5.12.6/qt-opensource-linux-x64-5.12.6.run chmod +x qt-opensource-linux-x64-5.12.6.run ./qt-opensource-linux-x64-5.12.6.run # MATLAB (needs Statistics and machine learning toolbox) prerequisites... sudo apt-get -y install libxp6 libncurses5 build-essential # 64 bit sudo ln -s /lib/x86_64-linux-gnu/libc.so.6 /lib64/ #sudo dpkg -i libxp6_1.0.2-2_amd64.deb # 32 bit #sudo ln -s /lib/x86-linux-gnu/libc.so.6 /lib/ sudo ln -s /lib/i386-linux-gnu/libc.so.6 /lib/ #sudo dpkg -i libxp6_1.0.2-2_i386.deb # To get shortcuts (including in GUI), sudo apt install matlab-support can be installed (require to specify manually where MATLAB is installed)... #sudo ln -s -f /opt/matlab/R2015a/bin/matlab /usr/local/bin/matlab #sudo apt-get -y install octave #sudo dpkg -i octave_4.0.0-3ubuntu5_i386.deb #sudo apt-get -y install scilab # OpenVPN (check also info on http://www.ensta-bretagne.fr/ , Espace Numérique de Travail) # Go to https://vpn2.ensta-bretagne.fr , login, download and extract openvpn_client.zip and in the extracted folder sudo apt-get install openvpn sudo openvpn --config openvpn_client.ovpn # resolconf should be installed? sudo apt-get install resolvconf # DNS resolution do not work -> add 3 lines at the end of the openvpn_client.ovpn config file script-security 2 up /etc/openvpn/update-resolv-conf down /etc/openvpn/update-resolv-conf # Launch OpenVPN sudo openvpn --config openvpn_client.ovpn # Then, you should be able to mount ENSTA Bretagne network drives in another terminal using http://www.ensta-bretagne.fr/lebars/Share/remote_ensieta.sh ... # See also https://superuser.com/questions/1737052/openssl-error0a00018essl-routinesca-md-too-weak # ??? #sudo apt-get install network-manager-openvpn network-manager-openvpn-gnome #https://www.ensta-bretagne.fr/zerr/dokuwiki/doku.php?id=network:network_namespaces # OneDrive, SharePoint sudo apt-get install davfs2 sudo addgroup $USER davfs2 # Reboot if needed... #sudo modprobe coda cd /opt wget https://github.com/suoko/spfilezilla/archive/master.zip unzip master.zip #cd spfilezilla-master #sudo mono bin/Debug/SPFileZilla2013.exe # Check README.md #cd /opt # Chrome sudo apt install gdebi-core wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb sudo gdebi google-chrome-stable_current_amd64.deb # If problems accessing a serial port device: # Add current user to dialout group (vi /etc/group), reboot if needed sudo addgroup $USER dialout # Change access rights to the serial port sudo chmod 666 /dev/ttyUSB0 # Conflict with Braille service when plugging SBG device on Ubuntu 22.04? sudo apt-get remove brltty # The following might cause incompatibilities...? #sudo apt-get remove modemmanager # ROS # Might need to run dos2unix on the files in case end-of-line characters are incorrect as well as set python scripts as executable if some nodes are reported as not found... # Note that ROS might perturbate OpenCV in Python if you add "source /opt/ros/kinetic/setup.bash" to .bashrc since this might change PYTHONPATH, try #unset PYTHONPATH # in the terminal where you want to use OpenCV in Python without ROS... # When launching roscore on the robot, sometimes the var ROS_MASTER_URI needs to be modified with the IP address returned by ping COMPUTER_NAME (assuming COMPUTER_NAME is the value returned by hostname) instead of localhost, e.g. export ROS_MASTER_URI=http://192.168.0.1:11311 (or maybe instead replace localhost with COMPUTER_NAME)... On the laptop, we need to set ROS_MASTER_URI to the same as the robot and ROS_IP to the IP address of the laptop, e.g. export ROS_IP=192.168.0.100... # See also http://bit.ly/1RCVMaB, https://www.clearpathrobotics.com/assets/guides/kinetic/ros... # If Gazebo crashes in a virtual machine, try export SVGA_VGPU10=0 (see https://answers.gazebosim.org//question/13214/virtual-machine-not-launching-gazebo/)... # We should not modify directly the nodes installed using apt otherwise the modifications might be overwritten by an upgrade, but it seems possible to leave our own .yaml and .launch... # Razor (for AHRS firmware) roscd razor_imu_9dof cp -r src/Razor_AHRS ~/Arduino roscd razor_imu_9dof/config cp razor.yaml my_razor.yaml roslaunch razor_imu_9dof razor-pub-and-display.launch rostopic echo /imu # Razor (for factory default firmware) roscd razor_imu_m0_driver roslaunch razor_imu_m0_driver driver_node.launch rostopic echo /imu/data # SBG roscd sbg_driver roslaunch sbg_driver sbg_ellipseA.launch rostopic echo /ekf_euler rostopic echo /imu_data # RPLIDAR # See also https://www.hackster.io/dmitrywat/ros-melodic-on-raspberry-pi-4-debian-buster-rplidar-a1m8-0d63d1...? roscd rplidar_ros roslaunch rplidar_ros view_rplidar.launch roslaunch rplidar_ros rplidar.launch rosrun rplidar_ros rplidarNodeClient # Hokuyo roscd urg_node rosrun urg_node getID /dev/ttyACM0 # MTi (old official, deprecated) cd ~/catkin_ws/ catkin_make . ~/catkin_ws/devel/setup.bash roscore rosrun xsens_driver mtnode.py _device:=/dev/ttyUSB0 _baudrate:=115200 rostopic echo /mti/sensor/imu # MTi (alternate) roscore roscd xsens_driver rosrun xsens_driver mtnode.py -d=/dev/ttyUSB0 rostopic echo /imu/data # GPS (gpsd) gpsd -S 4000 /dev/ttyUSB0 rosrun gpsd_client gpsd_client _host:=localhost _port:=4000 rostopic echo /fix # GPS (alternate) roscore rosrun nmea_navsat_driver nmea_serial_driver _port:=/dev/ttyUSB0 _baud:=4800 rostopic echo /fix # Pololu Maestro #https://github.com/EnstaBretagneClubRobo/ros_maestro #https://github.com/RemiRigal/BathyBoatNav #https://github.com/tuuzdu/crab_project/tree/master/crab_maestro_controller source devel/setup.bash roscd ros_maestro roslaunch ros_maestro maestro.launch # Tritech Micron Sonar #https://github.com/mcgill-robotics/ros-tritech-micron.git # mavros # https://github.com/nomumu/compressed_picam # https://github.com/SamSpaulding/ros_raspberry_pi_zero, https://github.com/fpasteau/raspicam_node/ # Repair rosbag... rosbag reindex file.bag.active rosbag check file.bag.active -g rulefile.rule rosbag fix file.bag.active file.repaired.bag # rqt (topic monitor plugin) sudo apt install ros-kinetic-rqt-robot-plugins rqt --force-discover # Check/delete .pyc files if message cannot find node... # To display plots, see https://plotjuggler.io/ # GitHub Desktop: see https://github.com/shiftkey/desktop/releases # Check gnome-tweak-tool # System Settings\Details\default apps (check after install of apps) # Change default app for .c, .cpp, .cxx, .h, .hpp, .hxx files in their properties (check after install of apps) # VS Code # Choose visual-studio-light-theme... # Look@LAN nmap 192.168.0.1-110 # Wi-Fi/4G control nmcli c nmcli c up UUID --ask nmcli c down UUID nmcli c delete UUID nmcli d nmcli d wifi list nmcli d wifi connect SSID --ask sudo nmcli radio wifi on # Bridge, hotspot # e.g. to create a hotspot with routing and DHCP server, add new Wi-Fi with AP mode and IP mode to Shared... # For a bridge you might need to use e.g. ip a command to get the Ethernet interface names, and the bridge status, note that the bridge might not appear in some Ubuntu GUI areas, Wi-Fi might not be supported in a bridge... # Terminal-only command: nmtui # Pre-18.04 GUI (still available at least in 20.04): nm-connection-editor # Firewall sudo ufw status sudo ufw allow ssh sudo apt install gufw # Ping through a specific interface ping -I eth0 www.google.fr # List connections netstat -t -u -n -a # Get version info uname -a cat /etc/os-release lsb_release -a # Check RAM usage free # Get info on a binary file a.out ldd a.out # Launch (e.g. from SSH) and retrieve unattended process screen, start process, CTRL+A D, screen -r # Launch and detach from terminal, but cannot retrieve...? noup a.out # Startup Applications (gnome-session-properties): create e.g. socat_443_2540.desktop in ~/.config/autostart/ (or in /etc/xdg/autostart/ for all users that do not have a ~/.config/autostart/?) : [Desktop Entry] Type=Application Exec=bash -c "while true; do sudo socat -d -d tcp-listen:443,reuseaddr,fork tcp:127.0.0.1:2540,reuseaddr;sleep 1; done" & Hidden=false NoDisplay=false X-GNOME-Autostart-enabled=true Name[en_US]=socat_443_2540 Name=socat_443_2540 Comment[en_US]= Comment= # Editing configuration files from the command line: sed sed -i 's/setting=.*/setting=newval/' file.txt # Add "#*" if the setting could be commented, "^" to match the beginning of the line... sed -i 's/^#*setting=.*/setting=newval/' file.txt # Replace all occurences instead of just the first... sed -i 's/setting=.*/setting=newval/g' file.txt # Special character "'"... sed -i 's/\x27sec\x27, \x27uint8\x27, \x27valid\x27, \x27error\x27/\x27sec\x27, \x27uint8\x27, \x27valid\x27, \x27uint8\x27/g' x64\hardwarex_proto.m # If needed to use an environment variable sed_param=s/setting=.*/setting=${NEW_VALUE}/ sed -i "$sed_param" file.txt # Editing configuration files from the command line: perl perl -i -p0e 's/setting\r\n1/setting\r\n0/' file.txt # Editing configuration files from the command line: http://augeas.net/tour.html sudo apt-get -y install augeas-tools sudo augtool set /files/etc/environment/socks_proxy test sudo augtool rm /files/etc/environment/socks_proxy sudo augtool set /files/etc/environment/socks_proxy '\"'socks://192.168.1.10:822/'\"' # Get info on serial port udevadm info -a -n ttyS1 # Rename USB serial port sudo nano /etc/udev/rules.d/99-usb-serial.rules SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", ATTRS{serial}=="FTDIF46B", SYMLINK+="gps", MODE="0666" # Rename standard serial port sudo nano /etc/udev/rules.d/90-rename-serial-ports.rule KERNEL=="ttyS1", SUBSYSTEM=="tty", SYMLINK+="gps", MODE="0666" # or ACTION=="add" KERNEL=="ttyS1" SYMLINK+="gps" MODE="0666" # Reload the rules (or need to reboot for standard serial ports) sudo udevadm control --reload-rules ; sudo udevadm trigger # ??? #ls /dev/serial/by-id # Virtual joystick...? sudo addgroup uinput sudo addgroup $USER uinput sudo nano /etc/udev/rules.d/99-input.rules sudo modprobe uinput ls -l /dev/uinput # ??? # Problems with certificates... # Mono-specific? yes "yes" | sudo certmgr -ssl https://valid.r1.roots.globalsign.com/ yes "yes" | sudo certmgr -ssl https://webcam1.lpl.org/axis-cgi/mjpg/video.cgi wget http://secure.globalsign.com/cacert/root-r1.crt yes "yes" | certmgr -add -c My ./root-r1.crt yes "yes" | certmgr -add -c AddressBook ./root-r1.crt yes "yes" | certmgr -add -c CA ./root-r1.crt yes "yes" | certmgr -add -c Trust ./root-r1.crt yes "yes" | sudo certmgr -add -c -m My ./root-r1.crt yes "yes" | sudo certmgr -add -c -m AddressBook ./root-r1.crt yes "yes" | sudo certmgr -add -c -m CA ./root-r1.crt yes "yes" | sudo certmgr -add -c -m Trust ./root-r1.crt wget https://secure.globalsign.com/cacert/gsdomainvalsha2g2r1.crt yes "yes" | certmgr -add -c My ./gsdomainvalsha2g2r1.crt yes "yes" | certmgr -add -c AddressBook ./gsdomainvalsha2g2r1.crt yes "yes" | certmgr -add -c CA ./gsdomainvalsha2g2r1.crt yes "yes" | certmgr -add -c Trust ./gsdomainvalsha2g2r1.crt yes "yes" | sudo certmgr -add -c -m My ./gsdomainvalsha2g2r1.crt yes "yes" | sudo certmgr -add -c -m AddressBook ./gsdomainvalsha2g2r1.crt yes "yes" | sudo certmgr -add -c -m CA ./gsdomainvalsha2g2r1.crt yes "yes" | sudo certmgr -add -c -m Trust ./gsdomainvalsha2g2r1.crt yes "yes" | sudo mozroots --import --quiet sudo mozroots --sync # More general? cd /usr/local/share/ca-certificates sudo wget http://secure.globalsign.com/cacert/root-r1.crt sudo wget https://secure.globalsign.com/cacert/gsdomainvalsha2g2r1.crt sudo openssl x509 -in root-r1.crt -inform der -out rootr1b64.crt sudo openssl x509 -in gsdomainvalsha2g2r1.crt -inform der -out gsdomainvalsha2g2r1b64.crt sudo update-ca-certificates # Test with Mono and curl... csharp -e 'new System.Net.WebClient ().DownloadString ("https://webcam1.lpl.org/")' curl https://webcam1.lpl.org/axis-cgi/mjpg/video.cgi # If needed to always work in UTC... # Select UTC as time zone, set the system date, set the hardware (BIOS RTC) clock to the same as the system clock considering the hardware clock in UTC # Armadeus (uClibc) echo "UTC0" > /etc/TZ date 081617342012 /sbin/hwclock --systohc --utc # Normal Linux cd /etc ln -sf ../usr/share/zoneinfo/UTC/Universal /etc/localtime date 081619082012 /sbin/hwclock --systohc --utc # Or ? timedatectl set-timezone UTC sudo date -s "19 MAY 2018 15:50:00" timedatectl set-local-rtc 0 # Windows 10 #Settings\Time & Language\Date & Time and select UTC # If needed to force Windows to always consider the hardware clock in UTC (even when local time is not UTC) # 32 bit #reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation" /v RealTimeIsUniversal /d 1 /t REG_DWORD /f # 64 bit #reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation" /v RealTimeIsUniversal /d 1 /t REG_QWORD /f # NTP... # On default Ubuntu 20.04 Desktop sudo nano /etc/systemd/timesyncd.conf FallbackNTP=ntp.ubuntu.com auvergne.ensieta.ecole # Then (if it does not work, try to restart computer...) sudo systemctl restart systemd-timesyncd # If using ntpdate (ntpdate deprecated as of Ubuntu 16.04...?) sudo ntpdate auvergne.ensieta.ecole # Enable synchro sudo timedatectl set-ntp true # Check status timedatectl # Raspberry Pi Zero cross compilation tools, assuming that pi contains a raw dd copy of the SD card... cd /opt #wget https://github.com/raspberrypi/tools/archive/master.zip #unzip -q -o master.zip #chmod -R 644 tools-master #rm -Rf master.zip # /opt/tools-master/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc... # Different gcc versions are also available on https://github.com/abhiTronix/raspberry-pi-cross-compilers if needed... wget https://sourceforge.net/projects/raspberry-pi-cross-compilers/files/Raspberry%20Pi%20GCC%20Cross-Compiler%20Toolchains/Buster/GCC%208.3.0/Raspberry%20Pi%201%2C%20Zero/cross-gcc-8.3.0-pi_0-1.tar.gz tar xfz cross-gcc-8.3.0-pi_0-1.tar.gz chmod -R 644 cross-pi-gcc-8.3.0-0 # To try to solve error about crt1.o, crti.o... cp -R cross-pi-gcc-8.3.0-0/arm-linux-gnueabihf/libc/usr/* cross-pi-gcc-8.3.0-0/arm-linux-gnueabihf/ rm -Rf cross-gcc-8.3.0-pi_0-1.tar.gz export PATH=/opt/cross-pi-gcc-8.3.0-0/bin:$PATH # Or... #wget https://github.com/Pro/raspi-toolchain/releases/latest/download/raspi-toolchain.tar.gz #tar xfz raspi-toolchain.tar.gz --strip-components=1 -C /opt #rm -Rf raspi-toolchain.tar.gz #export PATH=/opt/cross-pi-gcc/bin:$PATH # Or... #wget https://github.com/rvagg/rpi-newer-crosstools/archive/master.zip # Or sudo apt install g++-arm-linux-gnueabihf/crossbuild-essential-armhf pkg-config-arm-linux-gnueabihf?->sorry, unimplemented: Thumb-1 hard-float VFP ABI...->add -marm to compiler flags, but segmentation fault at runtime... # Change offset and sizelimit options depending on the start position (to convert in bytes) of the ext4 partition given by fdisk -l pi #fdisk -l pi2 # Only 1 partition can be mounted at a time...? # Add -r option to mount as read-only... sudo mkdir -p /mnt/bootfs sudo mount -v -o offset=4194304,loop,rw,sync -t vfat /mnt/zc/im/pi/pi /mnt/bootfs #sudo mount -v -o offset=1048576,loop,rw,sync -t vfat /mnt/zc/im/pi/pi2 /mnt/bootfs #sudo umount /mnt/bootfs sudo mkdir -p /mnt/rootfs sudo mount -v -o offset=276824064 -t ext4 /mnt/zc/im/pi/pi /mnt/rootfs #sudo mount -v -o offset=209715200 -t ext4 /mnt/zc/im/pi/pi2 /mnt/rootfs #sudo umount /mnt/rootfs # If some libraries cannot be found, it might be necessary to convert absolute symlinks into relative symlinks... # The filesystem needs to be mounted in rw, backup in case those modifications cause problems... #wget https://raw.githubusercontent.com/riscv/riscv-poky/master/scripts/sysroot-relativelinks.py #chmod +x ./sysroot-relativelinks.py #sudo ./sysroot-relativelinks.py /mnt/rootfs/ # Why the 3 following lines are sometimes necessary?->Should add --sysroot=/mnt/rootfs to gcc and g++...? #sudo ln -s /mnt/rootfs/usr/local/lib/arm-linux-gnueabihf /usr/local/lib/arm-linux-gnueabihf #sudo ln -s /mnt/rootfs/usr/lib/arm-linux-gnueabihf /usr/lib/arm-linux-gnueabihf #sudo ln -s /mnt/rootfs/lib/arm-linux-gnueabihf /lib/arm-linux-gnueabihf # For cmake... cd ~/Downloads wget https://www.ensta-bretagne.fr/lebars/Share/pi.cmake export RASPBIAN_ROOTFS=/mnt/rootfs export RASPBERRY_VERSION=1 cmake -D CMAKE_TOOLCHAIN_FILE=~/Downloads/pi.cmake . cmake --build . # Problems with cmake-gui...? # Armadeus APF27 cmake -D CMAKE_SYSTEM_NAME=Linux -D CMAKE_C_COMPILER=/home/user/armadeus-4.0/buildroot/output/build/staging_dir/usr/bin/arm-linux-gcc -D CMAKE_CXX_COMPILER=/home/user/armadeus-4.0/buildroot/output/build/staging_dir/usr/bin/arm-linux-g++ -D CMAKE_FIND_ROOT_PATH=/home/user/armadeus-4.0/buildroot/output/target -D CMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY -D CMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY -D CMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER . # Or ? #cd /home/user/armadeus-4.0 wget https://www.ensta-bretagne.fr/lebars/Share/armadeus.cmake #cmake -D CMAKE_TOOLCHAIN_FILE=/home/user/armadeus-4.0/armadeus.cmake . cmake -D CMAKE_TOOLCHAIN_FILE=armadeus.cmake . cmake --build . # Problems with cmake-gui...? # Docker (for VMware, should add vhv.enable="TRUE" to .vmx) docker images #docker image rm #docker image rm -f $(docker images -q) docker image prune -f docker rm $(docker ps -qa --no-trunc --filter "status=exited") # Images cache should be /var/lib/docker... docker run --rm --privileged multiarch/qemu-user-static:register --reset xhost +local:$(id -un) #docker run --net=host -e DISPLAY -i -v "$PWD/..:$PWD/.." lebarsfa/pi:buster /bin/bash -c "uname -a && cat /etc/os-release && cd $PWD && cmake -D CMAKE_BUILD_TYPE=Release . && cmake --build . && ./DisplayImage image.png" #docker build --progress=plain -t lebarsfa/pi:buster . docker login #docker push lebarsfa/pi:buster #docker tag lebarsfa/pi:buster lebarsfa/pi:latest ## Assuming rootfs is a mounted pi SD card... #sudo tar -C rootfs -c . | docker import - lebarsfa/pi:buster-tmp #wget https://github.com/balena-io-library/base-images/blob/master/balena-base-images/rpi/debian/buster/run/qemu-arm-static ## Assuming content of Dockerfile: ##FROM lebarsfa/pi:buster-tmp ##ENV QEMU_CPU=arm1176 ##COPY qemu-arm-static /usr/bin #docker build --progress=plain -t lebarsfa/pi:buster-full buster-full # # New way to use different platforms sudo apt-get install qemu binfmt-support qemu-user-static docker run --rm --privileged multiarch/qemu-user-static --reset -p yes docker run --platform linux/arm64 --rm -t arm64v8/ubuntu uname -m docker run --platform linux/arm64 --net=host -e DISPLAY -it -v "$PWD/..:$PWD/.." ubuntu:jammy /bin/bash docker build --platform linux/arm64 --progress=plain -t lebarsfa/manylinux2014_aarch64-for-codac . # docker logout # To list id of last modified containers sudo docker ps -l # To commit changes to the container sudo docker commit user/modified_container # If network conflicts: sudo ifconfig docker0 down; sudo systemctl stop docker # Or change /etc/docker/daemon.json { "bip": "172.26.0.1/16" } # Change Docker image storage location temporarily: sudo systemctl stop docker.service ; sudo systemctl stop docker.socket ; sudo dockerd -g /new/path/docker # /new/path/docker probably needs to be on an ext4 partition... # VMware Player sudo apt update sudo apt install -y build-essential # VMware Player needs to be uninstalled before otherwise VMware VIX installer might fail... #sudo ./VMware-Player-15.5.6-16341506.x86_64.bundle -u vmware-player # Or #sudo vmware-installer -l #sudo vmware-installer -u vmware-player #sudo vmware-installer -u vmware-vix # ... wget https://softwareupdate.vmware.com/cds/vmw-desktop/player/16341506/VMware-Player-15.5.6-16341506.x86_64.bundle --no-check-certificate -nv wget https://download3.vmware.com/software/player/file/VMware-VIX-1.17.0-6661328.x86_64.bundle --no-check-certificate -nv sudo ./VMware-VIX-1.17.0-6661328.x86_64.bundle --console --eulas-agreed --required # Then we can install VMware Player #sudo ./VMware-Player-15.5.6-16341506.x86_64.bundle --eulas-agreed sudo ./VMware-Player-16.1.0-17198959.x86_64.bundle --eulas-agreed # VIX and Player compatibility... wget http://www.ensta-bretagne.fr/lebars/Share/vixwrapper-config.txt --no-check-certificate -nv sudo cp -f ./vixwrapper-config.txt /usr/lib/vmware-vix/ # vmware-vdiskmanager (i386) #unzip -q -o 1023856-vdiskmanager-linux.7.0.1.zip #sudo mv -f ./1023856-vmware-vdiskmanager-linux.7.0.1 /usr/bin/vmware-vdiskmanager #sudo chmod +x /usr/bin/vmware-vdiskmanager # vmware-vdiskmanager tar xfz VMware-vix-disklib-7.0.1-16860560.x86_64.tar.gz sudo cp -Rf vmware-vix-disklib-distrib/* /usr/lib/vmware/ sudo bash -c "echo /usr/lib/vmware/lib64 > /etc/ld.so.conf.d/vmware-vix-disklib.conf" sudo ln -s -f /usr/lib/vmware/bin64/vmware-vdiskmanager /usr/bin/vmware-vdiskmanager sudo ln -s -f /usr/lib/vmware/bin64/vixDiskCheck /usr/bin/vixDiskCheck sudo ln -s -f /usr/lib/vmware/bin64/vddkReporter /usr/bin/vddkReporter sudo ldconfig sudo rm -Rf vmware-vix-disklib-distrib # /etc/vmware/netmap.conf... #sudo vmware-netcfg # Check also /usr/lib/vmware/vixwrapper-product-config.txt...? # Maybe create and run a first vm in case other things are asked... # Disable unattended-upgrades: choose No after sudo dpkg-reconfigure unattended-upgrades # Install only security upgrades, see https://help.ubuntu.com/community/AutomaticSecurityUpdates sudo apt-get install unattended-upgrades update-notifier-common sudo unattended-upgrades -v # Configure auto update options, e.g. auto reboot, etc. sudo nano /etc/apt/apt.conf.d/50unattended-upgrades # Set interval of days for auto updates sudo nano /etc/apt/apt.conf.d/20auto-upgrades APT::Periodic::Update-Package-Lists "1"; APT::Periodic::Download-Upgradeable-Packages "1"; APT::Periodic::AutocleanInterval "7"; APT::Periodic::Unattended-Upgrade "1"; # Check auto updates log cat /var/log/unattended-upgrades/unattended-upgrades.log # Test settings sudo unattended-upgrades --dry-run --debug # Upgrade Ubuntu release sudo apt install update-manager-core # Check Prompt=lts sudo nano /etc/update-manager/release-upgrades sudo do-release-upgrade # But it needs to be up to date, takes a long time, asks for multiple questions all through the installation... # Unattended installation (preseeding...)... # Prepare a bootable Ubuntu 18.04 Desktop Live USB drive and update preseed/ubuntu.seed with the content of http://www.ensta-bretagne.fr/lebars/Share/seed. # Choose the USB drive as temporary boot device on the BIOS/UEFI of the target computer and immediately press ESC, choose language, F3, choose the desired keyboard, F6, ESC and add noprompt # to the boot parameters (might be necessary to avoid random problems with auto reboot...?). # Then, modify the Ubuntu installer link on Ubuntu Live to add --automatic parameter to the ubiquity command, ensure you have the Internet, launch the installer and configure your partitions when requested... # # If you only have an original Ubuntu 18.04 Desktop Live DVD and cannot modify it, replace file=...ubuntu.seed in boot parameters with something similar to url=http://www.ensta-bretagne.fr/lebars/Share/seed noprompt # Change preferably to a local IP address (e.g. ftp://192.168.0.19/seed), the network (especially Ethernet, DNS, proxy...) seems to be buggy on the live system when specifying an url in boot parameters so it might be better to try to prepare a separate USB drive with the seed file and specify the correct path in the file boot parameter... # Network bug on VMware virtual machine: nmcli c up ens33, in GUI set connect automatically and DHCP for ens33, nmcli c down ens33, nmcli c up ens33...->Maybe try to specify explicitely DNS server in boot parameters (nameserver=8.8.8.8 nameserver=172.20.1.35, ip=192.168.0.120:192.168.0.1:192.168.0.1:255.255.255.0:vmhostname:eth0:off:192.168.0.1:8.8.8.8, ip=::::::dhcp)?->adding ip=::::::dhcp seems to help for 20.04... # Wi-Fi 5GHz on W700 seems to have also problems, but can try to connect/disconnect until it works... # automatic-ubiquity boot parameter will immediately launch unattended installation, but we must be sure the network works... # debug-ubiquity DEBCONF_DEBUG=5 boot parameters to increase debug messages in /var/log/installer... # Check syntax...? #debconf-set-selections -c ubuntu.seed #Disable what's new in Ubuntu window?->https://askubuntu.com/questions/1028822/disable-the-new-ubuntu-18-04-welcome-screen -> add X-GNOME-Autostart-enabled=false to /etc/xdg/autostart/gnome-welcome-tour.desktop...? # Problem with autologin on W700, NUC7 or 8...?->Should try timed login in /etc/gdm3/custom.conf...? # packer sudo apt-get update ; sudo apt-get -y install curl ; curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add - ; sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main" ; sudo apt-get update ; sudo apt-get -y install packer # To rebuild from source sudo apt-get -y install git wget https://golang.org/dl/go1.15.7.linux-amd64.tar.gz --no-check-certificate -nv sudo tar -C /usr/local -xzf go1.15.7.linux-amd64.tar.gz export PATH=$PATH:/usr/local/go/bin:/home/user/go/bin go version go get github.com/hashicorp/packer cd /home/user/go/src/github.com/hashicorp/packer make # export PACKER_LOG=1 # Run /home/user/go/src/github.com/hashicorp/packer/bin/packer # # packer playerVerifyVersion() problem in driver_player_unix.go #/usr/lib/vmware/bin/vmware-vmx -v # gives #VMware Workstation Information: #VMware Workstation 16.1.0 build-17198959 Release # while "VMware Player 16.1.0" seems to be expected... # Workaround : sudo nano vmware-vmx #!/bin/sh >&2 echo VMware Player 16.1.0 /usr/lib/vmware/bin/vmware-vmx-orig "$@" # sudo mv -f /usr/lib/vmware/bin/vmware-vmx /usr/lib/vmware/bin/vmware-vmx-orig sudo mv -f ./vmware-vmx-player /usr/lib/vmware/bin/vmware-vmx sudo chmod +x /usr/lib/vmware/bin/vmware-vmx # # packer Clone() problem in driver_player6.go #/usr/bin/vmrun -T ws clone /home/user/Downloads/2019_datacenter/10x64.vmx output-vmware-vmx/Win2019-Datacenter.vmx full # says Service type VIX_SERVICEPROVIDER_VMWARE_WORKSTATION was specified, but not installed (on Windows this part works, but still no VNC on Windows...)... #/usr/bin/vmrun -T player clone /home/user/Downloads/2019_datacenter/10x64.vmx output-vmware-vmx/Win2019-Datacenter.vmx full # says not supported... # Should modify the Clone() so that we are allowed to copy manually the vm...? # autotools (used e.g. in gaol, mathlib libraries...) sudo apt install autoconf automake libtool # To update the build system of the library folder: # (if files copied from Windows:) dos2unix **/* dos2unix -f ./test-driver check/Makefile.in ./config* ./compile ./depcomp ./missing ./install-sh ./ltmain.sh # Run multiple times (might need: rm -Rf m4 compile configure depcomp install-sh missing mkinstalldirs test-driver config.guess config.sub aclocal.m4 ltmain.sh)... autoreconf -i ; libtoolize ; aclocal ; automake --add-missing ; autoconf ; autoupdate # autogen.sh might not be useful any more according to https://stackoverflow.com/questions/50044091/what-is-the-job-of-autogen-sh-when-building-a-c-package-on-linux... # Bug no GUI Ubuntu 18.04 sudo apt-get install lightdm # Choose lightdm when asked... sudo reboot # Shutting down... sudo shutdown now # Check battery: cat /sys/class/power_supply/BATC/capacity # Or similar, use TAB for autocomplete in /sys/class/power_supply/ and subfolders... # CTRL+u to delete the current command, delete .bash_history, .python_history, check app Passwords and Keys if needed... # Remove any core file in ~ or /root, Downloads, Trash... # Making a shortcut to always launch an app with sudo: add sudo in Exec property in /usr/share/applications/XXX.desktop... # Nautilus Ubuntu 20.04: to get it as sudo, try to access /root and enter password when asked... # Capture screen: on Ubuntu 22.04 simplescreenrecorder might need sudo nano /etc/gdm3/custom.conf and uncomment WaylandEnable=false... Otherwise Ubuntu default screen recorder works... # Tool to quickly display GUI message boxes... #zenity --info --title="Title" --text="Text" # Find files of size ]7678;7682[ bytes... #sudo find / -size +$((7678))c -size -$((7682))c #sudo find / -iname "*ubiquity*" #sudo find / -ipath "*seed*" #sudo grep -r 'ensta-bretagne' / # Kill a program known by a part of its name or running arguments export TEST_PY_PID=`ps aux | grep test.py | head -n 1 | awk '{print $2}` sudo killall $TEST_PY_PID # Redirecting stdout and stderr to output.txt (make clean && (echo 11 | make)) >output.txt 2>&1 # Check syntax of scripts: http://www.shellcheck.net/ or shellcheck package and command... # Get readable help on the parameters of a specific command: e.g. https://explainshell.com/explain?cmd=ls+-l OLD # Cisco Anyconnect VPN (recommended as long as DNS do not work with OpenVPN...) # Go to https://vpn.ensta-bretagne.fr , login and wait for the auto Java plugin install to fail to get a link to download vpnsetup.sh chmod +x vpnsetup.sh sudo sh ./vpnsetup.sh # Go in the Ubuntu apps menu and search for VPN, launch Cisco Anyconnect Client and connect to vpn.ensta-bretagne.fr # You might need to set https://auvergne.ensieta.ecole/proxy.pac as proxy since 192.168.1.17 is not always accessible... # Then, you should be able to mount ENSTA Bretagne network drives in another terminal using http://www.ensta-bretagne.fr/lebars/Share/remote_ensieta.sh ... #sudo mount -t cifs -o username=$(>&2 echo -n "Enter remote username: "; read u; echo $u),nounix,noserverino //ensieta.ecole/data/public /mnt/public # Qt Creator 2010.05 cd ~/Downloads # 64 bit wget http://www.ensta-bretagne.fr/lebars/Share/qt-sdk-linux-x86_64-opensource-2010.05.1.bin chmod +x qt-sdk-linux-x86_64-opensource-2010.05.1.bin # ./qt-sdk-linux-x86_64-opensource-2010.05.1.bin --mode unattended has a bug, see https://bugreports.qt.io/browse/QTCREATORBUG-472...? ./qt-sdk-linux-x86_64-opensource-2010.05.1.bin wget http://www.ensta-bretagne.fr/lebars/Share/qt-opensource-linux-x64-5.11.0.run chmod +x qt-opensource-linux-x64-5.11.0.run ./qt-opensource-linux-x64-5.11.0.run # 32 bit wget http://www.ensta-bretagne.fr/lebars/Share/qt-sdk-linux-x86-opensource-2010.05.1.bin chmod +x qt-sdk-linux-x86-opensource-2010.05.1.bin ./qt-sdk-linux-x86-opensource-2010.05.1.bin # VMware VIX installer prerequisites?->not necessary, need to uninstall VMware Player before... #sudo apt update #sudo apt install -y build-essential curl python3.8-dev libcanberra-gtk-module qemu-utils # To try to disable the numerous password prompts in nomachine, do something similar to sudo nano /etc/polkit-1/localauthority.conf.d/03-allow-network-manager polkit.addRule(function(action, subject) { if (action.id =="org.freedesktop.NetworkManager.settings.modify.system" && subject.isInGroup ("users")) { return polkit.Result.YES; } }); if (action.id =="org.freedesktop.NetworkManager.settings.modify.system.own" && subject.isInGroup ("users")) { return polkit.Result.YES; } }); polkit.addRule(function(action, subject) { if (action.id =="org.freedesktop.login1.reboot" && subject.isInGroup ("users")) { return polkit.Result.YES; } }); sudo dos2unix /etc/polkit-1/localauthority.conf.d/03-allow-network-manager