# SWAT Problems

## NateZ

So I was going to set up my samba shares  with the web interface, as I have before, but on this clean build of Gentoo, it doesn't want to build nicely for me.

Here is my /etc/xinetd.d/swat file:

```
# default: off

# description: SWAT is the Samba Web Admin Tool. Use swat \

#              to configure your Samba server. To use SWAT, \

#              connect to port 901 with your favorite web browser.

# $Header: /var/cvsroot/gentoo/src/patchsets/samba/configs/swat.xinetd,v 1.1 20$

service swat

{

        port            = 901

        socket_type     = stream

        wait            = no

        only_from       = 192.168.1.0/24 localhost

        user            = root

        server          = /usr/sbin/swat

        log_on_failure += USERID

        disable         = no

}

```

However when I try to login to Swat at http://localhost:901 on firefox on my Gentoo box, it's a weird error i get, its not a login error - it's this:

```

500 Server Error

chdir failed - the server is not configured correctly

```

If anyone can help, it'd be greatly appreciated.

----------

## geforce

dont' chdir mean change directory ? Be sure that the directory swat try to look for exists first, and if you have the permissions, but this should not be a problem as far as it is running as root .

----------

## Xamindar

I'm having this problem too.  It is a recent problem on all my machines.  What is wrong with swat?  Has anyone found a fix?

----------

## geforce

can http://lists.samba.org/archive/samba/2003-September/075025.html help ??

----------

## Xamindar

Thanks, I'll try it out......Shouldn't the ebuild do that for us?

----------

## NateZ

Hrm. well this didn't actually work for me....:-/

Also, this is a very old build that you linked as a solution.

----------

## MankyD

I've got this same problem.  Has anyone had any luck?

----------

## breetie

Yes, same issue.  Saw this, though:

```
Section6 samba # strings /usr/sbin/swat | grep "/swat"

/swat/

<BODY background="/swat/images/background.jpg">

<A HREF="/swat/help/manpages/smb.conf.5.html#%s" target="docs"> %s</A>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; %s <br><span class="i18n_translated_parm">%s</span>

<A HREF="/swat/help/manpages/smb.conf.5.html#%s" target="docs"> %s</A>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; %s

<A HREF="%s/%s"><img border="0" src="/swat/%s" alt="%s"></A>

<A HREF="/swat/help/smb.conf.5.html#printcapname" target="docs">%s</A>

/usr/share/doc/samba-3.0.21b/swat
```

I don't have any of these files, nor are the directories there.  No doubt the problem is that these directories did not get created during installation.  Perhaps it is a bug with 3.0.21b?  It may be possible that my options may have adversely affected this, but I can't imagine what.  Anyone have any additions to add to this?  And, since the files and folders needed are definitely not there (at least in my case, even after a re-emerge), where can I download the files I need?  The repositories don't seem to have any of these available.  I'm still Google'ing though...

----------

## breetie

