Xfce Forum

Sub domains
 

You are not logged in.

#1 2025-05-18 21:42:46

jakfish
Member
Registered: 2019-12-23
Posts: 58
Windows 10Chrome 136.0

Need to Insert a Command for Fixing Lid Close Suspend

Using a P8, a GPD P3 wannabe, in both Manjaro and Linux Mint xfce, suspend by lid-close works, but upon resume, the USB drive letter always changes in Wine and sometimes changes from sdb1 to sdc1 in native linux. Weirdly, this drive-changing does not present in a timed or menu-chosen suspend.

I've discovered that if I:

sudo umount /mnt/P8

BEFORE closing the lid, I can remount the usb drive after resume from lid-suspend and the original drive-lettering remains intact.

Is it possible to add this command to the lid-close suspend procedure? I'm not certain which xfce command suspends on lid close or if it uses a script in which I can insert the umount command.

Ideally, I'd like the script to remount the usb drive upon resume, but that can be keystroked.

Much obliged for any suggestions.

Offline

#2 2025-05-19 01:37:35

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,993
LinuxFirefox 138.0

Re: Need to Insert a Command for Fixing Lid Close Suspend


Mark solved threads as [SOLVED] to make it easier for others to find solutions.
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#3 2025-05-19 01:52:41

jakfish
Member
Registered: 2019-12-23
Posts: 58
Windows 10Chrome 136.0

Re: Need to Insert a Command for Fixing Lid Close Suspend

Hey ToZ, thanks for weighing in.

I don't know sleep hooks, but looking over the examples in the site you cite, would I crib from this line:

ExecStartPre= -/usr/bin/pkill -u %u unison ; /usr/local/bin/music.sh stop

to something like:

ExecStartPre= sudo umount /mnt/P8

?

Offline

#4 2025-05-19 11:07:00

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,993
LinuxFirefox 138.0

Re: Need to Insert a Command for Fixing Lid Close Suspend

Try the example if 5.2 first. Create the file /usr/lib/systemd/system-sleep/usb.sh with the following content:

#!/bin/sh
case $1/$2 in
  pre/*)
    echo "Going to $2..."
    umount /mnt/P8
    ;;
  post/*)
    echo "Waking up from $2..."
    # put the mount command in here
    ;;
esac

...and make it executable.

1. Make sure you add your mount command in the script in the post section.
2. No sudo is needed because the script is run as root.
3. I'm assuming you are using systemd.


Mark solved threads as [SOLVED] to make it easier for others to find solutions.
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#5 2025-05-19 15:30:57

jakfish
Member
Registered: 2019-12-23
Posts: 58
Windows 10Chrome 136.0

Re: Need to Insert a Command for Fixing Lid Close Suspend

ToZ, that works, but only until the P8 decides to change the usb drive from sdb1 to sdc1. The good news: your modified script is a success (I had to insert a sleep command):

#!/bin/sh
case $1/$2 in
  pre/*)
    echo "Going to $2..."
    umount /mnt/P8
    ;;
  post/*)
    echo "Waking up from $2..."
    # put the mount command in here
     sleep 2
     mount /mnt/P8
    ;;
esac

But occasionally, and only from a resume-from-lid-suspend, sdb1 is changed to sdc1. I've tried a variety of fstab persistence:

/dev/disk/by-id/usb-SanDisk_Cruzer_Fit_4C530001050411101370-0:0-part1 /mnt/P8 vfat defaults,nofail,user

But once it changes to sdc1, I can't get it back to sdb1 unless I reboot. Mounting/remounting via by-id still results in sdc1

Ideally, in /dev, links could be set up so that sdb1 and sdc1 are the same media, but the links are not persistent, and delete themselves depending on the /dev presence of sdb1 or sdc1

I can set up Wine, etc for either sdb1 or sdc1, their appellation doesn't matter, but their constant change does.

Last edited by jakfish (2025-05-19 15:49:34)

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.007 seconds, 7 queries executed - Memory usage: 546.01 KiB (Peak: 547.29 KiB) ]