Skip to content

Conversation

@SunilSherkhane
Copy link
Contributor

@SunilSherkhane SunilSherkhane commented Dec 2, 2025

Remove the old package and updated the plasma.sh wby adding polkit and bios based time on liveuser mode.

Summary by Sourcery

Update Plasma live environment configuration to use LightDM with a KDE greeter, Wayland sessions, and improved system defaults for time, device access, and resource limits.

Enhancements:

  • Replace SDDM configuration with LightDM and a KDE greeter setup tailored for the Plasma live session.
  • Configure xinit for Plasma Wayland sessions with default US keyboard and Caps/Ctrl swap for the live user, root, and skeleton profiles.
  • Set system time handling to use UTC with BIOS-based time and enable NTP/ntpdate synchronization in rc.conf.
  • Tune sysctl defaults for local stream buffer sizes and allow user mounts via vfs.usermount.
  • Configure devfs rules and polkit policies to allow wheel users to mount disk devices in the live environment.

Chores:

  • Adjust rc.conf to include NTP server configuration for the display manager and remove the old Plasma package configuration file.

@SunilSherkhane SunilSherkhane requested review from a team as code owners December 2, 2025 13:59
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Dec 2, 2025

Reviewer's Guide

Replaces SDDM-specific setup with LightDM configuration, adds BIOS/UTC-based time and NTP configuration for live systems, tunes Plasma-related system settings (sysctl, xinit, devfs), and introduces polkit rules for mounting as wheel users while wiring all new setup routines into the plasma image build.

Sequence diagram for live session login and privileged mount via LightDM and polkit

sequenceDiagram
    actor User
    participant LiveSystem as Live_system
    participant LightDM as LightDM_display_manager
    participant Greeter as Lightdm_kde_greeter
    participant Plasma as KDE_Plasma_session
    participant Polkit as polkitd
    participant Udisks as udisks2
    participant Kernel as Kernel_devfs

    User->>LiveSystem: Power_on_live_image
    LiveSystem->>Kernel: Initialize_kernel_and_devfs_rules
    Kernel-->>LiveSystem: Devfs_rules_applied_for_da_devices

    LiveSystem->>LightDM: Start_display_manager
    LightDM->>Greeter: Start_kde_greeter_session

    User->>Greeter: Enter_liveuser_credentials
    Greeter->>LightDM: Authenticate_liveuser
    LightDM-->>LiveSystem: Start_plasma_session_for_liveuser
    LiveSystem->>Plasma: Exec_startplasma_wayland_via_xinitrc

    User->>Plasma: Open_file_manager_and_click_mount_disk
    Plasma->>Udisks: Request_mount_da_device
    Udisks->>Polkit: Check_authorization_for_mount_action
    Polkit-->>Udisks: Allow_mount_for_wheel_user_per_10_mount_rules
    Udisks-->>Kernel: Mount_filesystem
    Kernel-->>Plasma: Device_mounted
    Plasma-->>User: Mounted_volume_available_in_session
Loading

Flow diagram for plasma.sh setup routines in image build

flowchart TD
    A[start_plasma_sh] --> B[load_common_finalize_and_setuser]
    B --> C[patch_etc_files]
    C --> D[patch_loader_conf_d]
    D --> E[community_setup_liveuser]
    E --> F[community_setup_autologin]
    F --> G[configure_devfs]
    G --> H[update_rcconf_dm_add_ntpdate_hosts]
    H --> I[lightdm_setup_configure_lightdm_conf]
    I --> J[lightdm_kde_greeter_conf_enable_kde_greeter]
    J --> K[set_localtime_from_bios_link_UTC_and_enable_ntpd]
    K --> L[plasma_settings_tune_sysctl_and_usermount]
    L --> M[setup_polkit_rules_allow_mount_for_wheel]
    M --> N[setup_xinit_disable_lock_screen_set_keyboard_start_plasma_wayland]
    N --> O[final_setup]
    O --> P[end_plasma_sh]
Loading

File-Level Changes

