Ubuntu Tips


Ubuntu Tips

  • Disable audio power save mode to avoid static noise when no player active
  •     # Change live setting
        echo "0" | sudo tee /sys/module/snd_hda_intel/parameters/power_save
    
        # Change permanent setting
        echo "options snd_hda_intel power_save=0" | sudo tee -a /etc/modprobe.d/audio_disable_powersave.conf
      


Ubuntu Auto Upgrade


Configure Ubuntu Auto Upgrade in terminal

  • Install dependencies
  •         sudo apt install unattended-upgrades
          
  • Edit /etc/apt/apt.conf.d/50unattended-upgrades and change the following:
  •         # Enable this setting in Unattended-Upgrade::Allowed-Origins
            "${distro_id}:${distro_codename}-updates";
          
  • To keep /boot folder small
  •         Unattended-Upgrade::Remove-Unused-Kernel-Packages "true";
            Unattended-Upgrade::Remove-Unused-Dependencies "true";
          
  • Optional:
  •         # Replace email address with administrator address and insure that email can be sent from cli
            Unattended-Upgrade::Mail "you@some.site";
    
            # Enable auto reboot
            Unattended-Upgrade::Automatic-Reboot "true";
            Unattended-Upgrade::Automatic-Reboot-Time "02:38";
            # For non-critical servers, add this:
            Unattended-Upgrade::Automatic-Reboot-WithUsers "true";
          
  • Edit /etc/apt/apt.conf.d/20auto-upgrades and change the following:
  •         # Some of these settings may already be active
            APT::Periodic::Update-Package-Lists "1";
            APT::Periodic::Download-Upgradeable-Packages "1";
            APT::Periodic::AutocleanInterval "7";
            APT::Periodic::Unattended-Upgrade "1";
          
  • Check if it works:
  •         sudo unattended-upgrades --dry-run --debug
          

References


SVN instructions


Create a branch

  • Navigate to a temporary folder
  • Get the trunk URL of the project (e.g. https://www.softco.co.za/svn/trunk/projects/test/ – with trailing slash)
  • Replace trunk with branches/branch-name (e.g. https://www.softco.co.za/svn/branches/v1.1/test/)
  • Execute the following command:
  •         svn copy --parents "https://www.softco.co.za/svn/trunk/projects/test/" "https://www.softco.co.za/svn/branches/v1.1/test/"
          


Snap Security



Snap Security

Snap security

Snap packages are sandboxed and therefore they are not by default allowed to access the password service.
For example: When you choose “Store in keychain” MySQLWorkbench is blocked by AppArmor. To fix
this, you need to execute a command similar to the following (which is to allow MySQLWorkbench access
to the password manager service)

    sudo snap connect mysql-workbench-community:password-manager-service :password-manager-service
  

References:


Sane Network Scanning


Sane network scanning

  • Installing requirements
  •     # Basic requirements
        sudo apt install sane sane-utils xsane
    
        # XSane might need the following libraries
        # (start xsane net:10.0.0.123 from cli to see if libcanberra is missing)
        sudo apt install libcanberra-gtk-module libcanberra-gtk3-module
    
        # Copy systemd files
        sudo cp /usr/lib/systemd/system/saned* /etc/systemd/system
    
        # Set RUN=yes in /etc/default/saned
    
        # Enable Sane socket
        sudo systemctl enable saned.socket
      
  • Service configuration
  •     # Find USB vendor ID
        # (Vendor (VVVV) and device (DDDD) in "ID VVVV:DDDD")
        sudo lsusb
    
        # Change udev rules to use specific device group
        # (Change VVVV for Vendor ID)
        echo '"SUBSYSTEM=="usb", ATTRS{idVendor}=="VVVV", MODE="0660", GROUP="scanner", ENV{libsane_matched}="yes"' > cat /etc/udev/rules.d/55-libsane.rules
    
        # Edit /etc/saned.d/saned.conf and add access lists as follows
        192.168.0.0/24
        10.0.0.0/24
        127.0.0.1
        localhost
        
        # Add scanner group to users
        sudo usermod -a -G scanner [your-user-name]
    
        # Enable Sane socket
        sudo systemctl enable saned.socket
        sudo systemctl start saned.socket
    
        # If scanner is still not listed, edit /etc/systemd/system/saned@.service and 
      
  • Client configuration
  •     # Enable net module
        # Edit /etc/saned.d/dll.conf and uncomment line containing net
        # Edit /etc/saned.d/net.conf and add server ip addresses as follows:
        localhost
        10.0.0.100
      
  • Trouble shooting
  •     # If no scanners are listed on the client, you might want to run saned as root:
        # Edit /etc/default/saned and uncomment RUN_AS_USER
        # Edit /etc/systemd/system/saned.socket and uncomment RUN_AS_USER
        # Edit /etc/systemd/system/saned@.service and uncomment both User and Group
    
        # You can enable logging on the server by uncommenting Environment=SANE_CONFIG_DIR=/etc/sane.d SANE_DEBUG_DLL=255
        # To view debugging information:
        tail -f /var/log/syslog
        # Now search for scanners on client:
        scanimage -L
    
        # You might want to enable data port ranges in /etc/saned.d/saned.conf
        data_portrange = 10000 - 10010