Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230
SMB connection fails after changing to usb wifi
-
- Posts: 11
- Joined: 2021-02-10 08:47
SMB connection fails after changing to usb wifi
Hi,
On Debian Buster I have created a share to a usb hard disk on my router with smb.
I put the cifs params in fstab and it works fine. At startup it connects beautifully and the share is available.
But when I use a network connection via a usb wifi it fails to connect at startup ('only root can create this share'). When I go back to a ethernet connection and reboot it is ok again.
I guess it has to do with the order: ethernet connection is made before the creation of the share? And the usb wifi connection after?
Thanks for suggestions.
On Debian Buster I have created a share to a usb hard disk on my router with smb.
I put the cifs params in fstab and it works fine. At startup it connects beautifully and the share is available.
But when I use a network connection via a usb wifi it fails to connect at startup ('only root can create this share'). When I go back to a ethernet connection and reboot it is ok again.
I guess it has to do with the order: ethernet connection is made before the creation of the share? And the usb wifi connection after?
Thanks for suggestions.
- Head_on_a_Stick
- Posts: 14114
- Joined: 2014-06-01 17:46
- Location: London, England
- Has thanked: 81 times
- Been thanked: 133 times
Re: SMB connection fails after changing to usb wifi
Perhaps try adding the x-systemd.automount option so that the share is only mounted on demand. See also https://wiki.archlinux.org/index.php/Fs ... filesystem
Disclaimer: I've never used Samba.
Disclaimer: I've never used Samba.
deadbang
-
- Posts: 11
- Joined: 2021-02-10 08:47
Re: SMB connection fails after changing to usb wifi
ok I tried in fstab:
//192.168.1.17/USB_Storage/ncbackup /media/share cifs noauto,x-systemd.automount,x-systemd.mount-timeout=30,_netdev,uid=0,vers=1.0,credentials=/root/.smbcredentials
When I try to access /media/share with Dolphin I get: mount: /media/share: operation permitted for root only.
That is the same problem as before.
//192.168.1.17/USB_Storage/ncbackup /media/share cifs noauto,x-systemd.automount,x-systemd.mount-timeout=30,_netdev,uid=0,vers=1.0,credentials=/root/.smbcredentials
When I try to access /media/share with Dolphin I get: mount: /media/share: operation permitted for root only.
That is the same problem as before.
-
- Posts: 11
- Joined: 2021-02-10 08:47
Re: SMB connection fails after changing to usb wifi
Extra info: when I connect via ethernet, after a reboot I get the same error message. But when I change the fstab entry back to: //192.168.1.17/USB_Storage/ncbackup /media/share cifs uid=0,vers=1.0,credentials=/root/.smbcredentials
the share is mounted without problems after a reboot and connected via ethernet.
Thanks for suggestions
Peter
the share is mounted without problems after a reboot and connected via ethernet.
Thanks for suggestions
Peter
Re: SMB connection fails after changing to usb wifi
Either you mount as root during boot, which seems to work with ethernet in your case, or you mount as user on-demand, which can only work if you also add "users" to the list of options in fstab.
Otherwise systemd will try to mount it automatically on first use, as your user, and not as root, which is alas required by your own /etc/fstab.
Otherwise systemd will try to mount it automatically on first use, as your user, and not as root, which is alas required by your own /etc/fstab.
-
- Posts: 11
- Joined: 2021-02-10 08:47
Re: SMB connection fails after changing to usb wifi
Maybe I didn't make myself clear. I would like to mount the samba share on reboot when only the USB WIFI is available. The mount works fine when connected with an ethernet cable, but not when using USB WIFI.reinob wrote:Either you mount as root during boot, which seems to work with ethernet in your case, or you mount as user on-demand, which can only work if you also add "users" to the list of options in fstab.
Otherwise systemd will try to mount it automatically on first use, as your user, and not as root, which is alas required by your own /etc/fstab.
Re: SMB connection fails after changing to usb wifi
@Plfeenstra,
Given that during the thread you also tried the on-demand user mounting, I thought you'd like to know how to make that work.
In theory systemd should not try to mount stuff requiring network before ensuring the network is up.
Assuming you haven't tweaked (read: broken) in the systemd units, I can only suggest you review the log ("journalctl -b") which should indicate what failed.
You can of course post it here (or a link to a pastebin, whatever suits you).
PS: which program do you use for making the connection? systemd-networkd, network-manager, ifupdown, ??
Given that during the thread you also tried the on-demand user mounting, I thought you'd like to know how to make that work.
In theory systemd should not try to mount stuff requiring network before ensuring the network is up.
Assuming you haven't tweaked (read: broken) in the systemd units, I can only suggest you review the log ("journalctl -b") which should indicate what failed.
You can of course post it here (or a link to a pastebin, whatever suits you).
PS: which program do you use for making the connection? systemd-networkd, network-manager, ifupdown, ??
-
- Posts: 11
- Joined: 2021-02-10 08:47
Re: SMB connection fails after changing to usb wifi
Thank you,
I am a beginner,... I have set up the machine to be a Nextcloud server for use at home. For backup purposes I would like to connect to an external (usb) disk-drive that is connected to a router. So far so good.
Everything works fine as long as I connect the server with an ethernet cable to the network. As soon as I use the USB Wifi I get this problem. The 'funny' thing is that when I reboot the machine with de USB WIFI connected it does not mount the share, but as soon as I do sudo mount -a in a terminal, the share is mounted. In the journal / boot.log I see a message that the network could not be reached. It uses network-manager.
I will try to copy the journalctl -b info to a message here.
I am a beginner,... I have set up the machine to be a Nextcloud server for use at home. For backup purposes I would like to connect to an external (usb) disk-drive that is connected to a router. So far so good.
Everything works fine as long as I connect the server with an ethernet cable to the network. As soon as I use the USB Wifi I get this problem. The 'funny' thing is that when I reboot the machine with de USB WIFI connected it does not mount the share, but as soon as I do sudo mount -a in a terminal, the share is mounted. In the journal / boot.log I see a message that the network could not be reached. It uses network-manager.
I will try to copy the journalctl -b info to a message here.
-
- Posts: 11
- Joined: 2021-02-10 08:47
Re: SMB connection fails after changing to usb wifi
I tried the solution from this page: https://www.debian-fr.org/t/resolu-etc- ... ev/80543/3
But unfortunately that didn't work either.
I'll keep searching
But unfortunately that didn't work either.
I'll keep searching
Re: SMB connection fails after changing to usb wifi
In /etc/fstab, make sure you add the "_netdev" option, so that systemd (which nowadays takes care of mounting stuff during boot) recognizes it as requiring the network to be up before mounting.
//192.168.1... cifs _netdev,uid=0,vers=1.0,credentials=/root/.smbcredentials
It (normally) should work, as long as the connection (ethernet or USB wifi) happens during boot (i.e. before you log in as user, etc.).
Good luck,
(and post your "journalctl -b" if you need more help)
//192.168.1... cifs _netdev,uid=0,vers=1.0,credentials=/root/.smbcredentials
It (normally) should work, as long as the connection (ethernet or USB wifi) happens during boot (i.e. before you log in as user, etc.).
Good luck,
(and post your "journalctl -b" if you need more help)
-
- Posts: 11
- Joined: 2021-02-10 08:47
Re: SMB connection fails after changing to usb wifi
Thanks again,
I created a media-share.mount with the following content:
[Unit]
Description=mount ReadyShare samba share
Wants=network-online.target
After=network-online.target
[Mount]
Environment="SERVER='//192.168.1.17/USB_Storage/ncbackup'"
What=$SERVER
Where=/media/share
Type=cifs
Options=_netdev,users,user,noacl,guest,rw,uid=0,vers=1.0
SloppyOptions=on
DirectoryMode=0755
TimeoutSec=10
[Install]
WantedBy=multi-user.target
It works fine as long I have the ehternet cable connected during boot.
When I try to attach a compressed file to this message I get an error: Sorry, the board attachment quota has been reached.
Is there another way I can share the results of journalctl -b ? I have tried to put it as text in a message like this but that doesn't work either (blank page with error 500 or something like that).
P
I created a media-share.mount with the following content:
[Unit]
Description=mount ReadyShare samba share
Wants=network-online.target
After=network-online.target
[Mount]
Environment="SERVER='//192.168.1.17/USB_Storage/ncbackup'"
What=$SERVER
Where=/media/share
Type=cifs
Options=_netdev,users,user,noacl,guest,rw,uid=0,vers=1.0
SloppyOptions=on
DirectoryMode=0755
TimeoutSec=10
[Install]
WantedBy=multi-user.target
It works fine as long I have the ehternet cable connected during boot.
When I try to attach a compressed file to this message I get an error: Sorry, the board attachment quota has been reached.
Is there another way I can share the results of journalctl -b ? I have tried to put it as text in a message like this but that doesn't work either (blank page with error 500 or something like that).
P
- sunrat
- Administrator
- Posts: 6476
- Joined: 2006-08-29 09:12
- Location: Melbourne, Australia
- Has thanked: 118 times
- Been thanked: 474 times
Re: SMB connection fails after changing to usb wifi
The board doesn't do attachments; there's probably something about it in the FAQ. You can upload it to a pastebin service and link it but people are unlikely to trawl through the whole journal log.Plfeenstra wrote:When I try to attach a compressed file to this message I get an error: Sorry, the board attachment quota has been reached.
Is there another way I can share the results of journalctl -b ? I have tried to put it as text in a message like this but that doesn't work either (blank page with error 500 or something like that).
Best bet is to filter it with relevant terms like samba, smb, and net and post it here using code tags.
Code: Select all
journalctl -b | egrep "smb|net"
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ” Remember to BACKUP!
Those who have lost data
...and those who have not lost data YET ” Remember to BACKUP!
-
- Posts: 11
- Joined: 2021-02-10 08:47
Re: SMB connection fails after changing to usb wifi
Hello,reinob wrote:In /etc/fstab, make sure you add the "_netdev" option, so that systemd (which nowadays takes care of mounting stuff during boot) recognizes it as requiring the network to be up before mounting.
//192.168.1... cifs _netdev,uid=0,vers=1.0,credentials=/root/.smbcredentials
It (normally) should work, as long as the connection (ethernet or USB wifi) happens during boot (i.e. before you log in as user, etc.).
Good luck,
(and post your "journalctl -b" if you need more help)
It seems that I'm stuck in the mud a little
I installed pastebinit and tried to use it to post the journalct -b. But I get an empty paste.debian.net url and warinings that functions are deprecated in python 3.5. I searched for a solution, but didn't find something.
- Head_on_a_Stick
- Posts: 14114
- Joined: 2014-06-01 17:46
- Location: London, England
- Has thanked: 81 times
- Been thanked: 133 times
Re: SMB connection fails after changing to usb wifi
https://bugs.debian.org/cgi-bin/bugrepo ... bug=959048Plfeenstra wrote:I installed pastebinit and tried to use it to post the journalct -b. But I get an empty paste.debian.net url and warinings that functions are deprecated in python 3.5
Try this instead:
Code: Select all
journalctl -b | curl -F 'f:1=<-' ix.io
deadbang
-
- Posts: 11
- Joined: 2021-02-10 08:47
Re: SMB connection fails after changing to usb wifi
Hello,reinob wrote:In /etc/fstab, make sure you add the "_netdev" option, so that systemd (which nowadays takes care of mounting stuff during boot) recognizes it as requiring the network to be up before mounting.
//192.168.1... cifs _netdev,uid=0,vers=1.0,credentials=/root/.smbcredentials
It (normally) should work, as long as the connection (ethernet or USB wifi) happens during boot (i.e. before you log in as user, etc.).
Good luck,
(and post your "journalctl -b" if you need more help)
I returned to fstab to try to mount the share. I have added the _netdev option, but that makes no difference.
The results of the journalctl -b can be found on http://ix.io/2PB5
Thanks in advance.
Re: SMB connection fails after changing to usb wifi
Thanks @Plfeenstra,
From the looks of it your USB-WIFI connection is being managed by NetworkManager, but only when you are logged on!
Before you login, systemd has already failed to mount the share, as on the one hand it thinks you are online ("Reached target Network is Online"), but Network Manager seems to need time to think and/or who-knows-what that it only manages to connect when you are logged on.
I don't know much about Network Manager, and I would not recommend it for computers that are always online. All you need is wpa_supplicant and systemd-networkd. Oddly, https://wiki.debian.org/WiFi/HowToUse does not even care to explain how to use networkd.
Here (https://hackaday.io/project/162164/instructions) it is more or less well-explained. Let me know if you have problems.
From the looks of it your USB-WIFI connection is being managed by NetworkManager, but only when you are logged on!
Before you login, systemd has already failed to mount the share, as on the one hand it thinks you are online ("Reached target Network is Online"), but Network Manager seems to need time to think and/or who-knows-what that it only manages to connect when you are logged on.
I don't know much about Network Manager, and I would not recommend it for computers that are always online. All you need is wpa_supplicant and systemd-networkd. Oddly, https://wiki.debian.org/WiFi/HowToUse does not even care to explain how to use networkd.
Here (https://hackaday.io/project/162164/instructions) it is more or less well-explained. Let me know if you have problems.
Re: SMB connection fails after changing to usb wifi
I googled a bit about NetworkManager and it seems (thanks for the excellent Arch wiki: https://wiki.archlinux.org/index.php/NetworkManager) that it will only connect when a user has logged on, which for your use-case is absurd.
So make sure that the connection is marked as "available to all users."Connect to network with secret on boot
By default, NetworkManager will not connect to networks requiring a secret automatically on boot. This is because it locks such connections to the user who makes it by default, only connecting after they have logged in. To change this, do the following:
Log out and log back in to complete.
- 1. Right click on the nm-applet icon in your panel and select Edit Connections and open the Wireless tab
2. Select the connection you want to work with and click the Edit button
3. Check the boxes “Connect Automatically” and “Available to all users”
4. Additionally, ensure that under "Wi-Fi Security", "Store password for all users (not encrypted)" is selected
- Head_on_a_Stick
- Posts: 14114
- Joined: 2014-06-01 17:46
- Location: London, England
- Has thanked: 81 times
- Been thanked: 133 times
Re: SMB connection fails after changing to usb wifi
There is a systemd-networkd page in the Debian wiki but it only deals with servers. The ArchWiki page is applicable to Debian though and that isn't riddled with ads & javascript like that atrocious "hackaday" [sic] sitereinob wrote:All you need is wpa_supplicant and systemd-networkd. Oddly, https://wiki.debian.org/WiFi/HowToUse does not even care to explain how to use networkd.
deadbang
-
- Posts: 11
- Joined: 2021-02-10 08:47
Re: SMB connection fails after changing to usb wifi
Thanks a lot for your replies! I learned a lot. I will try the solution for the networkmanager this weekend and let you know how I proceed.
P
P
-
- Posts: 11
- Joined: 2021-02-10 08:47
Re: SMB connection fails after changing to usb wifi
Thank you very much, this solution works perfect for me!reinob wrote:I googled a bit about NetworkManager and it seems (thanks for the excellent Arch wiki: https://wiki.archlinux.org/index.php/NetworkManager) that it will only connect when a user has logged on, which for your use-case is absurd.
So make sure that the connection is marked as "available to all users."Connect to network with secret on boot
By default, NetworkManager will not connect to networks requiring a secret automatically on boot. This is because it locks such connections to the user who makes it by default, only connecting after they have logged in. To change this, do the following:
Log out and log back in to complete.
- 1. Right click on the nm-applet icon in your panel and select Edit Connections and open the Wireless tab
2. Select the connection you want to work with and click the Edit button
3. Check the boxes “Connect Automatically” and “Available to all users”
4. Additionally, ensure that under "Wi-Fi Security", "Store password for all users (not encrypted)" is selected
I will study the journalctl -b results; I think I can learn a lot from that.
Peter