university of pisa computer science department system administration boot-shutdown stefano...

26
University of Pisa Computer Science Department System Administration Boot-shutdown Stefano Bistarelli University of Pisa Computer Science Department [email protected] http://www.di.unipi.it/~bista/ Annalina Fabrizio

Upload: kaitlyn-mccann

Post on 27-Mar-2015

215 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: University of Pisa Computer Science Department System Administration Boot-shutdown Stefano Bistarelli University of Pisa Computer Science Department bista@di.unipi.it

University of PisaComputer Science Department

System Administration

Boot-shutdown

Stefano Bistarelli

University of PisaComputer Science [email protected]://www.di.unipi.it/~bista/

Annalina Fabrizio

Page 2: University of Pisa Computer Science Department System Administration Boot-shutdown Stefano Bistarelli University of Pisa Computer Science Department bista@di.unipi.it

dr. Stefano Bistarelli: System AdministrationUniversity of PisaComputer Science Department

Outline

lun mar mer gio ven sab dom

1 2 3 4 5 6 7

8 9 10 11 lab 12 lab 13 14

15 lab 16 17 18 lab 19 lab 20 21

22 lab 23selfstudy 24 25lab 26 lab 27 28

29 lab 30 selfstudy 31

2001

Gennaio

Page 3: University of Pisa Computer Science Department System Administration Boot-shutdown Stefano Bistarelli University of Pisa Computer Science Department bista@di.unipi.it

dr. Stefano Bistarelli: System AdministrationUniversity of PisaComputer Science Department

Outline

lun mar mer gio ven sab dom

1 2 lab 3 4

5 lab 6 7 Ripasso in

aula / Selfstudy 8 lab 9l ab 10 11

12 Exam 13 Exam 14 15 16 17 18

19 20 21 22 23 24 25

26 27 28

2001

Febbraio

Page 4: University of Pisa Computer Science Department System Administration Boot-shutdown Stefano Bistarelli University of Pisa Computer Science Department bista@di.unipi.it

dr. Stefano Bistarelli: System AdministrationUniversity of PisaComputer Science Department

Prima Settimana

9Introduzione

W2K•Installazione win2K (anche studenti)•Backup

Riferimenti:-Lucidi-Cap 1,2,15 libro

10W2K•registri•Active Directory•Gestione computer

Linux-Installazione Linux

Riferimenti:-Lucidi-Cap 4,5 libro-RH inst.guide

11 lab

-Linux utente1

12 lab

-Linux utente2

Page 5: University of Pisa Computer Science Department System Administration Boot-shutdown Stefano Bistarelli University of Pisa Computer Science Department bista@di.unipi.it

dr. Stefano Bistarelli: System AdministrationUniversity of PisaComputer Science Department

Seconda settimana

15 lab 16W2K•Booting and ShutdownDisco ripristino

Linux•Booting and Shutdown•Inst. Linux (studenti)

Riferimenti:-Lucidi- fotocopie

17W2K•Utenti

Linux•Backup•multi boot•Utenti•superuser

Riferimenti:-Libro Cap. 7-Lucidi- fotocopie

18 lab

Esercitazioni su:Backup (N-P-F)Ripasso quanto fatto finoraDomande studentiInst. office

19 lab

Page 6: University of Pisa Computer Science Department System Administration Boot-shutdown Stefano Bistarelli University of Pisa Computer Science Department bista@di.unipi.it

dr. Stefano Bistarelli: System AdministrationUniversity of PisaComputer Science Department

Booting and Shutdown - Linux

powered-down halted

1. Loading UNIX into memory2. Inizialization of the Kernel3. Hardware probing and configuration4. Creation of spontaneous system processes

single-user execution of inizialization script multi-user operation

Page 7: University of Pisa Computer Science Department System Administration Boot-shutdown Stefano Bistarelli University of Pisa Computer Science Department bista@di.unipi.it

dr. Stefano Bistarelli: System AdministrationUniversity of PisaComputer Science Department

Loading UNIX into memory

Processor look for the BIOS BIOS check the system, look and test for

periferal and look for booting device (disco, nastro, cdrom, rete)

su disco fa partire MBR MBR cerca il boot loader (LILO in Linux) LILO controlla file di configurazione

/etc/lilo.conf (vederlo) load the kernel /boot/vmlinuz-???

Page 8: University of Pisa Computer Science Department System Administration Boot-shutdown Stefano Bistarelli University of Pisa Computer Science Department bista@di.unipi.it

dr. Stefano Bistarelli: System AdministrationUniversity of PisaComputer Science Department

/etc/lilo.conf

Man lilo Lilo –q (per vedere

/boot/map) Boot via

seriale/mode Proteggere con

password

boot=/dev/sda

map=/boot/map

install=/boot/boot.b

prompt

timeout=50

linear

default=linux

image=/boot/vmlinuz-2.2.14-5.0smp

label=linux

initrd=/boot/initrd-2.2.14-5.0smp.img

read-only

root=/dev/sda1

image=/boot/vmlinuz-2.2.14-5.0

label=linux-up

initrd=/boot/initrd-2.2.14-5.0.img

read-only

