toolboc / psx-pi-smbshare

A swiss army knife for enhancing classic game consoles with Raspberry Pi
387 stars 34 forks source link

Raspberry pi 4 update? #10

Closed VersatileNinja closed 4 years ago

VersatileNinja commented 4 years ago

Can you update the image to be compatible with raspberry pi 4? I have the 2Gb model and it just black screens with the current image.

toolboc commented 4 years ago

@VersatileNinja,

That's interesting, the pre-supplied image offered in the releases is based on Raspbian, which is backwards compatible to all previous editions of the Pi (pi0/w, pi1, pi2, pi3 etc.). If the current image does not work on the pi4, it would seem that the latest release may not be forward compatible with the pi4. Can you verify this by ensuring that the latest psx-pi-smbshare release image works on another device (pi0/w, pi1, pi2, pi3 etc.) and then use that same SD card with a pi4?

I do not have a Raspberry Pi4 on hand to test, however, the setup script in this project should be capable of bootstrapping any device running a modern Debian based OS like Raspbian or Ubuntu.

To do this:

Let me know if you encounter any issues, it should work^TM

Assuming success here, I wonder if it makes more sense to move to a series of install steps based on the above rather than providing a pre-supplied image. The same steps could also be followed to update an existing install. Appreciate any feedback you provide here.

jamesfarnham commented 4 years ago

I get;

sudo: /etc/init.d/samba: command not found DAEMON_CONF="/etc/hostapd/hostapd.conf" interface=wlan1

driver=nl80211

ssid=XlinkKai hw_mode=g channel=7

ieee80211n=1

wmm_enabled=0 macaddr_acl=0 auth_algs=1 ignore_broadcast_ssid=0 wpa=2 wpa_passphrase=XlinkKai wpa_key_mgmt=WPA-PSK wpa_pairwise=TKIP rsn_pairwise=CCMP interface wlan1 static ip_address=10.254.0.1/16 nohook wpa_supplicant

interface=wlan1 bind-dynamic dhcp-range=10.254.0.2,10.254.0.100,12h Failed to start hostapd.service: Unit hostapd.service is masked. Config directory: /root/.xlink/ Initializing XLink Kai engine...

terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector >' what(): bind: Address already in use ./setup.sh: line 75: 5400 Aborted sudo kaiengine_arm Connection to 192.168.10.19 closed by remote host.

At the end of the installation. Full log here: https://pastebin.com/Eg3eU7MB

Is there any way to fix it? Thanks!

toolboc commented 4 years ago

@VersatileNinja.

Looking at the logs it looks like you ran the setup script more than once, which is fine but is the reason you are seeing this:

terminate called after throwing an instance of 'boost::exception_detail::clone_impl' what(): bind: Address already in use

This is because XLink Kai was already running at the time of execution and can basically be ignored.

Aside from that, logs look good with exception of :

sudo: /etc/init.d/samba: command not found

I assume this is due to samba now being called smbd on latest Raspbian? I'm not entirely sure because I don't have a pi4 to test. You can verify by listing the contents of /etc/init.d. If that is the case, changes would need to be made to the following.

I've stood up a branch which contains the suggested fix, i.e. changes references from /etc/init.d/samba to /etc/init.d/smbd. A better solution may exist using symlinks here, but we'll roll with this for now. Using your pi4 as-is, you should be able to try it out with (of course ignore the Xlink Kai Address already in use error):

Note: The only difference from before is we are pulling from the smbd branch instead of master

cd ~
wget -O setup.sh https://raw.githubusercontent.com/toolboc/psx-pi-smbshare/smbd/setup.sh
chmod 755 setup.sh
sudo ./setup.sh

This should work, if it does I'll go ahead and merge it in. Thank you again for posting detailed logs!

jamesfarnham commented 4 years ago

Here's another attempt on a fresh install, installing over the top had the same effect I think. It gets up to "Kai Engine: The engine is rocking Connect to: http://127.0.0.1:34522/", but can't connect to samba shares.

Thanks for your help!

https://pastebin.com/DzixUSma

toolboc commented 4 years ago

@jamesfarnham,

I've gone ahead an pulled the suggested changes to fix samba into master just now, I totally forgot that setup.sh references the master repo to pull configuration scripts so the previous fix to install from smbd branch would have given the same result.

Try running the following again (this time from master), no need to use a fresh install, just re-run over existing.

cd ~
wget -O setup.sh https://raw.githubusercontent.com/toolboc/psx-pi-smbshare/master/setup.sh
chmod 755 setup.sh
sudo ./setup.sh

Thank you for testing!

jamesfarnham commented 4 years ago

Thanks! Now I get:

https://pastebin.com/cZiD5gYV

Which looks fine ... But I'm not able to log in to the Samba server over Wi-fi. It throws up a login error in each case logging in with guest, or pi:raspberry. Is there a Samba log I could send that would help narrow that down?

I can see the share on Mac/Iphone file sharing app, but not log into it.

jamesfarnham commented 4 years ago

