Raspi-Mobile: Difference between revisions

From Coolscript
Jump to navigation Jump to search
(Created page with "=Intro= Raspi-Mobile is designed to run as a '''Mobile Device''' together with your '''Tablet''' or '''Laptop''', prepared for conditions such as in a Train, Flight, Hotel and...")
 
 
(63 intermediate revisions by the same user not shown)
Line 2: Line 2:
Raspi-Mobile is designed to run as a '''Mobile Device''' together with your '''Tablet''' or '''Laptop''', prepared for conditions such as in a Train, Flight, Hotel and so on.<br>
Raspi-Mobile is designed to run as a '''Mobile Device''' together with your '''Tablet''' or '''Laptop''', prepared for conditions such as in a Train, Flight, Hotel and so on.<br>
The project has its focus to run as a '''Streaming Server''' next to common features like '''Wireless''' and '''Internet-Routing''' support.<br>
The project has its focus to run as a '''Streaming Server''' next to common features like '''Wireless''' and '''Internet-Routing''' support.<br>
<br>Two major Raspberry/Linux issues are solved:<br>
<br>Two interesting Raspberry/Linux issues are solved:<br>
*'''True automatic mounting of USB flush drives'''
*'''True automatic mounting of USB flush drives'''
**Plugin any USB sticks, supporting the filesystems ntfs, vfat and exfat
**Plugin any USB flush drives and mount the device automatically, supporting the filesystems ntfs, vfat and exfat
*'''Graceful shutdown'''
*'''Graceful shutdown'''
**This solves the issue of preventing disk damages in case of losing electricity power.  
**This solves the issue of preventing disk damages in case of losing electricity power.  
**No need to login or connecting a keyboard and monitor to shutdown, just plugin the '''shutdown usb device''' to initiate a graceful shutdown
**No need to login or connecting a keyboard and monitor to shutdown the device graceful, just plugin the '''shutdown usb device''' to initiate an instant and graceful shutdown


=Features=
=Features=
*Support Raspberry3 or Raspberry4. The project was developed with Raspberry4 on Debian Buster
*'''Easy to setup''' just download one of the available image and write it to your memory card.
*Supporting the [https://www.raspberrypi.org/products/raspberry-pi-4-model-b/ Raspberry4]. The project was developed on Raspian 10 and Raspian 11
*Slim image file download, the image size is less than 2GB
*Slim image file download, the image size is less than 2GB
*Easy to setup
*Automatic mounting and un-mounting [https://en.wikipedia.org/wiki/USB_flash_drive USB flash drives]
*Automatic mounting and un-mounting [https://en.wikipedia.org/wiki/USB_flash_drive USB flash drives]
**Supported file systems: ntfs,ext32 and vfat
**Supported file systems: ntfs,ext32 and vfat
Line 26: Line 26:


=Easy Installation=
=Easy Installation=
*Get the 2GB image [https://coolscript.org/download/images/raspi-mobile.img here]
*Write the image to a '''Micro SD Card''' with the size of equal or better greater than '''2GB''', there is no limit, use any size of your Micro SD Card
*Write the image to a '''Micro SD Card''' with the size of equal or better greater than 2GB
**To write the Image you may use tools like [https://sourceforge.net/projects/win32diskimager/ DiskImager]
**To write the Image you may use tools like [https://sourceforge.net/projects/win32diskimager/ DiskImager]
*Insert the Micro SD Card to your Raspberry and start it
*Insert the Micro SD Card to your Raspberry and start it
**If the Micro SD Card is greater then 2GB then login and run '''raspi-config''', goto '''advanced''' and then '''expand filesystem''', finish and reboot
**The disk will get automatically expanded to the maximum size during the first boot
*Installation finished
***Optional you may check the disk size by logging in via '''ssh''' and then run '''raspi-config''', goto '''advanced''' and then '''expand filesystem''', finish and reboot  
=Default Username and Password=
*'''Installation finished'''
 
==Default Username and Password==
*Username '''pi'''
*Username '''pi'''
*Password '''raspberry'''
*Password '''raspberry'''
=Hostname and Aliases=
 
Available ONLY when connected through WiFi
==Hostname and Aliases==
Note: Hostname resolution is only available when connected through WiFi
*Hostname '''raspberrypi'''
*Hostname '''raspberrypi'''
*Aliases
*Aliases
Line 44: Line 46:
**192.168.5.1
**192.168.5.1


=SSH=
==SSH==
  ssh pi@raspi
  ssh pi@raspi
  ssh pi@192.168.5.1
  ssh pi@192.168.5.1
Line 50: Line 52:
  sudo -i
  sudo -i


=Wireless default access=
==Wireless default access==
*WiFi SID
*WiFi SID
**Raspi-Mobile
**Raspi-Mobile
Line 59: Line 61:
  http://raspi:8080  
  http://raspi:8080  
  http://192.168.5.1:8080
  http://192.168.5.1:8080
=Change the password for the pi user=
==Connect using SSH==
===Change the Linux Password===
Note: Changing the Linux password will cover '''sftp''' too
ssh pi@raspi
*Type
pi@raspberrypi:~ $ '''sudo -i'''
root@raspberrypi:~# '''passwd pi'''
New password:
Retype new password:
passwd: password updated successfully
===Change the SMB/CIFS Password===
This might need a new windows login after the change
pi@raspberrypi:~ $ '''sudo -i'''
root@raspberrypi:~# '''smbpasswd pi'''
New SMB password:
Retype new SMB password:
===Change the HTTP/WebDav Password===
htpasswd /etc/apache2/.htpasswd pi
=Add a new user=
===Add a new user to Linux===
This example will add the user '''admin'''<br>
Note: Changing the Linux password will cover '''sftp''' too<br>
*Login first
ssh pi@raspi
*Type
root@raspberrypi:/# '''adduser admin'''
Adding user `admin' ...
Adding new group `admin' (1002) ...
Adding new user `admin' (1001) with group `admin' ...
Creating home directory `/home/admin' ...
Copying files from `/etc/skel' ...
New password:
Retype new password:
passwd: password updated successfully
Changing the user information for admin
Enter the new value, or press ENTER for the default
        Full Name []: Raspi Admin
        Room Number []:
        Work Phone []:
        Home Phone []:
        Other []:
Is the information correct? [Y/n] Y
*Add the new user to the sudo group in order to allow the user to become root
usermod -a -G sudo admin
===Add a new user to SMB/CIFS===
pi@raspberrypi:~ $ '''sudo -i'''
root@raspberrypi:~# '''smbpasswd -a admin'''
New SMB password:
Retype new SMB password:
*Add the new user to the samba group
usermod -a -G sambagrp admin
===Add a new user to HTTP/WebDav===
htpasswd /etc/apache2/.htpasswd admin
New password:
Re-type new password:
Adding password for user admin
=Change the WiFi SID and Password=
*Login to http://raspi:8080/ and navigate to '''Hostspot''', do the changes on the website.
'''OR'''
*SSH to the Raspberry, then edit ''' /etc/hostapd/hostapd.conf  '''
=Unexpected Shutdown=
The Raspberry should never get shutdown unexpected during a write operation (eg by pulling the power cable), <br>
this may result in a data loss or filesystem damage.<br><br>
The reason for this is the behavior of the SD card, see a very good explanation for this [https://raspberrypi.stackexchange.com/questions/50345/is-it-okay-to-just-pull-the-plug here]<br><br>
For security reasons the syslog facility has been turned off, this way there is less writing activity which protects the filesystem in case of a unexpected shutdown.<br>
To enable syslog in case of debugging:
systemctl enable syslog.socket rsyslog.service
systemctl start syslog.socket rsyslog.service
=Graceful Shutdown=
Raspi-Mobile has a preconfigured udev rule configured to allow a '''greaceful shutdown''' by conneting a special prepared '''USB flash drive''', <br>
*The drive label '''RASPI-CLEAN-SHUTDOWN''' will instantly shut down the device.<br><br>
*Example of changing the drive label on Windows
{| style="width: 100%;"
|style="width:90%; vertical-align: top;"|
[[image:Raspi-clean-shutdown.png|900px|left]]
|}
<br><br>
*Once connected then please give the device a few seconds to complete the shutdown
=Known Problems=
'''Problem:'''<br>
In case of unplugging eth0 while wlan0 is active then it can happen that the SID is no more visible even after reboot<br>
'''Solution:'''<br>
Shut down the Raspi and start again without eth0, then shutdown again, plugin eth0 and start again.<br>
=Download=
*<span style="color:red">2GB image [https://coolscript.org/download/images/raspi-mobile-raspian11.img Raspbian11]</span><br>
*<span style="color:red">2GB image [https://coolscript.org/download/images/raspi-mobile-raspian10.img Raspbian10]</span>
=Links=
*Installation protocol: https://coolscript.org/index.php/Setup-Raspi-Mobile
[[image:rb01a.png|300px|left]]<br>
[[image:rb-bundle01.png|500px|left]]
[[image:rb-back01.png|500px|left]]<br>

Latest revision as of 22:20, 12 March 2022

Intro

Raspi-Mobile is designed to run as a Mobile Device together with your Tablet or Laptop, prepared for conditions such as in a Train, Flight, Hotel and so on.
The project has its focus to run as a Streaming Server next to common features like Wireless and Internet-Routing support.

Two interesting Raspberry/Linux issues are solved:

  • True automatic mounting of USB flush drives
    • Plugin any USB flush drives and mount the device automatically, supporting the filesystems ntfs, vfat and exfat
  • Graceful shutdown
    • This solves the issue of preventing disk damages in case of losing electricity power.
    • No need to login or connecting a keyboard and monitor to shutdown the device graceful, just plugin the shutdown usb device to initiate an instant and graceful shutdown

Features

  • Easy to setup just download one of the available image and write it to your memory card.
  • Supporting the Raspberry4. The project was developed on Raspian 10 and Raspian 11
  • Slim image file download, the image size is less than 2GB
  • Automatic mounting and un-mounting USB flash drives
    • Supported file systems: ntfs,ext32 and vfat
  • Graceful shutdown using a special prepared USB flash drive labeled with RASPI-CLEAN-SHUTDOWN
  • Wireless support, the device has a mangement web to customize WiFi settings like SID and password
  • Routing support together with ethernet connectivity, all interfaces are using DHCP
  • Support OpenVPN
  • Support of common protocols for streaming:
    • SMB/CIFS
    • WebDav
    • SFTP
    • HTTP

Easy Installation

  • Write the image to a Micro SD Card with the size of equal or better greater than 2GB, there is no limit, use any size of your Micro SD Card
    • To write the Image you may use tools like DiskImager
  • Insert the Micro SD Card to your Raspberry and start it
    • The disk will get automatically expanded to the maximum size during the first boot
      • Optional you may check the disk size by logging in via ssh and then run raspi-config, goto advanced and then expand filesystem, finish and reboot
  • Installation finished

Default Username and Password

  • Username pi
  • Password raspberry

Hostname and Aliases

Note: Hostname resolution is only available when connected through WiFi

  • Hostname raspberrypi
  • Aliases
    • raspi
    • raspberry
  • IP (alias to eth0, works even if eth0 is disconnected)
    • 192.168.5.1

SSH

ssh pi@raspi
ssh pi@192.168.5.1
  • Become root
sudo -i

Wireless default access

  • WiFi SID
    • Raspi-Mobile
  • WiFi Passwd
    • raspberry
  • RaspAP Web-Interface
http://raspi:8080 
http://192.168.5.1:8080

Change the password for the pi user

Connect using SSH

Change the Linux Password

Note: Changing the Linux password will cover sftp too

ssh pi@raspi
  • Type
pi@raspberrypi:~ $ sudo -i
root@raspberrypi:~# passwd pi
New password:
Retype new password:
passwd: password updated successfully

Change the SMB/CIFS Password

This might need a new windows login after the change

pi@raspberrypi:~ $ sudo -i
root@raspberrypi:~# smbpasswd pi
New SMB password:
Retype new SMB password:

Change the HTTP/WebDav Password

htpasswd /etc/apache2/.htpasswd pi

Add a new user

Add a new user to Linux

This example will add the user admin
Note: Changing the Linux password will cover sftp too

  • Login first
ssh pi@raspi
  • Type
root@raspberrypi:/# adduser admin
Adding user `admin' ...
Adding new group `admin' (1002) ...
Adding new user `admin' (1001) with group `admin' ...
Creating home directory `/home/admin' ...
Copying files from `/etc/skel' ...
New password:
Retype new password:
passwd: password updated successfully
Changing the user information for admin
Enter the new value, or press ENTER for the default
       Full Name []: Raspi Admin
       Room Number []:
       Work Phone []:
       Home Phone []:
       Other []:
Is the information correct? [Y/n] Y
  • Add the new user to the sudo group in order to allow the user to become root
usermod -a -G sudo admin

Add a new user to SMB/CIFS

pi@raspberrypi:~ $ sudo -i
root@raspberrypi:~# smbpasswd -a admin
New SMB password:
Retype new SMB password:
  • Add the new user to the samba group
usermod -a -G sambagrp admin

Add a new user to HTTP/WebDav

htpasswd /etc/apache2/.htpasswd admin
New password:
Re-type new password:
Adding password for user admin

Change the WiFi SID and Password

OR

  • SSH to the Raspberry, then edit /etc/hostapd/hostapd.conf

Unexpected Shutdown

The Raspberry should never get shutdown unexpected during a write operation (eg by pulling the power cable),
this may result in a data loss or filesystem damage.

The reason for this is the behavior of the SD card, see a very good explanation for this here

For security reasons the syslog facility has been turned off, this way there is less writing activity which protects the filesystem in case of a unexpected shutdown.
To enable syslog in case of debugging:

systemctl enable syslog.socket rsyslog.service 
systemctl start syslog.socket rsyslog.service

Graceful Shutdown

Raspi-Mobile has a preconfigured udev rule configured to allow a greaceful shutdown by conneting a special prepared USB flash drive,

  • The drive label RASPI-CLEAN-SHUTDOWN will instantly shut down the device.

  • Example of changing the drive label on Windows



  • Once connected then please give the device a few seconds to complete the shutdown

Known Problems

Problem:
In case of unplugging eth0 while wlan0 is active then it can happen that the SID is no more visible even after reboot
Solution:
Shut down the Raspi and start again without eth0, then shutdown again, plugin eth0 and start again.


Download

Links