add systemd-on-raspbian
This commit is contained in:
parent
1658fbd8da
commit
90d989b1d8
71
Gemfile.lock
Normal file
71
Gemfile.lock
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
GIT
|
||||||
|
remote: https://github.com/akzhan/pygments.rb.git
|
||||||
|
revision: 11422be8de49703021a2fb85eafe55caab5fc2af
|
||||||
|
specs:
|
||||||
|
pygments.rb (0.2.12)
|
||||||
|
rubypython (~> 0.6.1)
|
||||||
|
|
||||||
|
GEM
|
||||||
|
remote: http://rubygems.org/
|
||||||
|
specs:
|
||||||
|
RedCloth (4.2.9)
|
||||||
|
chunky_png (1.2.5)
|
||||||
|
classifier (1.3.3)
|
||||||
|
fast-stemmer (>= 1.0.0)
|
||||||
|
compass (0.12.2)
|
||||||
|
chunky_png (~> 1.2)
|
||||||
|
fssm (>= 0.2.7)
|
||||||
|
sass (~> 3.1)
|
||||||
|
directory_watcher (1.4.1)
|
||||||
|
fast-stemmer (1.0.1)
|
||||||
|
fssm (0.2.9)
|
||||||
|
haml (3.1.7)
|
||||||
|
jekyll (0.12.0)
|
||||||
|
classifier (~> 1.3)
|
||||||
|
directory_watcher (~> 1.1)
|
||||||
|
kramdown (~> 0.13.4)
|
||||||
|
liquid (~> 2.3)
|
||||||
|
maruku (~> 0.5)
|
||||||
|
kramdown (0.13.7)
|
||||||
|
liquid (2.3.0)
|
||||||
|
maruku (0.6.1)
|
||||||
|
syntax (>= 1.0.0)
|
||||||
|
posix-spawn (0.3.6)
|
||||||
|
rack (1.4.1)
|
||||||
|
rack-protection (1.2.0)
|
||||||
|
rack
|
||||||
|
rake (0.9.2.2)
|
||||||
|
rb-fsevent (0.9.1)
|
||||||
|
rdiscount (1.6.8)
|
||||||
|
rubypants (0.2.0)
|
||||||
|
rubypython (0.6.2)
|
||||||
|
blankslate (>= 2.1.2.3)
|
||||||
|
ffi (~> 1.0.7)
|
||||||
|
sass (3.1.19)
|
||||||
|
sinatra (1.3.2)
|
||||||
|
rack (~> 1.3, >= 1.3.6)
|
||||||
|
rack-protection (~> 1.2)
|
||||||
|
tilt (~> 1.3, >= 1.3.3)
|
||||||
|
stringex (1.4.0)
|
||||||
|
syntax (1.0.0)
|
||||||
|
tilt (1.3.7)
|
||||||
|
yajl-ruby (1.1.0)
|
||||||
|
|
||||||
|
PLATFORMS
|
||||||
|
ruby
|
||||||
|
|
||||||
|
DEPENDENCIES
|
||||||
|
RedCloth (~> 4.2.9)
|
||||||
|
compass (~> 0.12.2)
|
||||||
|
haml (~> 3.1.7)
|
||||||
|
jekyll (~> 0.12)
|
||||||
|
liquid (~> 2.3.0)
|
||||||
|
pygments.rb!
|
||||||
|
rack (~> 1.4.1)
|
||||||
|
rake (~> 0.9.2)
|
||||||
|
rb-fsevent (~> 0.9)
|
||||||
|
rdiscount (~> 1.6.8)
|
||||||
|
rubypants (~> 0.2.0)
|
||||||
|
rubypython (~> 0.6.1)
|
||||||
|
sinatra (~> 1.3.2)
|
||||||
|
stringex (~> 1.4.0)
|
1
plugins/ruby_python_arch_linux_fix.rb
Normal file
1
plugins/ruby_python_arch_linux_fix.rb
Normal file
@ -0,0 +1 @@
|
|||||||
|
RubyPython.start :python_exe => 'python2.7'
|
15
source/_includes/custom/richobject.html
Normal file
15
source/_includes/custom/richobject.html
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<meta property="og:url" value="{{ site.url }}{{ page.url }}">
|
||||||
|
<meta property="og:type" content="blog" />
|
||||||
|
{% if page.title %}
|
||||||
|
<meta property="og:title" value="{{ page.title }}">
|
||||||
|
<meta property="og:description" value="{{ page.description }}">
|
||||||
|
{% if page.cover %}
|
||||||
|
<meta property="og:image" value="{{ site.url }}{{ page.cover }}">
|
||||||
|
{% endif %}
|
||||||
|
{% else %}
|
||||||
|
<meta property="og:title" value="{{ site.title }}">
|
||||||
|
<meta property="og:description" value="{{ site.description }}">
|
||||||
|
{% if site.cover %}
|
||||||
|
<meta property="og:image" value="{{ site.url }}{{ site.cover }}">
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
155
source/_posts/2012-09-19-systemd-on-raspbian.markdown
Normal file
155
source/_posts/2012-09-19-systemd-on-raspbian.markdown
Normal file
@ -0,0 +1,155 @@
|
|||||||
|
---
|
||||||
|
layout: post
|
||||||
|
title: "Systemd on raspbian"
|
||||||
|
date: 2012-09-19 17:16
|
||||||
|
comments: true
|
||||||
|
categories: systemd raspberry pie raspbian
|
||||||
|
---
|
||||||
|
|
||||||
|
As I like the stability and raw speed of systemd, I wanted to leave debian's
|
||||||
|
init system behind and switch to systemd.
|
||||||
|
|
||||||
|
The basic installation is pretty easy:
|
||||||
|
|
||||||
|
$ apt-get install systemd
|
||||||
|
|
||||||
|
Then you need to tell the kernel to use systemd as the init system:
|
||||||
|
|
||||||
|
To do so, append `init=/bin/systemd` to the end of `/boot/cmdline.txt` line
|
||||||
|
|
||||||
|
$ cat /boot/cmdline.txt
|
||||||
|
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait init=/bin/systemd
|
||||||
|
|
||||||
|
If you reboot, systemd will be used instead of the default init script.
|
||||||
|
|
||||||
|
Currently debians version of systemd doesn't ship many service files by default. Systemd
|
||||||
|
will automaticly fallback to the lsb script, if a service file for a deamon is
|
||||||
|
missing. So the speedup isn't as big as on other distributions such as archlinux
|
||||||
|
or fedora, which provide a deeper integration.
|
||||||
|
|
||||||
|
To get a quick overview, which services are started nativly, type the following command:
|
||||||
|
|
||||||
|
$ systemctl list-units
|
||||||
|
|
||||||
|
All descriptions containing `LSB: ` are launched through lsb scripts.
|
||||||
|
|
||||||
|
Writing your own service files, is straight forward. If you add custom service
|
||||||
|
files, put them in /etc/systemd/system, so they will not get overwritten by
|
||||||
|
updates.
|
||||||
|
|
||||||
|
To get further information about systemd, I recommend the [great archlinux wiki article](https://wiki.archlinux.org/index.php/Systemd).
|
||||||
|
|
||||||
|
At the end of this article, I provide some basic one, I use. I port them over mostly from archlinux.
|
||||||
|
In the most cases, i just have adjusted the path of the binary to get them working. (from /usr/bin to /usr/sbin for ex.)
|
||||||
|
It is important, that the service name match with the initscript, so it will be used instead by systemd.
|
||||||
|
This will not work in all cases like dhcpcd which contains the specific network device (like dhcpcd@eth0). In this case, you have to remove origin service with `update-rc.d` and enable the service file with `systemctl enable`.
|
||||||
|
|
||||||
|
Also avaible as [gist](https://gist.github.com/ac8ab2e84125ededa5c5):
|
||||||
|
|
||||||
|
``` plain /etc/systemd/system/dhcpcd@.service
|
||||||
|
# IMPORTANT: only works with dhcpcd5 not the old dhcpcd3!
|
||||||
|
[Unit]
|
||||||
|
Description=dhcpcd on %I
|
||||||
|
Wants=network.target
|
||||||
|
Before=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=forking
|
||||||
|
PIDFile=/run/dhcpcd-%I.pid
|
||||||
|
ExecStart=/sbin/dhcpcd -A -q -w %I
|
||||||
|
ExecStop=/sbin/dhcpcd -k %I
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
Alias=multi-user.target.wants/dhcpcd@eth0.service
|
||||||
|
```
|
||||||
|
|
||||||
|
``` plain /etc/systemd/system/monit.service
|
||||||
|
[Unit]
|
||||||
|
Description=Pro-active monitoring utility for unix systems
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
ExecStart=/usr/bin/monit -I
|
||||||
|
ExecStop=/usr/bin/monit quit
|
||||||
|
ExecReload=/usr/bin/monit reload
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
```
|
||||||
|
|
||||||
|
``` plain /etc/systemd/system/ntp.service
|
||||||
|
[Unit]
|
||||||
|
Description=Network Time Service
|
||||||
|
After=network.target nss-lookup.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=forking
|
||||||
|
PrivateTmp=true
|
||||||
|
ExecStart=/usr/sbin/ntpd -g -u ntp:ntp
|
||||||
|
ControlGroup=cpu:/
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
```
|
||||||
|
|
||||||
|
``` plain /etc/systemd/system/sshdgenkeys.service
|
||||||
|
[Unit]
|
||||||
|
Description=SSH Key Generation
|
||||||
|
ConditionPathExists=|!/etc/ssh/ssh_host_key
|
||||||
|
ConditionPathExists=|!/etc/ssh/ssh_host_key.pub
|
||||||
|
ConditionPathExists=|!/etc/ssh/ssh_host_ecdsa_key
|
||||||
|
ConditionPathExists=|!/etc/ssh/ssh_host_ecdsa_key.pub
|
||||||
|
ConditionPathExists=|!/etc/ssh/ssh_host_dsa_key
|
||||||
|
ConditionPathExists=|!/etc/ssh/ssh_host_dsa_key.pub
|
||||||
|
ConditionPathExists=|!/etc/ssh/ssh_host_rsa_key
|
||||||
|
ConditionPathExists=|!/etc/ssh/ssh_host_rsa_key.pub
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=/usr/bin/ssh-keygen -A
|
||||||
|
Type=oneshot
|
||||||
|
RemainAfterExit=yes
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
```
|
||||||
|
|
||||||
|
``` plain /etc/systemd/system/ssh.socket
|
||||||
|
[Unit]
|
||||||
|
Conflicts=ssh.service
|
||||||
|
|
||||||
|
[Socket]
|
||||||
|
ListenStream=22
|
||||||
|
Accept=yes
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=sockets.target
|
||||||
|
```
|
||||||
|
|
||||||
|
``` plain /etc/systemd/system/ssh@.service
|
||||||
|
[Unit]
|
||||||
|
Description=SSH Per-Connection Server
|
||||||
|
Requires=sshdgenkeys.service
|
||||||
|
After=syslog.target
|
||||||
|
After=sshdgenkeys.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStartPre=/bin/mkdir -m700 -p /var/run/sshd
|
||||||
|
ExecStart=-/usr/sbin/sshd -i
|
||||||
|
ExecReload=/bin/kill -HUP $MAINPID
|
||||||
|
StandardInput=socket
|
||||||
|
```
|
||||||
|
|
||||||
|
``` plain /etc/systemd/system/ifplugd@.service
|
||||||
|
[Unit]
|
||||||
|
Description=Daemon which acts upon network cable insertion/removal
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=forking
|
||||||
|
PIDFile=/run/ifplugd.%i.pid
|
||||||
|
ExecStart=/usr/sbin/ifplugd %i
|
||||||
|
SuccessExitStatus=0 1 2
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
```
|
Loading…
Reference in New Issue
Block a user