Difference between revisions of "User:Djgera"
(→systemd) |
(→System configuration) |
||
Line 319: | Line 319: | ||
└── sshd.socket -> /usr/lib/systemd/system/sshd.socket | └── sshd.socket -> /usr/lib/systemd/system/sshd.socket | ||
</nowiki>}} | </nowiki>}} | ||
+ | |||
+ | |||
+ | ==== smartmontools ==== | ||
+ | |||
+ | {{hc| | ||
+ | /etc/systemd/system/smartlog@.service | ||
+ | |<nowiki> | ||
+ | [Unit] | ||
+ | Description=SMART on disk %I | ||
+ | |||
+ | [Service] | ||
+ | ExecStart=/usr/sbin/smartctl -a /dev/%I | ||
+ | SyslogIdentifier=smart-%I | ||
+ | </nowiki>}} | ||
+ | |||
+ | |||
+ | ==== hddtemp ==== | ||
+ | |||
+ | {{hc| | ||
+ | /etc/systemd/system/hddtemp.service.d/es.conf | ||
+ | |<nowiki> | ||
+ | [Service] | ||
+ | ExecStart= | ||
+ | ExecStart=/usr/bin/hddtemp -dF /dev/sda /dev/sdb /dev/sdc | ||
+ | </nowiki>}} | ||
+ | |||
==== apcupsd ==== | ==== apcupsd ==== |
Revision as of 23:41, 20 May 2013
Contents
Presentation
My name is Gerardo Exequiel Pozzi (djgera). I am from Buenos Aires (Argentina), my year of birth is 1982. My areas of interest are: low-level programming, theory of languages and mathematics in general.
I am using Arch Linux since December of 2008, my original distro was Slackware Linux since October of 2001. I like helping the community in what it can within my reach, for example reporting bugs and feature request, new ideas, packaging, etc.
Reported bugs and feature requests
Git repo
My machine
- Motherboard: Asus M2N32-SLI Deluxe (Firmware: 1603)
- CPU: AMD Athlon 64 X2 5200+ [ADA5200IAA6CS]
- RAM: 4 x 1GB OCZ DDR2 800MHz Platinum Rev 2 (4-4-4-15) [OCZ2P800R21G]
- GPU: EVGA GeForce GT 520 1GB RAM DDR3 | VBIOS: 75.19.1b.00.20 | PN: 01G-P3-1523-KR
- Audio: Sound Blaster Live! MP3
- Storage (sda): Western Digital Caviar Black 2TB - 64MB Cache (Firmware: 05.01D05) [WD2001FASS-00W2B0]
- Storage (sdb): Western Digital Caviar Black 2TB - 64MB Cache (Firmware: 01.00101) [WD2001FASS-00W2B0]
- Storage (sdc): Western Digital Caviar Black 2TB - 64MB Cache (Firmware: 05.01D05) [WD2001FASS-00W2B0]
- Storage [backup]: Western Digital Caviar Black 2TB - 64MB Cache (Firmware: 01.00101) [WD2001FASS-00W2B0]
- Storage [backup]: Western Digital Caviar Black 2TB - 64MB Cache (Firmware: 05.01D05) [WD2002FAEX-007BA0]
- Storage [backup]: Western Digital Caviar Black 2TB - 64MB Cache (Firmware: 05.01D05) [WD2002FAEX-007BA0]
- Optical Drive: LG DVD-RW SATA Dual Layer (Fimware IL00) [GH20NS15]
- Power Supply: PowerCooler ATX12V 2.0 PS-500SS 500W
- Monitor: Dell UltraSharp 24" - (H-IPS panel [LM240WU4-SLB1]) - 1920x1200 - [U2410 / Rev A05]
- Keyboard/Mouse: Logitech Cordless Desktop EX 100
- Webcam: Logitech HD Webcam C510
- Printer: HP Laserjet P1006
- UPS: APC Back-UPS RS800VA, 230V [BR800i] (Firmware: 9.o5 .I USB FW:o5)
System configuration
HDD partition scheme
Disk /dev/sda: 2000.4 GB, 2000398934016 bytes, 3907029168 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x79dfe14b Device Boot Start End Blocks Id System /dev/sda1 * 2048 133119 65536 83 Linux (64M - ext4 - /syslinux) /dev/sda2 133120 42076159 20971520 83 Linux (20G - ext4 - / - 32-bit) /dev/sda3 42076160 84019199 20971520 83 Linux (20G - ext4 - / - 64-bit) /dev/sda4 84019200 3907029167 1911504984 5 Extended (1.78T) /dev/sda5 84021248 92409855 4194304 82 Swap (4G) /dev/sda6 92411904 100800511 4194304 83 Linux (4G - ext4 - /var - 32-bit) /dev/sda7 100802560 109191167 4194304 83 Linux (4G - ext4 - /var - 64-bit) /dev/sda8 109193216 117581823 4194304 83 Linux (4G - ext4 - /home - 32-bit) /dev/sda9 117583872 125972479 4194304 83 Linux (4G - ext4 - /home - 64-bit) /dev/sda10 125974528 1384265727 629145600 83 Linux (600G - xfs - /data/data0) /dev/sda11 1384267776 3481419775 1048576000 83 Linux (1000G - xfs - /data/data1) /dev/sda12 3481421824 3907029167 212803672 83 Linux (203G - xfs - /data/data2)
Disk /dev/sdb: 2000.4 GB, 2000398934016 bytes, 3907029168 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0xba469f54 Device Boot Start End Blocks Id System /dev/sdb1 2048 3907029167 1953513560 83 Linux
Disk /dev/sdc: 2000.4 GB, 2000398934016 bytes, 3907029168 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x78aef04c Device Boot Start End Blocks Id System /dev/sdc1 2048 3907029167 1953513560 83 Linux
syslinux
syslinux (mbr.bin) installed on MBR (sda)
dd bs=440 count=1 conv=notrunc if=/usr/lib/syslinux/mbr.bin of=/dev/sda
extlinux -i /mnt/sda1/syslinux cp /usr/lib/syslinux/{chain,menu}.c32 /mnt/sda1/syslinux/
/syslinux/syslinux.cfg in sda1
timeout 10 ui menu.c32 label LINUX-32 com32 chain.c32 append hd0 2 label LINUX-64 com32 chain.c32 append hd0 3 label memtest86+ linux /memtest86+-4.20.bin
extlinux -i /mnt/sda2/boot/syslinux cp /usr/lib/syslinux/{chain,menu}.c32 /mnt/sda2/boot/syslinux/
/boot/syslinux/syslinux.cfg in sda2
timeout 10 ui menu.c32 label 3.8.13-32 linux /boot/vmlinuz-3.8.13-32 initrd /boot/initramfs-3.8.13-32.img append root=/dev/sda2 rootfstype=ext4 ro vga=normal label MAIN com32 chain.c32 append hd0 0
extlinux -i /mnt/sda3/boot/syslinux cp /usr/lib/syslinux/{chain,menu}.c32 /mnt/sda3/boot/syslinux/
/boot/syslinux/syslinux.cfg in sda3
timeout 10 ui menu.c32 label 3.8.13-64 linux /boot/vmlinuz-3.8.13-64 initrd /boot/initramfs-3.8.13-64.img append root=/dev/sda3 rootfstype=ext4 ro vga=normal label MAIN com32 chain.c32 append hd0 0
mkinitcpio
/etc/mkinitcpio-djgera.conf
HOOKS="base udev save_hdd_live timestamp fsck shutdown"
/usr/lib/initcpio/install/save_hdd_live
build() { add_file /etc/udev/rules.d/69-save-hdd-live.rules add_binary hdparm } help () { cat <<HELPEOF This hook will save your HDD live! HELPEOF }
systemd
/etc/locale.conf
LANG="en_US.UTF-8"
/etc/hostname
gerardo
/etc/vconsole.conf
KEYMAP="es"
/etc/localtime -> /usr/share/zoneinfo/America/Buenos_Aires
/etc/udev/rules.d/69-save-hdd-live.rules
ACTION=="remove", GOTO="save_hdd_live_end" SUBSYSTEM!="block", GOTO="save_hdd_live_end" ENV{DEVTYPE}!="disk", GOTO="save_hdd_live_end" ENV{ID_ATA_FEATURE_SET_APM}=="1", RUN+="hdparm -q -B 255 $devnode" ENV{ID_ATA_FEATURE_SET_AAM}=="1", RUN+="hdparm -q -M 128 $devnode" ENV{ID_ATA_FEATURE_SET_PM}=="1", RUN+="hdparm -q -S 0 $devnode" LABEL="save_hdd_live_end"
/etc/udev/rules.d/69-usbasp.rules
ACTION=="remove", GOTO="usbasp_end" SUBSYSTEM=="usb", ATTR{product}=="USBasp", TAG+="uaccess" LABEL="usbasp_end"
/etc/udev/rules.d/69-usbserial.rules
ACTION=="remove", GOTO="usbserial_end" SUBSYSTEM=="tty", KERNEL=="ttyUSB0", TAG+="uaccess" LABEL="usbserial_end"
/etc/udev/rules.d/69-android.rules
ACTION=="remove", GOTO="android_end" SUBSYSTEM=="usb", ATTR{product}=="MT65xx Android Phone", TAG+="uaccess" LABEL="android_end"
/etc/systemd/system/network@.service
[Unit] Description=Network Connectivity On %I Wants=network.target Before=network.target [Service] Type=oneshot RemainAfterExit=yes EnvironmentFile=/etc/conf.d/network/%I ExecStart=/sbin/ip link set dev %I up ExecStart=/sbin/ip addr add ${address}/${netmask} broadcast ${broadcast} dev %I ExecStart=/sbin/ip route add default via ${gateway} ExecStop=/sbin/ip addr flush dev %I ExecStop=/sbin/ip link set dev %I down [Install] Alias=multi-user.target.wants/network@enp0s16.service
/etc/conf.d/network/enp0s16
address=192.168.0.77 netmask=24 broadcast=192.168.0.255 gateway=192.168.0.1
/etc/systemd/system ├── dbus-org.freedesktop.Avahi.service -> /usr/lib/systemd/system/avahi-daemon.service ├── default.target -> /usr/lib/systemd/system/multi-user.target ├── getty.target.wants │ └── getty@tty1.service -> /usr/lib/systemd/system/getty@.service ├── hddtemp.service.d │ └── es.conf ├── multi-user.target.wants │ ├── apcupsd.service -> /usr/lib/systemd/system/apcupsd.service │ ├── avahi-daemon.service -> /usr/lib/systemd/system/avahi-daemon.service │ ├── cronie.service -> /usr/lib/systemd/system/cronie.service │ ├── cups.path -> /usr/lib/systemd/system/cups.path │ ├── hddtemp.service -> /usr/lib/systemd/system/hddtemp.service │ ├── mpd.service -> /usr/lib/systemd/system/mpd.service │ ├── network@enp0s16.service -> /etc/systemd/system/network@.service │ ├── ntpd.service -> /usr/lib/systemd/system/ntpd.service │ ├── remote-fs.target -> /usr/lib/systemd/system/remote-fs.target │ ├── smartd.service -> /usr/lib/systemd/system/smartd.service │ ├── smartlog@sda.service -> /etc/systemd/system/smartlog@.service │ ├── smartlog@sdb.service -> /etc/systemd/system/smartlog@.service │ ├── smartlog@sdc.service -> /etc/systemd/system/smartlog@.service │ └── vnstat.service -> /usr/lib/systemd/system/vnstat.service ├── network@.service ├── printer.target.wants │ └── cups.service -> /usr/lib/systemd/system/cups.service ├── smartlog@.service └── sockets.target.wants ├── avahi-daemon.socket -> /usr/lib/systemd/system/avahi-daemon.socket ├── cups.socket -> /usr/lib/systemd/system/cups.socket └── sshd.socket -> /usr/lib/systemd/system/sshd.socket
smartmontools
/etc/systemd/system/smartlog@.service
[Unit] Description=SMART on disk %I [Service] ExecStart=/usr/sbin/smartctl -a /dev/%I SyslogIdentifier=smart-%I
hddtemp
/etc/systemd/system/hddtemp.service.d/es.conf
[Service] ExecStart= ExecStart=/usr/bin/hddtemp -dF /dev/sda /dev/sdb /dev/sdc
apcupsd
/usr/lib/systemd/system-shutdown/apc_killpower
#!/bin/sh if [ -f /etc/apcupsd/powerfail -a "$1" = "poweroff" ]; then /etc/apcupsd/apccontrol killpower fi
/root/bin/ups-mailer
#!/bin/sh TO="<USER>@<DOMAIN>" MAIL="/usr/bin/mail" export MAILRC="/root/.mailrc" /sbin/apcaccess status | $MAIL -s "${0##*/} | $(hostname)" "$TO" exit 0
/etc/apcupsd/ ├── changeme -> /root/bin/ups-mailer ├── commfailure -> /root/bin/ups-mailer ├── commok -> /root/bin/ups-mailer ├── offbattery -> /root/bin/ups-mailer └── onbattery -> /root/bin/ups-mailer
heirloom-mailx
/root/.mailrc
set sendmail="/usr/bin/msmtp" set from="Gerardo Exequiel Pozzi <USER@DOMAIN>"
msmtp
/root/.msmtprc
account <USER> host <DOMAIN> from <USER@DOMAIN> auth on tls on tls_starttls off tls_trust_file /etc/ssl/certs/ca-certificates.crt port 465 user <USER> password <PASSWORD>
mc
/etc/profile.d/mc.sh
alias mc='. /usr/lib/mc/mc-wrapper.sh'
polkit
/etc/polkit-1/rules.d/69-djgera.rules
polkit.addRule(function(action, subject) { if (action.id == "org.freedesktop.login1.power-off" || action.id == "org.freedesktop.login1.power-off-multiple-sessions" || action.id == "org.freedesktop.login1.reboot" || action.id == "org.freedesktop.login1.reboot-multiple-sessions" || action.id == "org.freedesktop.login1.hibernate" || action.id == "org.freedesktop.login1.hibernate-multiple-sessions" || action.id == "org.freedesktop.login1.suspend" || action.id == "org.freedesktop.login1.suspend-multiple-sessions") { return "no"; } }); polkit.addRule(function(action, subject) { if (action.id == "org.freedesktop.upower.hibernate" || action.id == "org.freedesktop.upower.suspend") { return "no"; } });
filesystem
i686
/etc/fstab
tmp /tmp tmpfs nodev,nosuid,size=75% 0 0 /dev/sda5 none swap defaults 0 0 /dev/sda2 / ext4 noatime,nodev 0 1 /dev/sda6 /var ext4 noatime,nosuid,nodev 0 2 /dev/sda8 /home ext4 noatime,nosuid,nodev 0 2 /dev/sda10 /data/data0 xfs ro,noatime,nosuid,nodev,noexec 0 2 /dev/sda11 /data/data1 xfs ro,noatime,nosuid,nodev,noexec,noauto 0 2 /dev/sda12 /data/data2 xfs ro,noatime,nosuid,nodev,noexec,noauto 0 2 /dev/sdb1 /data/data3 xfs ro,noatime,nosuid,nodev,noexec,noauto 0 2 /dev/sdc1 /data/data4 xfs ro,noatime,nosuid,nodev,noexec,noauto 0 2
x86_64
/etc/fstab
tmp /tmp tmpfs nodev,nosuid,size=75% 0 0 /dev/sda5 none swap defaults 0 0 /dev/sda3 / ext4 noatime,nodev 0 1 /dev/sda7 /var ext4 noatime,nosuid,nodev 0 2 /dev/sda9 /home ext4 noatime,nosuid,nodev 0 2 /dev/sda10 /data/data0 xfs ro,noatime,nosuid,nodev,noexec 0 2 /dev/sda11 /data/data1 xfs ro,noatime,nosuid,nodev,noexec,noauto 0 2 /dev/sda12 /data/data2 xfs ro,noatime,nosuid,nodev,noexec,noauto 0 2 /dev/sdb1 /data/data3 xfs ro,noatime,nosuid,nodev,noexec,noauto 0 2 /dev/sdc1 /data/data4 xfs ro,noatime,nosuid,nodev,noexec,noauto 0 2
kmod
/etc/modules-load.d/djgera.conf
#fbcon
/etc/modprobe.d/djgera.conf
#blacklist nvidia blacklist nouveau blacklist rtl8187 blacklist pata_amd
/etc/modprobe.d/nvidia.conf
options nvidia NVreg_EnableMSI=1
xorg-server
/etc/X11/xorg.conf
Section "Device" Identifier "nvidia0" Driver "nvidia" # Driver "nouveau" # Option "GLXVBlank" "on" EndSection
xorg-xinit
/etc/udev/rules.d/61-x11-key.rules
ACTION=="remove", GOTO="x11_input_end" SUBSYSTEM=="input", ENV{ID_INPUT_KEY}=="?*", ENV{xkblayout}="es" LABEL="x11_input_end"
fontconfig
/etc/fonts/local.conf
<?xml version='1.0'?> <!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <fontconfig> <match target="font"> <edit mode="assign" name="autohint"> <bool>true</bool> </edit> </match> </fontconfig>
pacman
/etc/pacman.conf
[options] HoldPkg = pacman glibc Architecture = auto IgnorePkg = pm-utils pm-quirks IgnorePkg = linux-headers IgnorePkg = handbrake handbrake-cli IgnorePkg = hplip IgnorePkg = nvidia-utils opencl-nvidia NoUpgrade = etc/apcupsd/onbattery etc/apcupsd/offbattery etc/apcupsd/changeme etc/apcupsd/commok etc/apcupsd/commfailure SigLevel = Required DatabaseOptional LocalFileSigLevel = Optional [core] Include = /etc/pacman.d/mirrorlist [extra] Include = /etc/pacman.d/mirrorlist [community] Include = /etc/pacman.d/mirrorlist
¡Machetes!
qemu-kvm
Quick image with base setup
A quick way to make an image with a base installation without installer.
- Packages needed: syslinux arch-install-scripts
- First time boot with fallback initramfs, then run mkinitcpio -p linux
modprobe nbd max_part=8 qemu-img create -f qcow2 archbase.qcow2 1G qemu-nbd -c /dev/nbd0 archbase.qcow2 sleep 2 echo -e "p\nn\np\n1\n\n\na\n1\np\nw\nq\n" | fdisk /dev/nbd0 mkfs.ext4 -m0 -L AB_RAIZ /dev/nbd0p1 mkdir /tmp/archbase mount /dev/nbd0p1 /tmp/archbase pacstrap /tmp/archbase echo 'LABEL=AB_RAIZ / ext4 defaults 0 1' >> /tmp/archbase/etc/fstab echo 'archbase' > /tmp/archbase/etc/hostname sed -i 's|localhost$|localhost archbase|' /tmp/archbase/etc/hosts ln -s /usr/share/zoneinfo/America/Buenos_Aires /tmp/archbase/etc/localtime echo 'KEYMAP="es"' > /tmp/archbase/etc/vconsole.conf echo 'LANG="en_US.UTF-8"' > /tmp/archbase/etc/locale.conf mkdir /tmp/archbase/boot/syslinux cat << FIN > /tmp/archbase/boot/syslinux/syslinux.cfg # DEFAULT arch LABEL arch LINUX /boot/vmlinuz-linux APPEND root=LABEL=AB_RAIZ INITRD /boot/initramfs-linux.img LABEL arch-fallback LINUX /boot/vmlinuz-linux APPEND root=LABEL=AB_RAIZ INITRD /boot/initramfs-linux-fallback.img FIN extlinux -i /tmp/archbase/boot/syslinux umount /tmp/archbase rmdir /tmp/archbase cat /usr/lib/syslinux/mbr.bin > /dev/nbd0 blockdev --flushbufs /dev/nbd0 qemu-nbd -d /dev/nbd0
Increment size of the image
- Assume partition of 1G created in previous step. Resize to 2G.
modprobe nbd max_part=8 qemu-img convert archbase.qcow2 -O raw archbase.raw dd of=archbase.raw bs=1G count=0 seek=2 qemu-img convert archbase.raw -O qcow2 archbase.qcow2 qemu-nbd -c /dev/nbd0 archbase.qcow2 sleep 2 echo -e "p\nd\nn\np\n1\n\n\na\n1\np\nw\nq\n" | fdisk /dev/nbd0 e2fsck -f /dev/nbd0p1 resize2fs /dev/nbd0p1 blockdev --flushbufs /dev/nbd0 qemu-nbd -d /dev/nbd0
Network
ip tuntap add dev tap0 mode tap user djgera ip tuntap add dev tap1 mode tap user djgera brctl addbr br0 brctl setfd br0 0 brctl addif br0 enp0s16 brctl addif br0 tap0 brctl addif br0 tap1 ip link set dev br0 up ip link set dev tap0 up ip link set dev tap1 up ip addr del 192.168.0.77/24 dev enp0s16 ip addr add 192.168.0.77/24 broadcast + dev br0 ip route add default via 192.168.0.1