User Tools

Site Tools


operating_systems:raspbian:raspbian

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
operating_systems:raspbian:raspbian [2019/04/30 08:41] maferreiraoperating_systems:raspbian:raspbian [2019/05/17 06:53] maferreira
Line 1: Line 1:
 ====== Raspbian ====== ====== Raspbian ======
-===== Clone only a directory ===== + 
-    git clone <git path> +  [[Clean installation]] 
-    cd <git directory> +  * [[Minimal configuration]] 
-    git config core.sparsecheckout true +  * [[Tricks]] 
-    echo "<directory name>" >> .git/info/sparse-checkout +  * [[easyGateway configuration]] 
-    git checkout -- +  * [[easyDoor configuration]
-     +  * [[Common backup structure]]
-===== Reduce time that is used to raise network interfaces ===== +
-As root, create the "**networking.service.d**" directory if it does not already exist and create/modify "**reduce-timeout.conf**" +
-  mkdir /etc/systemd/system/networking.service.d +
-  vi reduce-timeout.conf +
-   +
- Then add this to your "**reduce.timeout.conf**" file +
-  [Service+
-  TimeoutStartSec=XX +
-   +
- <note>**XX** is the time in seconds that you want the system to wait</note>+
  
 ===== Disable swap ===== ===== Disable swap =====
Line 133: Line 123:
  
 After some time of lecture, I found out that there wasn't a config file with a lease-file option. After some time of lecture, I found out that there wasn't a config file with a lease-file option.
- 
- 
- 
-===== Create a clean raspbian image ===== 
-    sudo dd if=/Users/<username>/Downloads/2019-04-08-raspbian-stretch-lite.img of=/dev/rdisk<sd card number> bs=4m 
-     
-<note important>Do the following 3 steps **BEFORE BOOTING** your raspberry pi</note> 
- 
-Before modifying **cmdline.txt** and **config.txt**, **BACKUP THEM**! 
-    cp -p cmdline.txt cmdline.txt.original 
-    cp -p config.txt config.txt.original 
-Once you have finished, change the output console device and remove the script that autoexpands / partition size at first startup. 
-    vi cmdline.txt 
-    console=serial0,115200 console=tty1 -> console=ttyAMA0,115200 
-    delete init=/usr/lib/raspi-config/init_resize.sh 
- 
-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). 
-    vi config.txt 
-    add this : enable_uart=1 
- 
-    /dev/root       1.6G  978M  538M  65% / 
-    devtmpfs        460M      460M   0% /dev 
-    tmpfs           464M      464M   0% /dev/shm 
-    tmpfs           464M   12M  452M   3% /run 
-    tmpfs           5.0M  4.0K  5.0M   1% /run/lock 
-    tmpfs           464M      464M   0% /sys/fs/cgroup 
-    /dev/mmcblk0p1   43M   22M   21M  51% /boot 
-    tmpfs            93M       93M   0% /run/user/1000 
-     
-Now, resize the / partition and create a new one. As root, type : 
-    fdisk /dev/mmcblk0 
-Your partition table should look like this : 
-    Device         Boot Start     End Sectors  Size Id Type 
-    /dev/mmcblk0p1       8192   96042   87851 42.9M  c W95 FAT32 (LBA) 
-    /dev/mmcblk0p2      98304 3522559 3424256  1.6G 83 Linux 
-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 /dev/mmcblk0p<partition number>. Reboot your raspberry pi and then tell your system you have resized a partition by typing : 
-    resize2fs /dev/mmcblk0p<partition number> 
-After creating the partition that will be mounted at /media/data, **reboot** your raspberry pi. Then, turn it into an ext4 partition, and add it to **fstab**. 
-    mkfs.ext4 /dev/mmcblk0p3 
- 
-Now, it's time to test what you have done. 
-    mount -a 
-    df -h 
-     
-    Filesystem      Size  Used Avail Use% Mounted on 
-    /dev/root       7.9G  1.1G  6.5G  14% / 
-    devtmpfs        460M      460M   0% /dev 
-    tmpfs           464M      464M   0% /dev/shm 
-    tmpfs           464M   12M  452M   3% /run 
-    tmpfs           5.0M  4.0K  5.0M   1% /run/lock 
-    tmpfs           464M      464M   0% /sys/fs/cgroup 
-    tmpfs           464M      464M   0% /var/spool 
-    tmpfs           464M  148K  464M   1% /var/log 
-    tmpfs           464M      464M   0% /var/tmp 
-    tmpfs           464M      464M   0% /tmp 
-    /dev/mmcblk0p1   43M   22M   21M  51% /boot 
-    tmpfs            93M       93M   0% /run/user/1000 
-    /dev/mmcblk0p3  6.7G   31M  6.3G   1% /media/data 
-     
- 
-    sudo apt update 
-    sudo apt upgrade 
- 
-    touch /boot/ssh 
-    sudo systemctl enable ssh 
-    sudo systemctl start ssh 
-Reference : https://www.raspberrypi.org/documentation/remote-access/ssh/ 
- 
-    vi fstab 
-    tmpfs /tmp tmpfs defaults   0   0 
-    tmpfs /run tmpfs defaults   0   0 
-     
-    reboot 
-Check if there are any errors 
- 
-    vi /etc/systemd/system/generateRsyslogStructure.service 
-     
-    [Unit] 
-    Description=Generate Rsyslog structure 
-    Before=syslog.service 
-     
-    [Service] 
-    ExecStart=/bin/bash /home/pi/generateRsyslogStructure.sh 
-    Type=oneshot 
-     
-    [Install] 
-    WantedBy=default.target 
- 
-    vi /home/pi/generateRsyslogStructure.sh 
-    #!/bin/bash 
-     
-    if [ -r /etc/rsyslog.conf ]; then 
-        WorkDirectory=$(grep "WorkDirectory" /etc/rsyslog.conf | cut -d\  -f2) 
-    else 
-        echo "Cannot read /etc/rsyslog.conf" >> /tmp/rsyslogService.txt 
-        exit 1 
-    fi 
-     
-    if [ ! -d "$WorkDirectory" ]; then 
-        mkdir $WorkDirectory 
-    fi 
-     
-    exit 0 
- 
-    sudo chmod 664 generateRsyslogStructure.service 
-    chmod a+x generateRsyslogStructure.sh 
-     
-    sudo systemctl enable enerateRsyslogStructure.service 
-    vi /etc/fstab 
-    tmpfs                 /var/spool      tmpfs   defaults          0       0 
-     
-    reboot 
- 
-    vi /etc/fstab 
-    tmpfs                 /var/log        tmpfs   defaults          0       0 
-     
-    reboot 
-Systemd-hostnamed doest not start 
-    vi /etc/fstab 
-    tmpfs                 /var/tmp        tmpfs   defaults          0       0 
-     
-    reboot 
- 
-    vi /etc/fstab 
-    PARTUUID=c1dc39e5-02  /               ext4    defaults,noatime,ro  0       1 
-     
-    reboot 
- 
-    vi /etc/fstab 
-    PARTUUID=c1dc39e5-01  /boot           vfat    defaults,ro          0       2 
- 
-    sudo systemctl stop dphys-swapfile.service 
-    sudo systemctl disable dphys-swapfile.service 
-    reboot 
-Systemd manual: https://freedesktop.org/software/systemd/man/systemd.exec.html#id-1.20.8 
- 
-Create a partition with the unused partition size.\\ 
---Rw mode--\\ 
-Create /media/data\\ 
-Mount /media/data (/etc/fstab)\\ 
-reboot\\ 
---Ro mode--\\ 
-reboot\\ 
-    vi /etc/profile.d/noHistory.sh 
-     
-    #! /bin/bash 
-     
-    history -c 
-    set +o history 
-     
-    export HISTFILESIZE=0 
-    export HISTSIZE=0 
-    unset HISTFILE 
-     
-    chmod a+x /etc/profile.d/noHistory.sh 
-     
-    reboot 
-===== Rename username ===== 
-As root account is disabled by default on raspberrian, we need to activate it. But before doing that, mount / in read-write mode. 
-    sudo mount -o remount,rw / 
-    sudo su passwd root 
-And then enter the new password you want. 
- 
-    usermod -l acdsn pi 
-    usermod -m -d /home/acdsn acdsn 
-Set a password to the user 
-    passwd acdsn 
- 
-===== Rename group ===== 
-    groupmod --new-name acdsn pi 
- 
-===== Rename hostname ===== 
-    vi /etc/hostname 
-Replace the existing hostname by the new one. 
-===== Generate ssh keys ===== 
-    ssh-keygen -t rsa -b 2048