Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[BUG?] Fstab can't automount USB disk on frist attempt
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
iNeedIT
n00b
n00b


Joined: 10 Aug 2024
Posts: 13

PostPosted: Wed Aug 14, 2024 8:43 am    Post subject: [BUG?] Fstab can't automount USB disk on frist attempt Reply with quote

Hello gentoo forum,
Like in subject, fstab can't find my usb device, and mount it.
BUT, if I restart openRC init, everything is fine. Fstab can find it, and mount.
It is very annoying to restart openRC and log in. There must be another way.
Pictures for explain -> https://imgur.com/a/gentoo-forums-RxtRlet

Code:

# BLKID OF USB SAMSUNG
#/dev/sda1: LABEL="Gentoo" UUID="9ace0ae7-2c82-401b-a078-8b725fa38bd4" BLOCK_SIZE="512" TYPE="xfs" PARTUUID="5e2ef541-03b4-43b1-b52a-6515fc44b34e"

# ROOT PARTITION
PARTUUID=988508bb-d3b2-4057-af4b-3db1bcde3e5d / xfs defaults 1 1

#PENDRIVE USB SAMSUNG
PARTUUID=5e2ef541-03b4-43b1-b52a-6515fc44b34e  /home/anon xfs defaults 0 1


Any suggestion? I can provide more information, just ask me.
Back to top
View user's profile Send private message
lars_the_bear
Guru
Guru


Joined: 05 Jun 2024
Posts: 537

PostPosted: Wed Aug 14, 2024 10:11 am    Post subject: Reply with quote

It looks to me as if the drive isn't in a settled state by the time you try to mount it. It can take a long time between the kernel loading the driver and probing the bus, and the drive being ready -- it could be seconds for magnetic disks. But even if it's only milliseconds, it could be too long.

I don't know if there's a nice solution to this problem using OpenRC. In the past I've just mounted the disk using an init script with a time delay before the mount. It's not very elegant. I, too, would like to know if there's a nicer way.

BR, Lars.
Back to top
View user's profile Send private message
iNeedIT
n00b
n00b


Joined: 10 Aug 2024
Posts: 13

PostPosted: Wed Aug 14, 2024 11:09 am    Post subject: Reply with quote

lars_the_bear wrote:
It looks to me as if the drive isn't in a settled state by the time you try to mount it. It can take a long time between the kernel loading the driver and probing the bus, and the drive being ready -- it could be seconds for magnetic disks. But even if it's only milliseconds, it could be too long.

I don't know if there's a nice solution to this problem using OpenRC. In the past I've just mounted the disk using an init script with a time delay before the mount. It's not very elegant. I, too, would like to know if there's a nicer way.

BR, Lars.


Thanks. Init script has resolved the mount problem.

Template for anyone:
Code:


  GNU nano 8.0                                                /etc/init.d/mount_pendrive                                                         
#!/sbin/openrc-run

depend() {
    after localmount
}

start() {
    ebegin "Mounting pendrive as /home/anon"
   
    # Replace these variables with your actual values
    PARTUUID="FILL IT"
    MOUNTPOINT="also this"
    FILESYSTEM="and this"

    # Attempt to mount the partition
    mount -t $FILESYSTEM PARTUUID=$PARTUUID $MOUNTPOINT
   
    if [ $? -eq 0 ]; then
        eend 0 "Pendrive mounted successfully"
    else
        eend 1 "Failed to mount pendrive"
    fi
}

stop() {
    ebegin "Unmounting pendrive from /home/anon"
    umount /home/anon
    eend $?
}



Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum