Tag: fedora

  • How to Check and Enable Wake-on-LAN on Fedora

    How to Check and Enable Wake-on-LAN on Fedora

    Wake-on-LAN (WOL) allows you to power on a Fedora computer remotely by sending a specially formatted “magic packet” over the network. It is useful for remotely accessing a home server, desktop, or media center without leaving the machine running continuously.

    This guide explains how to check whether your network adapter supports WOL, enable it, make the setting persistent, and test that it works.

    Check the Network Interface

    First, identify your wired network interface:

    ip link

    In this example, the interface is named enp3s0.

    Run ethtool to inspect its capabilities:

    ethtool enp3s0

    If you see an error such as:

    netlink error: Operation not permitted

    run the command with sudo:

    sudo ethtool enp3s0

    The interface should also report an active network connection:

    Link detected: yes

    This confirms that the Ethernet connection itself is working.

    Check Wake-on-LAN Support

    Look for these two lines in the output:

    Supports Wake-on: pumbg
    Wake-on: d

    The Supports Wake-on line shows which wake-up methods the network adapter supports. The letter g represents wake-up using a magic packet.

    The Wake-on line shows the current configuration:

    • Wake-on: g — magic-packet WOL is enabled
    • Wake-on: d — WOL is disabled
    • Supports Wake-on: ...g... — the adapter supports magic-packet WOL

    In this example, the adapter supports WOL, but it is currently disabled.

    Enable Wake-on-LAN Temporarily

    Enable magic-packet wake-up with:

    sudo ethtool -s enp3s0 wol g

    Verify the setting:

    sudo ethtool enp3s0 | grep -i wake

    The expected output is:

    Supports Wake-on: pumbg
    Wake-on: g

    This setting may be lost after reboot or when the network connection is restarted, so configure it persistently if you plan to use WOL regularly.

    Make the Setting Persistent

    Fedora commonly manages network connections through NetworkManager. List the available connections:

    nmcli connection show

    Identify the wired connection associated with enp3s0. Then configure it to use magic-packet Wake-on-LAN:

    sudo nmcli connection modify "CONNECTION_NAME" 802-3-ethernet.wake-on-lan magic

    Replace CONNECTION_NAME with the actual connection name shown by nmcli.

    For example:

    sudo nmcli connection modify "Wired connection 1" 802-3-ethernet.wake-on-lan magic

    Reactivate the connection:

    sudo nmcli connection up "CONNECTION_NAME"

    Finally, verify the configuration:

    sudo ethtool enp3s0 | grep -i wake

    You should see:

    Wake-on: g

    Find the Computer’s MAC Address

    A Wake-on-LAN packet must be sent to the computer’s network adapter MAC address. Display it with:

    ip link show enp3s0

    Look for a line similar to:

    link/ether 00:11:22:33:44:55

    The value after link/ether is the MAC address you will use when sending the magic packet.

    Test Wake-on-LAN

    Before testing, shut down the Fedora computer:

    systemctl poweroff

    From another computer or mobile device on the same local network, send a Wake-on-LAN magic packet to the Fedora machine’s MAC address.

    If the computer powers on, Wake-on-LAN is working correctly.

    The sending device may require:

    • The target MAC address
    • The local broadcast address, often something like 192.168.1.255
    • UDP port 9 or 7

    The exact procedure depends on the operating system or WOL application you use.

    Troubleshooting

    If the computer does not wake, check the following:

    1. Confirm WOL is enabled before shutdown: sudo ethtool enp3s0 | grep -i wakeThe output should include: Wake-on: g
    2. Enable WOL in the BIOS or UEFI.
      Look for settings named:
      • Wake on LAN
      • Power On by PCI-E
      • Resume by LAN
      • PCIe Device Power On
    3. Use a wired Ethernet connection.
      Wake-on-LAN is generally more reliable over Ethernet than Wi-Fi.
    4. Keep the Ethernet cable connected.
      The network adapter must remain powered while the computer is off.
    5. Check power-saving settings.
      Options such as ErP, Deep Sleep, or EuP may remove power from the network adapter during shutdown. Disable them if necessary.
    6. Make sure the packet is sent from the same network.
      Basic WOL testing is easiest when both devices are connected to the same LAN.

    Summary

    To check and enable Wake-on-LAN on Fedora:

    sudo ethtool enp3s0
    sudo ethtool -s enp3s0 wol g
    sudo ethtool enp3s0 | grep -i wake

    A successful configuration reports:

    Supports Wake-on: pumbg
    Wake-on: g

    The adapter in this example supports Wake-on-LAN, and enabling wol g activates magic-packet wake-up. For reliable use after reboots, configure the setting through NetworkManager and verify that WOL is also enabled in the system’s BIOS or UEFI.

  • Remote Control Your Samsung Galaxy Note 20 Ultra from Fedora with scrcpy

    Remote Control Your Samsung Galaxy Note 20 Ultra from Fedora with scrcpy

    A complete guide to mirror and control your Note 20 Ultra from Fedora Linux with high performance, screen-off mode, autostart, and safe always-plugged-in usage.


    Why scrcpy?

    scrcpy is the best free and open-source tool for controlling Android devices from Linux. It offers:

    • Low latency
    • Full mouse + keyboard control
    • Audio support
    • No root required
    • Works over USB or Wi-Fi

    This guide is written specifically for Fedora + Galaxy Note 20 Ultra (SM-N986B), but it works with most modern Samsung phones.


    1. Install scrcpy on Fedora

    sudo dnf install android-tools
    sudo dnf copr enable zeno/scrcpy
    sudo dnf install scrcpy

    Enable USB debugging on your phone:

    1. Go to Settings → About phone → Software information
    2. Tap Build number 7 times
    3. Go back → Developer options
    4. Enable USB debugging

    Connect the phone via USB and accept the debugging prompt.


    2. High Performance + Screen Off Command

    This is the recommended command for best visuals, audio, and keeping the phone screen off while controlling it:

    scrcpy \
      --video-codec=h264 \
      --video-bit-rate=16M \
      --max-fps=60 \
      --audio-bit-rate=192K \
      --turn-screen-off \
      --stay-awake \
      --disable-screensaver \
      --power-off-on-close

    What the options do:

    • h264 → Most compatible codec on Fedora
    • 16M bitrate → Sharp image
    • 60 FPS → Smooth
    • --turn-screen-off → Phone screen stays black
    • --stay-awake → Prevents the phone from sleeping
    • --power-off-on-close → Turns the phone screen off when you close the scrcpy window

    3. Create a Startup Script

    Create a reliable script that waits for the phone and then launches scrcpy with the best settings:

    mkdir -p ~/bin
    nano ~/bin/start-scrcpy.sh

    Paste this:

    #!/bin/bash
    
    # Wait until the phone is connected
    while ! adb devices | grep -q "device$"; do
        sleep 2
    done
    
    # High quality + screen off + audio
    exec scrcpy \
      --video-codec=h264 \
      --video-bit-rate=16M \
      --max-fps=60 \
      --audio-bit-rate=192K \
      --turn-screen-off \
      --stay-awake \
      --disable-screensaver \
      --power-off-on-close

    Make it executable:

    chmod +x ~/bin/start-scrcpy.sh

    4. Create a Desktop Shortcut

    nano ~/Desktop/scrcpy.desktop

    Paste:

    [Desktop Entry]
    Version=1.0
    Type=Application
    Name=Phone Control
    Comment=Control Note 20 Ultra with scrcpy
    Exec=/home/YOUR_USERNAME/bin/start-scrcpy.sh
    Icon=phone
    Terminal=false
    Categories=Utility;
    StartupNotify=false

    Replace YOUR_USERNAME with your actual username, then:

    chmod +x ~/Desktop/scrcpy.desktop

    Right-click the icon on the desktop → Allow Launching.


    5. Auto-start on Login (Optional)

    mkdir -p ~/.config/autostart
    nano ~/.config/autostart/scrcpy.desktop

    Use the same content as the desktop shortcut above (just change the path if needed).


    6. Handling Pattern Lock / Black Lock Screen

    Android protects the pattern/PIN lock screen, so scrcpy shows a black screen when the phone is locked. This is a security feature.

    Best workflow:

    1. Unlock the phone first (fingerprint or pattern)
    2. Then launch Phone Control
    3. The screen will turn off, but the phone stays unlocked and fully controllable

    7. Safe Always-Plugged-In Usage

    If you keep the phone connected most of the time:

    1. Go to Settings → Battery and device care → Battery → More battery settings
    2. Enable Protect battery (limits charge to 85%)

    Extra tips:

    • Use a good quality cable and charger
    • Keep the phone in a well-ventilated spot
    • Avoid covering it while charging

    This combination keeps the battery healthier over the long term.


    Final Recommended Script

    Here’s the complete polished version:

    #!/bin/bash
    
    while ! adb devices | grep -q "device$"; do
        sleep 2
    done
    
    exec scrcpy \
      --video-codec=h264 \
      --video-bit-rate=16M \
      --max-fps=60 \
      --audio-bit-rate=192K \
      --turn-screen-off \
      --stay-awake \
      --disable-screensaver \
      --power-off-on-close

    Summary

    You now have:

    • High-quality remote control of your Note 20 Ultra
    • Phone screen stays off while controlling
    • Desktop shortcut named Phone Control
    • Optional auto-start
    • Safe battery settings for always-plugged use

    This setup turns your Note 20 Ultra into a powerful secondary device you can control comfortably from Fedora.


    My Start Script

    1 Main 2 Virtual:

    #!/bin/bash
    
    while ! adb devices | grep -q "device$"; do
        sleep 2
    done
    
    VIDEO_OPTS=(
      --video-codec=h265
      --video-bit-rate=10M
      --max-fps=60
      --stay-awake
      --disable-screensaver
    )
    
    # 1. Home Assistant (portrait virtual)
    scrcpy "${VIDEO_OPTS[@]}" \
      --new-display=1080x1920 \
      --start-app=io.homeassistant.companion.android \
      --no-audio \
      --no-vd-system-decorations \
      --window-title="Home Assistant" &
    
    # 2. Main phone screen
    scrcpy "${VIDEO_OPTS[@]}" \
      --audio-bit-rate=192K \
      --turn-screen-off \
      --power-off-on-close \
      --window-title="Note20 Main" &
    
    # 3. Jellyfin (landscape virtual)
    scrcpy "${VIDEO_OPTS[@]}" \
      --new-display=1920x1080 \
      --start-app=org.jellyfin.mobile \
      --no-audio \
      --no-vd-system-decorations \
      --window-title="Jellyfin" &
    
    wait
  • Fedora Linux Cheatsheet

    Fedora Linux Cheatsheet

    Essential commands for installation, package management, system administration, and troubleshooting
    Uses dnf (primary) and flatpak/rpm-ostree (for Silverblue/Atomic). All privileged commands require sudo.


    1. Installation (Live USB / Anaconda)

    TaskCommand / Action
    Boot live ISOSelect “Start Fedora-Workstation”
    Launch installerClick “Install to Hard Drive”
    Disk partitioningUse Blivet-GUI or manual (/boot/efi, /, swap)
    Post-install (first boot)Complete user setup via GNOME Initial Setup
    Manual install (netinstall)Boot netinstall ISO → dnf install @base-x (or minimal)
    Enable RPM Fusion (Free & Nonfree)sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
    sudo dnf install https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
    Update systemsudo dnf upgrade --refresh

    2. DNF (Package Management)

    ActionCommand
    Update systemsudo dnf upgrade --refresh
    Install packagesudo dnf install package
    Remove packagesudo dnf remove package
    Search packagednf search keyword
    List installeddnf list installed
    Autoremove unusedsudo dnf autoremove
    Clean cachesudo dnf clean all
    View package infodnf info package
    List files in packagerpm -ql package
    Which package owns filednf provides /path/to/file
    Enable COPR reposudo dnf copr enable user/repo
    History (undo/redo)dnf history
    sudo dnf history undo ID

    Flatpak (GUI & CLI)
    flatpak install flathub org.mozilla.firefox
    flatpak update
    flatpak uninstall package


    3. System Administration (systemd)

    TaskCommand
    List servicessystemctl list-unit-files --type=service
    Enable servicesudo systemctl enable service
    Start servicesudo systemctl start service
    Statussystemctl status service
    View logsjournalctl -u service
    Rebootreboot
    Shutdownpoweroff
    View kernel messagesdmesg | less
    Disk usagedf -h
    Memoryfree -h
    Processeshtop or top
    Kill processkill PID or pkill name

    4. Users & Permissions

    ActionCommand
    Add usersudo useradd -m username
    Set passwordsudo passwd username
    Add to wheel (sudo)sudo usermod -aG wheel username
    Change ownersudo chown user:group file
    Change permissionschmod 755 file

    5. Networking

    TaskCommand
    Check IPip a or nmcli device show
    List Wi-Finmcli device wifi list
    Connect Wi-Finmcli device wifi connect SSID password "pass"
    Restart NetworkManagersudo systemctl restart NetworkManager
    Check DNScat /etc/resolv.conf
    Firewall (firewalld)sudo firewall-cmd --list-all
    sudo firewall-cmd --add-service=http --permanent

    6. Filesystem & Storage

    TaskCommand
    Mount USBsudo mount /dev/sdb1 /mnt/usb
    Unmountumount /mnt/usb
    Format ext4sudo mkfs.ext4 /dev/sdX1
    Check disksudo fsck /dev/sdX1
    Find large filesdu -ah / | sort -rh | head -n 20
    Search filesfind / -name "filename" 2>/dev/null

    7. Fedora Variants

    Fedora Silverblue / Kinoite (Immutable)

    TaskCommand
    Rebase to new versionrpm-ostree upgrade
    rpm-ostree rebase fedora:fedora/40/x86_64/silverblue
    Layer packagerpm-ostree install package
    Remove layeredrpm-ostree override remove package
    Rollbackrpm-ostree rollback
    Check statusrpm-ostree status
    Boot into previousSelect from GRUB

    Toolbox (containerized dev)
    toolbox create
    toolbox enter


    8. Troubleshooting

    IssueCommand
    Boot to recoveryGRUB → e → add systemd.unit=rescue.target → Ctrl+X
    Fix broken depssudo dnf distro-sync
    Reinstall all packagessudo dnf reinstall $(dnf list installed | awk '{print $1}')
    Clear journalsudo journalctl --vacuum-time=2weeks
    Boot errorsjournalctl -b -p err
    Regenerate initramfssudo dracut -f
    Update GRUBsudo grub2-mkconfig -o /boot/grub2/grub.cfg (BIOS)
    sudo grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg (UEFI)

    9. Useful Tools to Install

    sudo dnf install vim htop git curl wget unzip tree dnf-automatic firewall-config

    10. One-Liners

    # Full update + clean
    sudo dnf upgrade --refresh && sudo dnf autoremove && sudo dnf clean all
    
    # Enable fastest mirrors
    sudo dnf install dnf-plugins-core
    sudo dnf config-manager --set-enabled fedora-cisco-openh264
    echo "fastestmirror=True" | sudo tee -a /etc/dnf/dnf.conf
    
    # Show orphan packages
    dnf leaves
    
    # Update Flatpaks
    flatpak update
    
    # Rebase Silverblue to latest
    rpm-ostree update && reboot

    11. Fedora Docs & Resources

    Official Docs: https://docs.fedoraproject.org
    Ask Fedora: https://ask.fedoraproject.org

    # Install offline docs
    sudo dnf install fedora-docs

    12. Quick Install Scripts

    # Post-install script (Workstation)
    sudo dnf install https://rpmfusion.org/... (both repos)
    sudo dnf upgrade --refresh
    sudo dnf install vim htop git @development-tools

    Pro Tip: Use gnome-software or dnfdragora for GUI package management.
    For immutability: Silverblue + Toolbox + Flatpak = future-proof desktop