Change Details Files
Switch from SDDM to LightDM (with KDE greeter) and adjust Plasma session startup to Wayland with keyboard defaults.
  • Remove the sddm_setup function and all SDDM configuration logic
  • Add lightdm_setup to configure greeter-session to slick-greeter and user-session to plasma in lightdm.conf
  • Add lightdm_kde_greeter_conf to force greeter-session=lightdm-kde-greeter via a drop-in config
  • Update setup_xinit to configure .xinitrc for live_user, root, and skel to set US layout, swap Ctrl/Caps, and start Plasma via dbus-launch and ck-launch-session with Wayland
desktop_config/plasma.sh
Configure time and NTP behavior based on BIOS/UTC and ensure NTP services are enabled for the live system.
  • Add update_rcconf_dm to append ntpdate_hosts to rc.conf
  • Add set_localtime_from_bios to point /etc/localtime to UTC zoneinfo, clean conflicting ntpd/local_unbound rc.conf entries, and enable ntpd, NTP sync on start, and ntpdate
desktop_config/plasma.sh
Tune system and device access settings (sysctl, devfs) for Plasma live environment and allow mounting via polkit for wheel users.
  • Add plasma_settings to set stream buffer sizes and vfs.usermount in sysctl.conf
  • Add configure_devfs to define a local devfs ruleset that makes da* devices world-writable and sets devfs_system_ruleset in rc.conf
  • Add setup_polkit_rules to create a polkit rule that permits wheel users to perform UDisks2 filesystem mounts
desktop_config/plasma.sh
Wire new setup routines into the Plasma build pipeline replacing the old SDDM setup step.
  • Replace sddm_setup invocation with calls to configure_devfs, update_rcconf_dm, lightdm_setup, lightdm_kde_greeter_conf, set_localtime_from_bios, plasma_settings, and setup_polkit_rules in the main execution sequence
desktop_config/plasma.sh

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there - I've reviewed your changes - here's some feedback:

  • Several helpers like update_rcconf_dm, plasma_settings, and configure_devfs always append to config files without checking for existing lines, which can lead to duplicated settings on repeated runs; consider using sed/grep or idempotent patterns similar to other parts of the script.
  • In lightdm_setup you assume /usr/local/etc/lightdm/lightdm.conf exists and contains commented greeter-session/user-session lines; it would be safer to create the file or append appropriate sections if they are missing to avoid sed failing or leaving LightDM misconfigured.
  • The skeleton .xinitrc path changed from dot.xinitrc to .xinitrc; if existing tooling expects the old dot.xinitrc name, this may break user skeleton population, so please confirm the name change is intentional or keep compatibility with both.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Several helpers like `update_rcconf_dm`, `plasma_settings`, and `configure_devfs` always append to config files without checking for existing lines, which can lead to duplicated settings on repeated runs; consider using `sed`/`grep` or idempotent patterns similar to other parts of the script.
- In `lightdm_setup` you assume `/usr/local/etc/lightdm/lightdm.conf` exists and contains commented `greeter-session`/`user-session` lines; it would be safer to create the file or append appropriate sections if they are missing to avoid `sed` failing or leaving LightDM misconfigured.
- The skeleton `.xinitrc` path changed from `dot.xinitrc` to `.xinitrc`; if existing tooling expects the old `dot.xinitrc` name, this may break user skeleton population, so please confirm the name change is intentional or keep compatibility with both.

## Individual Comments

