operating_systems:raspbian:clean_installation
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
operating_systems:raspbian:clean_installation [2019/05/20 14:37] – maferreira | operating_systems:raspbian:clean_installation [2019/06/03 14:25] – maferreira | ||
---|---|---|---|
Line 2: | Line 2: | ||
===== Clean your sd card ===== | ===== Clean your sd card ===== | ||
Before writing the raspbian image into your sd card, clean your storage device by turning all its bits into 0. | Before writing the raspbian image into your sd card, clean your storage device by turning all its bits into 0. | ||
- | | + | |
===== Burn raspbian image into sd card ===== | ===== Burn raspbian image into sd card ===== | ||
- | | + | |
===== Serial connection and disable first boot autosize ===== | ===== Serial connection and disable first boot autosize ===== | ||
Line 12: | Line 12: | ||
==== Backup cmdline.txt and config.txt ==== | ==== Backup cmdline.txt and config.txt ==== | ||
Before modifying **cmdline.txt** and **config.txt**, | Before modifying **cmdline.txt** and **config.txt**, | ||
- | | + | |
- | $ cp -p config.txt config.txt.original | + | $ cp -p config.txt config.txt.original |
==== Modify cmdline.txt ==== | ==== Modify cmdline.txt ==== | ||
Once you have finished, change the output console device and remove the script that autoexpands / partition size at first startup. | Once you have finished, change the output console device and remove the script that autoexpands / partition size at first startup. | ||
- | | + | |
- | console=serial0, | + | console=serial0, |
- | delete init=/ | + | delete init=/ |
==== Modify config.txt ==== | ==== Modify config.txt ==== | ||
Don't forget to enable this option, otherwise you won't be able to communicate to your raspberry pi throught raspberry debug port (TTL-232R-RPi). | Don't forget to enable this option, otherwise you won't be able to communicate to your raspberry pi throught raspberry debug port (TTL-232R-RPi). | ||
- | | + | |
- | add this : enable_uart=1 | + | add this : enable_uart=1 |
- | | + | |
- | devtmpfs | + | devtmpfs |
- | tmpfs | + | tmpfs |
- | tmpfs | + | tmpfs |
- | tmpfs | + | tmpfs |
- | tmpfs | + | tmpfs |
- | / | + | / |
- | tmpfs 93M | + | tmpfs 93M |
===== Resize / manualy and create /media/data partition ===== | ===== Resize / manualy and create /media/data partition ===== | ||
Now, resize the / partition and create a new one. | Now, resize the / partition and create a new one. | ||
- | | + | |
Your partition table should look like this : | Your partition table should look like this : | ||
- | | + | |
- | / | + | / |
- | / | + | / |
Delete the / partition, and create a new one (primary) which starts at **THE SAME POSITION** as the one you have just deleted, in my case **98304**.\\ | Delete the / partition, and create a new one (primary) which starts at **THE SAME POSITION** as the one you have just deleted, in my case **98304**.\\ | ||
In the **fstab**, replace **PARTUUID** by / | In the **fstab**, replace **PARTUUID** by / | ||
- | | + | |
After creating the partition that will be mounted at / | After creating the partition that will be mounted at / | ||
- | | + | |
- | # mkdir -p / | + | # mkdir -p / |
- | + | ||
- | # vi / | + | # vi / |
- | / | + | / |
<note warning> | <note warning> | ||
Now, it's time to test what you have done. | Now, it's time to test what you have done. | ||
- | | + | |
- | $ df -h | + | $ df -h |
- | + | ||
- | Filesystem | + | Filesystem |
- | / | + | / |
- | devtmpfs | + | devtmpfs |
- | tmpfs | + | tmpfs |
- | tmpfs | + | tmpfs |
- | tmpfs | + | tmpfs |
- | tmpfs | + | tmpfs |
- | tmpfs | + | tmpfs |
- | tmpfs | + | tmpfs |
- | tmpfs | + | tmpfs |
- | tmpfs | + | tmpfs |
- | / | + | / |
- | tmpfs 93M | + | tmpfs 93M |
- | / | + | / |
===== dhclient can't create lease file ===== | ===== dhclient can't create lease file ===== | ||
- | | + | |
- | # touch / | + | # touch / |
- | + | # ln -s / | |
+ | |||
+ | # vi / | ||
+ | # netbios_setup (comment the function call) | ||
===== Update raspbian packages and install needed packages ===== | ===== Update raspbian packages and install needed packages ===== | ||
- | | + | |
- | # apt upgrade | + | # apt upgrade |
- | # apt install --no-install-recommends tree lsof nmap git | + | # apt install --no-install-recommends tree lsof nmap git |
===== Enable ssh ===== | ===== Enable ssh ===== | ||
- | | + | |
- | # systemctl enable ssh | + | # systemctl enable ssh |
- | # systemctl start ssh | + | # systemctl start ssh |
Reference : https:// | Reference : https:// | ||
===== Mount partitions ===== | ===== Mount partitions ===== | ||
- | | + | |
- | tmpfs / | + | tmpfs / |
- | tmpfs / | + | tmpfs / |
- | tmpfs / | + | tmpfs / |
- | tmpfs / | + | tmpfs / |
- | | + | |
- | # reboot | + | # reboot |
<note warning> | <note warning> | ||
Systemd-hostnamed doest not start | Systemd-hostnamed doest not start | ||
- | | + | |
- | tmpfs / | + | tmpfs / |
Check if there are any errors | Check if there are any errors | ||
===== Fix rsyslog / | ===== Fix rsyslog / | ||
==== By unit file ==== | ==== By unit file ==== | ||
- | | + | |
- | + | ||
- | [Unit] | + | [Unit] |
- | Description=Generate Rsyslog structure | + | Description=Generate Rsyslog structure |
- | Before=syslog.service | + | Before=syslog.service |
- | + | ||
- | [Service] | + | [Service] |
- | ExecStart=/ | + | ExecStart=/ |
- | Type=oneshot | + | Type=oneshot |
- | + | ||
- | [Install] | + | [Install] |
- | WantedBy=default.target | + | WantedBy=default.target |
- | | + | |
- | # | + | # |
- | + | ||
- | if [ -r / | + | if [ -r / |
- | WorkDirectory=$(grep " | + | WorkDirectory=$(grep " |
- | else | + | else |
- | echo " | + | echo " |
- | exit 1 | + | exit 1 |
- | fi | + | fi |
- | + | ||
- | if [ ! -d " | + | if [ ! -d " |
- | mkdir $WorkDirectory | + | mkdir $WorkDirectory |
- | fi | + | fi |
- | + | ||
- | exit 0 | + | exit 0 |
- | | + | |
- | chmod a+x generateRsyslogStructure.sh | + | chmod a+x generateRsyslogStructure.sh |
- | + | ||
- | # systemctl enable generateRsyslogStructure.service | + | # systemctl enable generateRsyslogStructure.service |
==== By tmpfiles.d config files ==== | ==== By tmpfiles.d config files ==== | ||
- | | + | |
- | d / | + | d / |
- | + | ||
- | # mkdir / | + | # mkdir / |
Reference: [[http:// | Reference: [[http:// | ||
===== Disable swap ===== | ===== Disable swap ===== | ||
- | | + | |
- | # systemctl disable dphys-swapfile.service | + | # systemctl disable dphys-swapfile.service |
- | # reboot | + | # reboot |
===== Mount system in read-only mode ===== | ===== Mount system in read-only mode ===== | ||
- | | + | |
- | / | + | / |
- | / | + | / |
<note warning> | <note warning> | ||
Line 165: | Line 168: | ||
If you reboot your raspberry pi, you might see that apt-daily-upgrade.service failed to start. This happens because your system is in read-only mode. To solve this, disable it and it's timer. | If you reboot your raspberry pi, you might see that apt-daily-upgrade.service failed to start. This happens because your system is in read-only mode. To solve this, disable it and it's timer. | ||
- | | + | |
- | NEXT LEFT | + | NEXT LEFT |
- | Mon 2019-05-06 20:48:57 CEST 6h left Mon 2019-05-06 08:38:50 CEST 6h ago | + | Mon 2019-05-06 20:48:57 CEST 6h left Mon 2019-05-06 08:38:50 CEST 6h ago |
- | Tue 2019-05-07 06:39:25 CEST 15h left Mon 2019-05-06 14:27:48 CEST 19min ago apt-daily-upgrade.timer | + | Tue 2019-05-07 06:39:25 CEST 15h left Mon 2019-05-06 14:27:48 CEST 19min ago apt-daily-upgrade.timer |
- | Tue 2019-05-07 14:43:08 CEST 23h left Mon 2019-05-06 14:43:08 CEST 3min 45s ago systemd-tmpfiles-clean.timer systemd-tmpfiles-clean.service | + | Tue 2019-05-07 14:43:08 CEST 23h left Mon 2019-05-06 14:43:08 CEST 3min 45s ago systemd-tmpfiles-clean.timer systemd-tmpfiles-clean.service |
Now that you have the timer and ther unit name, stop and disable them. | Now that you have the timer and ther unit name, stop and disable them. | ||
- | | + | |
- | # systemctl stop apt-daily.service | + | # systemctl stop apt-daily.service |
- | + | ||
- | # systemctl disable apt-daily.timer | + | # systemctl disable apt-daily.timer |
- | # systemctl disable apt-daily.service | + | # systemctl disable apt-daily.service |
- | | + | |
- | # systemctl stop apt-daily-upgrade.service | + | # systemctl stop apt-daily-upgrade.service |
- | + | ||
- | # systemctl disable apt-daily-upgrade.timer | + | # systemctl disable apt-daily-upgrade.timer |
- | # systemctl disable apt-daily-upgrade.service | + | # systemctl disable apt-daily-upgrade.service |
===== systemd-tmpfiles ===== | ===== systemd-tmpfiles ===== | ||
This service doesn' | This service doesn' | ||
- | | + | |
- | # rm -r / | + | # rm -r / |
- | + | ||
- | # ln -s / | + | # ln -s / |