LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 06-15-2019, 04:38 AM   #1
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,289

Rep: Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322
Suspend irritation on all versions


I have Current atm and this minor irritation in suspend. If I have a usb drive mounted when I hit suspend, it stays mounted as sdb1. When coming back from suspend, sdb1 is already taken, so it defaults to sdc1, which actually upsets a lot of things here.

I'm even irritated to contemplate using a UUID for sdb, but if it's not force unmounted, I don't know if it will solve anything.

Any ideas, or are there realities I have to work around?
 
Old 06-15-2019, 04:41 AM   #2
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,057

Rep: Reputation: Disabled
Name it with its UUID.
 
Old 06-15-2019, 05:52 AM   #3
w1k0
Senior Member
 
Registered: May 2008
Location: Poland
Distribution: Slackware (personalized Window Maker), Mint (customized MATE)
Posts: 1,309

Rep: Reputation: 234Reputation: 234Reputation: 234
Alternatively you may use suspend script to unmount and mount the device:

suspend
Code:
#!/bin/bash

# suspend: suspends the system to RAM

# check the present virtual terminal
FGCONSOLE=`fgconsole`

# switch to virtual terminal 12
chvt 12

### umount /mnt/sdb1

/sbin/hwclock --systohc

sync

# suspend-to-ram
echo -n mem > /sys/power/state

/sbin/hwclock --hctosys

### mount /mnt/sdb1

# switch back to virtual terminal running X
chvt $FGCONSOLE
***

Well, maybe I missed something but I just suspended the system with mounted USB drive using the above script without those umount and mount commands and when I resumed it USB drive was still mounted as /dev/sdb1.

Last edited by w1k0; 06-15-2019 at 07:55 AM. Reason: maybe I missed something
 
1 members found this post helpful.
Old 06-15-2019, 12:33 PM   #4
Tonus
Senior Member
 
Registered: Jan 2007
Location: Paris, France
Distribution: Slackware-15.0
Posts: 1,405
Blog Entries: 3

Rep: Reputation: 514Reputation: 514Reputation: 514Reputation: 514Reputation: 514Reputation: 514
Suspend irritation on all versions

Just wondering : what does "hit suspend" mean?
I haven't experienced this but use dbus to hibernate (I do not suspend often), not the direct suspend with root privileges...
 
Old 06-16-2019, 04:30 AM   #5
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,289

Original Poster
Rep: Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322
Quote:
Originally Posted by Tonus View Post
Just wondering : what does "hit suspend" mean?
I haven't experienced this but use dbus to hibernate (I do not suspend often), not the direct suspend with root privileges...
Usually just hit the 'suspend' option in in XFCE. I have also used slackware's 'pm-suspend, & 'echo mem > /sys/power/state' but didn't notice either fixing the problem.
 
Old 06-16-2019, 04:47 AM   #6
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,289

Original Poster
Rep: Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322
Quote:
Originally Posted by w1k0 View Post
Alternatively you may use suspend script to unmount and mount the device:
[SNIP]
Well, maybe I missed something but I just suspended the system with mounted USB drive using the above script without those umount and mount commands and when I resumed it USB drive was still mounted as /dev/sdb1.
Very nice thank you.
I'll probably stick in an 'if' condition to check if sdb1 is actually mounted to save it spewing 'sdb1 not mounted' errors

@Didier Spaier: I was trying to figure out what the box would do when sdb1 was firmly mounted and it came across sdc1 with an identical UUID
 
Old 06-16-2019, 09:02 AM   #7
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,289

Original Poster
Rep: Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322
Actually, now that I think of it, the script has a few niggles.
  • The 'umount' command will fail if anyone has cd'ed into the drive, or if any file is open.
  • Unless I change something internally, the resume side will never run. If it does run, it will mount sdb1 as root, so my luser cannot write to it.

There's a bit more work to go in here, checks, balances
 
Old 06-16-2019, 09:51 AM   #8
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,289

Original Poster
Rep: Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322
Hey, Didier, I put that single UUID into /etc/fstab as /mnt/hd. To make a long story short, I could not mount it as anyone for love or money. 'mount /mnt/hd' failed as luser or root.

Put sdb1 back in, and everything worked.
 
Old 06-16-2019, 12:40 PM   #9
Tonus
Senior Member
 
Registered: Jan 2007
Location: Paris, France
Distribution: Slackware-15.0
Posts: 1,405
Blog Entries: 3

Rep: Reputation: 514Reputation: 514Reputation: 514Reputation: 514Reputation: 514Reputation: 514
Suspend irritation on all versions

Was it the device uuid or the partition's uuid? Made the mistake a few times here...
 
Old 06-17-2019, 04:47 AM   #10
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,289

Original Poster
Rep: Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322
Quote:
Originally Posted by Tonus View Post
Was it the device uuid or the partition's uuid? Made the mistake a few times here...
Yeah, It's ease done. I did
Code:
bash-5.0$ ls -l /dev/disk/by-uuid
total 0
lrwxrwxrwx 1 root root 10 Jun 17 10:26 28b17366-1d6e-4edf-80ae-9572932428d3 -> ../../sda6
lrwxrwxrwx 1 root root 10 Jun 17 10:26 31aa9e0e-fd75-4042-b6f6-e80eaf38c100 -> ../../sda5
lrwxrwxrwx 1 root root 10 Jun 17 10:29 348661f5-73b1-49de-bcf0-deb0d538e045 -> ../../sdb1
lrwxrwxrwx 1 root root 10 Jun 17 10:26 74d16e12-be9b-41cd-aa8f-5ca2bb28c8cc -> ../../sda3
lrwxrwxrwx 1 root root 10 Jun 17 10:29 7BFBBA3513627C8B -> ../../sdc1
lrwxrwxrwx 1 root root 10 Jun 17 10:26 82042242-a5d5-472c-92fb-ab8fc0cb7814 -> ../../sda7
lrwxrwxrwx 1 root root 10 Jun 17 10:26 b813280e-533f-49dd-8759-1677795b2e17 -> ../../sda1
lrwxrwxrwx 1 root root 10 Jun 17 10:26 f06b152f-9794-4af2-91b1-7405848c16c8 -> ../../sda2
then I copied the "348661f5-73b1-49de-bcf0-deb0d538e045" bit with the mouse and pasted it. Was that wrong? I generally avoid UUIDs for the reason that they're a PITA.
 
Old 06-17-2019, 07:52 AM   #11
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,057

Rep: Reputation: Disabled
It depends how you write the line in /etc/fstab.

For instance here:

Code:
didier[~]$ ls -l /dev/disk/by-uuid|grep /sdb3
lrwxrwxrwx 1 root root 10 Jun 17 08:34 b8d9d6ba-f993-466a-a243-04b63156485b -> ../../sdb3
didier[~]$ lsblk -l -o name,uuid|grep sdb3
sdb3 b8d9d6ba-f993-466a-a243-04b63156485b
didier[~]$ cat /etc/fstab|grep b8d9d6ba
UUID=b8d9d6ba-f993-466a-a243-04b63156485b /slint64 ext4 defaults 1 0
didier[~]$
Comments:
  • lsblk is easier to use in my opinion.
  • Here the uuid is the one of the file system. It will change if I create a new file system in the partition. So, better use parttuid instead (the UUID of the partition, not of the file system). For instance:
    Code:
    didier[/tmp]$ lsblk -l -o name,partuuid|grep sdb3
    sdb3 91ca468c-03
    didier[~]$ cat /etc/fstab |grep 91ca468c-03
    PARTUUID=91ca468c-03 /slint64 ext4 defaults 1 0
    The advantage is that if you reformat the /dev/sdb3 (without modifying the partition table) its partuuid won't change, hence no need to modify /etc/fstab.
  • As an aside, patches have been proposed to search partitions by partuuid in GRUB. Unfortunately probably too late to be applied in incoming version 2.04
 
Old 06-17-2019, 12:45 PM   #12
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,289

Original Poster
Rep: Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322
Code:
bash-5.0$ ls -l /dev/disk/by-uuid
total 0
…
lrwxrwxrwx 1 root root 10 Jun 17 16:06 348661f5-73b1-49de-bcf0-deb0d538e045 -> ../../sdb1
And in /etc/fstab
Code:
UUID=348661f5-73b1-49de-bcf0-deb0d538e045 	 /mnt/hd  	  auto	      noauto,relatime,diratime,user,exec,dev,suid,nofail     0   0
 
Old 06-20-2019, 04:29 AM   #13
jostber
Member
 
Registered: Jul 2001
Location: Skien, Norway
Distribution: Slackware Current 64-bit
Posts: 543

Rep: Reputation: 178Reputation: 178
You can make a rule for your USB port and give it a persistent name with udevadm?

http://weng-blog.com/2017/05/udev-rule/
 
Old 06-21-2019, 04:28 AM   #14
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,289

Original Poster
Rep: Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322
Quote:
Originally Posted by jostber View Post
You can make a rule for your USB port and give it a persistent name with udevadm?

http://weng-blog.com/2017/05/udev-rule/
Clever idea, and thanks for that. I read that link. It may solve the remounting half of the problem, but it doesn't get it unmounted before suspend. We also have the question of what error the system would throw on the remount of an already mounted device/uuid on an already used usb port. But permissions are fussy; I need a root force-unmount, and a user remount, so the user can write to it.

At this stage I'm convinced the user will have to change his habits. There's the guts of a working solution between the script in post #3 (un-mounting) and your idea re-mounting. Frankly, by the time I implement that, there's probably an update due anyhow. I was hoping for something simple, and it's not out there.
 
Old 06-21-2019, 06:09 AM   #15
jostber
Member
 
Registered: Jul 2001
Location: Skien, Norway
Distribution: Slackware Current 64-bit
Posts: 543

Rep: Reputation: 178Reputation: 178
A bit more risky, but possibly useful?

USB-persist:

https://www.kernel.org/doc/html/late...b/persist.html

Check also disabling USB autosuspend:

https://wiki.archlinux.org/index.php...SB_autosuspend
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] firefox/forums irritation timl Linux - General 2 03-26-2013 08:42 PM
[SOLVED] what are the other differences between fedora versions except their kernel versions teja_vijjapu Fedora 1 01-23-2012 06:38 AM
[SOLVED] Prepare firmware versions availability for current versions mufy AIX 2 01-03-2011 10:19 AM
normal versions vs LTS versions altella Ubuntu 1 11-15-2009 10:39 AM
gcc versions compatibility with kernel versions.. mahesh_manthapuri SUSE / openSUSE 1 03-22-2006 12:28 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 02:35 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration