On Bootup a Laptop Won't Mount a Samba Drive using fstab

Issues and / or general discussion relating to Puppy


Moderator: Forum moderators

Post Reply
JusGellin
Posts: 846
Joined: Fri Jan 19, 2024 11:12 pm
Has thanked: 112 times
Been thanked: 114 times

On Bootup a Laptop Won't Mount a Samba Drive using fstab

Post by JusGellin »

I was trying to make a laptop automatically mount to my main desktop acting as a samba server on boot up using fstab.

I can manually mount the share to access it so I know that works.
The stanza in the client's fstab is this:
//192.168.70.72/samba_server /mnt/nvme0n1p2/index/samba cifs credentials=/home.smbcredentials 0 0

But it doesn't connect.
If I use mount -a manually, it does connect so there is nothing wrong with the fstab stanza.

I read that "it may not work during boot due to the network stack not being fully operational at the time the /etc/fstab entry is processed"
One suggestion was to add _netdev, but that doesn't work.

Is there a better way to do this to make it work?

My main samba server is PopOs linux.
The laptop client is KLV-vmHost.

Thanks

User avatar
Trapster
Posts: 228
Joined: Sat Aug 01, 2020 7:44 pm
Location: Texas
Has thanked: 2 times
Been thanked: 71 times

Re: On Bootup a Laptop Won't Mount a Samba Drive using fstab

Post by Trapster »

should

Code: Select all

credentials=/home.smbcredentials

be

Code: Select all

credentials=/home/smbcredentials

Also try:

Code: Select all

//192.168.70.72/samba_server /mnt/nvme0n1p2/index/samba cifs credentials=/home.smbcredentials x-systemd.requires=network-online.target 0 0
JusGellin
Posts: 846
Joined: Fri Jan 19, 2024 11:12 pm
Has thanked: 112 times
Been thanked: 114 times

Re: On Bootup a Laptop Won't Mount a Samba Drive using fstab

Post by JusGellin »

@Trapster

should

Code: Select all

credentials=/home.smbcredentials

be

Code: Select all

credentials=/home/smbcredentials

I meant for it to be credentials=/home/.smbcredentials which I had.

Thanks

JusGellin
Posts: 846
Joined: Fri Jan 19, 2024 11:12 pm
Has thanked: 112 times
Been thanked: 114 times

Re: On Bootup a Laptop Won't Mount a Samba Drive using fstab

Post by JusGellin »

@Trapster

Also try:
//192.168.70.72/samba_server /mnt/nvme0n1p2/index/samba cifs credentials=/home.smbcredentials x-systemd.requires=network-online.target 0 0

I used this with the hidden file .smbcredentials:
//192.168.70.72/samba_server /mnt/nvme0n1p2/index/samba cifs credentials=/home/.smbcredentials x-systemd.requires=network-online.target 0 0

mount -a gives a parse error when trying this.

I re-verified that without the change doesn't give the parse error:
//192.168.70.72/samba_server /mnt/nvme0n1p2/index/samba cifs credentials=/home/.smbcredentials 0 0

Thanks

JusGellin
Posts: 846
Joined: Fri Jan 19, 2024 11:12 pm
Has thanked: 112 times
Been thanked: 114 times

Re: On Bootup a Laptop Won't Mount a Samba Drive using fstab

Post by JusGellin »

Instead of using fstab, is there a way to either do the mount later in a startup service or to run mount -a later in a startup service?

Thanks

User avatar
Trapster
Posts: 228
Joined: Sat Aug 01, 2020 7:44 pm
Location: Texas
Has thanked: 2 times
Been thanked: 71 times

Re: On Bootup a Laptop Won't Mount a Samba Drive using fstab

Post by Trapster »

This is what I use:

Code: Select all

mkdir /root/server && sshfs root@192.168.1.101:/mnt/sdb1 /root/server && rox /root/server /

Just unmount and delete /root/server when finished.

I use this for the script for mounting:

Code: Select all

#!/bin/bash

PS3='Choose an option '
dirs=("Music" "Movies" "Photos" "Server" "Root" "Unmount" "Quit")
select fav in "${dirs[@]}"; do
    case $fav in
        "Music")
            mkdir /root/server && sshfs root@192.168.1.101:/mnt/sdb1/mp3 /root/server && rox /root/server/
	    # optionally call a function or run some code here
            ;;
        "Movies")
            mkdir /root/server && sshfs root@192.168.1.101:/mnt/sdb1/movies /root/server && rox /root/server/
	    # optionally call a function or run some code here
            ;;
        "Photos")
            mkdir /root/server && sshfs root@192.168.1.101:/mnt/sdb1/photos /root/server && rox /root/server/
	    # optionally call a function or run some code here
			;;
		"Server")
			mkdir /root/server && sshfs root@192.168.1.101:/mnt/sdb1 /root/server && rox /root/server /
			;;	
		"Root")
			mkdir /root/server && sshfs root@192.168.1.101:/root /root/server && rox /root/server/
			;;
		"Unmount")
			umount /root/server && rm -d /root/server
			break
            ;;
		"Quit")
			umount /root/server && rm -d /root/server
			echo "User requested exit"
	    exit
	    ;;
        *) echo "invalid option $REPLY";;
    esac
done

and I use this to call that script as a shortcut on the desktop

Code: Select all

#!/bin/sh

xterm -hold -e 'bash -c "server-mount; exec bash"' &
User avatar
wizard
Posts: 2169
Joined: Sun Aug 09, 2020 7:50 pm
Location: Oklahoma, USA
Has thanked: 2980 times
Been thanked: 799 times

Re: On Bootup a Laptop Won't Mount a Samba Drive using fstab

Post by wizard »

@JusGellin

You could use the attached program, mntshare.sh, open in geany, edit the indicated lines and put in the /root/startup directory

wizard

Attachments
mntshare.sh.tar.gz
extract before using
(496 Bytes) Downloaded 4 times

Big pile of OLD computers

JusGellin
Posts: 846
Joined: Fri Jan 19, 2024 11:12 pm
Has thanked: 112 times
Been thanked: 114 times

Re: On Bootup a Laptop Won't Mount a Samba Drive using fstab

Post by JusGellin »

@Trapster
I liked your example for how you do this.
For me, I wouldn't need to have this connected to the remote server unless I needed it also
So I wouldn't have a need to make it start up automatically using fstab.
Also having a menu like this is just what I need - I just select the one I want when needed.

I've never used sshfs before, so I had a little difficulty making that work initially.
Once I learned that the server needed to have ssh running, I was able to work through your example.
It works really well to get the folders/files from the main desktop computer.
I've modified the menu to suit me.

This seems even simpler than using samba.
But I'm still going to try using what @wizard gave so I can get familiar with that method also.

Thanks

User avatar
wizard
Posts: 2169
Joined: Sun Aug 09, 2020 7:50 pm
Location: Oklahoma, USA
Has thanked: 2980 times
Been thanked: 799 times

Re: On Bootup a Laptop Won't Mount a Samba Drive using fstab

Post by wizard »

@JusGellin

For me, I wouldn't need to have this connected to the remote server unless I needed it also
So I wouldn't have a need to make it start up automatically using fstab.
Also having a menu like this is just what I need

Have 3 samba shares used often, just edited a copy of mntshare.sh and renamed accordingly for each. Then have those in a directory on the desktop named "network". Open directory, click one of the mntshare.sh copies and it is connected. Notice at the bottom of mntshare.sh there is a line you can un-comment that will automatically open the share in rox.

@Trapster code is a lot more sophisticated.

wizard

Big pile of OLD computers

User avatar
wizard
Posts: 2169
Joined: Sun Aug 09, 2020 7:50 pm
Location: Oklahoma, USA
Has thanked: 2980 times
Been thanked: 799 times

Re: On Bootup a Laptop Won't Mount a Samba Drive using fstab

Post by wizard »

@JusGellin

As an alternate to the last message, mntshare.sh can be used to configure Rox (or any file manager that uses bookmarks) so your network share is available as a bookmark directly in the file manager.

wizard

Big pile of OLD computers

JusGellin
Posts: 846
Joined: Fri Jan 19, 2024 11:12 pm
Has thanked: 112 times
Been thanked: 114 times

Re: On Bootup a Laptop Won't Mount a Samba Drive using fstab

Post by JusGellin »

@Trapster @wizard
Thanks

Using sshfs or samba are incredibly useful and easy - once I do it several times.
I just have to make good notes for doing this. It takes me a lot of time when first figuring out how to do this.
Plus, I don't need to automatically do this on startup since I can select a desktop icon when I need it.
So I don't need to use fstab.

Since both do what I want(share files from my main desktop), are there advantages for using one or the other?

Thanks

User avatar
Trapster
Posts: 228
Joined: Sat Aug 01, 2020 7:44 pm
Location: Texas
Has thanked: 2 times
Been thanked: 71 times

Re: On Bootup a Laptop Won't Mount a Samba Drive using fstab

Post by Trapster »

wizard wrote: Sat Mar 15, 2025 11:42 pm

@JusGellin

You could use the attached program, mntshare.sh, open in geany, edit the indicated lines and put in the /root/startup directory

wizard

@wizard
Does the server need to be running samba? Your script doesn't work for me.

Code: Select all

/initrd/mnt/dev_save/Downloads$ ./mntshare.sh 
ready
mount-FULL: /mnt/puppyserver: mount(2) system call failed: Connection refused.
/initrd/mnt/dev_save/Downloads$ 

This is with the firewall turned off.

User avatar
wizard
Posts: 2169
Joined: Sun Aug 09, 2020 7:50 pm
Location: Oklahoma, USA
Has thanked: 2980 times
Been thanked: 799 times

Re: On Bootup a Laptop Won't Mount a Samba Drive using fstab

Post by wizard »

@Trapster
@JusGellin

Does the server need to be running samba? Your script doesn't work for me.This is with the firewall turned off.

Yes, see this post for setting up the server: viewtopic.php?p=132971&hilit=file+server#p132971

wizard

Big pile of OLD computers

User avatar
wizard
Posts: 2169
Joined: Sun Aug 09, 2020 7:50 pm
Location: Oklahoma, USA
Has thanked: 2980 times
Been thanked: 799 times

Re: On Bootup a Laptop Won't Mount a Samba Drive using fstab

Post by wizard »

@JusGellin

Since both do what I want(share files from my main desktop), are there advantages for using one or the other?

Think sshfs is more secure, but samba is easier to set up.

wizard

Big pile of OLD computers

Clarity
Posts: 4234
Joined: Fri Jul 24, 2020 10:59 pm
Has thanked: 1814 times
Been thanked: 569 times

Re: On Bootup a Laptop Won't Mount a Samba Drive using fstab

Post by Clarity »

@JusGellin for file exchanges and folder accesses, the simple, cleanest, and a safe & secure approach for systems on your local LAN is SAMBA! It is baked into so much of what has been available in distros since the beginning of this century.

It is found to be baked into MS, MACs, Cell-phone apps, all top 20+ linux distros on distrowatch, etc. And it allows files/folders to be exchange from your VMs with the Host machine.

Do not hesitate its use. Look for the SAMBA Simple Management in ALL WoofCE PUPs. You also see it in KLs. It is designed to be simple clear and straight forward in sharing. Further, it appears to cover all you ask about in your (this) thread.

Any questions you have on its use, merely ask as there are users everywhere on this forum and largely in the Linux community as well outside of the forum who will jump to answer usage as just about everyone understands or have used it.

Hope this is helpful

Last edited by Clarity on Tue Mar 18, 2025 8:00 am, edited 1 time in total.
Clarity
Posts: 4234
Joined: Fri Jul 24, 2020 10:59 pm
Has thanked: 1814 times
Been thanked: 569 times

Re: On Bootup a Laptop Won't Mount a Samba Drive using fstab

Post by Clarity »

Also, I seem to remember @MochiMoppel shows a fstab entry, but I cannot find it, that will, at boot time, allow a linux PC (aka laptop/desktop/etc) to auto-connect IFF the MS/MAC/SAMBA server is active on the LAN when the Laptop is booted.

But, I think I may have an example on one of my PCs if need.

JusGellin
Posts: 846
Joined: Fri Jan 19, 2024 11:12 pm
Has thanked: 112 times
Been thanked: 114 times

Re: On Bootup a Laptop Won't Mount a Samba Drive using fstab

Post by JusGellin »

Clarity wrote: Tue Mar 18, 2025 6:45 am

Also, I seem to remember @MochiMoppel shows a fstab entry, but I cannot find it, that will, at boot time, allow a linux PC (aka laptop/desktop/etc) to auto-connect IFF the MS/MAC/SAMBA server is active on the LAN when the Laptop is booted.

But, I think I may have an example on one of my PCs if need.

@Clarity
Thanks, I would like to see a fstab entry that works.
My desktop has the samba active, but from what I understand from the internet is that its wifi still wasn't completely up so the samba mount couldn't be accomplished.
Once the laptop is up I can run the same stanza and successfully mount to it.
Maybe fstab has something that could delay the mount a bit to allow the wifi to be fully connected and the mount the client.
It could be that the laptop I'm using is just too fast for the boot up.

Clarity
Posts: 4234
Joined: Fri Jul 24, 2020 10:59 pm
Has thanked: 1814 times
Been thanked: 569 times

Re: On Bootup a Laptop Won't Mount a Samba Drive using fstab

Post by Clarity »

@JusGellin, @wizard,@Trapster and other forum users who might find auto-mounting your LAN server's resource at boot-time, a productivity gain.

A forum thread for automounting.

Hope this is helpful

JusGellin
Posts: 846
Joined: Fri Jan 19, 2024 11:12 pm
Has thanked: 112 times
Been thanked: 114 times

Re: On Bootup a Laptop Won't Mount a Samba Drive using fstab

Post by JusGellin »

Clarity wrote: Tue Mar 18, 2025 10:08 pm

@JusGellin, @wizard,@Trapster and other forum users who might find auto-mounting your LAN server's resource at boot-time, a productivity gain.

A forum thread for automounting.

Hope this is helpful

Thanks, that really is an excellent document for setting up the samba client.

I've set the fstab like the document before so it confirms I'm doing it correctly
But it still doesn't automatically mount the samba folder from the server just like before.

I still can run mount -a which successfully manually mounts the share.

Clarity
Posts: 4234
Joined: Fri Jul 24, 2020 10:59 pm
Has thanked: 1814 times
Been thanked: 569 times

Re: On Bootup a Laptop Won't Mount a Samba Drive using fstab

Post by Clarity »

Hello @JusGellin
So that I am clear (as I may be missing something) ... Are you saying the following after you've created the fstab changes?

  • When you boot the laptop, it does not connect?

  • AND, once booted, you open a terminal to enter mount -a and the mount-point populates?

Curious

BTW - there are 3 logs that I would consider review:

  • On the server, the samba.log

  • On the laptop, dmesg and the syslog

As any activity related to the fstab command should be logged. Let us know.

BTW2 - Could you post your fstab entry? (block the IP address AND the credentials filename OR send to me intact via a PM)

Post Reply

Return to “Users Help”