How do I change the target (runlevel)?

systemd has the concept of targets which is a more flexible replacement for runlevels in sysvinit.

Run level 3 is emulated by multi-user.target. Run level 5 is emulated by graphical.target. runlevel3.target is a symbolic link to multi-user.target and runlevel5.target is a symbolic link to graphical.target.

You can switch to 'runlevel 3' by running

 systemctl isolate multi-user.target 

You can switch to 'runlevel 5' by running

systemctl isolate graphical.target (재부팅되면 원복)

How do I change the default target?

 systemctl set-default <name of target>.target 

graphical.target is the default. You might want multi-user.target for the equivalent of non graphical (runlevel 3) from sysv init. The full list of targets can be accessed via systemctl list-units --type=target

systemd does not use /etc/inittab file.

How do I know the current target?

 systemctl get-default 



source - http://fedoraproject.org/wiki/Systemd#How_do_I_change_the_default_target.3F






systemd has the concept of targets which is a more flexible replacement for runlevels in sysvinit. 
Run level 3 is emulated by multi-user.target
Run level 5 is emulated by graphical.target.

runlevel3.target is a symbolic link to multi-user.target
runlevel5.target is a symbolic link to graphical.target.

You can switch to 'runlevel 3' by running

 systemctl isolate multi-user.target

You can switch to 'runlevel 5' by running

 systemctl isolate graphical.target


NOTE!

systemctl isolate is used to start one daemon and stop ALL others. Some possible targets are

# systemctl isolate 
    ctrl-alt-del.target    initrd-switch-root.service    poweroff.target
    runlevel2.target    system-update.target    default.target
    initrd-switch-root.target    reboot.target    runlevel3.target
    system-upgrade.target    emergency.target    initrd.target
    rescue.target    runlevel4.target    upgrade-switch-root.service
    graphical.target    kexec.target    runlevel0.target
    runlevel5.target    upgrade-switch-root.target    halt.target
    multi-user.target    runlevel1.target    runlevel6.target


source - https://ask.fedoraproject.org/en/question/42485/runlevel-3-in-fedora-20/






For Fedora 15, 16, 17, 18 and 19, change to different default level requires change the systemd target link.
To change it to desktop (graphic) mode:
# ln -sf /lib/systemd/system/runlevel5.target /etc/systemd/system/default.target

To change default runlevel to 3 (multi-user with networking and console only login):
# ln -sf /lib/systemd/system/runlevel3.target /etc/systemd/system/default.target


# cat /etc/inittab 

# inittab is no longer used when using systemd.
#
# ADDING CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.
#
# Ctrl-Alt-Delete is handled by /etc/systemd/system/ctrl-alt-del.target
#
# systemd uses 'targets' instead of runlevels. By default, there are two main targets:
#
# multi-user.target: analogous to runlevel 3
# graphical.target: analogous to runlevel 5
#
# To set a default target, run:
#
# ln -s /lib/systemd/system/.target /etc/systemd/system/default.target

The following runlevels are defined by default under Fedora:
0 — Halt
1 — Single-user text mode
2 — Not used (user-definable)
3 — Full multi-user text mode
4 — Not used (user-definable)
5 — Full multi-user graphical mode (with an X-based login screen)
6 — Reboot



source - http://marcofalchi.blogspot.kr/2013/05/change-default-runlevel-in-fedora-15-16.html








저자Lennart Poettering
초판2010 년 4 월 30 일
최신 버전197 / 2013 년 01 월 7 일 (3 개월 전)
프로그래밍 언어[1]
지원 OSLinux
종별Init 데몬
라이센스GNU LGPL 2.1 + ( 프리웨어 ) [2]
공식 사이트freedesktop.org / ... / systemd /



systemd 는 Linux 의 init 데몬을 대체이며, System V 스타일과 BSD 스타일을 모두 지원하고있다. 서비스 종속성을 잘 나타내는 소프트웨어 프레임 워크 를 제공하는 것을 목표로하고 있으며, 시스템 시작 프로세스를보다 병렬 적으로 수행 할 수있게하고  의 오버 헤드 절감을 목표로하고있다.

Unix 시스템의 데몬 (백그라운드 프로세스)의 명명 관습에 맞추고, 마지막에 "d"를 붙이고있다. 또한이 명칭은 말장난의 측면도, 프랑스 최근 잘 알려져있다 " 시스템 D 영어 버전 ) "라는 말을 따서있다. "시스템 D"는 환경에 빠르게 적응하고 문제를 즉흥적으로 해결하는 개인의 능력을 의미한다 [3] .

Lennart Poettering 가 쓰기 [4] , GNU Lesser General Public License 버전 2.1 이상이라는 조건으로 자유 소프트웨어 로 발표했다 [2] .

목차

  [ 숨기기 ] 

디자인 편집 ]

많은 배포판에서 사용되는 System V init에 비해 다음과 같은 새로운 기술을 채택하고있는 점에서 우수하다.

  • 소켓 시작 형 서비스와 버스 시작 형 서비스. 상호 의존하는 서비스에 대한보다 병렬로 시작할 수있다.
  • PID 대신 cgroups 를 사용하여 서비스 프로세스들을 모니터링한다. 즉, 데몬이 2 회 fork 해서 systemd에서 벗어날 수 없다.

2012 년 4 월 udev 소스 트리가 systemd 소스 트리에 병합 된 [5] .

systemd는 cgroups 및 fanotify 같은 Linux 고유의 기능에 의존하고 있으며, 디자인 Linux 커널 에서만 작동 할 수 없도록되어있다 [6] . Debian 이 정식 채용을 주저하는 것은이 문제가 있기 때문 [7] , Debian에는 FreeBSD 버전 (kFreeBSD)도있다. Lennart Poettering 이것을 문제라고는 생각하지 않고, "Debian kFreeBSD는 장난감 OS"라고 발언하고있다 [8] .

채용 예 편집 ]

systemd 저자 (Poettering)은 GNOME 3.2의 외부 의존 패키지로하는 것을 제안하고있다 [9] . 이는 GNOME을 사용하는 모든 배포판 systemd를 사용하거나 적어도 구성 옵션으로 준비해야한다는 것을 의미한다.

systemd이 기본이되고있다 배포판 :

systemd이 일단 사용 가능한 배포판 :

각주 편집 ]

  1. "systemd" , Analysis Summary ( Ohloh ) 2011 년 6 월 16 일 검색.
  2. b Lennart Poettering (2012-04-21) systemd Status Update 2012 년 4 월 28 일검색.
  3. Lennart Poettering, Kay Sievers, Thorsten Leemhuis (2012-05-08) Control Centre : The systemd Linux init system
  4. Lennart Poettering, "FAQs" , systemd (0pointer) 2011 년 6 월 16 일 검색.
  5. Sievers, Kay, "Commit importing udev into systemd" , systemd 2012 년 5 월 25 일 보기.
  6. Lennart Poettering (2010-04-30) systemd FAQ 2011 년 12 월 14 일 보기.
  7. Jake Edge (2011-07-27), Debian debates systemd 2011 년 12 월 14 일 보기.
  8. Un entretien avec Lennart Poettering (2011-07-05) 2011 년 12 월 14 일 보기.
  9. Lennart Poettering (2011-05-18), "systemd as an external dependency" ,desktop-devel mailing list (GNOME) 2011 년 5 월 26 일 보기.
  10. Dj Walker-Morgan (2011-05-24), Fedora 15 's Lovelock released , The H 2011 년 5 월 26 일 보기.
  11. Jake Edge (2010-08-25) systemd and Fedora 14 , LWN 2011 년 2 월 3 일 검색.
  12. Fabian Scherschel (2012-05-23) Mageia 2 arrives with GNOME 3 and systemd, The H 2012 년 5 월 26 일 보기.
  13. Dj Walker-Morgan (2011-08-29) Mandriva 2011 arrives with systemd , The H2011 년 8 월 29 일 보기.
  14. Chris von Eitzen (2011-11-16) openSUSE 12.1 arrives with systemd and Btrfs , The H 2011 년 11 월 16 일 보기.
  15. systemd is now the default on new installations , Archlinux News 2012 년 10 월 29 일 보기.
  16. systemd , Debian wiki 2011 년 7 월 21 일 보기.
  17. "Comment # 210" , systemd - bug # 318365 (Gentoo 's Bugzilla) 2011 년 7 월 5 일 보기.
  18. systemd , Gentoo 's Documentation 2011 년 7 월 5 일 보기.

관련 항목 편집 ]

외부 링크 편집 ]



출처 - http://ja.wikipedia.org/wiki/Systemd






Systemd
Original author(s)Lennart PoetteringKay Sievers
Developer(s)Lennart Poettering, Kay Sievers and others[1]
Initial release30 March 2010
Stable release209[2] / 19 February 2014; 2 days ago
Written inC[3]
Operating systemLinux
TypeInit daemon
Licensefirst GPLv2+, currentlyGNU LGPL 2.1+ [4]
Websitefreedesktop.org/…/systemd/


systemd is a system management daemon designed exclusively for the Linux kernel API. In the Linux startup process, it is the first process to execute in user space; therefore, it is also the parent process of all child processes in user space. The name systemd adheres to the Unix convention of making daemons easier to distinguish by appending the letter d to thefilename.[5]

systemd was developed for Linux to replace the init system inherited from UNIX System V and Berkeley Software Distribution (BSD) operating systems. Like init, systemd is a daemon that manages other daemons. All daemons, including systemd, are background processes. systemd is the first daemon to start (during booting) and the last daemon to terminate (during shutdown).

Lennart Poettering and Kay Sievers, the software engineers who initially developed systemd,[1] sought to surpass the efficiency of the init daemon in several ways. They wanted to improve the software framework for expressing dependencies; to allow more processing to be done concurrently or in parallel during system booting; and to reduce the computational overhead of the shell.

systemd is published as free and open-source software under the terms of the GNU Lesser General Public License version 2.1 or later.[4]

Software architecture

See also: Linux startup process

File:Systemd components.svg


Systemd's initialization instructions for each daemon are recorded in a declarative configuration file rather than a shell script. For inter-process communication, systemd makes Unix domain sockets and D-Bus available to the running daemons. Because systemd tracks processes using Linux cgroups instead of process identifiers (PIDs), daemons cannot "escape" systemd; not even by double-forking. Systemd is also capable of aggressive parallelization.

Among systemd's auxiliary features are a cron-like job scheduler called systemd Calendar Timers, and an event logging subsystem called journal.[6] The system administrator may choose whether to log system events with systemd or syslog. systemd's logfile is a binary file. The state of systemd itself can be preserved in asnapshot for future recall.

In April 2012, the source tree for udev (a device manager that interoperates with the Linux kernel) was merged into systemd.[7]

Systemd provides a replacement for sysvinit, pm-utils, inetd, acpid, syslog, watchdog, cron and atd. Also, it has an integrated login manager called systemd-logind, which offers multiseat improvements and replaces ConsoleKit which is no longer maintained.[8][9]

Userspace utilities[edit]

All available userspace utility programs for systemd and their man pages are currently documented at the project's official page.[10]


File:Linux desktop system daemons and their graphical front-ends.svg


Adoption[edit]

In May 2011, Fedora became the first major Linux distribution to enable systemd by default.[11]

Linux distributions that include systemd
Linux distributionDate added to software repository[note 1]Enabled by default?
ÅngströmN/AYes
Arch LinuxOctober 2012[12]Yes
CoreOSJuly 2013Yes[13]
Debian GNU/Linux[14]April 2012Chosen for next release[note 2]
FedoraMay 2011 (v15)[17]Yes
Frugalware LinuxAugust 2011 (v1.5)[18]Yes
Gentoo Linux2011[19][20][21]No
MageiaMay 2012 (v2.0)[22]Yes
openSUSEMarch 2011 (v11.4)[23]Yes
Red Hat Enterprise LinuxPending for RHEL 7Pending for RHEL 7[24][25]
Sabayon LinuxAugust 2013 (v13.08)[26]Yes
Ubuntu[note 3]April 2013 (v13.04)[28]Planned[16]
  1. Jump up^ Dates are for the general availability release.
  2. Jump up^ The Debian Technical Committee voted to make systemd the default system management daemon for Linux in the "jessie" release.[15] As a result, Ubuntu founder Mark Shuttleworth announced that Ubuntu would migrate towards it from its self-developed competitor Upstart for a future release, in order to maintain consistency with the distribution that Ubuntu is based upon.[16]
  3. Jump up^ Ubuntu's development documentation offers instructions on how to use systemd as an experimental option.[27]

In the interest of enhancing the interoperability between systemd and GNOME, systemd coauthor Lennart Poettering asked the GNOME Project to consider making systemd an external dependency of GNOME 3.2, so those two projects become better integrated, with GNOME using operations offered by systemd for various tasks.[29] In November 2012, the GNOME Project concluded that basic GNOME functionality should not rely on systemd.[30]

See also[edit]


References[edit]

  1. Jump up to:a b "README"systemd (freedesktop.org), retrieved 2012-09-09
  2. Jump up^ "[systemd-devel] [ANNOUNCE] systemd 209". Lists.freedesktop.org. 2014-02-19. Retrieved 2014-02-21.
  3. Jump up^ "systemd"Analysis Summary (Ohloh), retrieved 2011-06-16
  4. Jump up to:a b Lennart Poettering (2012-04-21), systemd Status Update, retrieved 2012-04-28
  5. Jump up^ Lennart Poettering, Kay Sievers, Thorsten Leemhuis (2012-05-08), Control Centre: The systemd Linux init system, The H, archived from the original on 14 October 2012, retrieved 2012-09-09
  6. Jump up^ "[Phoronix] Systemd Dreams Up New Feature, Makes It Like Cron". Phoronix.com. 2013-01-28. Retrieved 2014-01-22.
  7. Jump up^ Sievers, Kay, "Commit importing udev into systemd"systemd(freedesktop.org), retrieved 25 May 2012
  8. Jump up^ ConsoleKit official website
  9. Jump up^ "systemd-logind.service". Freedesktop.org. Retrieved 2014-02-17.
  10. Jump up^ "systemd.index"freedesktop.org
  11. Jump up^ "F15 one page release notes"fedoraproject.org, 2001-05-24
  12. Jump up^ systemd is now the default on new installations, Arch Linux News, 2012-10-17, retrieved 2014-01-05
  13. Jump up^ CoreOS's init system, CoreOS Inc, retrieved 2014-02-14
  14. Jump up^ systemd, Debian Wiki, retrieved 2011-07-21
  15. Jump up^ Bdale Garbee (2014-02-11), Bug#727708: call for votes on default Linux init system for jessie
  16. Jump up to:a b Mark Shuttleworth (2014-02-14). "Blog Archive » Losing graciously". markshuttleworth.com. Retrieved 2014-02-14.
  17. Jump up^ D. J. Walker-Morgan (2011-05-24), Fedora 15's Lovelock released, The H, archived from the original on 2 August 2011, retrieved 2012-08-22
  18. Jump up^ Phayz (2012-01-17), Review of 2011, Frugalware Project, retrieved 2012-08-22
  19. Jump up^ "Comment #210"systemd – bug #318365 (Gentoo's Bugzilla), retrieved 2011-07-05
  20. Jump up^ systemd, Gentoo's Documentation, retrieved 2011-07-05
  21. Jump up^ systemd, Gentoo wiki, retrieved 2012-08-26
  22. Jump up^ Fabian Scherschel (2012-05-23), Mageia 2 arrives with GNOME 3 and systemd, The H, archived from the original on 8 December 2013, retrieved 2012-08-22
  23. Jump up^ Directory view of the 11.4 i586 installation showing presence of the systemd v18 installables, 2011-02-23, retrieved 2013-09-24
  24. Jump up^ Lennart Poettering (2013-06-19). "Red Hat Summit talk about systemd in RHEL 7 is now available online". Retrieved 2013-12-31.
  25. Jump up^ Tim Burke (2012-06-27), "Red Hat Enterprise Linux Roadmap Highlights" (PDF), presentation
  26. Jump up^ lxnay (2013-08-12). "Press Release: Sabayon 13.08". Sabayon. Retrieved 2014-01-22.
  27. Jump up^ systemd - An alternative boot manager, Ubuntu Wiki, retrieved 2013-06-24
  28. Jump up^ "Package Search Results - systemd". ubuntu.com. Retrieved 2014-02-17.
  29. Jump up^ Lennart Poettering (2011-05-18), "systemd as an external dependency"desktop-devel mailing list (GNOME), retrieved 2011-05-26
  30. Jump up^ Frederic Peters (2011-11-04), "20121104 meeting minutes"release-team mailing list (GNOME), retrieved 2013-01-14



출처 - http://en.wikipedia.org/wiki/Systemd








systemd is a system and service manager for Linux, compatible with SysV and LSB init scripts. systemd provides aggressive parallelization capabilities, uses socket and D-Bus activation for starting services, offers on-demand starting of daemons, keeps track of processes using Linux cgroups, supports snapshotting and restoring of the system state, maintains mount and automount points and implements an elaborate transactional dependency-based service control logic. It can work as a drop-in replacement for sysvinit. For more information, watch the video athttp://linuxconfau.blip.tv/file/4696791/ or http://www.youtube.com/watch?v=TyMLi8QF6sw

Note.png
For system administrators
System administrators can visit this page, to understand how to use the native systemctl calls that replace their old workflow in SysVinit. Note that the service and chkconfig commands will continue to work as expected in the systemd world.

Contents

 [hide

Why systemd?

http://0pointer.de/blog/projects/why.html

Introduction

systemd starts up and supervises the entire system and is based around the notion of units composed of a name and a type and matching a configuration file with the same name and type (e.g. a unit avahi.service has a configuration file with the same name and is a unit encapsulating the Avahi daemon). There are seven different types of units:

  1. service: these are the most obvious kind of unit: daemons that can be started, stopped, restarted, reloaded.
  2. socket: this unit encapsulates a socket in the file-system or on the Internet. systemd currently support AF_INET, AF_INET6, AF_UNIX sockets of the types stream, datagram, and sequential packet. It can also support classic FIFOs as transport. Each socket unit has a matching service unit, that is started if the first connection comes in on the socket or FIFO (e.g. nscd.socket starts nscd.service on an incoming connection).
  3. device: this unit encapsulates a device in the Linux device tree. If a device is marked for this via udev rules, it will be exposed as a device unit in systemd. Properties set with udev can be used as configuration source to set dependencies for device units.
  4. mount: this unit encapsulates a mount point in the file system hierarchy.
  5. automount: this unit type encapsulates an automount point in the file system hierarchy. Each automount unit has a matching mount unit, which is started (i.e. mounted) as soon as the automount directory is accessed.
  6. target: this unit type is used for logical grouping of units: instead of actually doing anything by itself it simply references other units, which thereby can be controlled together. (e.g. multi-user.target, which is a target that basically plays the role of run-level 5 on classic SysV system; or bluetooth.target which is requested as soon as a bluetooth dongle becomes available and which simply pulls in bluetooth related services that otherwise would not need to be started: bluetoothd and obexd and suchlike).
  7. snapshot: similar to target units snapshots do not actually do anything themselves and their only purpose is to reference other units.

systemd documentation

systemd has very comprehensive documentation. Refer to

http://0pointer.de/blog/projects/systemd-docs.html


systemd features

systemd provides the following:

  • aggressive parallelization capabilities using socket: To speed up the entire boot and start more processes in parallel, systemd creates the listening sockets before actually starting the daemon, and then just passes the socket to it. All sockets for all daemons are created in one step in the init system, and then in a second step run all daemons at once. If a service needs another, and it is not fully started up, what will happen is that the connection is queued in the providing service and the client will potentially block on that single request. But only that one client will block and only on that one request. Also, dependencies between services no longer have to be configured to allow proper parallelized start-up: starting all sockets at once and a service needing another, it surely can connect to its socket.
  • D-Bus activation for starting services: Using bus activation, a service can be started the first time it is accessed. Bus activation also gives the minimal per-request synchronisation needed for starting up the providers and the consumers of D-Bus services at the same time: starting a service at the same time as another, if one is quicker, than via the bus activation logic the D-Bus queues the request until the other manages to establish its service name.
  • offers on-demand starting of daemons
  • keeps track of processes using Linux cgroups: Every executed process gets its own cgroup and it is very easy to configure systemd to place services in cgroups that have been configured externally, for example via the libcgroups utilities.
  • supports snapshotting and restoring of the system state: Snapshots can be used to save/rollback the state of all services and units of the init system. Primarily it has two intended use cases: to allow the user to temporarily enter a specific state such as "Emergency Shell", terminating current services, and provide an easy way to return to the state before, pulling up all services again that got temporarily pulled down.
  • maintains mount and automount points: Systemd monitors all mount points how they come and go, and can also be used to mount or unmount mount-points. /etc/fstab can be used here as an additional configuration source for these mount points. Using the comment= fstab option you can even mark /etc/fstab entries to become systemd controlled automount points..
  • implements an elaborate transactional dependency-based service control logic: Systemd supports several kinds of dependencies between services (or units), using After/BeforeRequires and Wantsoptions in the unit configuration files to fix the ordering how units are activated. Requires and Wants, express a positive requirement dependency, either mandatory, or optional. There is Conflictswhich expresses a negative requirement dependency, and others less used. As a transactional control, if a unit is requested to start up or shut down, systemd will add it and all its dependencies to a temporary transaction, verifing if the transaction is consistent (or the ordering via After/Before of all units is cycle-free). If it is not, systemd will try to fix it up, and removes non-essential jobs from the transaction that might remove the loop.

and:

  • For each process spawned, it controls: The environment, resource limits, working and root directory, umask, OOM killer adjustment, nice level, IO class and priority, CPU policy and priority, CPU affinity, timer slack, user id, group id, supplementary group ids, readable/writable/inaccessible directories, shared/private/slave mount flags, capabilities/bounding set, secure bits, CPU scheduler reset of fork, private /tmp name-space, cgroup control for various subsystems. Also, you can easily connect stdin/stdout/stderr of services to syslog/dev/kmsg, arbitrary TTYs. If connected to a TTY for input systemd will make sure a process gets exclusive access, optionally waiting or enforcing it.
  • The native configuration files use a syntax that closely follows the well-known .desktop files: It is a simple syntax for which parsers exist already in many software frameworks. Also, this allows to rely on existing tools for i18n for service descriptions, and similar, without for admins the need to learn a new syntax.
Note.png
systemadm 
There's a minimal UI, systemadm that allows to start/stop/introspect services. It is part of the systemd-gtk package It's a work in progress and is not functional yet, but useful as a debugging tool. It's written in Vala. Do not use it for now unless you are a developer

(... and more advanced)

  • Compatibility with SysV init scripts: It takes advantages of LSB and Red Hat chkconfig headers if they are available, if not, it uses otherwise available information, such as the start priorities in /etc/rc.d. These init scripts are simply considered a different source of configuration, easing the upgrade path to proper systemd services.
  • /etc/fstab configuration file: it just another source of configuration. Using the comment= fstab option it is possible to mark /etc/fstab entries to become systemd controlled automount points.
  • Support a simple templating/instance mechanism: For example, instead of having six configuration files for six gettys, it has only one getty@.service file which gets instantiated to getty@tty2.service and suchlike. The interface part can even be inherited by dependency expressions, i.e. it is easy to encode that a service dhcpcd@eth0.service pulls in avahi-autoipd@eth0.service, while leaving the eth0 string wild-carded.
  • Compatibility, to a certain extent, with /dev/initctl. This compatibility is in fact implemented with a FIFO-activated service, which simply translates these legacy requests to D-Bus requests. Effectively this means the old shutdown, poweroff and similar commands from Upstart and sysvinit continue to work with systemd.
  • Compatibility with utmp and wtmp (To an extent that is far more than healthy, given how crufty utmp and wtmp today are).

For all details view A short list of other features on the developer blog.

Tools

  • systemctl: used to introspect and control the state of the systemd system and service manager
  • systemd-cgls: recursively shows the contents of the selected Linux control group hierarchy in a tree
  • systemadm: a graphical frontend for the systemd system and service manager that allows introspection and control of systemd. Part of the systemd-gtk page. This is a early version and needs more work. Do not use it for now unless you are a developer.

View the man pages for more details.

Boot Kernel Command Line

On boot systemd activates (by default), the target unit default.target whose job is to activate services and other units by pulling them in via dependencies.

To override the unit to activate, systemd parses its own kernel command line arguments via the systemd.unit= command line option. This may be used to temporarily boot into a different boot unit. The classical run-levels are replaced as following:

systemd.unit=rescue.target is a special target unit for setting up the base system and a rescue shell (similar to run level 1); systemd.unit=emergency.target, is very similar to passinginit=/bin/sh but with the option to boot the full system from there; systemd.unit=multi-user.target for setting up a non-graphical multi-user system; systemd.unit=graphical.targetfor setting up a graphical login screen.

For details about these special systemd boot units, view the man systemd.special page.

What is the status of systemd in Fedora?

Fedora 14 featured it is a technology preview. It is the default in Fedora 15 and above replacing Upstart.

Has all legacy System V init files been converted to systemd service files or equivalent?

Many of the core services (/lib/systemd/system has them and you can check status at http://fedoraproject.org/wiki/User:Johannbg/QA/Systemd/compatability) have been converted but not all of them yet. The transition is planned for Fedora 16. Details at http://fedoraproject.org/wiki/Features/SysVtoSystemd. systemd is fully compatible with the legacy init scripts

What is the tool to manage services with systemd?

systemctl is the primary tool to use. It combines the functionality of both service and chkconfig into a single tool that you can use for instance to enable/disable services permanently or only for the current session.

list all running services etc:

 systemctl 

Refer to man systemctl for more details. systemd-cgls lists the running process in a tree format. It can recursively show the content of any given control group. Refer to man systemd-cgls for more details.

How do I start/stop or enable/disable services?

Activates a service immediately:

  systemctl start foo.service 

Deactivates a service immediately:

  systemctl stop foo.service 

Restarts a service:

 systemctl restart foo.service 

Shows status of a service including whether it is running or not:

 systemctl status foo.service 

Enables a service to be started on bootup:

 systemctl enable foo.service 

Disables a service to not start during bootup:

 systemctl disable foo.service 

Check whether a service is already enabled or not:

 systemctl is-enabled foo.service; echo $? 

0 indicates that it is enabled, and 1 indicates that it is disabled. In Fedora 17, in addition to the return code, "enabled" or "disabled" will be printed to stdout.

Refer to man systemctl for more details.

How do I change the runlevel?

systemd has the concept of targets which is a more flexible replacement for runlevels in sysvinit.

Run level 3 is emulated by multi-user.target. Run level 5 is emulated by graphical.target. runlevel3.target is a symbolic link to multi-user.target and runlevel5.target is a symbolic link to graphical.target.

You can switch to 'runlevel 3' by running

 systemctl isolate multi-user.target (or) systemctl isolate runlevel3.target 

You can switch to 'runlevel 5' by running

 systemctl isolate graphical.target (or) systemctl isolate runlevel5.target 

How do I change the default runlevel?

systemd uses symlinks to point to the default runlevel. You have to delete the existing symlink first before creating a new one

 rm /etc/systemd/system/default.target 

Switch to runlevel 3 by default

 ln -sf /lib/systemd/system/multi-user.target /etc/systemd/system/default.target 

Switch to runlevel 5 by default

 ln -sf /lib/systemd/system/graphical.target /etc/systemd/system/default.target 

systemd does not use /etc/inittab file.

How do I know the current run level?

runlevel command still works with systemd. You can continue using that however runlevels is a legacy concept in systemd and is emulated via 'targets' and multiple targets can be active at the same time. So the equivalent in systemd terms is

 systemctl list-units --type=target 

How to power off the machine ?

You can use

poweroff

Some more possibilities are: halt -pinit 0shutdown -P now

Note that halt used to work the same as poweroff in previous Fedora releases, but systemd distinguishes between the two, so halt without parameters now does exactly what it says - it merely stops the system without turning it off.

Does service command work with systemd?

Yes. It has been modified to call systemctl automatically when dealing with systemd service files. So either of the following commands does the same thing

 service NetworkManager stop 

(or)

 systemctl stop NetworkManager.service 

Does chkconfig command work with systemd?

Yes, for turning on/off services, compatibility has been provided both ways. chkconfig has been modified to call systemctl when dealing with systemd service files. Also systemctl automatically calls chkconfig when dealing with a traditional sysv init file.

So either of the following commands does the same thing

 chkconfig NetworkManager off 

(or)

 systemctl disable NetworkManager.service 

chkconfig --list doesn't list systemd services, only Sys V services. The output of chkconfig takes note of this, along with supplying additional information.

Does system-config-services work with systemd?

The Fedora 15 or above version of system-config-services can cope with systemd service files. If you have problems, file a bug report.

How do I change the number of gettys running by default?

To add another getty:

Simply place another symlink for instantiating another getty in the getty.target.wants/ directory:

ln -sf /lib/systemd/system/getty@.service /etc/systemd/system/getty.target.wants/getty@tty9.service
systemctl daemon-reload
systemctl start getty@tty9.service

To remove a getty:

Simply remove the getty symlinks you want to get rid of in the getty.target.wants/ directory:

rm /etc/systemd/system/getty.target.wants/getty@tty5.service /etc/systemd/system/getty.target.wants/getty@tty6.service
systemctl daemon-reload
systemctl stop getty@tty5.service getty@tty6.service

systemd does not use /etc/inittab file.

How do I set automatic login on a virtual console terminal?

First create a new service similar to getty@.service:

# cp /lib/systemd/system/getty@.service \
     /etc/systemd/system/autologin@.service
# ln -s /etc/systemd/system/autologin@.service \
        /etc/systemd/system/getty.target.wants/getty@tty8.service

then edit ExecStart, Restart and Alias values, like this:

...
ExecStart=-/sbin/mingetty --autologin USERNAME %I
Restart=no
...
Alias=getty.target.wants/getty@tty8.service

and finally reload daemon and start the service:

systemctl daemon-reload
systemctl start getty@tty8.service

Note that if you exit tty8 session, you wont be able to use it until next reboot or manual start by systemctl, except if you leave Restart as ‘always’, but I highly recommend to avoid this according to security reasons.

How do I customize a unit file/ add a custom unit file?

The unit files in /etc/systemd/system have a higher precedence over unit files in /lib/systemd/system. Copy them from the latter to the former and customize it as per your requirements.

If a line starts with .include followed by a file name, the specified file will be parsed at this point. Make sure that the file that is included has the appropiate section headers before any directives.

You should use .include statement instead of copying the whole unit file from /lib/systemd/system to /etc/systemd/system if possible. This will enable to update the unchanged directives correctly during future package updates.

Be careful when using .include together with directives that can be defined multiple times (like EnvironmentFile=), since we can only add new directives, but we can't remove already defined ones. We have to copy the whole file from /lib/systemd/system to /etc/systemd/system in this case.

Let's say we use a lighttpd server and we want to lower its niceness value. All we need to do is to add Nice=-5 to the lighttpd.service file. We can do this by either copying the whole file from /lib/systemd/system/lighttpd.service to /etc/systemd/system/lighttpd.service or creating the following file in /etc/systemd/system/lighttpd.service:

.include /lib/systemd/system/lighttpd.service 
[Service]
Nice=-5

Don't forget to reload systemd daemon using systemctl daemon-reload after editing a unit file.


Note.png
When modifying an unit that has an symlink pointing to that unit for example like the display-manager.service -> prefdm.service does, the symlink should be copied instead of the actual unit as in display-manager.service should be copied to the /etc/systemd/system directory or a new unit created with .includes that bears that name .

How do I debug systemd issues?

Refer to How_to_debug_Systemd_problems

Readahead

systemd has a built-in readahead implementation which is not enabled on upgrades. It should improve bootup speed but your mileage may vary depending on your hardware. To enable it:

systemctl enable systemd-readahead-collect.service
systemctl enable systemd-readahead-replay.service

Warnings on separate /usr partition

Refer to http://freedesktop.org/wiki/Software/systemd/separate-usr-is-broken and http://cgit.freedesktop.org/systemd/tree/README for details.

Man pages

systemd comes with extensive documentation including several man pages. The web version is at

http://www.freedesktop.org/software/systemd/man/

References


출처 - http://fedoraproject.org/wiki/Systemd#How_do_I_change_the_runlevel.3F








'System > Linux' 카테고리의 다른 글

linux - webmin  (0) 2013.05.17
fedora - virtualbox installation  (0) 2013.05.02
linux - YUM(Yellow dog Updater, Modified)  (0) 2013.04.30
linux - LVS(Linux Virtual Server)  (0) 2013.04.27
linux - centos 6.4 netinstall  (0) 2013.04.19
Posted by linuxism
,