Colorado State University
Computer Science Department
Original slides from Dr. James Walden at Northern Kentucky University.
My /etc/default/grub
:
GRUB_DEFAULT=0 GRUB_HIDDEN_TIMEOUT_QUIET=true GRUB_TIMEOUT=4 GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian` GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" GRUB_CMDLINE_LINUX=""
Edit, then update-grub
.
How can GRUB_DISTRUBTOR possibly do shell stuff at boot-time?!
(hd0,0)
First partition of first hard disk
(hd1,2)
Third partition of second hard disk.
/boot/vmlinuz-VERSION
/boot/initrd.img-VERSION
to memory.
initrd
and mounts as /sysroot
.
/sysroot
.
systemd
, init
, upstart
, or whatever’s in fashion.
Numeric arguments
single
also specifies single user mode
Root device options
root=
specifies which root device to use
ro
, rw
specify access type
Console options
console=ttyS1,9600
will use serial console
Hardware options
See bootparam for many more.
There has to be an initial process that gets things going. It must:
Historically, Linux systems have used the System V init
to accomplish this.
init
does NOT monitor or restart services after boot.
If a service dies, it dies. So sad!
init
has several competitors, including:
initng
runit
upstart
systemd
systemd
is quite popular, and quite controversial. It is now the
default startup mechanism for Debian, Fedora, Red Hat, SUSE, and Ubuntu.
We will discuss only systemd
.
Command | Purpose |
---|---|
systemctl start name | Start a service right now. |
systemctl stop name | Stop a service right now. |
systemctl restart name | Restart a service (stop+start). |
systemctl reload name | Reload configuration (config file changed). |
systemctl status name | How’s it going? |
systemctl enable name | Start this service at each boot. |
systemctl disable name | Do not start service at each boot. |
systemctl is-active name | What services are active? |
systemctl list-units --type service --all | What services exist? |
Old init Runlevel | Systemd Target | Description |
---|---|---|
0 | poweroff.target | Halt the system. |
1, s, single | rescue.target | Single user mode |
3 | multi-user.target | Multi-user, non-graphical login via console or the network |
5 | graphical.target | Same as previous plus graphical login |
6 | reboot.target | Reboot |
emergency.target | Emergency shell |
Switch to a different target: systemctl isolate
name
systemd
by booting into shell
init=/bin/bash
argument to kernel.
rw
option as well.
$ PATH=/sbin:/bin:/usr/bin $ type -p shutdown halt poweroff reboot /sbin/shutdown /sbin/halt /sbin/poweroff /sbin/reboot $ ls -l $(type -p shutdown halt poweroff reboot) lrwxrwxrwx 1 root root 16 Sep 23 20:25 /sbin/halt -> ../bin/systemctl lrwxrwxrwx 1 root root 16 Sep 23 20:25 /sbin/poweroff -> ../bin/systemctl lrwxrwxrwx 1 root root 16 Sep 23 20:25 /sbin/reboot -> ../bin/systemctl lrwxrwxrwx 1 root root 16 Sep 23 20:25 /sbin/shutdown -> ../bin/systemctl
/usr/lib/systemd/system/crond.service:
[Unit] Description=Command Scheduler After=auditd.service nss-user-lookup.target systemd-user-sessions.service time-s ync.target ypbind.service [Service] EnvironmentFile=/etc/sysconfig/crond ExecStart=/usr/sbin/crond -n $CRONDARGS ExecReload=/bin/kill -HUP $MAINPID KillMode=process [Install] WantedBy=multi-user.target
Modified: 2017-11-29T20:21 User: Guest Check: HTML CSSEdit History Source |
Apply to CSU |
Contact CSU |
Disclaimer |
Equal Opportunity Colorado State University, Fort Collins, CO 80523 USA © 2015 Colorado State University |