//---------------------------------------------------------// linux meetup presentation 06-04-2012 Fedora 16 (with elaboration on Gnome 3, Grub2, & the new systemd) presented by Bob Carnaghi w/the usual glorious assistance of Jason Schonberg http://www.meetup.com/linux-85/ //----------------------// `yum install yum-plugin-fastestmirror` `rpm -ivh http://download1.rpmfusion.org/free/fedora/releases/16/Everything/x86_64/os/rpmfusion-free-release-16-1.2.noarch.rpm` `rpm -ivh http://download1.rpmfusion.org/nonfree/fedora/releases/16/Everything/x86_64/os/rpmfusion-nonfree-release-16-1.1.noarch.rpm` //----------------------// `yum -y install hardinfo` //-------------------------------------------------------// //---------- gnome3 ----------// https://live.gnome.org/ http://www.youtube.com/watch?v=SSGfS6K7pI0 http://mustaxe.blogspot.com/2011/06/fedora-15-and-gnome-3-add-shutdown.html http://mustaxe.blogspot.com/2011/05/fedora-15-and-gnome-3-add-minimize.html http://live.gnome.org/GnomeShell/CheatSheet http://www.youtube.com/watch?v=NFF5GeGTLQI (fall back to gnome dt) //----------------------// how to get rid of gnome 3 shell: switch gnome 3 out of shell (into fallback) mode: -> install (packages) compiz compiz-gnome compiz-manager compiz-plugin-main -> logout, then login to gnome3 desktop w/compiz -> install (packages) ccsm, compiz-fusion, compiz-fusion-extras, compiz-fusion-gnome -> look under "other -> compiz-config settings manager //---------------------------------------------------------// //----------- gnome-shell-extensions -----------// `yum -y install gnome-tweak-tool gnome-shell-extensions-common` Then after install start the tool by just Alt+F2 and type gnome-tweak-tool https://extensions.gnome.org/ http://live.gnome.org/GnomeShell/Extensions http://www.techrepublic.com/blog/opensource/gnome-3-extensions-making-the-desktop-crazy-easy/3253 //----------------------// //----------- extensions installed on demo system -----------// gnome-shell-extension-common-3.2.3-2.fc16.noarch gnome-shell-extension-apps-menu-3.2.3-2.fc16.noarch gnome-shell-extension-calc-0-0.3.git2fca097.fc16.noarch gnome-shell-extension-systemMonitor-3.2.3-2.fc16.noarch gnome-shell-extension-alternate-tab-3.2.3-2.fc16.noarch gnome-shell-extension-workspacesmenu-0-1.fc16.noarch gnome-shell-extension-dock-3.2.3-2.fc16.noarch nautilus-extensions-3.2.1-2.fc16.x86_64 //----------- extension config location -----------// ~/.local/share/gnome-shell/ //---------------------------------------------------------// //----------- systemd -----------// http://fedoraproject.org/wiki/Systemd http://www.youtube.com/watch?v=TyMLi8QF6sw https://www.linux.com/learn/tutorials/524577-here-we-go-again-another-linux-init-intro-to-systemd https://www.linux.com/learn/tutorials/539856-more-systemd-fun-the-blame-game-and-stopping-services-with-prejudice https://www.linux.com/learn/tutorials/527639-managing-services-on-linux-with-systemd http://0pointer.de/blog/projects/systemd.html http://0pointer.de/blog/projects/systemd-for-admins-1.html http://0pointer.de/blog/projects/systemd-for-admins-2.html http://0pointer.de/blog/projects/systemd-for-admins-3.html http://0pointer.de/blog/projects/systemd-for-admins-4.html http://0pointer.de/blog/projects/three-levels-of-off.html http://0pointer.de/blog/projects/changing-roots http://0pointer.de/blog/projects/blame-game.html http://0pointer.de/blog/projects/the-new-configuration-files.html http://0pointer.de/blog/projects/on-etc-sysinit.html http://0pointer.de/blog/projects/instances.html http://0pointer.de/blog/projects/inetd.html systemd home page: http://www.freedesktop.org/wiki/Software/systemd //----------- notes -----------// systemadm - graphical systemd manager - install the systemd-gtk package on Fedora, the systemd package on Arch, or the systemd-gui for Debian see the status of everything systemd controls: `systemctl` see only available services, running or not: `systemctl list-units -t service --all` see only active services: `systemctl list-units -t service` check the status of any individual service: `systemctl status .service` start a service: `systemctl start sshd.service` use restart to restart a running service. This stops a service: `systemctl stop sshd.service` start a service at boot: `systemctl enable sshd.service` disable it from starting at boot: `systemctl disable sshd.service` check to see if a service is running; 0 means it is currently running and 1 means it is not: `systemctl is-enabled sshd.service; echo $?` enabled 0 shutdown or reboot the system. All three send a wall message to users warning that the system is going down. `systemctl [halt | poweroff | reboot] Processes, cgroups, and Killing systemd organizes processes with cgroups, and you can see this with the ps command, which has been updated to show cgroups. see which service owns which processes: `ps xawf -eo pid,user,cgroup,args` cgroups were introduced into the Linux kernel a few years ago, and they are an interesting mechanism for allocating and limiting kernel resources. In systemd, cgroups are used to corral and manage processes. When new processes are spawned they become members of the parent's cgroup. The cgroup is named for the service it belongs to, and services cannot escape from their cgroups so you always know what service they belong to. When you need to kill a service you can kill the cgroup, and snag all of its processes in one swoop instead of playing find-the-fork-or-renamed-process. `systemd-cgls` `systemctl kill .service` stop a running service temporarily: `systemctl stop .service` stop it from starting at boot, does not stop a running service: (will also prevent it from being started by anything else, such as plugging in some hardware, or by socket or bus activation; it can still be started and stopped manually) `systemctl disable .service` ***** to stop a service for good (without uninstalling it), mask it by linking it to /dev/null: `ln -s /dev/null /etc/systemd/system/.service` `systemctl daemon-reload` "When you do this you can't even start the service manually. Nothing can touch it. After being vexed by mysterious scripts that sneaked around behind my back and restarted services I wanted killed on sysvinit distros, I like this particular command a lot. The unit files in /etc/systemd/system override /lib/systemd/system, which have the same names. Unless your chosen Linux distro does something weird, /etc/systemd/system is for sysadmins and /lib/systemd/system is for your distro maintainers, for configuring package management. So masking should survive system updates." to re-enable the service delete the symlink and run: `systemctl enable .service` reload the entire systemd manager configuration (without disrupting active services): `daemon-reload` and reload. The daemon-reload option reload the configuration files for a specific service (without disrupting the service): `systemctl reload .service` (this is what to use when you make configuration changes) system boot: "The time it takes for a PC to boot is controlled by two things: how the long the BIOS takes to do its part, and then the operating system... There isn't much we can do about BIOS times. Some are fast, some are slow, and unless you're using a system with OpenBIOS you're at the mercy of your motherboard vendor. The PC BIOS hasn't advanced much since its inception lo so many decades ago, except for recurring attempts to lock users out and control what we can install on our own computers, which I think is pretty sad. With quad-core systems as common as dust mites it seems a computer should boot as fast as flicking a light switch." `systemd-analyze blame` There are some limitations to this command: it doesn't show which services start in parallel or what's holding up the ones that take longer. But it does show me a lot of slow services that don't need to be running at all on my system. If you like pretty graphs systemd includes a cool command for automatically generating an SVG image from the blame output, like this: `systemd-analyze plot > graph1.svg` systemd reports to syslog a boot-time summary, written to /var/log/messages: `cat /var/log/messages | grep -i startup` //---------------------------------------------------------// //----------- grub2 -----------// excellent tutorial: http://www.dedoimedo.com/computers/grub-2.html good intro: http://fedoraproject.org/wiki/Grub2 http://fedoraproject.org/wiki/Features/Grub2 http://ubuntu-install.blogspot.com/2009/11/grub2-title-tweaks.html critical files: /boot/grub2/grub.cfg - main config file, do not edit manually, will be created during build process /etc/grub.d - directory that contains grub scripts w/build the grub.cfg file /etc/default/grub - GRUB menu settings read by GRUB scripts and written into grub.cfg; this is the customization part of GRUB, similar to the old menu.lst if you want to change the GRUB menu, edit existing scripts or create new ones, then update the menu with the command `grub2-mkconfig` commands: `update-grub` = grub file + scripts = grub.cfg (this is debian/ubuntu only..?) `grub-install target` (/dev/sda, etc.) note that the update-grub command is only on deb-type systems try this: `grub2-mkconfig -o /boot/grub2/grub.cfg` //----------------------// key commands: grub2-mkconfig grub2-set-default grub2-editenv [list] grep menuentry /boot/grub2/grub.cfg full list of commands: grub2-bin2h - Convert a binary file to a C header. grub2-editenv - Tool to edit environment block. grub2-fstest - Debug tool for filesystem driver. grub2-install - Install GRUB on your drive. grub2-kbdcomp - got error output ..? grub2-menulst2cfg - Usage: grub2-menulst2cfg [INFILE [OUTFILE]] grub2-mkconfig - Generate a grub config file grub2-mkdevicemap - Generate a device map file automatically. grub2-mkfont - Usage: grub2-mkfont [OPTIONS] FONT_FILES grub2-mkimage - Make a bootable image of GRUB. grub2-mklayout - ??? grub2-mknetdir - Install GRUB on your drive. Usage: grub2-mknetdir [OPTION] install_device grub2-mkpasswd-pbkdf2 - Usage: grub2-mkpasswd-pbkdf2 [OPTIONS] grub2-mkrelpath - Make a system path relative to its root. grub2-mkrescue - Make GRUB rescue image. grub2-mkrescue generates a bootable rescue image with specified source files, source directories, or mkisofs options listed by: xorriso -as mkisofs -help grub2-probe - Probe device information for a given path (or device, if the -d option is given). grub2-reboot - Set the default boot entry for GRUB, for the next boot only. Usage: grub2-reboot [OPTION] entry grub2-script-check - Checks GRUB script configuration file for syntax errors. grub2-set-default - Set the default boot entry for GRUB. grub2-setup - Set up images to boot from DEVICE. You should not normally run this program directly. Use grub-install instead. how to change the default boot target: 1. run `egrep ^menuentry\|^set /boot/grub2/grub.cfg`, note listed output 2. run `grub2-set-default `, substitute w/number from output above; numbering starts @ "0" 3. make sure /etc/defaults/grub has entry "GRUB_DEFAULT=saved"; it's ok to edit that file 4. run `grub2-mkconfig -o /boot/grub2/grub.cfg`; it's not ok to edit the grub.cfg file, it'll get overwritten //----------------------// Encountering the dreaded Grub2 boot prompt You would swear that drive should boot and everything is ok, but then you see the Grub2 Command Prompt what to do and how to recover 1. List the drives which Grub2 saw: grub2> ls 2. The output for a dos partition table /dev/sda with three partitons will look something like (hd0) (hd0,msdos3) (hd0,msdos2) (hd0,msdos1) 3. While the output for a gpt partition table /dev/sda with four partitions will look something like (hd0) (hd0,gpt4) (hd0,gpt3) (hd0,gpt2) (hd0,gpt1) 4. With this information you can now interrogate each partition of the drive and locate your vmlinuz and initramfs files: ls (hd0,1)/ Would list the files on /dev/sda1 and if it was the /boot would give you the full name of vmlnuz and initramfs 5. Armed with the location and full name of vmlinuz and initramfs you can "bootstrap" boot your system 5a. Declare your root partition first grub> set root=(hd0,3) 5b. Declare the kernel you want used grub> linux (hd0,1)/vmlinuz-3.0.0-1.fc16.i686 root=/dev/sda3 rhgb quiet selinux=0 # NOTE : add other kernel args if you have need of them # NOTE : change the numbers to match your system 5c. Declare the initrd to use grub> initrd (hd0,1)/initramfs-3.0.0-1.fc16.i686.img # NOTE : change the numbers to match your system 5d. Instruct Grub2 to now please boot the chosen files grub> boot 6. Now when your system boots open a terminal 7. Issue the grub2-mkconfig command to re-create the grub.cfg file grub2 needed to boot your system grub2-mkconfig -o /boot/grub2/grub.cfg 8. Issue the grub2-install command to install grub2 to your hard drive and make use of your config grub2-install --boot-directory=/boot /dev/sda # Note: your drive may have another device name check for it with mount command output //----------------------// //---------------------------------------------------------// //----------- install memtest as boot option -----------// http://pkgs.org/fedora-16/fedora-updates-x86_64/memtest86+-4.20-4.fc16.x86_64.rpm.html Memtest86+ is a thorough stand-alone memory test for x86 and x86-64 architecture computers. BIOS based memory tests are only a quick check and often miss many of the failures that are detected by Memtest86+. The ELF version should be used for booting from grub, and avoids the following errors: "Error 7: Loading below 1MB is not supported" "Error 13: Invalid or unsupported executable format" "Error 28: Selected item cannot fit into memory" specific steps: yum install memtest86+ /usr/sbin/memtest-setup grub2-mkconfig -o /boot/grub2/grub.cfg