root=/dev/sda1

Page 9: University of Pisa Computer Science Department System Administration Boot-shutdown Stefano Bistarelli University of Pisa Computer Science Department bista@di.unipi.it

dr. Stefano Bistarelli: System AdministrationUniversity of PisaComputer Science Department

Lab: 15 min

Man lilo.conf Opzione utili?

Compact Message=messsagefile Verbose=?

Si? Aggiungerla se non c’e’ di gia. Digitare lilo per fissare modifiche

Page 10: University of Pisa Computer Science Department System Administration Boot-shutdown Stefano Bistarelli University of Pisa Computer Science Department bista@di.unipi.it

dr. Stefano Bistarelli: System AdministrationUniversity of PisaComputer Science Department

Inizialization of the Kernel and Hardware probing and configuration

Kernel: test per trovare quanta memoria istallata e quanta

riservarne per se. test per controllare che HW e' presente (nel kernel ci

sono inseriti tutti i device che volete, e lui controlla per verificare la presenza dell'HW)

configurazione dell'HW (via probing o leggendola dal device)

Se HW non risponde, device e' disabilitato (se aggiungete l' HW l'O.S. non se ne accorge (non e' plug-and-play)

Page 11: University of Pisa Computer Science Department System Administration Boot-shutdown Stefano Bistarelli University of Pisa Computer Science Department bista@di.unipi.it

dr. Stefano Bistarelli: System AdministrationUniversity of PisaComputer Science Department

Creation of spontaneous system processes

id:5:initdefault:

# System initialization.

si::sysinit:/etc/rc.d/rc.sysinit

l0:0:wait:/etc/rc.d/rc 0

l6:6:wait:/etc/rc.d/rc 6

# Things to run in every runlevel.

ud::once:/sbin/update

# Trap CTRL-ALT-DELETE

ca::ctrlaltdel:/sbin/shutdown -t3 -r now

# When our UPS tells us power has failed, assume we have a few minutes

# of power left. Schedule a shutdown for 2 minutes from now.

# This does, of course, assume you have powerd installed and your

# UPS connected and working correctly.

pf::powerfail:/sbin/shutdown -f -h +2 "Power Failure; System Shutting Down"

# If power was restored before the shutdown kicked in, cancel it.

pr:12345:powerokwait:/sbin/shutdown -c "Power Restored; Shutdown Cancelled"

# Run gettys in standard runlevels

1:2345:respawn:/sbin/mingetty tty1

6:2345:respawn:/sbin/mingetty tty6

# Run xdm in runlevel 5; xdm is now a separate service

x:5:respawn:/etc/X11/prefdm -nodaemon

/sbin/init (legge /etc/inittab)

Page 12: University of Pisa Computer Science Department System Administration Boot-shutdown Stefano Bistarelli University of Pisa Computer Science Department bista@di.unipi.it

dr. Stefano Bistarelli: System AdministrationUniversity of PisaComputer Science Department

Id:runlevel:azione:processo

# Run gettys in standard runlevels 1:2345:respawn:/sbin/mingetty tty1 Runlevel

0 halted 1,s,S single-user 2 NFS 3 net 4 not used 5 Xwin 6 reboot

Azione Respawn (riparte al termine dopo 5 minuti) Once (solo una volta)

Page 13: University of Pisa Computer Science Department System Administration Boot-shutdown Stefano Bistarelli University of Pisa Computer Science Department bista@di.unipi.it

dr. Stefano Bistarelli: System AdministrationUniversity of PisaComputer Science Department

Inittab (continua)

/etc/rc.d/sysinit.d Set the path Read in config data. Set the system clock. Start up swapping swapon –a Set the hostname hostname ${HOSTNAME} Clear mtab Enter root and /proc into mtab. Load sound modules Check filesystems chkfs Mount all other filesystems

/etc/sysconfig

Page 14: University of Pisa Computer Science Department System Administration Boot-shutdown Stefano Bistarelli University of Pisa Computer Science Department bista@di.unipi.it

dr. Stefano Bistarelli: System AdministrationUniversity of PisaComputer Science Department

modalità single user

- solo / montata - nessun demone attivo - possibilità di fare fsck, date, ...

Da boot di lilo Single emergency

Page 15: University of Pisa Computer Science Department System Administration Boot-shutdown Stefano Bistarelli University of Pisa Computer Science Department bista@di.unipi.it

dr. Stefano Bistarelli: System AdministrationUniversity of PisaComputer Science Department

initialiazation script /etc/rc* (vederli)

- setting the name - setting the timezone - fsck - mountin fs - removing file from /tmp - starting daemon e net services - account e quotas - configurig network interface

Page 16: University of Pisa Computer Science Department System Administration Boot-shutdown Stefano Bistarelli University of Pisa Computer Science Department bista@di.unipi.it

dr. Stefano Bistarelli: System AdministrationUniversity of PisaComputer Science Department

daemoni

cron swapper update lpd sendmail inetd comsat talkd rwhod

ftpd rexecd rlogind rshd timed routed gated syslogd named nntpd

Page 17: University of Pisa Computer Science Department System Administration Boot-shutdown Stefano Bistarelli University of Pisa Computer Science Department bista@di.unipi.it

dr. Stefano Bistarelli: System AdministrationUniversity of PisaComputer Science Department

multiuser

- runlevels: 0 halted 1,s,S single-user 6 reboot

- inittab: initdefault 1 getty

Login shell 2 xdm xterm

Page 18: University of Pisa Computer Science Department System Administration Boot-shutdown Stefano Bistarelli University of Pisa Computer Science Department bista@di.unipi.it

dr. Stefano Bistarelli: System AdministrationUniversity of PisaComputer Science Department

login

/etc/nologin /etc/usertty /etc/securetty .hushlogin (quiet login)

No chekmail, no motd, no last log (/var/log/lastlog)

Who /var/run/utmp (userlist grafico) /var/log/wtmp (va ripulito)

Page 19: University of Pisa Computer Science Department System Administration Boot-shutdown Stefano Bistarelli University of Pisa Computer Science Department bista@di.unipi.it

dr. Stefano Bistarelli: System AdministrationUniversity of PisaComputer Science Department

Shell

login ~/.bash_profile ~/.profile

Shell – xterm ~/.bashrc

File passwd e shadow .. Con calma!!

Page 20: University of Pisa Computer Science Department System Administration Boot-shutdown Stefano Bistarelli University of Pisa Computer Science Department bista@di.unipi.it

dr. Stefano Bistarelli: System AdministrationUniversity of PisaComputer Science Department

the system does not boot

- HW problem - boot device difettoso - damaged fs - kernel malconfigurato - errori in /etc/rc*

Page 21: University of Pisa Computer Science Department System Administration Boot-shutdown Stefano Bistarelli University of Pisa Computer Science Department bista@di.unipi.it

dr. Stefano Bistarelli: System AdministrationUniversity of PisaComputer Science Department

HW problem

- power? - cavi? - check the light! - spengi-riaccendi - prova autodiagnostici - syslog.conf --> log non su /dev/console ma

su /var/log/kernellog - chiama tecnico

Page 22: University of Pisa Computer Science Department System Administration Boot-shutdown Stefano Bistarelli University of Pisa Computer Science Department bista@di.unipi.it

dr. Stefano Bistarelli: System AdministrationUniversity of PisaComputer Science Department

altri

device probem copie del kernel su piu' boot device

damaged fs / damaged --> niente da fare --> reinstall boot single user, fsck

kernel malconfigurato riconfigurarlo

erori in rc* edit

Page 23: University of Pisa Computer Science Department System Administration Boot-shutdown Stefano Bistarelli University of Pisa Computer Science Department bista@di.unipi.it

dr. Stefano Bistarelli: System AdministrationUniversity of PisaComputer Science Department

shut-down

- modifiche a /etc/rc script - reset periferiche e non piu' riconosciute

(modem, printer) - un macchina unix si dovrebbe spegnere

max 1 volta a settimana - se si inchioda

Page 24: University of Pisa Computer Science Department System Administration Boot-shutdown Stefano Bistarelli University of Pisa Computer Science Department bista@di.unipi.it

dr. Stefano Bistarelli: System AdministrationUniversity of PisaComputer Science Department

come fare shut-down

turn-off (solo incendio/inondazione) shutdown [-t sec] [-rkhncf] time [warning-message]

bloccato login (vedi anche file nologin) opzioni -r rebbot (6), -h halt (0), -k kidding, -f fastboot,

-c cancel Halt (o), reboot (6), poweroff [-n] [-w] [-d] [-f] [-i] [-

p] Kill the processes, execute sync, halt the CPU -n nosync, -p poweroff

init 0-6,s

Page 25: University of Pisa Computer Science Department System Administration Boot-shutdown Stefano Bistarelli University of Pisa Computer Science Department bista@di.unipi.it

dr. Stefano Bistarelli: System AdministrationUniversity of PisaComputer Science Department

come fare shut-down

kill [ -signal ] [ -a ] pid By sending signal TERM to init (kill –15 1 == kill -TERM 1) SHUTDOWN

By sending signal KILL to init Kill –9 1

Page 26: University of Pisa Computer Science Department System Administration Boot-shutdown Stefano Bistarelli University of Pisa Computer Science Department bista@di.unipi.it

dr. Stefano Bistarelli: System AdministrationUniversity of PisaComputer Science Department

Signals: kill –l signal

SIGHUP 1 SIGINT 2 SIGQUIT 3 SIGILL 4 SIGTRAP 5 SIGABRT 6 SIGIOT 6 SIGBUS 7 SIGFPE 8 SIGKILL 9 SIGUSR1 10 SIGSEGV 11 SIGUSR2 12 SIGPIPE 13 SIGALRM 14 SIGTERM 15

SIGSTKFLT 16 SIGCHLD 17 SIGCONT 18 SIGSTOP 19 SIGTSTP 20 SIGTTIN 21 SIGTTOU 22 SIGURG 23 SIGXCPU 24 SIGXFSZ 25 SIGVTALRM 26 SIGPROF 27 SIGWINCH 28 SIGIO 29 SIGPWR 30 SIGUNUSED 31