operating_systems:raspbian:raspbian
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:raspbian [2019/04/30 14:33] – maferreira | operating_systems:raspbian:raspbian [2019/07/22 09:26] – maferreira | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Raspbian ====== | ====== Raspbian ====== | ||
- | ===== Clone only a directory ===== | ||
- | git clone <git path> | ||
- | cd <git directory> | ||
- | git config core.sparsecheckout true | ||
- | echo "< | ||
- | git checkout -- | ||
- | | ||
- | ===== Disable swap ===== | ||
- | As root, turn off the process that automatically creates a swap file | ||
- | / | ||
- | |||
- | Also as root, add " | ||
- | vi / | ||
- | |||
- | ### BEGIN INIT INFO | ||
- | # Provides: | ||
- | # Required-Start: | ||
- | # Required-Stop: | ||
- | # Should-Start: | ||
- | # Should-Stop: | ||
- | # Default-Start: | ||
- | # Default-Stop: | ||
- | # Short-Description: | ||
- | # Description: | ||
- | # swap partition. Instead install without swap partition and then run | ||
- | # this, with file size (re-)computed automatically to fit the current | ||
- | # RAM size. | ||
- | ### END INIT INFO | ||
- | | ||
- | exit 0 | ||
- | | ||
- | . / | ||
- | | ||
- | # get ready to work | ||
- | PATH=/ | ||
- | export PATH | ||
- | | ||
- | ... | ||
- | | ||
- | |||
- | ===== Stop process using files in / ===== | ||
- | First we need to know which processes are using files in the directory we want to make read-only. To do so, you can use the fuser command. | ||
- | sudo fuser -v -m / | ||
- | You should have something like this | ||
- | USER PID ACCESS COMMAND | ||
- | /: | ||
- | Some other process | ||
- | | ||
- | root 423 Frce. rsyslogd | ||
- | root 657 Frce. dhclient | ||
- | | ||
- | Some other process | ||
- | |||
- | < | ||
- | |||
- | Now, if you check rsyslog status it might be stopped because it uses / | ||
- | vim / | ||
- | |||
- | [Unit] | ||
- | Description=Generate rsyslog structure | ||
- | Before=rsyslog.service | ||
- | | ||
- | [Service] | ||
- | ExecStart=/ | ||
- | Type=oneshot | ||
- | | ||
- | [Install] | ||
- | WantedBy=default.target | ||
- | |||
- | |||
- | And then create " | ||
- | #!/bin/bash | ||
- | | ||
- | if [ -r / | ||
- | WorkDirectory=$(grep " | ||
- | else | ||
- | echo " | ||
- | exit 1 | ||
- | fi | ||
- | | ||
- | [ -d " | ||
- | | ||
- | exit 0 | ||
- | Restart rsyslog and it should work! | ||
- | |||
- | From the 2 processes I showed you earlier, only dhclient remains. | ||
- | |||
- | dhclient is launched by dhcpcd which uses a file as database for each network interface (/ | ||
- | |||
- | After reading the dhcpcd documentation, | ||
- | |||
- | So I took a look to the dhcpcd.conf manual page but I didn't found a " | ||
- | |||
- | I started thinking if I couldn' | ||
- | |||
- | If you have done the BLFS project before, you might remember installing dhcpcd package. | ||
- | Here is what they used to compile it: | ||
- | |||
- | ./configure --libexecdir=/ | ||
- | --dbdir=/ | ||
- | make | ||
- | sudo make install | ||
- | As you can see, dbdir is a compilation variable that contains the path where dhcpcd can find the lease files for each network interface. | ||
- | |||
- | Here is the precedure I used to try to find if there is a config file other than dhcpcd.conf or if there is an option to change the default lease files path. | ||
- | - Find out where dbdir is defined/ | ||
- | - Search for some kind of read_config function and see where it is used | ||
- | Unfortunately, | ||
- | I searched in the dhcpcd.conf manual page for an option that isn't used very often in order to make the " | ||
- | |||
- | I choose the **xidhwaddr** option. I executed **grep -r -i " | ||
- | ./ | ||
- | ./ | ||
- | ./ | ||
- | | ||
- | After this, I took a look to the if-options.c file to know where this C struct option where used. The first line of code I found contained a **parse_config_line function** which had a **char *line** parameter. | ||
- | |||
- | The next step was to find out where this function was called. I found out that it was called by a read_config function which didn't have a char *line parameter. | ||
- | |||
- | It was obvious that the line variable was initialised and declared inside read_config. After a research in that function, I realised that the line variable contained data from either dhcpcd.conf or / | ||
- | |||
- | After some time of lecture, I found out that there wasn't a config file with a lease-file option. | ||
- | |||
* [[Clean installation]] | * [[Clean installation]] | ||
* [[Minimal configuration]] | * [[Minimal configuration]] | ||
* [[Tricks]] | * [[Tricks]] | ||
+ | * [[easyGateway configuration]] | ||
+ | * [[Common backup structure]] |