Um, okay, sorry folks, was playing with it.  I made some progress when I created the directory 'swat' in /usr/share/doc/samba-3.0.21b (seeing as how the directory isn't there).  It...kind of...works.  Since none of the documents are there, I'm going to have to manually hunt them down.  I'm having some trouble tracking down why, exactly, these seemingly necessary files would be omitted.  I'm trying to see what options I have that may have affected this.  In the meantime, I will keep ya'll posted.   :Razz: 

----------

## breetie

Okay, um...

Here is how I fixed this.  First, the error message:

'chgdir failed - server error' etc. etc. and so forth.

In my case, this was because...well...a directory and files were missing in /usr/share/doc/samba-3.0.21b/.  This, namely, was the directory 'swat' and all the html pages enclosed within it.  So, since I really didn't feel like hunting all day on the 'net (unless I got lucky and found a repository with all the files I needed), I simply scp'd the required files from another server I have running 3.0.7-r1.  Works now.  Er, well...not exactly a 'fix', but it works.  As to where the proper html is, I have no idea.  Why was that omitted?

----------

## geforce

Looks like the ebuild don't create the directory and put the files in ?

Have you posted this as a bug ?

----------

## NateZ

I started this topic, but thanks so much breetie for looking into it so much. it'd be cool if you wanted to email me all of the appropriate files for that sometime  :Smile: ...

As for this being in a bug report, no - i haven't yet, i'll let someone more experienced in doing so to submit that if they could  :Smile: 

----------

## dfelicia

Just add the doc use flag for samba.

/etc/portage/package.use:

```

net-fs/samba doc

```

```

emerge --newuse samba

```

----------

## MarkH

 *dfelicia wrote:*   

> Just add the doc use flag for samba.
> 
> /etc/portage/package.use:
> 
> ```
> ...

 

I get this problem too - the above caused a complete rebuild but didn't work for me.

----------

## dfelicia

```

dfelicia@rtfm swat $ equery belongs /usr/share/doc/samba-3.0.21b/swat

[ Searching for file(s) /usr/share/doc/samba-3.0.21b/swat in *... ]

net-fs/samba-3.0.21b (/usr/share/doc/samba-3.0.21b/swat)

dfelicia@rtfm swat $ emerge -pv samba

These are the packages that I would merge, in order:

Calculating dependencies ...done!

[ebuild   R   ] net-fs/samba-3.0.21b  +acl -async -automount +cups +doc -examples -kerberos +ldap -ldapsam +libclamav +mysql -oav +pam -postgres +python -quotas +readline (-selinux) +swat -syslog +winbind +xml +xml2 0 kB 

```

Clearly the swat files are part of teh ebuild.  Can you emerge -pv swat and make sure +doc is in the USE variable list?  Is your portage snapshot up to date?Last edited by dfelicia on Thu Mar 30, 2006 3:06 pm; edited 1 time in total

----------

## essdeeay

In addition to the doc flag, you also need the swat flag.  Recompile net-fs/samba with --newuse and you should be okay.

Steve  :Smile: 

----------

## Xamindar

Im recompiling it now, I hope it works.

Who would make an ebuild that didn't even work right when a certain use flag was turned off?  :Rolling Eyes:    Why not just not have that use flag for the samba ebuild?

----------

## dfelicia

 *Quote:*   

> Why not just not have that use flag for the samba ebuild?

 

b/c not everyone wants/needs doc and [especially] swat.

----------

## Xamindar

 *dfelicia wrote:*   

>  *Quote:*   Why not just not have that use flag for the samba ebuild? 
> 
> b/c not everyone wants/needs doc and [especially] swat.

 

Yes, but it seems that even without the "swat" use flag swat is still being built.

----------

## linuxbum

Following the above USE flag changes and emerge --newuse --update --verbose 

Fixed my three SAMBA servers after emerge world -pv. broke them  :Smile: 

```

USE="doc swat" emerge samba --newuse --verbose --update

```

Swat now works again on local machines...  :Laughing: 

Bryan

----------

## jbpros

 *linuxbum wrote:*   

> Following the above USE flag changes and emerge --newuse --update --verbose 
> 
> Fixed my three SAMBA servers after emerge world -pv. broke them 
> 
> ```
> ...

 

FYI the --newuse parameter is not necessary, it is used to select packages that have use flag changes since compilation, nothing else. In other words, using it when you explicitly specify the packages to merge is just not necessary.

```
emerge --newuse world
```

The above call shows the interest of the --newuse parameter: select any package within the virtual group "world" that have use flags changed.

In our samba case:

```
USE="doc swat" emerge samba --verbose --update
```

Is sufficient. Though, I don't recommend using the USE= variable as it is lost whenever the package is recompiled without it.

Put swat and doc in package.use or make.conf and do:

```
emerge -avu --newuse world
```

or 

```
emerge -av samba
```

----------

