Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Tango with systemd

66 views

Published on

Used by many major distributions, systemd is widely known in the desktop and server world. But it is not so common to find it in embedded product.
In this talk, we will show how systemd can be a real benefit for the embedded world; for both your sanity and your time.
We will discuss how systemd was integrated into Phantom, a speaker from Devialet, and what was the pro and cons of using it.

Link to the video:
https://media.ccc.de/v/ASG2017-128-tango_with_systemd#video&t=258

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Tango with systemd

  1. 1. Tango with systemd
  2. 2. Wait what ?
  3. 3. Maxime Hadjinlian - mh@devialet.com
  4. 4. Tango with systemd
  5. 5. First dance
  6. 6. systemd-journald
  7. 7. systemd-journald
  8. 8. systemd-journald ● Hack the service to make it boot after a mountpoint is created
  9. 9. systemd-journald ● Hack the service to make it boot after a mountpoint is created ● Do not use its API
  10. 10. systemd-journald ● Hack the service to make it boot after a mountpoint is created ● Do not use its API ● Design your own logger
  11. 11. systemd-timesyncd
  12. 12. systemd-timesyncd
  13. 13. systemd-timesyncd ● Use OpenNTPD (very good piece of software)
  14. 14. systemd-timesyncd ● Use OpenNTPD (very good piece of software) ● No interface available ? Hack all the things !
  15. 15. systemd-timesyncd ● Use OpenNTPD (very good piece of software) ● No interface available ? Hack all the things ! ● No DNS ? Hack all the things !
  16. 16. systemd-timesyncd ● Use OpenNTPD (very good piece of software) ● No interface available ? Hack all the things ! ● No DNS ? Hack all the things ! ● No RTC ? Hack all the things !
  17. 17. systemd-networkd
  18. 18. systemd-networkd
  19. 19. systemd-networkd ● Why use already existing software ? NIH syndrome
  20. 20. systemd-networkd ● Why use already existing software ? NIH syndrome ● Detect interfaces at boot using a shell script.
  21. 21. systemd-networkd ● Why use already existing software ? NIH syndrome ● Detect interfaces at boot using a shell script. ● Static interfaces detection with hardcoded name
  22. 22. systemd-networkd ● Why use already existing software ? NIH syndrome ● Detect interfaces at boot using a shell script. ● Static interfaces detection with hardcoded name ● Need to embed many many tools and have code able to manage all theses differents tools.
  23. 23. systemd PID 1 ?
  24. 24. First dance
  25. 25. First dance ● Not a good experience, due mainly to lack of understanding of systemd
  26. 26. First dance ● Not a good experience, due mainly to lack of understanding of systemd ● Used two “init” systems
  27. 27. First dance ● Not a good experience, due mainly to lack of understanding of systemd ● Used two “init” systems ● Created root launchers to avoid applications started as root
  28. 28. First dance ● Not a good experience, due mainly to lack of understanding of systemd ● Used two “init” systems ● Created root launchers to avoid applications started as root ● Boot almost sequential, did not toke advantage of the parallel boot speed
  29. 29. First dance ● Not a good experience, due mainly to lack of understanding of systemd ● Used two “init” systems ● Created root launchers to avoid applications started as root ● Boot almost sequential, did not toke advantage of the parallel boot speed ● …. Many more errors
  30. 30. RTFM ?
  31. 31. Second dance
  32. 32. systemd-journald
  33. 33. systemd-journald
  34. 34. systemd-journald ● There’s an API for that !
  35. 35. systemd-journald ● There’s an API for that ! ● Embrace the binary log format; easy to compress and send to a server for analysis
  36. 36. systemd-journald ● There’s an API for that ! ● Embrace the binary log format; easy to compress and send to a server for analysis ● Handle the coredump also
  37. 37. systemd-journald ● There’s an API for that ! ● Embrace the binary log format; easy to compress and send to a server for analysis ● Handle the coredump also ● Learn to use the command line
  38. 38. systemd-timesyncd
  39. 39. systemd-timesyncd
  40. 40. systemd-timesyncd ● Works with networkd
  41. 41. systemd-timesyncd ● Works with networkd ● Maintain a ‘clock’ file as fake RTC
  42. 42. systemd-timesyncd ● Works with networkd ● Maintain a ‘clock’ file as fake RTC ● Works even without DNS
  43. 43. systemd-timesyncd ● Works with networkd ● Maintain a ‘clock’ file as fake RTC ● Works even without DNS ● Fast !
  44. 44. systemd-networkd
  45. 45. systemd-networkd
  46. 46. systemd-networkd ● Dynamically detect interfaces
  47. 47. systemd-networkd ● Dynamically detect interfaces ● .network files: set-up lots of iface’s parameters
  48. 48. systemd-networkd ● Dynamically detect interfaces ● .network files: set-up lots of iface’s parameters ● Perfect for simple and not so simple network
  49. 49. systemd-networkd ● Dynamically detect interfaces ● .network files: set-up lots of iface’s parameters ● Perfect for simple and not so simple network ● No WiFi AP support
  50. 50. Second dance
  51. 51. Second dance ● Real boot time gain
  52. 52. Second dance ● Real boot time gain ● Reduced/maintained/tested code base
  53. 53. Second dance ● Real boot time gain ● Reduced/maintained/tested code base ● Drop-ins are awesome !
  54. 54. Second dance ● Real boot time gain ● Reduced/maintained/tested code base ● Drop-ins are awesome ! ● More tools to troubleshoot
  55. 55. Second dance ● Real boot time gain ● Reduced/maintained/tested code base ● Drop-ins are awesome ! ● More tools to troubleshoot ● DBus interface
  56. 56. Second dance ● Real boot time gain ● Reduced/maintained/tested code base ● Drop-ins are awesome ! ● More tools to troubleshoot ● DBus interface ● Stateless system
  57. 57. Second dance ● Real boot time gain ● Reduced/maintained/tested code base ● Drop-ins are awesome ! ● More tools to troubleshoot ● DBus interface ● Stateless system ● Not such a huge beast; you can chop it down easily
  58. 58. Second dance ● Real boot time gain ● Reduced/maintained/tested code base ● Drop-ins are awesome ! ● More tools to troubleshoot ● DBus interface ● Stateless system ● Not such a huge beast; you can chop it down easily ● So much more...
  59. 59. THANK YOU ! YOU’RE AWESOME
  60. 60. Tips ‘n’ Tricks
  61. 61. Tips ‘n’ Tricks
  62. 62. Tips ‘n’ Tricks ● systemctl list-dependencies basic.target
  63. 63. Tips ‘n’ Tricks ● systemctl list-dependencies basic.target ● systemctl list-dependencies –after tmp.mount
  64. 64. Tips ‘n’ Tricks ● systemctl list-dependencies basic.target ● systemctl list-dependencies –after tmp.mount ● systemd-delta
  65. 65. Tips ‘n’ Tricks ● systemctl list-dependencies basic.target ● systemctl list-dependencies –after tmp.mount ● systemd-delta ● systemctl cat
  66. 66. Tips ‘n’ Tricks ● systemctl list-dependencies basic.target ● systemctl list-dependencies –after tmp.mount ● systemd-delta ● systemctl cat ● systemd-analyze dot rescue.target
  67. 67. Tips ‘n’ Tricks ● systemctl list-dependencies basic.target ● systemctl list-dependencies –after tmp.mount ● systemd-delta ● systemctl cat ● systemd-analyze dot rescue.target ● ssh user@<host> /bin/systemd-analyze plot > /tmp/bootchart.svg
  68. 68. THANK YOU ! YOU’RE AWESOME

×