mount: block device is write-protected, mounting read-only
Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
mount: block device is write-protected, mounting read-only
Hallo!
I'm trying to mount a NAS from a FC. When I use the GUI "Places/connect to Server", I don't have any difficulty. when I try to mount with the command line I get this:
Quote:
sudo mount -t cifs -o username=myuser //XXX.XXX.XX.XX/myServer /home/myuser/backup
mount: block device //XXX.XXX.XX.XX/myServer is write-protected, mounting read-only
mount: cannot mount block device //XXX.XXX.XX.XX/myServer read-only
New version(s) of CIFS change expected behavior for those used to 'smbfs'
Reviving this old thread because it's the only one that described my exact problem: newer distros are beginning to default to 'cifs' and might not include the 'smbfs' package by default, which could change the expected behavior of the 'mount' command when mounting password-protected SMB shares. I ran into the problem using Ubuntu 8.04 (Hardy) and 8.10 (Intrepid) LiveCDs, but the information below should apply equally well to any new-ish distribution for which 'cifs' is being implemented as a replacement for 'smbfs'/'smbmount'.
A "vanilla" installation of Ubuntu 8.04/8.10 (Desktop i386) includes no 'smbmount' command, no '/sbin/mount.cifs' (although, confusingly, the man page is installed), and instead appears to rely on the 'cifs' loadable module to provide the capability of mounting SMB/CIFS shares via a kernel facility. This is similar to other network filesystems such as NFS, which are built into the kernel or loaded via modules and do not have their own mount.whatever command.
Some of the changes in switching over to 'cifs' are very subtle from a user perspective, like the meaning of the 'user' command (traditionally = "allow an ordinary user to mount the filesystem"; permitted by newer mount.cifs as a synonym for "username", as in "-ousername=myname"). Of note, the 'cifs' kernel module does not appear to allow prompting for a share password interactively at the command-line, as with smbmount/mount.cifs. It seems you must pass it explicitly on the command-line using the '-o password=' option. (This has always worried me because then your password ends up in your ".bash_history" file, but I guess that's no worse than using a 'credentials' file when you think about it, as both contain the plaintext passwords but neither is world-readable.)
The CIFS kernel module should be loaded dynamically as needed (perhaps when you give a 'mount -t cifs' command for the first time), but you can check to see that it is by typing:
Code:
$ cat /proc/filesystems
and looking for
Code:
...
nodev cifs
...
in the output.
I was familiar with the options for 'smbmount' (or 'mount -t smbfs'), having used it many times on old RIPLinux and KNOPPIX boot CDs to mount shares on a NAS for system backups using GNU 'partimage'.
So when I booted up an Ubuntu 8.10 LiveCD, I expected
Code:
mount -t cifs //servername/sharename /local/mount/point -ousername=myname
to prompt me for a password; instead I got the same confusing error as the above poster:
Code:
mount: block device //servername/sharename is write-protected, mounting read-only
mount: cannot mount block device //servername/sharename read-only
I found two solutions: you can either (1) install the 'smbfs' package (yes--possible with the Live CD as long as you're connected to the Internet) to get an actual '/sbin/mount.cifs' which knows how to prompt for a password, and supports all the expected options from the man page, or (2) specify the password directly in the 'mount' command using the '-o password=' option as below:
Code:
mount -t cifs //servername/sharename /local/mount/point -o username=myname,password=supersecret
After checking all the permissions on my NAS share (and almost giving up and going back to trusty KNOPPIX), I started poking around on the filesystem of the Ubuntu Intrepid LiveCD and noted there was no 'mount.cifs' or 'smbmount'. This started me searching the web to figure out what the heck was going on. As there was no user-space program to prompt for a password (CIFS being loaded into the kernel instead), it almost makes sense that you'd have to specify the password as an option to 'mount -t cifs'. But it took a loooong time for me to finally figure this out.
To solve this for RedHat, you basically have to make sure a few packages are installed. Namely samba.i386, samba-client.i386 from something like yum. There is no smbfs named package specifically for RedHat.
I had this exact same problem with Ubuntu 10.04 Lucid Lynx.
Using the -o password= option was the first thing I tried, but it didn't help. For me the only solution to this problem was to set up the smbfs package.
Code:
sudo apt-get install smbfs
One would expect that installing samba would also install smbfs, so this was quite unexpected to me.
This thread is still valid and useful. Using Linux Mint 13 on two machines, side by side. After setting up a new fileserver, I tried to login to same. One Mint 13 machine logged in a-ok, the other gave me the "read-only can not mount" business error message.
Installing smbfs fixed the problem. I noticed when installing that smbfs has a dependency on cifs-utils, which also got installed, and which may be the current culprit.
Don't ask me why one machine worked and the other did not - but I will say the machines are not identical, and they have some different things installed. One is a desktop, the other is a business laptop - different program requirements.
This thread is still valid and useful. Using Linux Mint 13 on two machines, side by side. After setting up a new fileserver, I tried to login to same. One Mint 13 machine logged in a-ok, the other gave me the "read-only can not mount" business error message.
Installing smbfs fixed the problem. I noticed when installing that smbfs has a dependency on cifs-utils, which also got installed, and which may be the current culprit.
Don't ask me why one machine worked and the other did not - but I will say the machines are not identical, and they have some different things installed. One is a desktop, the other is a business laptop - different program requirements.
Well. That was easy!
Thanks for the thread!
now why in the world would you be using SAMBA to file share between Linux systems? that is like asking an Apple to taste like an Orange when you hand it to your friend. does not work properly.
Use NFS for sharing between Linux. NFS is the NATVIE file sharing protocol for Linux, Cifs/Samba is the NON-Native file sharing protocol for Linux to Microsoft Windows system. They are NOT the same, nor are they equal.
now why in the world would you be using SAMBA to file share between Linux systems? that is like asking an Apple to taste like an Orange when you hand it to your friend. does not work properly.
Use NFS for sharing between Linux. NFS is the NATVIE file sharing protocol for Linux, Cifs/Samba is the NON-Native file sharing protocol for Linux to Microsoft Windows system. They are NOT the same, nor are they equal.
Nice of ya to be so helpful and polite and all, for sure. Much appreciated.
However,
1. your point is OT, yes?
2. uh - gets back to #1
3. but, since you ask, it is a mixed network, and I need to know the samba is working. Since there are a number of people on this and similar threads, it would appear I am not alone. Sometimes I use sshfs instead, but sshfs has bugs when it comes to crossing partitions with files and data, so sometimes I use the samba share.
This thread is still valid and useful. Using Linux Mint 13 on two machines, side by side. After setting up a new fileserver, I tried to login to same. One Mint 13 machine logged in a-ok, the other gave me the "read-only can not mount" business error message.
Installing smbfs fixed the problem. I noticed when installing that smbfs has a dependency on cifs-utils, which also got installed, and which may be the current culprit.
Don't ask me why one machine worked and the other did not - but I will say the machines are not identical, and they have some different things installed. One is a desktop, the other is a business laptop - different program requirements.
Well. That was easy!
Thanks for the thread!
This thread is still valid for Elementary OS Freya.
However, I did not install smbfs to address the problem, since I did not need it and it is deprecated. I simply installed cifs-utils, which does appear to be the culprit. Thanks hiero2.
I encountered this problem today on debian 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt25-2+deb8u3 (2016-07-02) x86_64 GNU/Linux. The only resolution I found was by typing:
Code:
sudo apt-get install cifs utils
followed by inserting ISO for the Debian installation into the DVD drive, and pressing Enter to start the cifs-utils to download and install. Once the cifs-utils installation was successful, I accessed my FreeNAS share by typing
Code:
sudo mount -o username=<username> //<server IP address>/<share name> /<mount point>
and was prompted for the password. This should assist any Debian users looking to access a FreeNas fileshare from a newer Debian-style linux distro. Our FreeNAS uses Samba, smbfs package is no longer available, and cifs-utils package has replaced it.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.