Ps2 over Ethernet gets the same error; 300 cant connect to SMB

jamesfarnham commented 4 years ago

Actually, running ./samba-init.sh got it to complete the mount on my mac;

pi@raspberrypi:~ $ ./samba-init.sh [global] workgroup = WORKGROUP usershare allow guests = yes map to guest = bad user allow insecure wide links = yes [share] Comment = Pi shared folder Path = /share Browseable = yes Writeable = Yes only guest = no create mask = 0777 directory mask = 0777 Public = yes Guest ok = yes force user = pi follow symlinks = yes wide links = yes

Then I could edit the /etc/samba/smb.conf file to change the path from /share to /media/sda1 - I guess that was the problem not letting the connection happen. I restarted samba and it works!

Update: Restarted the pi and killed it again! The order to get it working again was;

pi@smbshare:~ $ ./automount-usb.sh pi@smbshare:~ $ ./samba-init.sh pi@smbshare:~ $ sudo nano /etc/samba/smb.conf

(change /share to /media/sda1)

pi@smbshare:~ $ sudo service smbd restart

Then I was able to connect from a mac over wifi and from the PS2 over Ethernet.

toolboc commented 4 years ago

@jamesfarnham,

I hope automount isn't broken on the pi4.

Just FYI, when you plug in your external media (sda1), the automount-usb.sh script should trigger on it's own and reconfigure /share to point to /media/$PART (in your case sda1). Would you be able to verify this by pasting contents of /etc/samba/smb.conf before and after plugging in the external drive and also list out contents of the /media directory before and after?

If you need your working changes to be made permanent (I assume you are probably itching to play your games and not troubleshoot), you can modify /usr/local/bin/samb-init.sh as that is where the samba configuration is setup on boot.

Apologies for all the mess here, I'm happy we are making progress without a physical device present for me to test. Couldn't do this without your help!

Cheers!

jamesfarnham commented 4 years ago

smb.conf before plugging in usb:

[global] workgroup = WORKGROUP usershare allow guests = yes map to guest = bad user allow insecure wide links = yes [share] Comment = Pi shared folder Path = /share Browseable = yes Writeable = Yes only guest = no create mask = 0777 directory mask = 0777 Public = yes Guest ok = yes force user = pi follow symlinks = yes wide links = yes

media empty

after plugging in usb:

[global] workgroup = WORKGROUP usershare allow guests = yes map to guest = bad user allow insecure wide links = yes [share] Comment = Pi default shared folder Path = /media/sda5 Browseable = yes Writeable = Yes only guest = no create mask = 0777 directory mask = 0777 Public = yes Guest ok = yes force user = pi follow symlinks = yes wide links = yes

pi@smbshare:/media $ ls sda1 sda2 sda3

I only had to change sda5 to sda1 in the .conf and restart Samba to make it work this time. Before I wasn't plugging in the USB live, only booting with it already plugged in, if that could make a difference.

Always willing to break something in the name of science! Thanks again for your help and support.

toolboc commented 4 years ago

@jamesfarnham,

Hmmm, it seems automount is mostly working, the drive letter being (sda5) may or may not be an issue depending on what value was assigned at time of insertion. It should also work whether the drive is hot plugged or already inserted at boot time.

I’ll try to source a pi4 in the meantime and close this out when I can confirm it locally.

VersatileNinja commented 4 years ago

Just wanted to give a quick update as I revisited this recently with a 1GB RPI4.

After using the latest Raspbian lite (Feb 2020 release), I ran the following script:

cd ~
wget -O setup.sh https://raw.githubusercontent.com/toolboc/psx-pi-smbshare/master/setup.sh
chmod 755 setup.sh
sudo ./setup.sh

Let it do its thing, and then I reboot at the end for safe measure. I insert a usb drive (usb 2.0 or usb 3.0 port on RPI4 doesn't matter) and PS2 recognizes the smb share.

I assume xlink kai is working but I haven't tested that yet on my 360.

toolboc commented 4 years ago

Thank you for verifying, I’ve still not acquired a pi4 of my own so definitely appreciate your help here.

I’m going to keep the issue open until I get a device of my own and cut a release for pi4.

If any issues are noted, please let us know here.

Thanks again!

VersatileNinja commented 4 years ago

I can confirm I can access xlink kai on my rpi4 via the web browser by using pi_ip_address:34522

However, I cannot access the mounted usb share through windows. \SMBSHARE\share doesn't work like the readme webpage. In fact, I can't even the folder shared under Windows 10 under Windows Explorer under Network icon.

It's not that big of a deal, but if I could figure out how to access the share that be awesome thru Windows that be awesome.

toolboc commented 4 years ago

@VersatileNinja, it looks like a recent Windows 10 update now disables access to insecure Samba shares. For now, you can enable insecure Samba access on your PC by following these instructions: https://devanswers.co/network-error-problem-windows-cannot-access-hostname-samba/

I am a bit reluctant to enable user/pass by default in future releases as it increases complexity to configure access to the share on the PS2/3 side.