Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision |
operating_systems:raspbian:clean_installation [2019/05/14 09:02] – [By tmpfiles.d config files] maferreira | operating_systems:raspbian:clean_installation [2019/05/24 07:34] – [dhclient can't create lease file] maferreira |
---|
# dd if=/dev/zero of=/dev/rdisk<sd card number> bs=4m | # dd if=/dev/zero of=/dev/rdisk<sd card number> bs=4m |
| |
===== Write raspbian image into sd card ===== | ===== Burn raspbian image into sd card ===== |
# dd if=/Users/<username>/Downloads/2019-04-08-raspbian-stretch-lite.img of=/dev/rdisk<sd card number> bs=4m | # dd if=/Users/<username>/Downloads/2019-04-08-raspbian-stretch-lite.img of=/dev/rdisk<sd card number> bs=4m |
| |
===== Serial connection and disable first boot autosize ===== | ===== Serial connection and disable first boot autosize ===== |
<note important>Do the following 3 steps **BEFORE BOOTING FOR THE FIRST TIME** your raspberry pi</note> | <note warning>Do the following 3 steps **BEFORE BOOTING FOR THE FIRST TIME** your raspberry pi</note> |
| |
==== Backup cmdline.txt and config.txt ==== | ==== Backup cmdline.txt and config.txt ==== |
/dev/mmcblk0p3 /media/data ext4 defaults 0 0 | /dev/mmcblk0p3 /media/data ext4 defaults 0 0 |
| |
<note important>Make sure you have **CREATED /media/data** folder **BEFORE MOUNTING** it because your raspberry pi **WON'T BOOT** after that : **Cannot open access to console. The root account is locked see sulogin(8) man page for more details.**</note> | <note warning>Make sure you have **CREATED /media/data** folder **BEFORE MOUNTING** it because your raspberry pi **WON'T BOOT** after that : **Cannot open access to console. The root account is locked see sulogin(8) man page for more details.**</note> |
| |
Now, it's time to test what you have done. | Now, it's time to test what you have done. |
/dev/mmcblk0p3 6.7G 31M 6.3G 1% /media/data | /dev/mmcblk0p3 6.7G 31M 6.3G 1% /media/data |
| |
| ===== dhclient can't create lease file ===== |
| # mkdir -p /media/data/var/lib/dhcp |
| # touch /media/data/var/lib/dhcp/dhclient.leases |
| # ln -s /media/data/var/lib/dhcp/dhclient.leases /var/lib/dhcp/dhclient.leases |
| |
| # vi /etc/dhcp/dhclient-enter-hooks.d/samba |
| # netbios_setup (comment the function call) |
===== Update raspbian packages and install needed packages ===== | ===== Update raspbian packages and install needed packages ===== |
# apt update | # apt update |
| |
# reboot | # reboot |
<note important>**REBOOT** your raspberry pi **AFTER** adding each line to **FSTAB**</note> | <note warning>**REBOOT** your raspberry pi **AFTER** adding each line to **FSTAB**</note> |
| |
Systemd-hostnamed doest not start | Systemd-hostnamed doest not start |
/dev/mmcblk0p1 /boot vfat defaults,ro 0 2 | /dev/mmcblk0p1 /boot vfat defaults,ro 0 2 |
| |
<note important>**REBOOT** your raspberry pi **AFTER** adding each line to **FSTAB**</note> | <note warning>**REBOOT** your raspberry pi **AFTER** adding each line to **FSTAB**</note> |
| |
Systemd manual: https://freedesktop.org/software/systemd/man/systemd.exec.html#id-1.20.8 | Systemd manual: https://freedesktop.org/software/systemd/man/systemd.exec.html#id-1.20.8 |
| |
===== Disable bash history ===== | |
<note important>Since /etc/profile is only read by interactive shells (login) and we connect to raspberry pi using acdsn acount, when loging into root acount using su command, the system won't read that file. We could directly modify /etc/bash.bashrc but it could be erased by an update.</note> | |
| |
==== acdsn ==== | |
# vi /home/acdsn/git/fw-rules/<port number>/etc/profile.d/noHistory.sh | |
| |
#! /bin/bash | |
| |
history -c | |
set +o history | |
| |
export HISTFILESIZE=0 | |
export HISTSIZE=0 | |
unset HISTFILE | |
| |
# chmod a+x /home/acdsn/git/fw-rules/<port number>/etc/profile.d/noHistory.sh | |
| |
# ln -s /home/acdsn/git/fw-rules/<port number>/etc/profile.d/noHistory.sh ./etc/profile.d/noHistory.sh | |
| |
==== root ==== | |
# mv /etc/bash.bashrc /home/acdsn/git/fw-rules/<port number>/etc/ | |
# mv /home/acdsn/git/fw-rules/<port number>/etc/.bashrc /home/acdsn/git/fw-rules/<port number>/etc/bashrc.root | |
# ln -s /home/acdsn/git/fw-rules/3780/bashrc.root .bashrc | |
| |
Import **noHistory.sh** into .bashrc | |
if [ -r /etc/profile.d/noHistory.sh ]; then | |
. /etc/profile.d/noHistory.sh | |
fi | |
Reference: http://www.linuxfromscratch.org/blfs/view/stable/postlfs/profile.html | |
| |
===== Disable apt-daily.service and apt-daily-upgrade.service===== | ===== Disable apt-daily.service and apt-daily-upgrade.service===== |