Home of the Squeezebox™ & Transporter® network music players.
Page 1 of 3 123 LastLast
Results 1 to 10 of 21
  1. #1
    Senior Member DJanGo's Avatar
    Join Date
    Sep 2005
    Location
    Germany
    Posts
    2,483

    bug in gerrelts squeezelite.sh

    Hi,

    in another thread here we had some disccusion about gerrelts script.

    Quote Originally Posted by K.Clemens View Post
    True..

    However, the mac adress should work without uncommenting it...

    Since i am not using this script but i do know it - i know that line is from gerrelt.
    Hopefully he sees that thread.

    These are the lines that didnt work anymore...

    Code:
    # get mac address from wifi adapter or on board network card
    SL_MAC_ADDRESS=$(ifconfig | grep '^wlan0 ' | tr -s ' ' | rev | sed -e 's/^[ \t]*//' | cut -d ' ' -f1 | rev)
    [ -n "$SL_MAC_ADDRESS" ] || SL_MAC_ADDRESS=$(ifconfig | grep 'eth0' | tr -s ' ' | rev | sed -e 's/^[ \t]*//' | cut -d ' ' -f1 | rev)
    Even on my rpi these lines didnt work anymore.

    I would use something like that instead:
    written / tested under rasbian 9.1

    Code:
    # ping your localhost subnet once
    ping -c1 127.0.0.0
    # find the active networkdevice 
    device=$(arp -a|grep ":"|cut -d ' ' -f7|sort -u)
    # find the macaddress of that device and use it as SL_MAC_ADDRESS
    SL_MAC_ADDRESS=$(cat /sys/class/net/$device/address)
    # make sure SL_MAC_ADDRESS contains : otherwise its malformed /useless and we clear the variable
    echo $SL_MAC_ADDRESS|grep ":" ||SL_MAC_ADDRESS=
    the last line should be at least added to the script - it clears SL_MAC_ADDRESS if its not containing the char :
    Last edited by DJanGo; 2017-11-30 at 23:34. Reason: typo and added some lines;arp -a|grep ":"|cut -d ' ' -f7|sort -u instead of arp -a|grep "on"|cut -d ' ' -f7|sort -u

  2. #2
    Senior Member
    Join Date
    Apr 2008
    Location
    Paris, France
    Posts
    2,138
    Yeah, I've read the thread, I don't know the script but if its purpose is to define a MAC address as player ID, why not define as many MAC as needed out of something (almost) completely arbitrary like "02:0a:0b:0c:0d:01", "02:0a:0b:0c:0d:02", etc.

    I see quite often my pCPs start with a nil player ID these days. Somehow it boots and starts squeezelite before the DHCP server had time to react. Or a switch gets in the way. So I use -m systematically.
    Yes, I do use the actual MAC from the host for that. It is sort of a nice touch, but frankly copying the real MAC serves no purpose and I have time to do it by hand, one setup at a time.

    The old script (whatever it does) is definitely dead thanks to systemd's last wonderful implementation of predictable network device names. "grep wlan" no more.
    Your script runs on raspbian 8, but it returns junk on the machine I used, which has 2 bridges (one with a wireless interface for AP use) active.
    I didn't try your snippet on pCP, but between busybox and sysfs I fear there could (will) be some portability issue.

    So why not go arbitrary all the way? I think my proposal breaks at 255 instances...
    3 SB 3 • Libratone Loop, Zipp Mini • iPeng (iPhone + iPad) • LMS 7.9 (linux) with plugins: CD Player, WaveInput, Triode's BBC iPlayer by bpa • IRBlaster by Gwendesign (Felix) • Server Power Control by Gordon Harris • Smart Mix, Music Walk With Me, What Was That Tune? by Michael Herger • PowerSave by Jason Holtzapple • Song Info, Song Lyrics by Erland Isaksson • AirPlay Bridge by philippe_44 • WeatherTime by Martin Rehfeld • Auto Dim Display, SaverSwitcher, ContextMenu by Peter Watkins.

  3. #3
    Senior Member DJanGo's Avatar
    Join Date
    Sep 2005
    Location
    Germany
    Posts
    2,483
    Quote Originally Posted by epoch1970 View Post
    I don't know the script but if its purpose is to define a MAC address as player ID, why not

    Hi,

    hell yeah - it was too late yesterday....

    My script didnt work on a non enu debian eather
    arp -a
    ? (192.168.199.103) auf
    it auf not on.

    Since squeezelite didnt need -m and always uses a hardware address - that whole script to find the hardwareadress is bullshit!

    thanks

  4. #4
    Senior Member Greg Erskine's Avatar
    Join Date
    Sep 2006
    Location
    Sydney, Australia
    Posts
    1,231
    Quote Originally Posted by epoch1970 View Post
    I see quite often my pCPs start with a nil player ID these days. Somehow it boots and starts squeezelite before the DHCP server had time to react. Or a switch gets in the way. So I use -m systematically.
    Hi epoch1970,

    I haven't seen this happen for a long time. I have never had the need to use the -m option. I am using slow wifi and a very old wifi router with DHCP.

    regards
    Greg

  5. #5
    Senior Member DJanGo's Avatar
    Join Date
    Sep 2005
    Location
    Germany
    Posts
    2,483
    Quote Originally Posted by epoch1970 View Post
    I see quite often my pCPs start with a nil player ID these days.
    did you use some "3rd party stuff or a regular simple service for squeezelite?
    my squeezelite sessions have always the networkstack as dependency - yours too?
    Quote Originally Posted by epoch1970 View Post
    Somehow it boots and starts squeezelite before the DHCP server had time to react. Or a switch gets in the way. So I use -m systematically.
    Thats maybe the solution for another problem...
    Your Macadresses are not called "Hardwareadress" by accident its exactly what this name told you.

    Your system knows its hardwareadress whenever the networkdevice is starting.
    There is no dhcp involed - dhcp only gives a ip address to a hardwareaddress - nothing else!

    Quote Originally Posted by epoch1970 View Post
    Yes, I do use the actual MAC from the host for that. It is sort of a nice touch, but frankly copying the real MAC serves no purpose and I have time to do it by hand, one setup at a time.
    yapp IMHO fake something like a mac address is fake / in harder words bullsh1t if there is only a single squeezelitesession on a hardware involved.
    And thats AFAIK the reason to fake the mac to allow more than a single squeezelitesession on a single hardwaredevice.

  6. #6
    Senior Member
    Join Date
    Apr 2008
    Location
    Paris, France
    Posts
    2,138
    Quote Originally Posted by Greg Erskine View Post
    Hi epoch1970,

    I haven't seen this happen for a long time. I have never had the need to use the -m option. I am using slow wifi and a very old wifi router with DHCP.

    regards
    Greg
    I have 4 players that are using DHCP, the network path has 2 "pro" switches along the way plus a software bridge, there is a dedicated VLAN, and the DHCP server is running on the (raspbian) Pi that runs LMS. The Pi runs a bit of routing/filtering and applications but it is normally not busy.
    The players boot fast and network config comes later, almost guaranteed. As a consequence, Squeezelite uses the nil player ID.
    That's a pain because when multiple players have the nil ID you only see one via LMS, so reaching to every one of them and setting the appropriate "-m" option can take a little time and guesswork.
    I'm using pCP 3.2.0 but I am fairly confident the culprit is either the Pi server or the switches which take their time learning the MACs. I'm using a MAC-defined VLAN for the players, maybe that doesn't help either.
    3 SB 3 • Libratone Loop, Zipp Mini • iPeng (iPhone + iPad) • LMS 7.9 (linux) with plugins: CD Player, WaveInput, Triode's BBC iPlayer by bpa • IRBlaster by Gwendesign (Felix) • Server Power Control by Gordon Harris • Smart Mix, Music Walk With Me, What Was That Tune? by Michael Herger • PowerSave by Jason Holtzapple • Song Info, Song Lyrics by Erland Isaksson • AirPlay Bridge by philippe_44 • WeatherTime by Martin Rehfeld • Auto Dim Display, SaverSwitcher, ContextMenu by Peter Watkins.

  7. #7
    Senior Member
    Join Date
    Apr 2008
    Location
    Paris, France
    Posts
    2,138
    Quote Originally Posted by DJanGo View Post
    yapp IMHO fake something like a mac address is fake / in harder words bullsh1t if there is only a single squeezelitesession on a hardware involved.
    Strong words, friend

    The issue is a little confusing, I have to admit:
    1 - There are people who need multiple instances
    2 - There are people who want to force the player to a specific identity, a good reason for that would be to retain player preferences when swapping hardware. (I've used active/backup wifi+ether bonding on a Pi player once or twice, it's funnier than useful, but it also makes a strong case for using option "-m")
    3 - There is a very specific condition that can happen in squeezelite: http://forums.slimdevices.com/showth...l=1#post890873
    (you can backtrack to the beginning of the conversation, it is short.)

    In my case, I use Pi 3s as pCP players. Wifi is disabled. I use a single instance of Squeezelite. Ok, my tc archive "is a little large" but really I don't think it has anything to do with the issue. The MAC address of the network interface is never a problem, my players always get a DHCP lease. But this takes a few seconds (10 secs?)
    So I get this problem: Squeezelite has started before networking has settled, it doesn't know what player ID to report, so it reports a nil ID.
    And "-m" solves it.

    (-m is a good option. It got a bad rap when people started "recycling" slimdevices MACs to software players and put unwarranted load over mysb.com, but it does have legitimate uses.)
    Last edited by epoch1970; 2017-12-03 at 06:18. Reason: Typos
    3 SB 3 • Libratone Loop, Zipp Mini • iPeng (iPhone + iPad) • LMS 7.9 (linux) with plugins: CD Player, WaveInput, Triode's BBC iPlayer by bpa • IRBlaster by Gwendesign (Felix) • Server Power Control by Gordon Harris • Smart Mix, Music Walk With Me, What Was That Tune? by Michael Herger • PowerSave by Jason Holtzapple • Song Info, Song Lyrics by Erland Isaksson • AirPlay Bridge by philippe_44 • WeatherTime by Martin Rehfeld • Auto Dim Display, SaverSwitcher, ContextMenu by Peter Watkins.

  8. #8
    Senior Member bakker_be's Avatar
    Join Date
    May 2009
    Location
    Kwaadmechelen, Belgium
    Posts
    639
    Quote Originally Posted by epoch1970 View Post
    Strong words, friend

    The issue is a little confusing, I have to admit:
    1 - There are people who need multiple instances
    2 - There are people want to force the player to a specific identity, a good reason for that would be to retain player preferences when swapping hardware. (I've used active/backup wifi+ether bonding on a Pi player once or twice, it's funnier than useful, but it also makes a strong case for using option "-m")
    3 - There is a very specific condition that can happen in squeezelite: http://forums.slimdevices.com/showth...l=1#post890873
    (you can backtrack to the beginning of the conversation, it is short.)

    In my case, I use Pi 3s as pCP players. Wifi is disabled. I use a single instance of Squeezelite. Ok, my tc archive "is a little large" but really I don't think it has anything to do with the issue. The MAC address of the network interface is never a problem, my players always get a DHCP lease. But this takes a few seconds (10 secs?)
    So I get this problem: Squeezelite has started before networking has settled, it doesn't know what player ID to report, so it reports a nil ID.
    And "-m" solves it.

    (-m is a good option. I got a bad rap when people started "recycling" slimdevices MACs to software players and put unwarranted load over mysb.com, but it does have legitimate uses.)
    Couldn't this be solved by modifying the start-up timing of squeezelite? Don't really know for PiCore, but on an OS where services are managed by systemd you'd add the following lines to the service file, to make it wait until runlevel 3:
    Code:
    [Install]
    WantedBy=multi-user.target
    Main System: Touch; Marantz SR-5004 + TMA Premium 905 + TMA Premium 901 + Teufel Ultima 20 Mk 2 + BK Monolith+ FF + Lenovo T460 + Kodi + Pioneer PDP-LX5090H
    Workshop: iPad 32GB Wifi + Squeezepad (local playback activated)
    Wherever needed: Acer Iconia Tab A700 + Squeezeplayer
    Kitchen: iPhone 5s + Squeezepad (local playback activated) + NAD 312 + Teufel Ultima 20 Mk 2
    Headphone (cozy corner): Lenovo T550 + Squeezelite-X + Aune X7S + Focal Elear
    Car: TBC ...

  9. #9
    Senior Member
    Join Date
    Apr 2008
    Location
    Paris, France
    Posts
    2,138
    Quote Originally Posted by bakker_be View Post
    Couldn't this be solved by modifying the start-up timing of squeezelite?
    If my theory is right, then yes it could solve the issue.
    But a nil ID is not a blocker, it is more of a nuisance. The issue doesn’t happen to everyone, obviously.
    And if you start waiting, when do you stop waiting, really?

    EDIT. Also, here is a super simple way of getting the ID right: reboot pCP or restart squeezelite. In the case of rebooting, this works because the switches and other devices in the path haven't had time to unlearn the MAC of the client yet, so the whole DHCP lease deal is faster than with a really cold start and SL can report an ID.

    Don't really know for PiCore, but on an OS where services are managed by systemd ...
    I am glad to report systemd is nowhere near in sight under Tiny Core. sysVinit triggers a chain of shell scripts that bring the machine up to order. Simple, sequential, and predictable.

    I for one am very happy with the way PCP works. I had this intriguing issue, I could find a probable cause, and solve it with 100% reliability via an easy config option. Can’t really ask for more...
    Last edited by epoch1970; 2017-12-03 at 06:42.
    3 SB 3 • Libratone Loop, Zipp Mini • iPeng (iPhone + iPad) • LMS 7.9 (linux) with plugins: CD Player, WaveInput, Triode's BBC iPlayer by bpa • IRBlaster by Gwendesign (Felix) • Server Power Control by Gordon Harris • Smart Mix, Music Walk With Me, What Was That Tune? by Michael Herger • PowerSave by Jason Holtzapple • Song Info, Song Lyrics by Erland Isaksson • AirPlay Bridge by philippe_44 • WeatherTime by Martin Rehfeld • Auto Dim Display, SaverSwitcher, ContextMenu by Peter Watkins.

  10. #10
    Senior Member paul-'s Avatar
    Join Date
    Jan 2013
    Posts
    969
    For what it's worth, pCP does wait for the network to get a IP/Broadcast address before starting squeezelite. The timeout is set to 20 seconds. Take a look a the log (/var/log/pcp_boot.log)

    Code:
    Waiting for network........... Done (11).
    Every dot between network and Done is 0.5seconds

    Squeezelite is what is picking up the interface address. For some reason that is failing on your system. Are you doing something that would be setting an environment variable called UTMAC?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •