forked from mainsail-crew/MainsailOS
-
-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fix error autologin on serial tty (mainsail-crew#242)
* fix: fix autologin on serial tty This fixes issue that after connection to a serial console it trys to autologin with user 'orangepi', which does not exist in our images Signed-off-by: Stephan Wendel <[email protected]> * feat: add workaround for orangepi images Apply release file workaround for OrangePI based images. Signed-off-by: Stephan Wendel <[email protected]>
- Loading branch information
1 parent
30e6afb
commit 608d051
Showing
4 changed files
with
53 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,27 +18,15 @@ source /common.sh | |
install_cleanup_trap | ||
|
||
## Clean up | ||
## Step 1: Remove autologin and lock root account | ||
if [ -f "/etc/systemd/system/[email protected]/override.conf" ]; then | ||
rm -f /etc/systemd/system/[email protected]/override.conf | ||
fi | ||
## END | ||
|
||
## Step 2: Disable autologin on serial console | ||
if [ -f "/etc/systemd/system/[email protected]/override.conf" ]; then | ||
sed -i 's/--autologin root //' /etc/systemd/system/[email protected]/override.conf | ||
fi | ||
## END | ||
|
||
## Step 3: Delete root passwd | ||
## Step 1: Delete root passwd (disables root login) | ||
### Deleting root passwd doesn't let you unlock the account | ||
sudo passwd -d root | ||
## END | ||
## END Step 1 | ||
|
||
## Step 4: Lock root account | ||
## Step 2: Lock root account (disables root login) | ||
sudo passwd -l root | ||
## END | ||
## END Step 2 | ||
|
||
## Step 5: Remove passwdless sudo | ||
## Step 3: Remove passwdless sudo | ||
sed -i '/'"${BASE_USER}"' ALL=(ALL:ALL) NOPASSWD:ALL/d' /etc/sudoers | ||
## END | ||
## END Step 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,10 @@ is_board_type() { | |
echo "${board}" | ||
} | ||
|
||
get_gettyconf_dirs() { | ||
find "${1}" -type d -name "*getty@*" | ||
} | ||
|
||
# Base User groups | ||
# Shameless "stolen" from | ||
# https://github.com/guysoft/CustomPiOS/blob/devel/src/variants/armbian/pre_chroot_script | ||
|
@@ -85,25 +89,16 @@ if [ -f "/root/.not_logged_in_yet" ]; then | |
fi | ||
## END Step 4 | ||
|
||
## Step 5: Move armbian-release to display mainsailos-release | ||
if [[ -f "/etc/orangepi-release" ]]; then | ||
echo_green "OrangePi release file found! moving to: 'orangepi-release-info.txt'" | ||
mv /etc/orangepi-release /etc/orangepi-release-info.txt | ||
else | ||
echo_red "OrangePi release file not found! [SKIPPED]" | ||
fi | ||
## END Step 5 | ||
|
||
## Step 6: Patch dynamic motd | ||
## Step 5: Patch dynamic motd | ||
echo_green "Patch dynamic motd ..." | ||
unpack /filesystem/root / | ||
chmod +x /etc/update-motd.d/* | ||
if [ -f "/etc/default/orangepi-motd" ]; then | ||
sed -i 's/^MOTD_DISABLE=""/MOTD_DISABLE="header tips"/' /etc/default/orangepi-motd | ||
fi | ||
## END Step 6 | ||
## END Step 5 | ||
|
||
## Step 7: Enable SPI interface by default | ||
## Step 6: Enable SPI interface by default | ||
echo_green "Enable interfaces on Orange Pi SBC's ..." | ||
|
||
### Substep 1: Copy default config to backup file | ||
|
@@ -136,9 +131,9 @@ fi | |
echo "spi-dev" >> "${ORANGEPI_MODULES_FILE}" | ||
|
||
echo_green "Enable SPI interface on Orange Pi SBC's ... DONE!" | ||
## END Step 7 | ||
## END Step 6 | ||
|
||
## Step 8: Install orangepi-config from git source repository | ||
## Step 7: Install orangepi-config from git source repository | ||
if [[ "${ORANGEPI_INSTALL_OPI_CONFIG}" == "true" ]]; then | ||
echo_green "Install orangepi-config from git sources ..." | ||
|
||
|
@@ -191,4 +186,31 @@ if [[ "${ORANGEPI_INSTALL_OPI_CONFIG}" == "true" ]]; then | |
else | ||
echo_red "WARN: orangepi-config install not configured ... [SKIPPED]" | ||
fi | ||
## END Step 7 | ||
|
||
## Step 8: Fix tty and serial-tty autologin | ||
### NOTE: Since OrangePI OS uses for its getty override.conf files | ||
### the location of '/lib/systemd/system/[serial-][email protected]' | ||
### instead the appropriate location in etc, we have to fix that. | ||
if [[ "${ORANGEPI_DISABLE_GETTY_AUTOLOGIN}" = "1" ]]; then | ||
echo_green "Disable 'getty' autologin ..." | ||
|
||
### Substep 1: copy '/lib/systemd/system/[serial-][email protected]' | ||
for dir in $(get_gettyconf_dirs /usr/lib/systemd/system); do | ||
cp -R "${dir}" /etc/systemd/system | ||
done | ||
### End Substep 1 | ||
|
||
### Substep 2: Modify 'override.conf', delete autologin | ||
for conf in $(get_gettyconf_dirs /etc/systemd/system); do | ||
if [[ -f "${conf}/override.conf" ]]; then | ||
echo_green "Found '${conf}/override.conf', trying to modify ..." | ||
sed -i 's/--autologin orangepi //' "${conf}/override.conf" | ||
else | ||
echo_green "No '${conf}/override.conf' found, modifying skipped!" | ||
fi | ||
done | ||
### END Substep 2 | ||
echo_green "Disable 'getty' autologin ... DONE!" | ||
fi | ||
## END Step 8 |