Skip to content

Snap Permissions (Linux)

This page explains how to configure permissions for Rayforge when installed as a Snap package on Linux.

What are Snap Permissions?

Snaps are containerized applications that run in a sandbox for security. By default, they have limited access to system resources. To use certain features (like serial ports for laser controllers), you must explicitly grant permissions.

Required Permissions

Rayforge needs these Snap interfaces connected for full functionality:

Interface Purpose Required?
serial-port Access to USB serial devices (laser controllers) Yes (for machine control)
home Read/write files in your home directory Auto-connected
removable-media Access external drives and USB storage Optional
network Network connectivity (for updates, etc.) Auto-connected

Granting Serial Port Access

This is the most important permission for Rayforge.

Check Current Permissions

# View all connections for Rayforge
snap connections rayforge

Look for the serial-port interface. If it shows "disconnected" or "-", you need to connect it.

Connect Serial Port Interface

# Grant serial port access
sudo snap connect rayforge:serial-port

You only need to do this once. The permission persists across app updates and reboots.

Verify Connection

# Check if serial-port is now connected
snap connections rayforge | grep serial-port

Expected output:

serial-port     rayforge:serial-port     :serial-port     -

If you see a plug/slot indicator, the connection is active.


Granting Removable Media Access

If you want to import/export files from USB drives or external storage:

# Grant access to removable media
sudo snap connect rayforge:removable-media

Now you can access files in /media and /mnt.


Troubleshooting Snap Permissions

Serial Port Still Not Working

After connecting the interface:

  1. Replug the USB device:
  2. Unplug your laser controller
  3. Wait 5 seconds
  4. Plug it back in

  5. Restart Rayforge:

  6. Close Rayforge completely
  7. Relaunch from the application menu or:

    snap run rayforge
    

  8. Check that the port appears:

  9. Open Rayforge Settings Machine
  10. Look for serial ports in the dropdown
  11. Should see /dev/ttyUSB0, /dev/ttyACM0, or similar

  12. Verify the device exists:

    # List USB serial devices
    ls -l /dev/ttyUSB* /dev/ttyACM*
    

"Permission Denied" Despite Connected Interface

This is rare but can happen if:

  1. The Snap installation is broken:

    # Reinstall the snap
    sudo snap refresh rayforge --devmode
    # Or if that fails:
    sudo snap remove rayforge
    sudo snap install rayforge
    # Re-connect interfaces
    sudo snap connect rayforge:serial-port
    

  2. Conflicting udev rules:

  3. Check /etc/udev/rules.d/ for custom serial port rules
  4. They might conflict with Snap's device access

  5. AppArmor denials:

    # Check for AppArmor denials
    sudo journalctl -xe | grep DENIED | grep rayforge
    

If you see denials for serial ports, there may be an AppArmor profile conflict.

Can't Access Files Outside Home Directory

By design, Snaps can't access files outside your home directory unless you grant removable-media.

Workaround options:

  1. Move files to your home directory:

    # Copy SVG files to ~/Documents
    cp /some/other/location/*.svg ~/Documents/
    

  2. Grant removable-media access:

    sudo snap connect rayforge:removable-media
    

  3. Use Snap's file picker:

  4. The built-in file chooser has broader access
  5. Open files through File Open rather than command-line arguments

Manual Interface Management

List All Available Interfaces

# See all Snap interfaces on your system
snap interface

Disconnect an Interface

# Disconnect serial-port (if needed)
sudo snap disconnect rayforge:serial-port

Reconnect After Disconnect

sudo snap connect rayforge:serial-port

Alternative: Install from Source

If Snap permissions are too restrictive for your workflow:

Option 1: Build from source

# Clone the repository
git clone https://github.com/kylemartin57/rayforge.git
cd rayforge

# Install dependencies using pixi
pixi install

# Run Rayforge
pixi run rayforge

Benefits: - No permission restrictions - Full system access - Easier debugging - Latest development version

Drawbacks: - Manual updates (git pull) - More dependencies to manage - No automatic updates

Option 2: Use Flatpak (if available)

Flatpak has similar sandboxing but sometimes with different permission models. Check if Rayforge offers a Flatpak package.


Snap Permission Best Practices

Only Connect What You Need

Don't connect interfaces you don't use:

  •  Connect serial-port if you use a laser controller
  •  Connect removable-media if you import from USB drives
  • L Don't connect everything "just in case" - defeats security purpose

Verify Snap Source

Always install from the official Snap Store:

# Check publisher
snap info rayforge

Look for: - Verified publisher - Official repository source - Regular updates


Understanding Snap Sandbox

What Can Snaps Access by Default?

Allowed: - Files in your home directory - Network connections - Display/audio

Not allowed without explicit permission: - Serial ports (USB devices) - Removable media - System files - Other users' home directories

Why This Matters for Rayforge

Rayforge needs:

  1. Home directory access (auto-granted)
  2. To save project files
  3. To read imported SVG/DXF files
  4. To store preferences

  5. Serial port access (must be granted)

  6. To communicate with laser controllers
  7. This is the critical permission

  8. Removable media (optional)

  9. To import files from USB drives
  10. To export G-code to external storage

Debugging Snap Issues

Enable Verbose Snap Logging

# Run Snap with debug output
snap run --shell rayforge
# Inside the snap shell:
export RAYFORGE_LOG_LEVEL=DEBUG
exec rayforge

Check Snap Logs

# View Rayforge logs
snap logs rayforge

# Follow logs in real-time
snap logs -f rayforge

Check System Journal for Denials

# Look for AppArmor denials
sudo journalctl -xe | grep DENIED | grep rayforge

# Look for USB device events
sudo journalctl -f -u snapd
# Then plug in your laser controller

Getting Help

If you're still having Snap-related issues:

  1. Check permissions first:

    snap connections rayforge
    

  2. Try a serial port test:

    # If you have screen or minicom installed
    sudo snap connect rayforge:serial-port
    # Then test in Rayforge
    

  3. Report the issue with:

  4. Output of snap connections rayforge
  5. Output of snap version
  6. Output of snap info rayforge
  7. Your Ubuntu/Linux distribution version
  8. Exact error messages

  9. Consider alternatives:

  10. Install from source (see above)
  11. Use a different package format (AppImage, Flatpak)

Quick Reference Commands

# Grant serial port access (most important)
sudo snap connect rayforge:serial-port

# Grant removable media access
sudo snap connect rayforge:removable-media

# Check current connections
snap connections rayforge

# View Rayforge logs
snap logs rayforge

# Refresh/update Rayforge
sudo snap refresh rayforge

# Remove and reinstall (last resort)
sudo snap remove rayforge
sudo snap install rayforge
sudo snap connect rayforge:serial-port