Skip to content

Instantly share code, notes, and snippets.

@mafredri
Last active January 29, 2024 20:42
Show Gist options
  • Star 29 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save mafredri/e88401c91489232e92e493d0e02912ef to your computer and use it in GitHub Desktop.
Save mafredri/e88401c91489232e92e493d0e02912ef to your computer and use it in GitHub Desktop.
Samba config for Open PS2 Loader (PlayStation 2)
# This setup works pretty well for OPL with a network link that travels through
# two UniFi switches and connects to a Samba server running inside Docker. The
# host OS is Debian with a ZFS filesystem and the container OS is also Debian.
# Latest Samba (4.11+).
[global]
# ======================
# General Samba settings
# ======================
log level = 1
workgroup = WORKGROUP
server string = PS2 Samba Server
server role = standalone server
log file = /dev/stdout
max log size = 0
# Disable printers.
load printers = no
printing = bsd
printcap name = /etc/printcap
printcap cache time = 0
disable spoolss = yes
pam password change = yes
map to guest = bad user
usershare allow guests = yes
create mask = 0664
force create mode = 0664
directory mask = 0775
force directory mode = 0775
force user =
force group = users
# ===========================
# PlayStations 2 OPL settings
# ===========================
# Lower the minimum protocol to NT1 (a SMB1 dialect), this is required since
# Samba 4.11 changed the default and deprecated SMB1.
# See https://github.com/ifcaro/Open-PS2-Loader/issues/86 and
# https://github.com/ps2dev/ps2sdk/issues/72 for future SMB2 support.
server min protocol = NT1
server signing = disabled
smb encrypt = disabled
# Tweak socket options for lower delay. We also set TCP_KEEPIDLE to 20s which is
# about what it takes to reset the console and launch OPL, this avoids keeping
# file locks around for too long. We could try to optimize socket buffer sizes
# but Linux should do this automatically.
# TODO(mafredri): Do more testing with TCP_QUICKACK.
socket options = TCP_NODELAY TCP_KEEPIDLE=20 IPTOS_LOWDELAY SO_KEEPALIVE
# Disable keepalive to avoid hanging onto locks. Should not be needed
# due to SO_KEEPALIVE and helps with FMV audio stutter.
keepalive = 0
# ------------------------------------
# Attempt to speed up reads and writes
# ------------------------------------
# This setting only works for oplocked files but OPL doesn't oplock.
write cache size = 0
# Speed up directory listings.
getwd cache = yes
# Remove audio stutter in FMVs.
large readwrite = yes
# Disable asynchronous reads and writes.
aio read size = 0
aio write size = 0
# This might help with performance as the system doesn't need to check locks.
# OPL is the only client so we don't care about locks anyway.
strict locking = no
# ----------
# ZFS tuning
# ----------
# Don't listen to client requests for sync.
strict sync = no
# ZFS does not support preallocation (copy-on-write FS).
strict allocate = no
# Disable low-latency file operations for better performance.
read raw = no
write raw = no
# ----
# Misc
# ----
# Allow symlinks, useful for symlinking saves for multi-disk games.
follow symlinks = yes
[PS2]
comment = PlayStation 2
path = /mnt/ps2
browsable = yes
guest ok = yes
public = yes
available = yes
read only = no
veto files = /._*/.apdisk/.AppleDouble/.DS_Store/.TemporaryItems/.Trashes/desktop.ini/ehthumbs.db/Network Trash Folder/Temporary Items/Thumbs.db/
delete veto files = yes
@gdfsv
Copy link

gdfsv commented Nov 27, 2021

this hangs for me on Fatal Frame 3. I'm using BTRFS.

@mafredri
Copy link
Author

mafredri commented Nov 27, 2021

@gdfsv have you tried using different versions of Open PS2 Loader? Or changing game settings/hacks inside OPL? A hang sounds like a game specific OPL issue but I'm definitely no expert.

I'd start testing from the latest stable OPL release (v1.1.0), then try a newer beta, or some of the older v0 releases.

The only Samba change for btrfs I can think of is changing these from no to yes (it may or may not improve btrfs performance):

read raw = yes
write raw = yes

Btw, on what OS are you, and what version of Samba?

@gdfsv
Copy link

gdfsv commented Nov 30, 2021

i tried opl 1.0, 1.1.0, and latest beta. also done enable read/write write. issue persists.

i use NixOS. samba 4.15.0

@mafredri
Copy link
Author

mafredri commented Dec 1, 2021

@gdfsv ok, sounds like you have the bases covered in that department. Did you try changing the game modes (and experimenting with different combinations) in game settings (inside OPL)? That's the only thing I can think of that could help assuming the game is playable over Samba. That's about all the help I can provide in this instance.

@jamez2128
Copy link

jamez2128 commented Jan 14, 2022

add this line for passwords to work in OPL:
ntlm auth = yes

@GabubuAvailable
Copy link

If it still doesn't work, make sure to create a samba user:
sudo smbpasswd -a samba_user, where samba_user can be the username you want.

Restart the smb and nmb services with systemctl then open OPL and use the USER and PASSWORD used for creating the samba user previously.

@NetMan134
Copy link

write cache size is not present in samba 4+ afaik

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment