-
Notifications
You must be signed in to change notification settings - Fork 397
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐛 | 3 minute start-up time #1110
Comments
Because I had issues with my sd card: Can you test it with a faster card? Are tracks played instantly? |
I'm using a Transcend 300S 16 GB (Class 10 + UHS-I + UHS-Class 1, Read 95 MB/s, Write 10 MB/s). |
I'm trying to figure out where 14.029s lighttpd.service 12.876s smbd.service 8.528s phoniebox-startup-scripts.service 6.324s nmbd.service 6.298s dev-mmcblk0p2.device 5.569s [email protected] 4.782s dhcpcd.service 2.372s ssh.service 2.012s networking.service 1.981s systemd-udev-trigger.service 1.909s phoniebox-startup-sound.service 1.796s systemd-timesyncd.service 1.687s rng-tools.service 1.568s rpi-eeprom-update.service 1.550s avahi-daemon.service 1.501s rsyslog.service 1.455s systemd-update-utmp-runlevel.service 1.419s systemd-journald.service 1.401s atd.service 1.373s systemd-fsck@dev-disk-by\x2dpartuuid-d6a683cc\x2d01.service 1.371s mopidy.service 1.345s systemd-logind.service 1.264s [email protected] 1.127s systemd-rfkill.service 1.095s systemd-fsck-root.service 1.062s systemd-user-sessions.service 770ms wpa_supplicant.service 767ms systemd-update-utmp.service 709ms resolvconf.service 672ms systemd-tmpfiles-setup.service 607ms systemd-sysctl.service 594ms systemd-remount-fs.service 563ms fake-hwclock.service 537ms systemd-modules-load.service 534ms kmod-static-nodes.service 420ms dev-mqueue.mount 419ms alsa-restore.service 391ms systemd-journal-flush.service 367ms systemd-sysusers.service 331ms sys-kernel-debug.mount 323ms systemd-random-seed.service 320ms run-rpc_pipefs.mount 280ms sys-kernel-config.mount 277ms systemd-udevd.service 264ms console-setup.service 224ms nfs-config.service 178ms boot.mount 153ms systemd-tmpfiles-setup-dev.service 83ms ifupdown-pre.service So I can basically exclude an issue with the phoniebox startup script. I have also removed all Spotify folders and playlists to no effect. I'm wary about two stretches from the syslog: Oct 23 10:22:52 raspberrypi mpd: exception: Failed to create pid file "/run/mpd/pid": Permission denied Oct 23 10:22:52 raspberrypi systemd[710]: mpd.service: Main process exited, code=exited, status=1/FAILURE Oct 23 10:22:53 raspberrypi systemd[710]: mpd.service: Failed with result 'exit-code'. Oct 23 10:22:53 raspberrypi systemd[710]: Failed to start Music Player Daemon. Oct 23 10:22:53 raspberrypi systemd[710]: Reached target Default. Oct 23 10:22:53 raspberrypi systemd[710]: Startup finished in 35.338s. and Oct 23 10:22:53 raspberrypi mopidy[538]: INFO [MainThread] mopidy.__main__ Starting Mopidy 3.0.2 Oct 23 10:22:53 raspberrypi mopidy[538]: INFO [MainThread] mopidy.config Loading config from builtin defaults Oct 23 10:22:53 raspberrypi mopidy[538]: INFO [MainThread] mopidy.config Loading config from file:///usr/share/mopidy/conf.d/mopidy-local.conf Oct 23 10:22:53 raspberrypi mopidy[538]: INFO [MainThread] mopidy.config Loading config from file:///usr/share/mopidy/conf.d/mopidy.conf Oct 23 10:22:53 raspberrypi mopidy[538]: INFO [MainThread] mopidy.config Loading config from file:///etc/mopidy/mopidy.conf Oct 23 10:22:53 raspberrypi mopidy[538]: INFO [MainThread] mopidy.config Loading config from command line options Oct 23 10:22:53 raspberrypi mopidy[538]: ERROR [MainThread] mopidy.internal.log Loading logging config '/etc/mopidy/logging.conf' failed. 'formatters' Oct 23 10:23:00 raspberrypi mopidy[538]: INFO [MainThread] mopidy.__main__ Enabled extensions: iris, file, local, http, m3u, stream, spotify, softwaremixer, mpd Oct 23 10:23:00 raspberrypi mopidy[538]: INFO [MainThread] mopidy.__main__ Disabled extensions: none Oct 23 10:23:06 raspberrypi mopidy[538]: INFO [MainThread] mopidy.commands Starting Mopidy mixer: SoftwareMixer Oct 23 10:23:06 raspberrypi mopidy[538]: INFO [MainThread] mopidy.commands Mixer volume set to 30 Oct 23 10:23:06 raspberrypi mopidy[538]: INFO [MainThread] mopidy.commands Starting Mopidy audio Oct 23 10:23:06 raspberrypi mopidy[538]: INFO [MainThread] mopidy.commands Starting Mopidy backends: FileBackend, M3UBackend, StreamBackend, SpotifyBackend, LocalBackend Oct 23 10:23:07 raspberrypi systemd[1]: phoniebox-idle-watchdog.service: Succeeded. Oct 23 10:23:07 raspberrypi mopidy[538]: INFO [Audio-2] mopidy.audio.actor Audio output set to "alsasink" Oct 23 10:23:13 raspberrypi mopidy[538]: INFO [SpotifyEventLoop] mopidy_spotify.backend Logged in to Spotify in online mode Oct 23 10:23:14 raspberrypi mopidy[538]: INFO [SpotifyBackend-6] mopidy_spotify.web Logged into Spotify Web API as *commented out* Oct 23 10:24:45 raspberrypi mopidy[538]: INFO [SpotifyBackend-6] mopidy_spotify.playlists Refreshed 26 Spotify playlists Oct 23 10:24:45 raspberrypi mopidy[538]: INFO [MainThread] mopidy.commands Starting Mopidy core Oct 23 10:24:46 raspberrypi mopidy[538]: INFO [MainThread] mopidy.commands Starting Mopidy frontends: IrisFrontend, HttpFrontend, MpdFrontend Oct 23 10:24:46 raspberrypi mopidy[538]: INFO [IrisFrontend-11] mopidy_iris.core Starting Iris 3.52.4 Oct 23 10:24:46 raspberrypi mopidy[538]: INFO [HttpFrontend-13] mopidy.http.actor HTTP server running at [::ffff:0.0.0.0]:6680 Oct 23 10:24:46 raspberrypi mopidy[538]: INFO [MainThread] mopidy_mpd.actor MPD server running at [::ffff:0.0.0.0]:6600 Oct 23 10:24:46 raspberrypi mopidy[538]: INFO [MainThread] mopidy.commands Starting GLib mainloop Oct 23 10:24:46 raspberrypi mopidy[538]: INFO [MpdSession-15] mopidy_mpd.session New MPD connection from [::ffff:127.0.0.1]:47524 Oct 23 10:24:48 raspberrypi mopidy[538]: INFO [MpdSession-16] mopidy_mpd.session New MPD connection from [::ffff:127.0.0.1]:47528 Oct 23 10:24:48 raspberrypi bash[326]: OK MPD 0.19.0 Oct 23 10:24:48 raspberrypi bash[326]: OK Oct 23 10:24:48 raspberrypi bash[326]: OK |
lighttpd should start up very quickly, even on embedded devices, though openssl may pause during initialization while waiting for a newly booted system to generate sufficient entropy. I'd recommend making sure you are running the latest lighttpd release from Debian buster (lighttpd 1.4.53 + patches), and, if you can, the latest lighttpd from buster-backports (lighttpd 1.4.55) |
Another idea: |
I've been trying to cut down my start up time a bit and right now I'm at roughly 90 seconds. The most time is used to start up Mopidy now. I wasn't successful in trying to cut down the used mopidy extensions. I just want to play Spotify tracks/albums/playlists with the Phoniebox, but disabling any of the extensions made the box unusable. |
Overclocking the RPi Zero for the initial 60 seconds, I'm now at |
I am also looking into getting my Phoniebox to start up faster. Only at the beginning of the process and with two very small kids I am a bit slow getting into it (new to playing with a Raspberry...)
How is this done? Taking quite some time on mine, too... Is it still possible to refresh playlists manually when needed? I would like to use a playlists where I can add songs that my kids like just from my Spotify app, but I would be ok to manually refresh the list on the Phoniebox if that gets it to start faster. |
@olli83 I will be able to share the small changes I made in the mopidy-spotify tomorrow. Regarding the refreshing, I noticed that mopidy-spotify loads all, even just favourited playlists from my Spotify accounts on every startup (e.g. "Refreshed 26 playlists from Spotify"). |
@olli83 I tested this again and actually you just have to set |
Hi @MiczFlor, I added the bit about skipping the initial Spotify playlist refresh by |
Where did you comment out a wait for mpd? I am using the classic version without Spotify and my Raspberry boots 1min+
|
What is the command to list this startup time for the services? I found I think the MDP wait is commented out in #########################################
# wait until mopidy/MPD server is running
STATUS=0
while [ "$STATUS" != "ACTIVE" ]; do STATUS=$(echo -e status\\nclose | nc -w 1 localhost 6600 | grep 'OK MPD'| sed 's/^.*$/ACTIVE/'); done I commented this out, too. It does not have any negative effect for my setup. I also removed the start sound. This is 4 seconds long and seems so, that you have to wait for it until it's fully played. There are 2 seconds silence at the beginning of the start sound. |
The command to analyze the startup times is Nice, I'll try to comment out the mpd startup and start sound also to check the impact on the times. |
Hmm, interesting that the started services are so different for our installations:
I also removed samba (don't know, why there is a service left) and exim4 using apt. I disabled "Wait for Network on Boot" in the raspi-config. That's all I've done so far. I hope this helps. |
I'm also on a RPi Zero W, I suppose that performance goes up considerably depending on the Pi that is used. |
Yes, that's true. I meant not the starting time itself, it's more about the service names. @s-martin Do you know a command or preferred log file to analyse the start up of the phoniebox service better? syslog is not a good option, there is so much stuff going on. |
I commented out the wait for MPD, then startup finishes considerably faster, but the player still won't react until MPD and mopidy are running completely. So unfortunately I cannot apply this in my use case (only Spotify player). |
@Huseriato Unfortunately I don't know a good tool. If there's something difficult to find i usually copy the log via WinSCP to my Windows machine and use Notepad++ to find stuff (and bulk remove noise). Following things for startup time should be considered:
Hope this helps and I guess I should add that to the wiki, too. ;) |
@Toqqi you're right. Commenting out the MDP wait, leads to wait time after boot is finished until the cards are working. I was so focused on boosting this time, I forgot to test a card immediately. I'm currently thinking about, if I really need Spotify. I think the box is more reliable, when using local media. I've not integrated a power bank, because I wanted to make the children's room more attractive to the kids. But the box is attachable to a powerbank or a car outlet. So the box is theoretically portable, but is considered to be in the children's room. @s-martin Thanks for your input. So is it true, that the non spotify version plays the tracks using mpg123? Or how does this work here? |
mpg123 is just used for startup sounds. The classic edition uses MPD, spotify edition uses Mopidy. |
A new installation improved my startup time from 90s to 30s. Weird. |
I have the same issue (+Spotify edition, RPi0W, freshly installed 2.1.1). Future owner will have to stretch all his patience to wait ~3mins for the startup sound :( |
@arrisde, unfortunately I think RPi Zero and Spotify edition may lead to long boot times, but if you have some improvements to share many Phoniebox users would be interested. |
Please check #1174 for some performance improvements especially on Pi Zero |
I am trying to speed up the boot on the rpi zero as well. The following steps I did with at least some success:
At the moment I have audio available 30s after the boot. what I still want to do:
my goal is to boot til audio in at least 20s. br |
So I improved some more seconds, basically be removing further plugins from mpd. you can find the details here Maybe there is still a little more potential in mpd, but not much. |
I finally managed to boot to sound in 20 sec
A more detailed bootchart can be generated with systemd-bootchart Details: disabled systemd generators blacklisted modules: |
I got another 5s by compiling a custom kernel, sound in 15s now. basically I tried to disable things which I don't need (trace_fs, usb_otg) If you are interested, here is the kernel config as well: I mainly followed the instructions here for cross compiling: |
Hi, mostly the startup time is caused because of mopidy refreshing the spotify playlists. I wrote some speed hacks here: https://splittscheid.de/phoniebox-schneller-booten-fehler-beheben/ Another option is to try a OS like dietPi. It boots up pretty fast. But i stay at Raspbian and i am searching for more Speed Hacks. The custom kernel sounds good @arne123, i will try that! |
@arne123 can you provide some guidance on how to reproduce your steps? I'm using a RPi Zero W with the RC522 RFID reader and the HifiBerry miniamp and it takes 60s until I hear the startup sound and can start using the box. Any help is greatly appreciated! For the record my
|
I think you will have the biggest benefit recompiling mpd. Then you have to deal with systemd and the systemd configuration files. Probably you don't need avahi-daemon.service, there are also some other services which I don't see on my setup. |
Hey @arne123 thank you for your reply! Although I know my way around Linux I never found myself dealing with that aspect of the OS before, so I don't know much about systemd and how to tweak it. I just learned about Thanks again for your input, it is much appreciated. |
systemd-analyze plot > boot.svg will give you an svg where you can get an impression of the dependencies during boot. Try this mpd: mpd.gz, [Service] do you use samba to access your box? |
@arne123 I don't know how to thank you 😂 First of all good catch with the samba service. Since I use the webinterface to upload audio and scp to copy files like the mpd binary you just provided, I won't miss samba. But most of all thank you for compiling and sharing your mpd binary with me! I have no idea what you did there or how, but it simply works and you just reduced my boot time from ~60 to ~35 seconds 🤯 Thank you so much! P.S.:
|
Hi @arne123 |
@arne123 |
Sure, I thought I already did, here is the latest: To all using that binary, please be aware that the mpd is build on the rpi zero w, with the instruction set armv6l of that specific processor . I believe that newer arm processors are mostly backwards compatible, but you might run into some issues running it on different environments. Here is the discussion I had in the mpd forum: The conclusion is, that not mpd itself is causing the long start time, but the load of several shared libraries which are mostly not used, so I removed as much as possible of them. |
@arne123 I will do some research in order to apply your meson build flags to mopidy-mpd. Thanks! |
I never had a deeper look into mopidy yet, but I think that mopidy-mpd is a python based reimplementation of mpd. From https://github.com/mopidy/mopidy-mpd: "MPD stands for Music Player Daemon, which is also the name of the original MPD server project. Mopidy does not depend on the original MPD server, but implements the MPD protocol itself, and is thus compatible with most clients built for the original MPD server" |
I have a fresh develop install with spotify. I was wondering about the Startup speed too as I did not yet add anything to the system: So for sure I can disable some services but the first one is most interesting: So most time is consumed while executing startup scripts, right? Any recommendation how to speed this up? I'm using pi zero 2 and was hoping to get 20s start up time... |
Have a look at this. The issue is often Here is a before and after comparison: From
To
|
Just wanted to add
In case someone wants to rebuild mpd using above approach and following mpd doc , for 0.23.9 you need to add Additionally for web streaming you need to explicitly set mad is necessary for playing the streams, as mpg123 cannot deal with web urls. Make sure you are building the proper config. Hope this helps. |
The Mopidy refresh problematic is solved in the newest version introduced with #2315 |
Bug
phoniebox-startup-scripts.service takes around 3 minutes to start up, then runs fine. I'm looking for help to resolve whatever error is causing the delay.
What I did
I installed the raspberry pi with above mentioned buster image and ran the installer script.
What happened
I takes a long time until the startup sound is played (3 minutes).
From
systemd-analyze blame
I instantly noticed2min 57.826s phoniebox-startup-scripts.service
.Then
journalctl -u phoniebox-startup-scripts.service -b
revealedI expected this to happen
From other posts, I am seeing that
phoniebox-startup-scripts.service
only takes around 4 seconds to start.Further information that might help
Output of
tail -n 500 /var/log/syslog
Output of
journalctl -u mopidy
Software
Base image and version
Output of
cat /etc/os-release
Branch / Release
master
Installscript
scripts/installscripts/buster-install-default.sh
Hardware
RaspberryPi version
Raspberry Pi Zero W Rev 1.1
RFID Reader
SBC-RFID-RC522
Soundcard
HiFiBerry Miniamp
Other notable hardware
The text was updated successfully, but these errors were encountered: