Sunday, June 15, 2025

Getting rtcwake working on Bluefin

#!/bin/bash
# User systemd setup for auto suspend/wake on Bluefin

#Please run these two commands manually:

#1. First, create the sudo rule:
echo "$(whoami) ALL=(ALL) NOPASSWD: /usr/bin/rtcwake" | sudo tee /etc/sudoers.d/rtcwake-nopasswd
#bash
#2. Then set the correct permissions:
sudo chmod 440 /etc/sudoers.d/rtcwake-nopasswd
#bash
#After you've run those commands, we can test if passwordless sudo works:
sudo rtcwake -m show
#❯ sudo rtcwake -m show
#alarm: off

# Create user service directory

mkdir -p ~/.config/systemd/user

# Create helper script for suspend + rtcwake
mkdir -p ~/bin
cat > ~/bin/rtc-suspend.sh << 'EOF'
#!/bin/bash
# Helper script to suspend and set RTC wake time
# Usage: rtc-suspend.sh "wake_time_description"

if [ $# -ne 1 ]; then
echo "Usage: $0 'wake_time_description'"
echo "Example: $0 '15:00 today'"
exit 1
fi

wake_time="$1"
wake_timestamp=$(date -d "$wake_time" +%s)

if [ $? -ne 0 ]; then
echo "Error: Invalid time format '$wake_time'"
exit 1
fi

echo "Setting RTC wake for: $(date -d @$wake_timestamp)"

# Set the RTC wake time first (before suspend)
sudo rtcwake -m no -t $wake_timestamp

if [ $? -eq 0 ]; then
echo "RTC wake time set successfully"
# Small delay then suspend
sleep 2
systemctl suspend
else
echo "Error: Failed to set RTC wake time"
exit 1
fi
EOF

chmod +x ~/bin/rtc-suspend.sh

# Create the morning suspend service (9 AM - 3 PM)
cat > ~/.config/systemd/user/morning-suspend.service << 'EOF'
[Unit]
Description=Suspend system at 9 AM until 3 PM
After=graphical-session.target

[Service]
Type=oneshot
Environment=PATH=/usr/local/bin:/usr/bin:/bin:%h/bin
ExecStart=%h/bin/rtc-suspend.sh "15:00 today"
Restart=no

[Install]
WantedBy=default.target
EOF

# Create the evening suspend service (9 PM - 5 AM)
cat > ~/.config/systemd/user/evening-suspend.service << 'EOF'
[Unit]
Description=Suspend system at 9 PM until 5 AM tomorrow
After=graphical-session.target

[Service]
Type=oneshot
Environment=PATH=/usr/local/bin:/usr/bin:/bin:%h/bin
ExecStart=%h/bin/rtc-suspend.sh "05:00 tomorrow"
Restart=no

[Install]
WantedBy=default.target
EOF

# Create timer for 9 AM suspend
cat > ~/.config/systemd/user/morning-suspend.timer << 'EOF'
[Unit]
Description=Trigger morning suspend at 9 AM
Requires=morning-suspend.service

[Timer]
OnCalendar=*-*-* 09:00:00
Persistent=true
AccuracySec=1min

[Install]
WantedBy=timers.target
EOF

# Create timer for 9 PM suspend
cat > ~/.config/systemd/user/evening-suspend.timer << 'EOF'
[Unit]
Description=Trigger evening suspend at 9 PM
Requires=evening-suspend.service

[Timer]
OnCalendar=*-*-* 21:00:00
Persistent=true
AccuracySec=1min

[Install]
WantedBy=timers.target
EOF

echo "Setting up user systemd services..."

# Reload user systemd daemon
systemctl --user daemon-reload

# Enable the services
systemctl --user enable morning-suspend.timer
systemctl --user enable evening-suspend.timer
#systemctl --user enable wake-notification.service

# Start the timers
systemctl --user start morning-suspend.timer
systemctl --user start evening-suspend.timer

# Enable lingering so services run when not logged in
sudo loginctl enable-linger $USER

echo ""
echo "=== SETUP COMPLETE ==="
echo ""
echo "Your system will now:"
echo " • Suspend at 9:00 AM and wake at 3:00 PM"
echo " • Suspend at 9:00 PM and wake at 5:00 AM"
echo ""
echo "Active hours:"
echo " • 5:00 AM - 9:00 AM (4 hours)"
echo " • 3:00 PM - 9:00 PM (6 hours)"
echo ""
echo "=== TESTING ==="
echo "Test your RTC wake capability first:"
echo " sudo rtcwake -m mem -s 30 # 30-second test"
echo ""
echo "Test the helper script:"
echo " ~/bin/rtc-suspend.sh '$(date -d '+2 minutes' +'%H:%M today')'"
echo ""
echo "=== MONITORING ==="
echo "Check timer status:"
echo " systemctl --user list-timers"
echo ""
echo "View service logs:"
echo " journalctl --user -u morning-suspend.service"
echo " journalctl --user -u evening-suspend.service"
echo ""
echo "=== CONTROL ==="
echo "Disable (stop automatic suspend):"
echo " systemctl --user stop morning-suspend.timer evening-suspend.timer"
echo " systemctl --user disable morning-suspend.timer evening-suspend.timer"
echo ""
echo "Re-enable:"
echo " systemctl --user enable morning-suspend.timer evening-suspend.timer"
echo " systemctl --user start morning-suspend.timer evening-suspend.timer"
echo ""
echo "=== TROUBLESHOOTING ==="
echo "If suspend doesn't work, check:"
echo " 1. Your user can suspend: 'systemctl suspend'"
echo " 2. RTC wake works: 'sudo rtcwake -m mem -s 30'"
echo " 3. User lingering is enabled: 'loginctl show-user $USER'"
echo ""
echo "Common issues on Bluefin:"
echo " • May need to add user to 'wheel' group for suspend permissions"
echo " • Some hardware doesn't support RTC wake from suspend"
echo " • Check BIOS/UEFI settings for wake-on-RTC support"



Monday, June 2, 2025

Export existing distrobox environment to another machine

 

On the Source Machine (Exporting)

see also: https://www.perplexity.ai/search/detailed-instructions-on-how-t-g5vpRZiUSx6L6aE6fk.5og#0

1. List Your Distroboxes

First, identify which distrobox you want to export:

bash
distrobox list

2. Stop the Distrobox

Stop the container you want to export (replace mydevbox with your container name):

bash
distrobox stop mydevbox

3. Export the Container

Use podman to export the container as a tar archive:

bash
podman export mydevbox > mydevbox-export.tar

4. Save the Distrobox Configuration

Export the distrobox configuration to recreate it with the same settings:

bash
distrobox generate-entry mydevbox > mydevbox-config.desktop

Alternatively, note down the original creation command. You can find this information with:

bash
podman inspect mydevbox | grep -A 20 "Labels"

Transferring Files

Transfer both files to your target machine using your preferred method:

Via SCP:

bash
scp mydevbox-export.tar mydevbox-config.desktop user@target-machine:~/

Via USB drive, network share, or cloud storage: Simply copy both files to your transfer medium.

On the Target Machine (Importing)

1. Import the Container Image

Import the tar file as a new container image:

bash
podman import mydevbox-export.tar mydevbox:latest

2. Recreate the Distrobox

Create a new distrobox using the imported image. If you have the original creation command, use that. Otherwise, create it with basic settings:

bash
distrobox create --name mydevbox --image mydevbox:latest

If you need specific options (like additional volumes, environment variables, etc.), add them:

bash
distrobox create --name mydevbox --image mydevbox:latest \
  --additional-packages "package1 package2" \
  --volume /host/path:/container/path \
  --nvidia  # if you need GPU access

3. Enter and Verify

Enter the distrobox to verify everything transferred correctly:

bash
distrobox enter mydevbox

Check that your development tools, configurations, and files are present.

Alternative Method: Using Distrobox Assemble

For a more automated approach, you can create an assemble configuration file:

1. Create a Configuration File

On the source machine, create a YAML file describing your setup:

yaml
# mydevbox-assemble.yml
container_name: mydevbox
image: registry.fedoraproject.org/fedora-toolbox:38
additional_packages:
  - git
  - nodejs
  - python3-pip
  - vim
init_hooks:
  - "pip install --user some-package"
  - "npm install -g some-global-package"

2. Transfer and Apply

Transfer this file to the target machine and run:

bash
distrobox assemble create --file mydevbox-assemble.yml

Important Notes

  • Home Directory Integration: Distrobox automatically mounts your home directory, so personal files and configs in ~/ will be available immediately on the new machine.
  • Host Integration: Applications installed in the distrobox and integrated with the host (using distrobox-export) will need to be re-exported on the new machine.
  • System Dependencies: Ensure both machines have the same version of distrobox and podman for best compatibility.
  • Storage Space: The exported tar file can be quite large depending on your container's contents. Clean up unnecessary files before export if space is a concern.

This method preserves your entire development environment including installed packages, configurations, and any custom setups within the container.

Thursday, May 29, 2025

Bluefin + Blue Build Custom Atomic


 

 

Dev environment: https://docs.projectbluefin.io/bluefin-dx 

Terminal setup: https://docs.projectbluefin.io/command-line/

Rebasing: https://docs.projectbluefin.io/administration/

 

Custom Images:   

images for NVIDIA and non-NVIDIA at: https://github.com/whelanh/myBluefin

 

OneDrive: 

brew install onedrive
# type onedrive to register/connect with your MSft OneDrive account 
brew services start onedrive 


Tailscale:
 
brew install tailscale
tailscale up --ssh # flag permits ssh access
tailscale ssh <
tailscale node name>

 

Kmymoney: need prefix to disable video acceleration: 

QMLSCENE_DEVICE=softwarecontext QT_OPENGL=software kmymoney (last could be flatpak run org.kde.mymoney)


 

Toolbox (good pattern: use to compile Stockfish...but can now do in custom image):

toolbox create
toolbox enter
sudo dnf groupinstall "Development Tools" 
sudo dnf in gcc-c++ 

Cron Replacement: https://fedoramagazine.org/systemd-timers-for-scheduling-tasks/ 

systemctl --user stop schedule-test.timer 
systemctl --user disable schedule-test.timer 
systemctl --user stop schedule-test.service 
systemctl --user disable schedule-test.service 
systemctl --user daemon-reload 
systemctl --user reset-failed


systemctl --user enable schedule-test.service
systemctl --user enable schedule-stockfish.service 
 
systemctl --user enable schedule-test.timer
systemctl --user enable schedule-test-two.timer
systemctl --user enable schedule-stockfish.timer

systemctl --user start schedule-test.timer
systemctl --user start schedule-test-two.timer
systemctl --user start schedule-stockfish.timer

systemctl --user status schedule-test 

systemctl --user list-unit-files

Pycharm:

Download the Jetbrains toolbox: JetBrains Toolbox App: Manage Your Tools with Ease (already installed with Bluefin-dx....just run it)

Untar it and run the command, that will install a helper app for you that will let you install PyCharm. It will also download and configure all the python things you need via virtual environments, or conda, etc. There’s no need to mess with system stuff for this, the pycharm toolbox keeps everything in your home directory so it’s nice and neat.

Rebase:
rpm-ostree rebase ostree-image-signed:docker://ghcr.io/ublue-os/bluefin-dx:stable-daily

rpm-ostree rebase ostree-image-signed:docker://ghcr.io/ublue-os/bluefin-dx-nvidia-open:stable-daily

 

To update all distrobox apps:
distrobox upgrade --all

Rstudio (now part of my custom image):
create a distrobox environment as above, enter it, and then:

sudo dnf copr enable iucar/rstudio # enables this repo 
sudo dnf install R rstudio-desktop # for RStudio Desktop
 

Chezmoi (for managing dotfiles): 


Compile program and create desktop icon:
# Clone the repository
git clone https://github.com/your-repo/your-project.git
cd your-project

# Create a distrobox (e.g., Fedora)
distrobox create -n fedora-dev -i fedora:latest

# Enter the distrobox
distrobox enter fedora-dev

# Install dependencies (inside the distrobox)
sudo dnf install gcc make gcc-c++

# Compile the code (inside the distrobox)
make

# Run the program (inside the distrobox)
./your-program
 
Create Desktop file for gui compiled in distrobox (put in .local/share/applications folder):
[Desktop Entry] Type=Application Version=1.0 Name=VSCode (Distrobox) Comment=Code Editing. Redefined. Exec=sh -c 'distrobox enter ubuntu-23-04 -- code' GenericName=Text Editor Icon=com.visualstudio.code Keywords=vscode; Categories=TextEditor;Development;IDE; Terminal=false StartupNotify=true


Saturday, May 17, 2025

Cosmic Desktop

 Auto Login

edit /etc/greetd/cosmic-greeter.toml as follows:
 
[general]
service = "login"
#service = "cosmic-greeter"

[default_session]
command = "cosmic-comp systemd-cat -t cosmic-greeter cosmic-greeter"
user = "hugh"
#user = "cosmic-greeter"

# hugh added below
[initial_session]
command = "cosmic-session"
user = "hugh"


 See what's using RAM

 ps aux  | awk '{print $6/1024 " MB\t\t" $11}'  | sort -n    

Wednesday, May 14, 2025

Optimizing JaKooLit Fedora-Hyprland Files To Reduce Power Consumption/Heat

 

Specific Optimization Instructions for Hyprland

I noticed using the JaKooLit dot files that my idle temperature was about 3 degrees warmer than just using Fedora Workstation Gnome DE.  I implemented the recommendations of Claude AI below and got idle temps back to within a degree of Gnome.

1. First, Disable Rainbow Borders (Highest Impact)

Edit ~/.config/hypr/UserConfigs/Startup_Apps.conf:

 

# Find this line:
exec-once = $UserScripts/RainbowBorders.sh

# Comment it out by adding # at the beginning:
# exec-once = $UserScripts/RainbowBorders.sh


2. Optimize Decorations (High Impact)

Replace the content in ~/.config/hypr/UserConfigs/UserDecorations.conf with:

# Decoration Settings
# Hyprland Wiki Links
# Animation - https://wiki.hyprland.org/Configuring/Animations/
# Decoration - https://wiki.hyprland.org/Configuring/Variables/#decoration
# Sourcing colors generated by wallust
source = $HOME/.config/hypr/wallust/wallust-hyprland.conf

general {
border_size = 2
gaps_in = 2
gaps_out = 4

col.active_border = $color12
col.inactive_border = $color10
}

decoration {
rounding = 10

active_opacity = 1.0
inactive_opacity = 1.0 # Changed from 0.9 to 1.0 (removes transparency)
fullscreen_opacity = 1.0
dim_inactive = false # Changed from true to false
dim_strength = 0.1 # Keep this in case you want to re-enable dim_inactive later
dim_special = 0.8

shadow {
enabled = false # Changed from true to false
range = 3
render_power = 1
color = $color12
color_inactive = $color10
}

blur {
enabled = false # Changed from true to false
# Below settings kept for reference if you want to re-enable blur with lightweight settings
size = 3 # Reduced from 6 to 3
passes = 1 # Reduced from 2 to 1
ignore_opacity = true
new_optimizations = true
special = true
popups = true
}
}

group {
col.border_active = $color15
groupbar {
col.active = $color0
}
}

3. Optimize Animations (Medium-High Impact)

Replace the content in ~/.config/hypr/UserConfigs/UserAnimations.conf with:

# /* ---- Optimized for lower system temperature ---- */
animations {
enabled = true

# Simpler bezier curve
bezier = simpleEase, 0.25, 0.1, 0.25, 1.0

# Reduced animation duration and complexity
animation = windows, 1, 4, simpleEase
animation = windowsIn, 1, 4, simpleEase
animation = windowsOut, 1, 4, simpleEase
animation = windowsMove, 1, 4, simpleEase
animation = border, 0, 1, default # Minimal/disabled
animation = borderangle, 0, 1, default # Minimal/disabled
animation = fade, 1, 5, default # Reduced duration
animation = workspaces, 1, 4, simpleEase
}

 

4. Optimize Startup Apps (Medium Impact)

# Commands and Apps to be executed at launch
$scriptsDir = $HOME/.config/hypr/scripts
$UserScripts = $HOME/.config/hypr/UserScripts
$wallDIR=$HOME/Pictures/wallpapers
$lock = $scriptsDir/LockScreen.sh
$SwwwRandom = $UserScripts/WallpaperAutoChange.sh
$livewallpaper=""

# wallpaper stuff - Static wallpaper instead of daemon
exec-once = swww init && swww img $HOME/Pictures/wallpapers/your-favorite-wallpaper.jpg

# Startup essentials
exec-once = dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
exec-once = systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
exec-once = $scriptsDir/Polkit.sh
exec-once = nm-applet --indicator
exec-once = swaync
# exec-once = ags # Commented out unless you specifically need it

# Only enable what you regularly use
exec-once = blueman-applet # Only if you use Bluetooth regularly
exec-once = insync start # Only if you need cloud sync continuously
exec-once = gnome-keyring-daemon --start
exec-once = waybar

# Clipboard manager - only text (more efficient)
exec-once = wl-paste --type text --watch cliphist store
# exec-once = wl-paste --type image --watch cliphist store # Commented out to save resources

# Rainbow borders - commented out to reduce CPU/GPU usage
# exec-once = $UserScripts/RainbowBorders.sh

# Starting hypridle to start hyprlock
exec-once = hypridle

# Other commented features
# exec-once = swww-daemon --format xrgb && swww img $HOME/Pictures/wallpapers/mecha-nostalgia.png
#gnome polkit for nixos
#exec-once = $scriptsDir/Polkit-NixOS.sh
#exec-once = $scriptsDir/PortalHyprland.sh


Note: For the static wallpaper, replace your-favorite-wallpaper.jpg with an actual image file in your wallpapers directory.

5. Additional Power Saving Options

Create a script to automatically set power-saving mode when using Hyprland:

  1. Create a file at ~/.config/hypr/UserScripts/PowerSave.sh


#!/bin/bash


# Reduce screen brightness slightly if applicable
if command -v brightnessctl &> /dev/null; then
current=$(brightnessctl g)
max=$(brightnessctl m)
# Set to 80% of max if over that
target=$(( max * 80 / 100 ))
if [ $current -gt $target ]; then
brightnessctl s $target
fi
fi

 

Make it executable:

chmod +x ~/.config/hypr/UserScripts/PowerSave.sh

 

  1. Add it to your startup:

Edit ~/.config/hypr/UserConfigs/Startup_Apps.conf again and add:

# Power saving
exec-once = $UserScripts/PowerSave.sh 

 

 

 


Thursday, November 7, 2024

RTL-SDR On Opensuse Tumbleweed

Notes on setting up RTL-SDR V4 in Opensuse Tumbleweed:


opi sdrpp

sudo zypper in rtl-sdr


sudo usermod -a -G rtlsdr $(whoami)  #then logout and back out


Monday, October 21, 2024

Opensuse Tumbleweed

 



https://youtu.be/ttG2NFkKPRM?si=SuAC-XRueX6k_p9g

https://youtu.be/MnlRpH9sPBM?si=HXrk69GGOfiqbQz4

https://youtu.be/KW7hzWehuDo?si=dDaPA0haS8pimA7D

zram vs suspend to disk?

Optimize mirrors:

zypper in mirrorsorcerer
sudo mirrorsorcerer -x
systemctl enable --now mirrorsorcerer 
reboot

 Edit zypp.conf:

sudo micro /etc/zypp/zypp.conf 
 
parallel downloads=5
download.min_download_speed = 20000
 
Install opi:
sudo zypper install opi
sudo zypper install -t pattern devel_basis


Install Pycharm:

sudo zypper in libgthread-2_0-0 gcc-fortran gnome-disk-utility texlive
sudo opi pycharm
sudo zypper in python3-pandas python3-suds python3-colorama python3-reportlab python3-svglib

sudo pip3 install chess --break-system-packages

sudo opi micro
 

Rstudio-desktop:

sudo zypper in R-base-devel
sudo opi rstudio-desktop

opi version is outdated, so can also download Opensuse rpm from: https://posit.co/download/rstudio-desktop/ 
then:  sudo zypper in [downloaded rpm file]
You also need to: sudo zypper in openssl-1_1
If you manually install rstudio, zypper will want to downgrade....so run sudo zypper al rstudio.....which locks the package (sudo zypper removelock rstudio to remove lock)

 sudo opi rjava (after installing java-21-openjdk-devel pcre2-devel lzma-sdk-devel libbz2-devel)

Install Insync:

sudo rpm --import https://d2t3ff60b2tol4.cloudfront.net/repomd.xml.key
sudo zypper ar -f http://yum.insync.io/opensuse-tumbleweed/rolling/ Insync
sudo zypper refresh
sudo zypper in insync

Enable dnf:

sudo zypper in dnf rpm-repos-openSUSE-Tumbleweed
 
add to /etc/dnf/dnf.conf:
fastestmirror=True
max_parallel_downloads=10
defaultyes=True

Install Flatpak:

sudo dnf in fastfetch eza dropbox flatpak fish
sudo opi fisher
flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
flatpak install sqlitebrowser
 
Install Codecs:
opi codecs
 

Right way to update:

sudo zypper refresh
sudo zypper dup --allow-vendor-change

Nvidia:

inxi -G     to see what driver is loaded

https://en.opensuse.org/SDB:NVIDIA_drivers

zypper addrepo --refresh https://download.nvidia.com/opensuse/tumbleweed NVIDIA

sudo zypper install-new-recommends --repo NVIDIA    or....

sudo zypper in nvidia-video-G06

Security Audit System:

sudo dnf in lynis && sudo lynis audit system

Virt Manager:

https://samanpavel.medium.com/kvm-vms-with-virt-manager-on-opensuse-f4370165c03d

sudo usermod -aG libvirt hugh
sudo dnf in libvirt 
sudo systemctl start libvirtd.service 
NO NEED TO CHOOSE SECURE BOOT....just use default UEFI 

Some Interesting Set up scripts including fix for Gigabyte motherboard sleep issue

https://github.com/DAK404/OpenSUSE-Setup-Scripts


OpenRGB:

To install OpenRGB with hardware access on openSUSE Tumbleweed, follow these steps:

1. Install OpenRGB from the official repositories:

```bash
sudo zypper install OpenRGB
```

2. Install the i2c-tools package, which is needed for accessing certain RGB devices:

```bash
sudo zypper install i2c-tools
```

3. Load the necessary kernel modules:

```bash
sudo modprobe i2c-dev
sudo modprobe i2c-piix4  # For AMD systems
# OR
sudo modprobe i2c-i801   # For Intel systems
```

4. To make these modules load automatically on boot, create a new file:

```bash
sudo nano /etc/modules-load.d/openrgb.conf
```

Add the following lines to the file:

```
i2c-dev
i2c-piix4  # For AMD systems
# OR
i2c-i801   # For Intel systems
```

5. Install the OpenRGB kernel patches:

```bash
sudo zypper install i2c-openrgb-kmp-default
```

6. Reboot your system to apply the changes.

7. Run OpenRGB with sudo privileges:

```bash
sudo openrgb
```

If you want to run OpenRGB without sudo, you can add your user to the i2c group:

```bash
sudo usermod -aG i2c $USER
```

Then log out and log back in for the changes to take effect.

sudo zypper ref
sudo zypper install OpenRGB
sudo zypper in i2c-tools
sudo usermod -aG i2c hugh
sudo modprobe i2c-dev
sudo modprobe i2c-piix4
cd /etc/modules-load.d/
sudo touch /etc/modules-load.d/i2c.conf
sudo sh -c 'echo "i2c-dev" >> /etc/modules-load.d/i2c.conf'
sudo sh -c 'echo "i2c-piix4" >> /etc/modules-load.d/i2c.conf'

Getting rtcwake working on Bluefin

#!/bin/bash # User systemd setup for auto suspend/wake on Bluefin #Please run these two commands manually: #1. First, create the sudo rule: ...