The original is quite something:
But this piano solo is something else:
The original is quite something:
But this piano solo is something else:
If a question is popular and gets a lot of attention, but is on a slightly complex topic, what will happen? Enough stupid users will look at it, miss-interpret it and vote to close it. It just takes 5 idiots over any length of time. But then to get it re-opened, it’s near impossible. It takes 5 users over a short time. Yes, there’s a time limit, but only for reopening. And of course, once a question’s closed, views plummet because the SE system makes it so. So that question is then dead. A valuable question which brings a challenging concept [to some] … is permanently dead.
And what if you delete and start again? You get penalised. You can even get banned. What happens if you ask it a second time? It gets marked as a duplicate.
This is just one way in which the SE system is broken. And it is trolls that are breaking it.
Rant over. For now.
Rather than reduce Raspbian by uninstalling packages and hacking down services run at boot-up to give a minimal system that runs NodeJS, I thought I’d try starting with a minimal system using RaspberryPi-UA-NetInst and just adding what’s needed.
That link gives an excellent tutorial on getting started. But before you install it, there are tweaks to be made before installing it that will get a lot of stuff set up on installing, rather than afterwards. This is a great bonus because if you ever have to reinstall, you don’t have to reconfigure the system each time. Simply format the SD card, place your modified installer files on the card, put it in the RPi and boot up, cross fingers and it’ll all be installed in under 30 minutes. And it can all be done over WiFi without touching a network cable!
So simple! Just follow Method#1 in this previous tutorial of mine, but replace the contents of on-first-login.sh with the following:
echo ------ Running /boot/CUSTOM/on-first-login.sh ---------
# output all contents of STDOUT and STDERR from this script into STDOUT *and* log file
exec &> >(tee -a ~/.on-first-login.log)
# install git
apt-get install git -y
# get the node version manager and check it out into /root/.nvm
git clone https://github.com/creationix/nvm.git ~/.nvm
git checkout v0.32.0
chmod 0755 nvm.sh
# let nvm do its stuff now
# make nvm do its stuff in future
echo "source ~/.nvm/nvm.sh" >> ~/.bashrc
# install node 6.6.0
nvm install 6.6.0
# this is a good place to put more stuff...
# eg install your server code, have the server
# start on boot-up, etc etc
echo ------ INSTALLATION COMPLETE! ---------
You might want to tweak the installer to create a user besides root, it seems to be a preferred way of doing things! But I’ll leave that to you. From here you can test out your new NodeJS server, check out this NodeJS tutorial.
This can be taken a few steps further still though! What if you want your entire NodeJS Pi server set up un an unattended fashion, right up to downloading your NodeJS source code from GitHub and running the server? And configuring systemd so it starts up automatically every time? No problem! Tutorial coming soon! 😉
Disadvantages of NodeJs:
Avoid asynchronous he’ll with Node Fibers:
Web framework for NodeJs:
GPIO access with NodeJs:
Want a bare-bones Raspbian distribution? Start with this one:
But what if you want to make a custom installer which comes with more? With either of the above, there are two ways you can do this:
The problem is the former does not give scope for configuration, and the latter is somewhat of a black art. For example, in post-install.txt you cannot simply include commands like this:
apt-get install xyz
Instead you need to do this:
chroot /rootfs /usr/bin/apt-get install xyz
And if you want to manipulate files that will appear on the final installation, God help you. I have had mixed success with this. YMMV!
This brings me to the greatest resource for moving forward:
There are three options it hints at:
I will explore them in that order….
This assumes that you’ll be using the Pi’s UART via a USB-serial console, rather than using SSH to log in.
First, get a copy of the raspbian-ua-netinst installer, and follow the instructions, all from here: RaspberryPi-Ua-NetInst.
Everything we need to do will involve adding and changing files they provide that will be going onto your SD card before you put it in your Pi.
They way this method works is first we will configure the installer by making a configuration file in the root of the SD card called installer-config.txt . Put the following in it to make output go to the UART:
cmdline="dwc_otg.lpm_enable=0 console=serial0,115200 elevator=deadline fsck.repair=yes"
Once the installer has done most of the installing, we will tack on a few things for it to do by adding a file at the root of the SD card called post-install.txt . It will run these commands before the installer after it’s done the installing, but before it reboots.
The final feature of the installer that we will use, is it allows us to bundle any files we want onto the SD card, and tell it where it should place them on the final system. We do this by placing them in /config/files/ , and listing them in /config/my-files.txt as per the instructions.
Putting it all together, we will use these features of the installer to firstly make the system automatically log in once the installer reboots, then to have the system run a script we’ll make once it’s logged in.
We will adapt this tutorial which shows how to make the Pi log in automatically when boot up after installation, using systemd, which we will configure to do so simply by adding a file we’ll call serial-getty@ttyAMA0.service into two places within /config/files .
Secondly, when the system is installed and boots and automatically logs-in for the first time, we’ll get the system to run our commands by putting a little something into the .bashrc file in root’s home directory. Here’s how:
In the installer files that you copy on to the SD card, edit /config/my-files.list and add these lines:
root:root 755 /etc/systemd/system/getty.target.wants/serial-getty@ttyAMA0.service
root:root 755 /etc/systemd/system/serial-getty@ttyAMA0.service
root:root 755 /root/on-first-login.sh
Create this directory structure:
Make two files, both called serial-getty@ttyAMA0.service , in the following locations:
With the following in each:
# This file is part of systemd.
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
# Modified from /lib/systemd/system/serial-getty@.service
Description=Serial Getty on %I
After=dev-%i.device systemd-user-sessions.service plymouth-quit-wait.service
# If additional gettys are spawned during boot then we should make
# sure that this is synchronized before getty.target, even though
# getty.target didn't actually pull it in.
# ExecStart=-/sbin/agetty --keep-baud 115200,38400,9600 %I $TERM
ExecStart=-/sbin/agetty --autologin root --noclear --keep-baud 115200,38400,9600 %I $TERM
Then make a file called on-first-login.sh in this location:
With the following contents:
echo ------ Running ~/on-first-login.sh ---------
# outputs all contents of STDOUT and STDERR from this script into STDOUT *and* log file
exec &> >(tee -a ~/.on-first-login.log)
# this is where the magic happens! Here, finally, we can do what we want
# to configure our system.
Make a file at the root of the installation files called add.bashrc with the following:
if [ ! -f ~/.on-first-login.log ]; then
Now create a file at the root of the installation files called post-install.txt and put this in it:
cat /bootfs/add.bashrc >> /rootfs/root/.bashrc
And that’s it! Now you have what you need to easily set up your system post-installation without any attention required – it will do the entire thing without any input, just insert the SD card, power-up and wait 20 minutes! Just put your post-installation commands in on-first-login.sh .
Why is Linux so hard? You have to do a lot of rooting around.
(Sorry… worst joke yet)
As usual, tutorials on Linux become out of date quickly. And as usual, linux tutorials always need fiddling to get working on any setup different to that of the author’s. So here is how I got node v4.0 installed on the RPi version B with Raspbian:
First, from this tutorial:
tar -xvf node-v4.0.0-linux-armv6l.tar.gz
sudo cp -R * /usr/local/
Then, from this tutorial:
git clone https://github.com/creationix/nvm.git ~/.nvm && cd ~/.nvm && git checkout v0.25.4
Then edit ~/.bashrc:
sudo nano ~/.bashrc
Add this line at the end:
Then edit ~/.profile:
sudo nano ~/.profile
Add this line at the end:
Finally you can get on with actually using it!
But if you want a slimmed-down Raspbian, try my tutorial on getting RaspberryPi-Ua-NetInst working with NodeJs.
This tutorial has a great introduction to using Node.JS. It requires NodeJS v4.0 which you should now have. Plus you now have nvm , the node version manager, which it also requires.
I have been programming for about 20 years. Within that, about a solid year has been fiddling with Linux. Yet I wonder how much I’ve been able to remember. When ever I try to set something up in Linux, I quickly start swearing like a trooper, and end up Googling things like “I f****ing hate Linux”. Or “Why is Linux so f***ing obscure”. It’s reassuring to know I’m not alone.
But why do I keep going back? Because it has its place. While I think it is unfit as a desktop OS for 99.9% of cases, (stats don’t lie. How many people actually use it for that?) The fact is it is beyond widespread on servers, and frequently used for embedded systems and systems like the Raspberry Pi. If you know what you’re doing, (if you *really* know what you’re doing), you can butcher it, configure it and extend it to your heart’s content. Oh, and it’s free. That’s why I love it.
You just need to read through the comments on this blog post to see plenty of reasons Linux is hated. But I’m going to add a couple. I’m fiddling with an RPi at the moment, so I will have plenty of reminders for what to say on this matter.
The truth is that whenever I try something remotely ambitious in Linux, I end up throwing in the towel. We shall see how this goes.
Have you tried understanding entries in /etc/inittab ? Even once you know how it works, there’s no denying that the syntax is cryptic compared to how modern programming languages might specify the same configurations. It’s hardly as ubiquitous as JSON.
Why is it so hard to get things working on Linux? The problem is threefold:
These are some options for using a stripped-down RPi when you need the best performance by tailoring what you need to the bare minimum.
Why stripped down? If you want it fast. Fast boot, fast processing, low latency. The RPi is in the order of 100 times faster than 8-bit PIC microcontrollers that I’m used to using, yet most Linux distributions adds a lot of bloat for these kinds of use-cases.
In order from high to low level:
Raspbian: It’s well supported; regular updates and plethora of available packages. Also, packages can quickly be removed as per this previous post, and boot time and other run-time resource hogs can be eliminated as per this previous post.
Why not Arch linux? It’s an option. However, I spent a day just trying to get it to boot, with no luck. It is no longer an option in the NOOBS installer, and having no previous experience with it, and little experience with the RPi, I’d lost before I started.
Start with Raspbian-Ua-NetInst and build it up: If the experience with Arch was too ambitious, then this probably is too. While it is dead easy to install, I wouldn’t want to spend months and months learning with no guarantee of success; I’d want to start with something that just works – even if mediocre – and take it from there. It doesn’t even come with a package manager, and a quick Google search shows that the lack of tutorials for building on it might be a deal-breaker.
Why not MiniBian? ‘Cos I just found out about it.
PiLFS: Probably the lowest level besides bare-metal, but still pretty bulky. It’s not all that clear how much space it would take on the SD card; somewhere between 8MB and 1GB as a minimum??
Why not bare-metal? Are you kidding me? I don’t want to write a Web server, or networking capability from scratch. The reason I’ve decided to use a RPi is to give powerful high-level programming capability to really get stuff done. However, a great tutorial is here: http://www.valvers.com/open-software/raspberry-pi/step01-bare-metal-programming-in-cpt1/. It is a massive 5-part tutorial which gets you a long way, relatively speaking; great if you just want a quick way of hammering hardware.
This post will be a work-in-progress. How to reduce boot time of your Raspberry Pi running Raspbian?
First you need to know how long it actually takes to boot up so you can assess your progress.
It has the added benefit of telling you what is happening in that time. Run that command and it will give an output like this:
pi@raspberrypi:/etc $ dmesg
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Initializing cgroup subsys cpuset
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Initializing cgroup subsys cpuacct
[ 0.000000] Linux version 4.4.11+ (dc4@dc4-XPS13-9333) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611) ) #888 Mon May 23 20:02:58 BST 2016
[ 0.000000] CPU: ARMv6-compatible processor [410fb767] revision 7 (ARMv7), cr=00c5387d
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
[ 0.000000] Machine model: Raspberry Pi Model B Rev 1
[ 0.000000] cma: Reserved 8 MiB at 0x0b400000
[ 0.000000] Memory policy: Data cache writeback
[ 0.000000] On node 0 totalpages: 49152
[ 0.000000] free_area_init_node: node 0, pgdat c0880270, node_mem_map cbe3c700
[ 0.000000] Normal zone: 432 pages used for memmap
[ 0.000000] Normal zone: 0 pages reserved
[ 0.000000] Normal zone: 49152 pages, LIFO batch:15
[ 0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[ 0.000000] pcpu-alloc:  0
[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 48720
[ 0.000000] Kernel command line: dma.dmachans=0x7f35 bcm2708_fb.fbwidth=1824 bcm2708_fb.fbheight=984 bcm2708.boardrev=0x3 bcm2708.serial=0xda25038e smsc95xx.macaddr=B8:27:EB:25:03:8E bcm2708_fb.fbswap=1 bcm2708.uart_clock=3000000 vc_mem.mem_base=0xec00000 vc_mem.mem_size=0x10000000 dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p7 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
[ 0.000000] PID hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.000000] Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
[ 0.000000] Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
[ 0.000000] Memory: 176896K/196608K available (6051K kernel code, 436K rwdata, 1840K rodata, 380K init, 726K bss, 11520K reserved, 8192K cma-reserved)
[ 0.000000] Virtual kernel memory layout:
vector : 0xffff0000 - 0xffff1000 ( 4 kB)
fixmap : 0xffc00000 - 0xfff00000 (3072 kB)
vmalloc : 0xcc800000 - 0xff800000 ( 816 MB)
lowmem : 0xc0000000 - 0xcc000000 ( 192 MB)
modules : 0xbf000000 - 0xc0000000 ( 16 MB)
.text : 0xc0008000 - 0xc07bcddc (7892 kB)
.init : 0xc07bd000 - 0xc081c000 ( 380 kB)
.data : 0xc081c000 - 0xc0889348 ( 437 kB)
.bss : 0xc0889348 - 0xc093eef0 ( 727 kB)
[ 0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] NR_IRQS:16 nr_irqs:16 16
[ 0.000029] sched_clock: 32 bits at 1000kHz, resolution 1000ns, wraps every 2147483647500ns
[ 0.000074] clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1911260446275 ns
[ 0.000173] bcm2835: system timer (irq = 27)
[ 0.000480] Console: colour dummy device 80x30
[ 0.001430] console [tty1] enabled
[ 0.001485] Calibrating delay loop... 697.95 BogoMIPS (lpj=3489792)
[ 0.060342] pid_max: default: 32768 minimum: 301
[ 0.060734] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.060807] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.061825] Disabling cpuset control group subsystem
[ 0.061924] Initializing cgroup subsys io
[ 0.061991] Initializing cgroup subsys memory
[ 0.062080] Initializing cgroup subsys devices
[ 0.062146] Initializing cgroup subsys freezer
[ 0.062207] Initializing cgroup subsys net_cls
[ 0.062327] CPU: Testing write buffer coherency: ok
[ 0.062444] ftrace: allocating 20616 entries in 61 pages
[ 0.173987] Setting up static identity map for 0x81c0 - 0x81f8
[ 0.175934] devtmpfs: initialized
[ 0.184293] VFP support v0.3: implementor 41 architecture 1 part 20 variant b rev 5
[ 0.184924] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[ 0.186760] pinctrl core: initialized pinctrl subsystem
[ 0.187685] NET: Registered protocol family 16
[ 0.193101] DMA: preallocated 4096 KiB pool for atomic coherent allocations
[ 0.201456] hw-breakpoint: found 6 breakpoint and 1 watchpoint registers.
[ 0.201545] hw-breakpoint: maximum watchpoint size is 4 bytes.
[ 0.201751] Serial: AMBA PL011 UART driver
[ 0.202217] 20201000.uart: ttyAMA0 at MMIO 0x20201000 (irq = 81, base_baud = 0) is a PL011 rev2
[ 0.566612] console [ttyAMA0] enabled
[ 0.571098] bcm2835-mbox 2000b880.mailbox: mailbox enabled
[ 0.618546] bcm2835-dma 20007000.dma: DMA legacy API manager at f2007000, dmachans=0x1
[ 0.628936] SCSI subsystem initialized
[ 0.633078] usbcore: registered new interface driver usbfs
[ 0.638806] usbcore: registered new interface driver hub
[ 0.644328] usbcore: registered new device driver usb
[ 0.659571] raspberrypi-firmware soc:firmware: Attached to firmware from 2016-05-20 19:01
[ 0.695465] clocksource: Switched to clocksource timer
[ 0.752208] FS-Cache: Loaded
[ 0.755667] CacheFiles: Loaded
[ 0.778533] NET: Registered protocol family 2
[ 0.784267] TCP established hash table entries: 2048 (order: 1, 8192 bytes)
[ 0.791432] TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
[ 0.797913] TCP: Hash tables configured (established 2048 bind 2048)
[ 0.804516] UDP hash table entries: 256 (order: 0, 4096 bytes)
[ 0.810468] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[ 0.817217] NET: Registered protocol family 1
[ 0.822215] RPC: Registered named UNIX socket transport module.
[ 0.828273] RPC: Registered udp transport module.
[ 0.833010] RPC: Registered tcp transport module.
[ 0.837776] RPC: Registered tcp NFSv4.1 backchannel transport module.
[ 0.845579] hw perfevents: enabled with armv6_1176 PMU driver, 3 counters available
[ 0.854731] futex hash table entries: 256 (order: -1, 3072 bytes)
[ 0.877556] VFS: Disk quotas dquot_6.6.0
[ 0.881939] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[ 0.891922] FS-Cache: Netfs 'nfs' registered for caching
[ 0.898752] NFS: Registering the id_resolver key type
[ 0.903932] Key type id_resolver registered
[ 0.908275] Key type id_legacy registered
[ 0.916660] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)
[ 0.924562] io scheduler noop registered
[ 0.928673] io scheduler deadline registered (default)
[ 0.934273] io scheduler cfq registered
[ 0.940952] BCM2708FB: allocated DMA memory 4b800000
[ 0.946131] BCM2708FB: allocated DMA channel 0 @ f2007000
[ 0.975389] Console: switching to colour frame buffer device 228x61
[ 2.029462] bcm2835-rng 20104000.rng: hwrng registered
[ 2.035022] vc-cma: Videocore CMA driver
[ 2.039122] vc-cma: vc_cma_base = 0x00000000
[ 2.043933] vc-cma: vc_cma_size = 0x00000000 (0 MiB)
[ 2.049493] vc-cma: vc_cma_initial = 0x00000000 (0 MiB)
[ 2.055521] vc-mem: phys_addr:0x00000000 mem_base=0x0ec00000 mem_size:0x10000000(256 MiB)
[ 2.090201] brd: module loaded
[ 2.106329] loop: module loaded
[ 2.110835] vchiq: vchiq_init_state: slot_zero = 0xcb880000, is_master = 0
[ 2.120438] Loading iSCSI transport class v2.0-870.
[ 2.126981] usbcore: registered new interface driver smsc95xx
[ 2.133178] dwc_otg: version 3.00a 10-AUG-2012 (platform bus)
[ 2.339709] Core Release: 2.80a
[ 2.342960] Setting default values for core params
[ 2.347966] Finished setting default values for core params
[ 2.554042] Using Buffer DMA mode
[ 2.557522] Periodic Transfer Interrupt Enhancement - disabled
[ 2.563491] Multiprocessor Interrupt Enhancement - disabled
[ 2.569225] OTG VER PARAM: 0, OTG VER FLAG: 0
[ 2.573735] Dedicated Tx FIFOs mode
[ 2.577875] WARN::dwc_otg_hcd_init:1047: FIQ DMA bounce buffers: virt = 0xcb814000 dma = 0x4b814000 len=9024
[ 2.588007] FIQ FSM acceleration enabled for :
Non-periodic Split Transactions
Periodic Split Transactions
High-Speed Isochronous Endpoints
Interrupt/Control Split Transaction hack enabled
[ 2.615888] dwc_otg: Microframe scheduler enabled
[ 2.616034] WARN::hcd_init_fiq:413: FIQ on core 0 at 0xc0407c10
[ 2.627258] WARN::hcd_init_fiq:414: FIQ ASM at 0xc0407eec length 36
[ 2.638783] WARN::hcd_init_fiq:439: MPHI regs_base at 0xcc898000
[ 2.650063] dwc_otg 20980000.usb: DWC OTG Controller
[ 2.660385] dwc_otg 20980000.usb: new USB bus registered, assigned bus number 1
[ 2.673101] dwc_otg 20980000.usb: irq 56, io mem 0x00000000
[ 2.683964] Init: Port Power? op_state=1
[ 2.693079] Init: Power Port (0)
[ 2.701914] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[ 2.713920] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[ 2.726446] usb usb1: Product: DWC OTG Controller
[ 2.736468] usb usb1: Manufacturer: Linux 4.4.11+ dwc_otg_hcd
[ 2.747428] usb usb1: SerialNumber: 20980000.usb
[ 2.758695] hub 1-0:1.0: USB hub found
[ 2.767943] hub 1-0:1.0: 1 port detected
[ 2.778005] dwc_otg: FIQ enabled
[ 2.778032] dwc_otg: NAK holdoff enabled
[ 2.778046] dwc_otg: FIQ split-transaction FSM enabled
[ 2.778109] Module dwc_common_port init
[ 2.778695] usbcore: registered new interface driver usb-storage
[ 2.790624] mousedev: PS/2 mouse device common for all mice
[ 2.802742] bcm2835-cpufreq: min=700000 max=700000
[ 2.813194] sdhci: Secure Digital Host Controller Interface driver
[ 2.824652] sdhci: Copyright(c) Pierre Ossman
[ 2.834702] sdhost: log_buf @ cb813000 (4b813000)
[ 2.925553] mmc0: sdhost-bcm2835 loaded - DMA enabled (>1)
[ 2.957263] sdhci-pltfm: SDHCI platform and OF driver helper
[ 2.969070] ledtrig-cpu: registered to indicate activity on CPUs
[ 2.983956] hidraw: raw HID events driver (C) Jiri Kosina
[ 2.994826] Indeed it is in host mode hprt0 = 00021501
[ 3.068579] usbcore: registered new interface driver usbhid
[ 3.079438] usbhid: USB HID core driver
[ 3.093914] Initializing XFRM netlink socket
[ 3.104436] NET: Registered protocol family 17
[ 3.114488] Key type dns_resolver registered
[ 3.127521] registered taskstats version 1
[ 3.137557] vc-sm: Videocore shared memory driver
[ 3.147736] [vc_sm_connected_init]: start
[ 3.160363] [vc_sm_connected_init]: end - returning 0
[ 3.172562] of_cfs_init
[ 3.180950] of_cfs_init: OK
[ 3.191095] Waiting for root device /dev/mmcblk0p7...
[ 3.201765] mmc0: host does not support reading read-only switch, assuming write-enable
[ 3.218906] mmc0: new high speed SDHC card at address aaaa
[ 3.230977] mmcblk0: mmc0:aaaa SL08G 7.40 GiB
[ 3.245212] mmcblk0: p1 p2 < p5 p6 p7 >
[ 3.265591] usb 1-1: new high-speed USB device number 2 using dwc_otg
[ 3.277666] Indeed it is in host mode hprt0 = 00001101
[ 3.362958] EXT4-fs (mmcblk0p7): mounted filesystem with ordered data mode. Opts: (null)
[ 3.376731] VFS: Mounted root (ext4 filesystem) readonly on device 179:7.
[ 3.394863] devtmpfs: mounted
[ 3.404692] Freeing unused kernel memory: 380K (c07bd000 - c081c000)
[ 3.496346] usb 1-1: New USB device found, idVendor=0424, idProduct=9512
[ 3.508745] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 3.524490] hub 1-1:1.0: USB hub found
[ 3.534280] hub 1-1:1.0: 3 ports detected
[ 3.760273] random: systemd urandom read with 55 bits of entropy available
[ 3.780119] systemd: systemd 215 running in system mode. (+PAM +AUDIT +SELINUX +IMA +SYSVINIT +LIBCRYPTSETUP +GCRYPT +ACL +XZ -SECCOMP -APPARMOR)
[ 3.799866] systemd: Detected architecture 'arm'.
[ 3.825643] usb 1-1.1: new high-speed USB device number 3 using dwc_otg
[ 3.926304] usb 1-1.1: New USB device found, idVendor=0424, idProduct=ec00
[ 3.939137] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 3.956968] smsc95xx v1.0.4
[ 3.999603] NET: Registered protocol family 10
[ 4.011954] systemd: Inserted module 'ipv6'
[ 4.030978] systemd: Set hostname to <raspberrypi>.
[ 4.051935] smsc95xx 1-1.1:1.0 eth0: register 'smsc95xx' at usb-20980000.usb-1.1, smsc95xx USB 2.0 Ethernet, b8:27:eb:25:03:8e
[ 4.164468] uart-pl011 20201000.uart: no DMA platform data
[ 4.778564] systemd: Expecting device dev-ttyAMA0.device...
[ 4.798387] systemd: Starting Forward Password Requests to Wall Directory Watch.
[ 4.812783] systemd: Started Forward Password Requests to Wall Directory Watch.
[ 4.826732] systemd: Starting Remote File Systems (Pre).
[ 4.845552] systemd: Reached target Remote File Systems (Pre).
[ 4.858162] systemd: Starting Arbitrary Executable File Formats File System Automount Point.
[ 4.881473] systemd: Set up automount Arbitrary Executable File Formats File System Automount Point.
[ 4.897413] systemd: Starting Encrypted Volumes.
[ 4.916116] systemd: Reached target Encrypted Volumes.
[ 4.927978] systemd: Starting Swap.
[ 4.945223] systemd: Reached target Swap.
[ 4.956023] systemd: Expecting device dev-mmcblk0p6.device...
[ 4.975573] systemd: Starting Root Slice.
[ 4.993648] systemd: Created slice Root Slice.
[ 5.004866] systemd: Starting User and Session Slice.
[ 5.024227] systemd: Created slice User and Session Slice.
[ 5.036685] systemd: Starting /dev/initctl Compatibility Named Pipe.
[ 5.057654] systemd: Listening on /dev/initctl Compatibility Named Pipe.
[ 5.071300] systemd: Starting Delayed Shutdown Socket.
[ 5.090875] systemd: Listening on Delayed Shutdown Socket.
[ 5.103308] systemd: Starting Journal Socket (/dev/log).
[ 5.123253] systemd: Listening on Journal Socket (/dev/log).
[ 5.135887] systemd: Starting udev Control Socket.
[ 5.155064] systemd: Listening on udev Control Socket.
[ 5.167103] systemd: Starting udev Kernel Socket.
[ 5.186129] systemd: Listening on udev Kernel Socket.
[ 5.197903] systemd: Starting Journal Socket.
[ 5.216862] systemd: Listening on Journal Socket.
[ 5.228317] systemd: Starting System Slice.
[ 5.246522] systemd: Created slice System Slice.
[ 5.257838] systemd: Starting File System Check on Root Device...
[ 5.283402] systemd: Starting system-systemd\x2dfsck.slice.
[ 5.315859] systemd: Created slice system-systemd\x2dfsck.slice.
[ 5.332517] systemd: Starting system-getty.slice.
[ 5.368134] systemd: Created slice system-getty.slice.
[ 5.385911] systemd: Starting system-serial\x2dgetty.slice.
[ 5.412243] systemd: Created slice system-serial\x2dgetty.slice.
[ 5.425856] systemd: Starting Increase datagram queue length...
[ 5.459456] systemd: Starting Restore / save the current clock...
[ 5.521133] systemd: Mounted Huge Pages File System.
[ 5.581818] systemd: Starting Create list of required static device nodes for the current kernel...
[ 5.657426] systemd: Mounting POSIX Message Queue File System...
[ 5.789270] systemd: Starting Load Kernel Modules...
[ 5.876358] systemd: Started Set Up Additional Binary Formats.
[ 5.900476] systemd: Starting udev Coldplug all Devices...
[ 5.932706] systemd: Mounting Debug File System...
[ 5.948055] fuse init (API version 7.23)
[ 5.975732] i2c /dev entries driver
[ 6.028569] systemd: Starting Slices.
[ 6.110093] systemd: Reached target Slices.
[ 6.147993] systemd: Mounted Debug File System.
[ 6.166153] systemd: Mounted POSIX Message Queue File System.
[ 6.187828] systemd: Started File System Check on Root Device.
[ 6.225830] systemd: Started Increase datagram queue length.
[ 6.247432] systemd: Started Restore / save the current clock.
[ 6.269491] systemd: Started Create list of required static device nodes for the current kernel.
[ 6.295997] systemd: Started Load Kernel Modules.
[ 6.348239] systemd: Time has been changed
[ 6.540959] systemd: Started udev Coldplug all Devices.
[ 6.733746] systemd: Mounting FUSE Control File System...
[ 6.758776] systemd: Starting Apply Kernel Variables...
[ 6.811321] systemd: Mounting Configuration File System...
[ 6.878803] systemd: Starting Create Static Device Nodes in /dev...
[ 6.932189] systemd: Starting Syslog Socket.
[ 6.963953] systemd: Listening on Syslog Socket.
[ 6.964325] systemd: Starting Journal Service...
[ 7.025817] systemd: Started Journal Service.
[ 7.475835] systemd-udevd: starting version 215
[ 9.287986] bcm2835-wdt 20100000.watchdog: Broadcom BCM2835 watchdog timer
[ 9.540669] gpiomem-bcm2835 20200000.gpiomem: Initialised: Registers at 0x20200000
[ 9.617864] EXT4-fs (mmcblk0p7): re-mounted. Opts: (null)
[ 12.964029] systemd-journald: Received request to flush runtime journal from PID 1
[ 16.404481] cfg80211: World regulatory domain updated:
[ 16.404527] cfg80211: DFS Master region: unset
[ 16.404544] cfg80211: (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
[ 16.404573] cfg80211: (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[ 16.404593] cfg80211: (2457000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[ 16.404612] cfg80211: (2474000 KHz - 2494000 KHz @ 20000 KHz), (N/A, 2000 mBm), (N/A)
[ 16.404634] cfg80211: (5170000 KHz - 5250000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (N/A)
[ 16.404656] cfg80211: (5250000 KHz - 5330000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (0 s)
[ 16.404675] cfg80211: (5490000 KHz - 5730000 KHz @ 160000 KHz), (N/A, 2000 mBm), (0 s)
[ 16.404697] cfg80211: (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 2000 mBm), (N/A)
[ 16.404714] cfg80211: (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 0 mBm), (N/A)
[ 17.202488] Adding 102396k swap on /var/swap. Priority:-1 extents:1 across:102396k SSFS
[ 19.289337] smsc95xx 1-1.1:1.0 eth0: hardware isn't capable of remote wakeup
[ 19.295372] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[ 20.805745] smsc95xx 1-1.1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0xDDE1
[ 20.809860] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[ 22.182190] random: nonblocking pool is initialized
[ 3611.492639] systemd-udevd: starting version 215
The number in square brackets on the left is the time since it started up, and whatever is on the right is what is being loaded at that point. I’m not sure what the very last line is about, but the line before that indicates that boot-up time (including ethernet setup in this case) was 22.1 seconds.
This topic on the Raspberry Pi Forums gives a few ideas for how to speed boot-up time. There are an awful lot of good responses there. Things I’ve tried / will try:
Another link: http://rpitc.blogspot.co.uk/p/docs.html
Random hint: some things are never documented. Except in the source code itself. For example, if you have to edit /boot/cmdline.txt , then the only help you will get is by looking at the source.
There are different ways of changing what services are started up during boot-up. I’m not clear what’s supposed to be used when; the complication arises because the way boot-up services are run has changed over the course of Raspbian’s existance. Earlier versions used /etc/inittab but newer versions use systemd . I think this change is why rcconf and sysv-rc-conf don’t work properly; they seem to lose settings on reboot, which makes them useless.
The most successful way I’ve had of reducing boot times is by using systemd-analyze blame to show what is taking longest to load. It outputs something like this:
To find out what the services you’re disabling actually do, run this:
And you’ll get an output like this: (Scroll to the right to see the description).
UNIT LOAD ACTIVE SUB DESCRIPTION
proc-sys-fs-binfmt_misc.automount loaded active waiting Arbitrary Executable File Formats File System Automount Point
sys-devices-platform-soc-20201000.uart-tty-ttyAMA0.device loaded active plugged /sys/devices/platform/soc/20201000.uart/tty/ttyAMA0
sys-devices-platform-soc-20202000.sdhost-mmc_host-mmc0-mmc0:aaaa-block-mmcblk0-mmcblk0p1.device loaded active plugged /sys/devices/platform/soc/20202000.sdhost/mmc_host/mmc0/mmc0:aaaa/bl
sys-devices-platform-soc-20202000.sdhost-mmc_host-mmc0-mmc0:aaaa-block-mmcblk0-mmcblk0p2.device loaded active plugged /sys/devices/platform/soc/20202000.sdhost/mmc_host/mmc0/mmc0:aaaa/bl
sys-devices-platform-soc-20202000.sdhost-mmc_host-mmc0-mmc0:aaaa-block-mmcblk0-mmcblk0p5.device loaded active plugged /sys/devices/platform/soc/20202000.sdhost/mmc_host/mmc0/mmc0:aaaa/bl
sys-devices-platform-soc-20202000.sdhost-mmc_host-mmc0-mmc0:aaaa-block-mmcblk0-mmcblk0p6.device loaded active plugged /sys/devices/platform/soc/20202000.sdhost/mmc_host/mmc0/mmc0:aaaa/bl
sys-devices-platform-soc-20202000.sdhost-mmc_host-mmc0-mmc0:aaaa-block-mmcblk0-mmcblk0p7.device loaded active plugged /sys/devices/platform/soc/20202000.sdhost/mmc_host/mmc0/mmc0:aaaa/bl
sys-devices-platform-soc-20202000.sdhost-mmc_host-mmc0-mmc0:aaaa-block-mmcblk0.device loaded active plugged /sys/devices/platform/soc/20202000.sdhost/mmc_host/mmc0/mmc0:aaaa/block/mmcblk
sys-devices-platform-soc-20980000.usb-usb1-1\x2d1-1\x2d1.1-1\x2d1.1:1.0-net-eth0.device loaded active plugged SMSC9512/9514 Fast Ethernet Adapter
sys-devices-virtual-tty-ttyprintk.device loaded active plugged /sys/devices/virtual/tty/ttyprintk
sys-module-configfs.device loaded active plugged /sys/module/configfs
sys-module-fuse.device loaded active plugged /sys/module/fuse
sys-subsystem-net-devices-eth0.device loaded active plugged SMSC9512/9514 Fast Ethernet Adapter
-.mount loaded active mounted /
boot.mount loaded active mounted /boot
dev-mqueue.mount loaded active mounted POSIX Message Queue File System
run-user-1000.mount loaded active mounted /run/user/1000
sys-fs-fuse-connections.mount loaded active mounted FUSE Control File System
sys-kernel-config.mount loaded active mounted Configuration File System
sys-kernel-debug.mount loaded active mounted Debug File System
systemd-ask-password-console.path loaded active waiting Dispatch Password Requests to Console Directory Watch
systemd-ask-password-wall.path loaded active waiting Forward Password Requests to Wall Directory Watch
session-c1.scope loaded active running Session c1 of user pi
avahi-daemon.service loaded active running Avahi mDNS/DNS-SD Stack
cron.service loaded active running Regular background program processing daemon
dbus.service loaded active running D-Bus System Message Bus
dhcpcd.service loaded active running dhcpcd on all interfaces
dphys-swapfile.service loaded active exited LSB: Autogenerate and use a swap file
fake-hwclock.service loaded active exited Restore / save the current clock
email@example.com loaded active running Getty on tty1
hdparm.service loaded active exited LSB: Tune IDE hard disks
kmod-static-nodes.service loaded active exited Create list of required static device nodes for the current kernel
networking.service loaded active exited LSB: Raise network interfaces.
ntp.service loaded active running LSB: Start NTP daemon
raspi-config.service loaded active exited LSB: Switch to ondemand cpu governor (unless shift key is pressed)
rc-local.service loaded active exited /etc/rc.local Compatibility
rsyslog.service loaded active running System Logging Service
serial-getty@ttyAMA0.service loaded active running Serial Getty on ttyAMA0
ssh.service loaded active running OpenBSD Secure Shell server
systemd-fsck-root.service loaded active exited File System Check on Root Device
firstname.lastname@example.org loaded active exited File System Check on /dev/mmcblk0p6
systemd-journald.service loaded active running Journal Service
systemd-logind.service loaded active running Login Service
systemd-modules-load.service loaded active exited Load Kernel Modules
systemd-random-seed.service loaded active exited Load/Save Random Seed
systemd-remount-fs.service loaded active exited Remount Root and Kernel File Systems
systemd-setup-dgram-qlen.service loaded active exited Increase datagram queue length
systemd-sysctl.service loaded active exited Apply Kernel Variables
systemd-tmpfiles-setup-dev.service loaded active exited Create Static Device Nodes in /dev
systemd-tmpfiles-setup.service loaded active exited Create Volatile Files and Directories
systemd-udev-trigger.service loaded active exited udev Coldplug all Devices
systemd-udevd.service loaded active running udev Kernel Device Manager
systemd-update-utmp.service loaded active exited Update UTMP about System Boot/Shutdown
systemd-user-sessions.service loaded active exited Permit User Sessions
udev-finish.service loaded active exited Copy rules generated while the root was ro
email@example.com loaded active running User Manager for UID 1000
-.slice loaded active active Root Slice
system-getty.slice loaded active active system-getty.slice
system-serial\x2dgetty.slice loaded active active system-serial\x2dgetty.slice
system-systemd\x2dfsck.slice loaded active active system-systemd\x2dfsck.slice
system.slice loaded active active System Slice
user-1000.slice loaded active active user-1000.slice
user.slice loaded active active User and Session Slice
avahi-daemon.socket loaded active running Avahi mDNS/DNS-SD Stack Activation Socket
dbus.socket loaded active running D-Bus System Message Bus Socket
syslog.socket loaded active running Syslog Socket
systemd-initctl.socket loaded active listening /dev/initctl Compatibility Named Pipe
systemd-journald-dev-log.socket loaded active running Journal Socket (/dev/log)
systemd-journald.socket loaded active running Journal Socket
systemd-shutdownd.socket loaded active listening Delayed Shutdown Socket
systemd-udevd-control.socket loaded active running udev Control Socket
systemd-udevd-kernel.socket loaded active running udev Kernel Socket
var-swap.swap loaded active active /var/swap
basic.target loaded active active Basic System
cryptsetup.target loaded active active Encrypted Volumes
getty.target loaded active active Login Prompts
local-fs-pre.target loaded active active Local File Systems (Pre)
local-fs.target loaded active active Local File Systems
multi-user.target loaded active active Multi-User System
network-online.target loaded active active Network is Online
Then disable the individual services as you desire by doing this:
sudo systemctl disable kbd