CT320

CT320: Network and System Administration

Fall 2015

Booting

See this page as a slide show

Booting And Shutting Down

Colorado State University
Computer Science Department

Original slides from Dr. James Walden at Northern Kentucky University.

Topics

  1. Booting
  2. Bootstrap loaders
  3. Run levels
  4. Startup system
  5. Shutdown and reboot

Booting

  1. ROM boot code (BIOS in PCs)
  2. Master Boot Record (MBR)
  3. Bootloader
  4. Kernel
  5. Hardware detection and configuration
  6. Creation of system processes
  7. Multiuser operation

BIOS

MBR

Bootloader: GRUB

GRUB Boot

Booting with GRUB

Direct Boot

Chainloading

GRUB Config

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?!

GRUB Naming Convention

Kernel

Kernel Arguments

Numeric arguments

Root device options

Kernel Arguments (continued)

Console options

Hardware options

See bootparam for many more.

Getting it all going

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.

What's wrong with init?

Competition

init has several competitors, including:

systemd is quite popular. It is now the default startup mechanism for Debian, Fedora, Red Hat, SUSE, and Ubuntu. We will discuss only systemd.

Service Cheatsheet

CommandPurpose
systemctl start nameStart a service right now.
systemctl stop nameStop a service right now.
systemctl restart nameRestart a service (stop+start).
systemctl reload nameReload configuration (config file changed).
systemctl status nameHow’s it going?
systemctl enable nameStart this service at each boot.
systemctl disable nameDo not start service at each boot.
systemctl is-active nameWhat services are active?
systemctl list-units --type service --allWhat services exist?

Targets in systemd

Old init RunlevelSystemd TargetDescription
0poweroff.targetHalt the system.
1, s, singlerescue.targetSingle user mode
3multi-user.targetMulti-user, non-graphical
login via console or the network
5graphical.targetSame as previous plus graphical login
6reboot.targetReboot
 emergency.targetEmergency shell

Switch to a different target: systemctl isolate name

What if single user mode doesn’t work?

It’s all systemd

% wherep shutdown halt poweroff reboot
lrwxrwxrwx 1 root root 16 Jun  9 07:40 /sbin/shutdown -> ../bin/systemctl
lrwxrwxrwx 1 root root 16 Jun  9 07:40 /usr/sbin/shutdown -> ../bin/systemctl
lrwxrwxrwx 1 root root 16 Jun  9 07:40 /sbin/halt -> ../bin/systemctl
lrwxrwxrwx 1 root root 16 Jun  9 07:40 /usr/sbin/halt -> ../bin/systemctl
lrwxrwxrwx 1 root root 16 Jun  9 07:40 /sbin/poweroff -> ../bin/systemctl
lrwxrwxrwx 1 root root 16 Jun  9 07:40 /usr/sbin/poweroff -> ../bin/systemctl
lrwxrwxrwx 1 root root 16 Jun  9 07:40 /sbin/reboot -> ../bin/systemctl
lrwxrwxrwx 1 root root 16 Jun  9 07:40 /usr/sbin/reboot -> ../bin/systemctl

Example systemd .service file

/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

References

Modified: 2015-08-30T15:27

User: Guest

Check: HTML CSS
Edit History Source
Apply to CSU | Contact CSU | Disclaimer | Equal Opportunity
Colorado State University, Fort Collins, CO 80523 USA
© 2015 Colorado State University
CS Building