### Comment 1
<location> `desktop_config/plasma.sh:18-27` </location>
<code_context>
+
+lightdm_setup() {
+  lightdm_conf="${release}/usr/local/etc/lightdm/lightdm.conf"
+  sed -i '' "s@#greeter-session=.*@greeter-session=slick-greeter@" "${lightdm_conf}"
+  sed -i '' "s@#user-session=default@user-session=plasma@" "${lightdm_conf}"
+}
+
+# ADD: Enable KDE Greeter
+lightdm_kde_greeter_conf() {
+  mkdir -p "${release}/usr/local/etc/lightdm/lightdm.conf.d"
+  cat <<EOF > "${release}/usr/local/etc/lightdm/lightdm.conf.d/50-myconfig.conf"
+[Seat:*]
+greeter-session=lightdm-kde-greeter
 EOF
-  else
</code_context>

<issue_to_address>
**issue (bug_risk):** The LightDM greeter is configured twice with potentially conflicting values.

`lightdm_setup` sets `greeter-session=slick-greeter` in `lightdm.conf`, while `lightdm_kde_greeter_conf` sets `greeter-session=lightdm-kde-greeter` in a drop-in. This double configuration can be confusing and may behave differently if merge/precedence changes. If the goal is to always use the KDE greeter, either remove the `slick-greeter` change or conditionally apply one of these settings so they can’t conflict.
</issue_to_address>

### Comment 2
<location> `desktop_config/plasma.sh:85-91` </location>
<code_context>
+
+}
+
+configure_devfs() {
+  devfs_rules="${release}/etc/devfs.rules"
+  rc_conf="${release}/etc/rc.conf"
+
+  echo '[localrules=10]' >> "${devfs_rules}"
+  echo "add path 'da*' mode 0666 group operator" >> "${devfs_rules}"
+  echo 'devfs_system_ruleset="localrules"' >> "${rc_conf}"
+}
+
</code_context>

<issue_to_address>
**issue (bug_risk):** configure_devfs always appends rules, which can lead to duplicate or conflicting devfs configuration.

Because it always appends, rerunning this script or running it on an image that already has these entries can produce duplicate `[localrules=10]` sections and multiple `devfs_system_ruleset` lines, making the final configuration unpredictable. Please guard these writes by checking whether the entries already exist (e.g., `grep -q` before appending) or by updating existing lines with `sed` instead of blindly appending.
</issue_to_address>

### Comment 3
<location> `desktop_config/plasma.sh:55` </location>
<code_context>
+
+  echo 'net.local.stream.recvspace=65536' >> "${sysctl_conf}"
+  echo 'net.local.stream.sendspace=65536' >> "${sysctl_conf}"
+  echo 'vfs.usermount=1' >> "${sysctl_conf}"
 }

</code_context>

<issue_to_address>
**suggestion (bug_risk):** Appending vfs.usermount may create multiple conflicting entries in sysctl.conf.

You’re removing existing `net.local.stream.*` entries but not any existing `vfs.usermount` line before appending a new one. If the base system or a prior run already set `vfs.usermount`, you can end up with conflicting entries whose effect depends on load order. Consider first deleting any existing `^vfs.usermount` line (as you do for `net.local.*`) and then appending the desired value to keep the config deterministic.

Suggested implementation:

```
  sed -i '' '/^net.local.stream.recvspace/d' "${sysctl_conf}" 2>/dev/null || true
  sed -i '' '/^net.local.stream.sendspace/d' "${sysctl_conf}" 2>/dev/null || true
  sed -i '' '/^vfs.usermount/d' "${sysctl_conf}" 2>/dev/null || true

```

```
  echo 'net.local.stream.recvspace=65536' >> "${sysctl_conf}"
  echo 'net.local.stream.sendspace=65536' >> "${sysctl_conf}"
  echo 'vfs.usermount=1' >> "${sysctl_conf}"

```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +18 to +27
sed -i '' "s@#greeter-session=.*@greeter-session=slick-greeter@" "${lightdm_conf}"
sed -i '' "s@#user-session=default@user-session=plasma@" "${lightdm_conf}"
}

# ADD: Enable KDE Greeter
lightdm_kde_greeter_conf() {
mkdir -p "${release}/usr/local/etc/lightdm/lightdm.conf.d"
cat <<EOF > "${release}/usr/local/etc/lightdm/lightdm.conf.d/50-myconfig.conf"
[Seat:*]
greeter-session=lightdm-kde-greeter
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): The LightDM greeter is configured twice with potentially conflicting values.

lightdm_setup sets greeter-session=slick-greeter in lightdm.conf, while lightdm_kde_greeter_conf sets greeter-session=lightdm-kde-greeter in a drop-in. This double configuration can be confusing and may behave differently if merge/precedence changes. If the goal is to always use the KDE greeter, either remove the slick-greeter change or conditionally apply one of these settings so they can’t conflict.

Copy link
Member

@ericbsd ericbsd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ericbsd ericbsd merged commit 0302dc8 into ghostbsd:master Dec 2, 2025
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

2 participants