Bug 135946

Summary: Cannot write to /etc/samba/smb.conf
Product: [Fedora] Fedora Reporter: Bob Gustafson <bobgus>
Component: system-config-sambaAssignee: Nils Philippsen <nphilipp>
Status: CLOSED WORKSFORME QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 3   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-10-19 21:13:13 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Bug Depends On:    
Bug Blocks: 130887    

Description Bob Gustafson 2004-10-15 16:38:14 EDT
Description of problem:

I try to add a share and it says:

  Cannot write to /etc/samba/smb.conf Program will now exit


Version-Release number of selected component (if applicable):

  From 'About box':

  Samba Server Configuration Tool 1.2.20

How reproducible:

  Every time I have tried over the last couple of days.

Steps to Reproduce:
1. Gnome->System Settings->Server Settings->Samba
2. insert root password when asked
3. Add a share - browse to a directory
4. Allow access to everyone (..)
5. Click on OK

6. Read dismal Warning box 'Cannot write to /etc/samba/smb.conf..

Actual results:

  see above

Expected results:

  I should see the appropriate changes written into smb.conf

Additional info:

[root@hoho2 samba]# pwd
/etc/samba
[root@hoho2 samba]# ls -l
total 24
-rw-r--r--  1 root root    20 Oct 13 16:30 lmhosts
-rw-r--r--  1 root root 10836 Oct 14 21:46 smb.conf
-rw-r--r--  1 root root    97 Oct 13 16:30 smbusers
[root@hoho2 samba]#
Comment 1 Nils Philippsen 2004-10-18 05:07:25 EDT
Can you please run system-config-samba from the command line? It
should spit ot a python traceback, please copy it here.
Comment 2 Bob Gustafson 2004-10-18 13:16:03 EDT
[user1@hoho2 ~]$ su
Password:
[root@hoho2 user1]# system-config-samba
Traceback (most recent call last):
  File "/usr/share/system-config-samba/system-config-samba.py", line
41, in ?
    mainWindow.MainWindow(debug_flag)
  File "/usr/share/system-config-samba/mainWindow.py", line 75, in
__init__
    self.samba_data = sambaParser.SambaParser(self)
  File "/usr/share/system-config-samba/sambaParser.py", line 40, in
__init__
    self.parseFile()
  File "/usr/share/system-config-samba/sambaParser.py", line 74, in
parseFile
    token = self.createToken(line)
  File "/usr/share/system-config-samba/sambaParser.py", line 146, in
createToken    token =
sambaToken.SambaToken(sambaToken.SambaToken.SAMBA_TOKEN_KEYVAL, (name,
value), self.parent)
  File "/usr/share/system-config-samba/sambaToken.py", line 36, in
__init__
    raise AttributeError, value
AttributeError: ('readonly', 'yes')
[root@hoho2 user1]#
Comment 3 Nils Philippsen 2004-10-18 13:38:39 EDT
This indicates a wrong option in your /etc/smb.conf. According the the
smb.conf(5) man page it is "read only", not "readonly" -- could you
check your /etc/smb.conf please?
Comment 4 Bob Gustafson 2004-10-18 15:09:39 EDT
# From http://www.poulpetersen.dk/linux/uklinshr.htm
# cdrom setup
[cdrom]
   comment = Samba Server CDROM
   browseable = yes
   writeable = no
   readonly = yes
   printable = no
   public = yes
   only guest = no
   path = /mnt/cdrom


Changing the readonly to 'read only' gives much better results. Before
it was a blank dialog box. Now there are a few lines showing shares,
etc. (Including the cdrom drive..)

Thanks much for the pointer. (maybe smb.conf parse errors should show
in the dialog box?)
Comment 5 Bob Gustafson 2004-10-18 15:10:10 EDT
Works for me
Comment 6 Nils Philippsen 2004-10-19 05:47:21 EDT
Reopening this under a slightly different title ;-).
Comment 7 Bob Gustafson 2004-10-19 12:29:50 EDT
Hmm, I am still getting the dialog box

Cannot write to /etc/samba/smb.conf Program will now exit.

I open a 'preferences' dialog and get the above message when I exit,
no matter whether I change anything or not.

Running from the command line, this is what I get:

[root@hoho2 samba]# system-config-samba
/usr/share/system-config-samba/mainWindow.py:113: DeprecationWarning:
use gtk.UIManager
  item_fac = gtk.ItemFactory(gtk.MenuBar, "<main>", accel_group)
/usr/share/system-config-samba/mainWindow.py:138: DeprecationWarning:
  button = self.toolbar.insert_stock('gtk-add', _("Add a samba
share"), None, self.onNewButtonClicked, None, 0)
/usr/share/system-config-samba/mainWindow.py:143: DeprecationWarning:
  self.properties_button = self.toolbar.insert_stock('gtk-properties',
_("Edit the properties of the selected directory"), None,
self.onPropertiesButtonClicked, None, 1)
/usr/share/system-config-samba/mainWindow.py:148: DeprecationWarning:
  self.delete_button = self.toolbar.insert_stock('gtk-delete',
_("Delete the selected directory"), None, self.onDeleteButtonClicked,
None, 2)
/usr/share/system-config-samba/mainWindow.py:153: DeprecationWarning:
  self.toolbar.insert_stock('gtk-help', _("View help"), None,
self.onHelpClicked, None, 3)
Traceback (most recent call last):
  File "/usr/share/system-config-samba/shareWindow.py", line 537, in
onOkEditButtonClicked
    self.samba_data.writeFile()
  File "/usr/share/system-config-samba/sambaParser.py", line 173, in
writeFile
    raise RuntimeError, (_("Cannot write to %s.  Program will now
exit." % path))
RuntimeError: Cannot write to /etc/samba/smb.conf.  Program will now exit.
[root@hoho2 samba]#
Comment 8 Nils Philippsen 2004-10-19 12:43:32 EDT
Ahh I got the culprit now, changed title back.
Comment 9 Nils Philippsen 2004-10-19 13:13:13 EDT
Should be fixed in 1.2.21-1. Grab them from
http://people.redhat.com/nphilipp/BETA/system-config-samba/ until they
hit the mirrors.
Comment 10 Bob Gustafson 2004-10-19 21:13:13 EDT
Seems to work

I did

rpm -i system..src.rpm
rpm -i system..noarch.rpm
cd /usr/src/redhat/SPECS
rpmbuild -bi system..src.rpm 2>&1 system-config.out

And then added a 'share' and then deleted it. Seemed to work OK.

Thanks much

Works for me
Comment 11 Nils Philippsen 2004-10-20 06:02:30 EDT
You shouldn't have needed to rebuild the source RPM ;-), but anyway
good to hear that it works.