Skip to content

Instantly share code, notes, and snippets.

@mafredri
Last active November 11, 2024 05:10
Show Gist options
  • 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
@SpazCode153
Copy link

@tomeq82 are there any logs for the container? you can run the following command to see the logs for the container: sudo docker container logs CONTAINER_NAME

just replace CONTAINER_NAME with your container name or the container id

@tomeq82
Copy link

tomeq82 commented Jun 7, 2024

@SpazCode153 in fact, I have a lot of the debugs - I enabled level 5, then reduced do level 3.
Each time it says "waiting for connections" is my restart of the container as it simply exits/dies.
Also, any meaningful error is something like that when tried to read the file:

https://pastebin.com/RSLTcRhv

and here are the other logs:
https://pastebin.com/0sm1hcrp

What is surprising it is not repatable situation eg. sometimes I got into listing of the particular game inside the share, but most of the time it simple drops error 300 or 301.

@SpazCode153
Copy link

@tomeq82 Just to confirm, your PS2 is directly connected to the samba device via LAN cable? What device are you using to share your games via samba?

@tomeq82
Copy link

tomeq82 commented Jun 7, 2024

@SpazCode153 no, PS2 is connected to the same lan as NAS hosting the container with samba. Docker container, vanilla alpine linux + just samba packages.

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