PMB

Forum Replies Created

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • in reply to: Linaro running from NAND #3007
    PMB
    Keymaster

    Installing and Setup
    .
    After a fresh re-flash.
    Linaro. Username “linaro”, PW “linaro”.
    SSH in and you get these two messages:
    chmod: changing permissions of `/dev/disp’: Operation not permitted
    chmod: changing permissions of `/dev/cedar_dev’: Operation not permitted
    .
    .
    $ locale -a ; produces error messages ?
    locale: Cannot set LC_CTYPE to default locale: No such file or directory
    locale: Cannot set LC_MESSAGES to default locale: No such file or directory
    locale: Cannot set LC_ALL to default locale: No such file or directory
    Solution:
    $ sudo locale-gen en_NZ.UTF-8 ; generate missing locale files
    .
    To change locale: ; takes effect after next login
    $ locale -a ; will display available locales (can generate more if needed)
    $ sudo nano /etc/default/locale
    LC_ALL=en_US.UTF-8
    LANG=en_US.UTF-8
    .
    This build based on Ubuntu Quantal Quetzal (12.10)
    Support for Ubuntu 12.10 Quantal Quetzal officially ended on May 16, 2014.
    note: Trusty Tahr = 14.04
    $ sudo apt-get update ; some errors : Some index files failed to download
    .
    Err http://ports.ubuntu.com quantal/main Sources 404 Not Found
    Err http://ports.ubuntu.com quantal/universe Sources 404 Not Found
    Err http://ports.ubuntu.com quantal/main armhf Packages 404 Not Found
    Err http://ports.ubuntu.com quantal/universe armhf Packages 404 Not Found

    W: Failed to fetch http://ports.ubuntu.com/ubuntu-ports/dists/quantal/main/source/Sources 404 Not Found
    W: Failed to fetch http://ports.ubuntu.com/ubuntu-ports/dists/quantal/universe/source/Sources 404 Not Found
    W: Failed to fetch http://ports.ubuntu.com/ubuntu-ports/dists/quantal/main/binary-armhf/Packages 404 Not Found
    W: Failed to fetch http://ports.ubuntu.com/ubuntu-ports/dists/quantal/universe/binary-armhf/Packages 404 Not Found
    .
    I did this: (follow the sequence)
    $ sudo apt-get install mc ; failed, errors, not found….. 🙁
    $ sudo nano /etc/apt/sources.list ; add precise (2 lines)
    $ sudo apt-get update
    $ sudo apt-get upgrade
    $ sudo nano /etc/apt/sources.list ; # out quantal (2 lines)
    $ sudo apt-get update
    $ sudo apt-get upgrade
    $ sudo apt-get install mc ; worked OK this time 🙂
    .
    .
    Update users and passwords
    Change the root password:
    $ sudo passwd root ; enter and confirm a new password
    Change the default linaro user password:
    $ sudo passwd linaro ; enter and confirm a new password
    Create new user:
    $ sudo adduser paul ; enter details when prompted, will ask for password
    $ sudo passwd paul ; to change PW if not already set up.
    $ sudo apt-get install mc ; install mc (midnight commander)
    $ sudo apt-get install htop ; install htop
    make user home dir and chown
    $ sudo usermod -a -G admin paul ; example to add user to existing group
    $ id linaro ; reports user info
    $ groups linaro ; reports groups containing user linaro
    Add user to the sudoers file.
    $ sudo adduser sudo
    .
    Change SSH setup
    $ sudo nano /etc/ssh/sshd_config ; change permitrootlogin to no, change port number
    .
    Set hostname in etc/hostname (mail2) and in etc/hosts (mail2.rcbeacon.com mail2)
    . FQDN = mail2.rcbeacon.com
    $ hostname ; display hostname
    $ hostname -f ; display FQDN
    .
    Fixed IP
    $ sudo nano /etc/network/interfaces
    iface eth0 inet static
    address 192.168.1.20
    netmask 255.255.255.0
    gateway 192.168.1.10
    Nameserver
    $ sudo nano /etc/resolv.conf
    nameserver 192.168.1.10
    .
    SATA – to activate at boot ; should already be active
    $ sudo echo “sw_ahci_platform” >> /etc/modules
    SATA drive appears at /dev/sda, sda1 etc.
    $ sudo mkfs -t ext4 /dev/sda1 ; this will format the drive
    Mount before use:
    $ sudo mkdir /media/sdd1
    $ sudo mount /dev/sda1 /media/sdd1 ; to manually mount
    Add to fstab
    $ sudo blkid /dev/sda1 ; to determin UUID
    $ sudo nano /etc/fstab
    UUID=43ce92c0-cf57-4252-b4de-63826a9fbd74 /media/sdd1 ext4 noatime,errors=remount-ro 0 2
    .
    About time for a reboot
    $ sudo reboot
    .
    How to duplicate the NAND image to the SATA drive:
    $ dd if=/dev/nandb of=/dev/sda1 bs=1M
    $ sync
    .
    LAMP install
    $ sudo apt-get install apache2
    Suggested packages: apache2-doc apache2-suexec apache2-suexec-custom ufw
    Recommended packages: ssl-cert
    $ sudo apt-get install mysql-server mysql-client libapache2-mod-auth-mysql php5-mysql
    Suggested packages: libterm-readkey-perl tinyca mailx php5-suhosin php-pear
    Recommended packages: libhtml-template-perl
    ; Gets stuck here: Setting up mysql-server-5.5 (5.5.27-0ubuntu2) …
    login with another window and : $ sudo stop mysql ; stops the restart loop and allows install to complete
    Can’t find a solution to this; file /var/run/mysqld/mysqld.sock is missing
    NOTE:
    Prior to above mentioned quantal-to-precise sources change:
    Useful install ends here…
    After the above mentioned quantal-to-precise sources change:
    Install completes but reports:
    Errors were encountered while processing:
    mysql-server-5.5
    mysql-server
    E: Sub-process /usr/bin/dpkg returned an error code (1).
    Still missing = /var/run/mysqld/mysqld.sock
    .
    $ sudo service mysql start
    $ dmesg
    $ service mysql status
    .
    So, where to now ????
    ——————————————————————————
    .
    $ sudo mysql_install_db
    error: ???
    ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)
    try this:
    $ cd /etc/init.d/
    $ mysqld_safe

    $ sudo /usr/bin/mysql_secure_installation
    $ sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt
    $ sudo nano /etc/apache2/mods-enabled/dir.conf
    Add index.php to the beginning of index files.
    $ apt-cache search php5- ; list modules that can be installed
    $ sudo apt-get install name of the module
    .
    sudo service apache2 restart
    .
    $ sudo nano /var/www/test_file.php

    To test it browse to: 192.168.1.??/test_file.php
    .
    ——————————————————————————————————-
    ——————————————————————————————————-
    Ref. for LAMP install:
    https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu
    .
    Note:
    $ sudo apt-get install mysql-server mysql-client php5-mysql ; will prompt for root PW
    Or root PW can be set later on like this
    $ mysql -u root
    mysql> USE mysql;
    mysql> UPDATE user SET Password=<your password> WHERE user=”root”;
    mysql> FLUSH PRIVILEGES;
    .
    $ sudo apt-get install phpmyadmin
    Test by browsing to: 192.168.1.??/phpmyadmin
    .
    Fully qualified domain name error notes:
    $ sudo nano /etc/hosts
    1.1 mail.pmb.co.nz mail
    .
    Ref:
    https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu
    .
    NOTES: and old-info.
    .
    View log file:
    $ tail -f /var/log/syslog
    Find a file:
    $ sudo find / -type s | grep mysqld.sock
    .
    or
    perl: warning: Setting locale failed.
    perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = “en_US.utf8”,
    LANG = “en_NZ.UTF-8″
    are supported and installed on your system.
    $ sudo locale-gen fr_FR.UTF-8 ; generate locale
    $ locale -a ; show available locales
    $ locale ; get current locale info
    $ export LANG=en_NZ.utf8
    $ export LANG=”en_NZ.utf8”
    $ sudo nano /etc/default/locale ; add the line “LANG=”en_NZ.UTF-8″”
    .
    /bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.utf8)
    locale: Cannot set LC_CTYPE to default locale: No such file or directory
    locale: Cannot set LC_MESSAGES to default locale: No such file or directory
    locale: Cannot set LC_ALL to default locale: No such file or directory
    /bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.utf8)
    /bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.utf8)
    .
    update: to solve this problem ?? : NOTE: there are many versions of how to solve this problem.
    $ sudo locale-gen en_NZ.UTF-8 ; generate missing locale files
    $ sudo locale-gen en_US.UTF-8 ; generate missing locale files
    $ sudo dpkg-reconfigure locales ; .
    and/or add to the file /etc/environment
    LC_ALL=C
    and/or add to the file /etc/default/locale ; not sure which will work:
    LC_ALL=en_NZ.UTF-8
    LANG=en_NZ.UTF-8
    .
    .
    $ sudo apt-get update ; This returned problems:
    E: Could not get lock /var/lib/dpkg/lock – open (11: Resource temporarily unavailable)
    E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?
    .
    .

    in reply to: RaspberryPi as a Mail Server #2216
    PMB
    Keymaster

    Here’s a good one…

    Last night I noticed that our traffic was high by about 1G/day and had been for the last 3 days. Some investigating narrowed it to the email server. The logs showed postfix was rejecting a message as too large. A customer had sent a set of pictures totaling about 14MB. It’s been downloading 10MB and failing every 8 minutes for 3 days.

    I edited postfix main.cf to include “message_size_limit = 20480000”. All fixed.

    in reply to: Ubuntu Linux #1971
    PMB
    Keymaster

    Ubuntu 12.10

    Canonical has apparently included Amazon and Ubuntu One into the Dash search. When you search locally using the Ubuntu desktop, Ubuntu sends the string to a Canonical server and probably Amazon.

    I hear you can turn this off in your privacy settings. Probably a good idea.

    You may be able to get rid of this, try:

    sudo dpkg –purge unity-lens-shopping

    I’ll have to try the 12.10 Kubuntu

    ..

    in reply to: Email and SMS #1900
    PMB
    Keymaster

    I’m no expert at this. Reading an alarm input on the GPIO is probably not too difficult. It looks like 1-wire is supported on GPIO-4 for the Dallas/Maxim DS18B20 temperature sensor. Once you have the state or information, sending a email is not too difficult. I’ve got fetchmail, postfix, and dovecot running and can send emails from the command line.
    Years ago there was at least one web site that allowed you to send free text messages. They are probably all pay services now or require a cell module connected to the R-Pi.
    Let us know how it goes.

    in reply to: RaspberryPi as a Mail Server #1838
    PMB
    Keymaster

    reserved 2

    in reply to: RaspberryPi as a Mail Server #1837
    PMB
    Keymaster

    reserved 1

    in reply to: RaspberryPi as a Mail Server #1836
    PMB
    Keymaster

    Remember: this is just an apparently random series of notes that I’ll tidy up later.
    Reference only : Installed ubuntu server and specify a mail server
    .
    NOTE: I had this all formatted with code blocks etc. BUT the damned editor keeps deleting all the formatting
    (see here)
    so I’ve given up. I could drown the dick-head responsible for this “feature”.
    .
    $ sudo nano /etc/default/fetchmail
    . change START_DAEMON to yes to allow fetchmail to run LAMP and a few Misc Packages Linux Apache, MySQL, PHP.
    I probably installed things in the wrong order and it took a bit of sorting out.
    At various stages I got error messages that seemed to relate to dovecot.
    $ sudo apt-get install mc
    $ sudo apt-get install Apache2
    $ sudo apt-get install php5 libapache2-mod-php5
    $ sudo /etc/init.d/apache2 restart
    To test php
    $ sudo nano /var/www/testphp.php
    . <!–?php include(“config.php”);
    . mysql_connect(“$dbhost”, “$dbuname”, “$dbpass”);
    . mysql_select_db(“$dbname”);
    . echo mysql_error();
    . phpinfo();
    . ?–> http://192.168.1.56/testphp.php
    .
    $ sudo apt-get install mailutils
    $ sudo apt-get install mysql-server
    $ sudo nano /etc/mysql/my.cnf
    . bind-address = 127.0.0.1 #
    . change line to your IP address
    $ sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin
    $ sudo nano /etc/php5/apache2filter/php.ini extension=mysql.so # uncomment this line
    $ sudo /etc/init.d/apache2 restart
    Hostname What is the current hostname: hostname -f Change the hostname:
    $ sudo nano /etc/hostname pmb.co.nz
    $ sudo nano /etc/hosts
    . change hostname from original to new
    . change reverse DNS = determining a domain name from a given IP address
    …… install dnsutils = various client programs related to DNS:
    Then you can check the reverse DNS:
    $ dig -x “ip-address”
    .
    Install fetchmail
    Fetchmail is a remote mail retrieval and forwarding utility. It gets the mail in from one or a number of sources and puts it in a folder where it can be picked up by the next step in the process.
    $ sudo apt-get install fetchmail
    Edit the config file fetchmailrc in directory /etc
    $ sudo nano /etc/fetchmailrc
    $ sudo nano /etc/default/fetchmail
    . change START_DAEMON to yes ; to allow fetchmail to run
    $ sudo /etc/init.d/fetchmail start ; Starting fetchmail – gave an error: pi@pmb ~ $
    $ sudo /etc/init.d/fetchmail restart [….] Restarting mail retriever agent: fetchmailfetchmail: cannot open /var/log/fetchmail.log: Permission denied fetchmail: fetchmail: Cannot detach into background. Aborting.
    After trying various locations, I put the log file in -var-log-. Created a new user (paul) in the process. The error was fixed changing the log file ownership to fetchmail-root
    .
    Postfix
    A mail transport agent. A popular alternative to sendmail.
    $ sudo apt-get install postfix ; when prompted, select “internet with smarthost” and enter your mail name (pmb.co.nz): Redirect mail from root user to your user name then reload:
    $ sudo nano /etc/aliases root: paul sudo newaliases
    Edit the main postfix config file and change 3 lines at the end of the file and restart postfix:
    $ sudo nano /etc/postfix/main.cf
    . myorigin = $pmb.co.nz
    . mydestination = $pmb.co.nz, localhost.$pmb.co.nz, localhost
    . mynetworks = 127.0.0.0/8
    $ sudo /etc/init.d/postfix restart
    To test it, send email using php interactive shell (address, subject, body):
    . php -a mail (‘paul@pmb.co.nz’, “PMB- A simple test email”, “testing… testing…”);
    . extit ();
    .
    Dovecot
    Dovecot is a Mail Delivery Agent (MDA), set up as a IMAP or POP3 server. Mail is stored in /home/paul/Maildir/
    Edit these files to configure dovecot:
    $ sudo apt-get install dovecot-imapd dovecot-pop3d
    $ sudo nano /etc/dovecot/dovecot.conf
    $ sudo nano /etc/dovecot/10-auth.conf
    $ sudo nano /etc/dovecot/10-mail.conf
    $ sudo nano /etc/dovecot/10-pop3.conf
    . Create the Maildir for future users:
    $ sudo maildirmake.dovecot /etc/skel/Maildir
    $ sudo maildirmake.dovecot /etc/skel/Maildir/.Drafts
    $ sudo maildirmake.dovecot /etc/skel/Maildir/.Sent
    $ sudo maildirmake.dovecot /etc/skel/Maildir/.Trash
    $ sudo maildirmake.dovecot /etc/skel/Maildir/.Templates
    .
    For existing users:
    $ sudo cp -r /etc/skel/Maildir /home/paul/
    $ sudo chown -R paul:paul /home/paul/Maildir
    $ sudo chmod -R 700 /home/paul/Maildir
    .
    To start/stop/restart dovecot
    $ sudo /etc/init.d/dovecot start
    To see if dovecot is running: ps -A | grep dovecot
    .
    Mount the USB drive:
    The usb drive must be ext4 formatted so you can chown and chmod it.
    $ umount /dev/sda1
    $ sudo mkfs.ext4 /dev/sda1
    .
    Auto-mount USB drive at boot by adding to /etc/rc.local mount /dev/sda1 /home/paul/usb1_data
    .
    From /home/paul/ create a symlink to make the Maildir on the usb flash drive appear to be in /home/paul
    $ sudo ln -s /home/paul/usb1_data/Maildir Maildir
    .
    A useful command to determine the total size of a directory and everything in and below it:
    $ du -sh /directory/
    .
    NOTES:
    $ dpkg -S which sendmail
    $ sudo netstat -pel | grep smtp
    $ dpkg -S “$(sudo ps ux | grep 3281 | awk ‘{print $NF}’)” ; note 3281 came from the previous command result
    $ tail -f /var/log/mail.log ; view mail logs
    $ sudo fuser -uv 25/tcp ; show all processes listening on port 25
    .
    References: https://help.ubuntu.com/community/Dovecot
    .
    ERROR LOGS – REPAIRS NEEDED
    linaro@mail2:~$ tail -f /var/log/mail.log
    Jul 8 14:20:06 mail2 postfix/local[1065]: 69A3BFEA8: to=, orig_to=, relay=local, delay=38220, delays=38216/2.8/0/0.38, dsn=4.3.0, status=deferred (temporary failure)
    Jul 8 14:20:07 mail2 dovecot: lda(root): Error: user root: Initialization failed: Initializing mail storage from mail_location setting failed: mkdir(/root/Maildir) failed: Permission denied (euid=65534(nobody) egid=65534(nogroup) missing +w perm: /root, dir owned by 0:0 mode=0755)
    Jul 8 14:20:07 mail2 dovecot: lda(root): Error: user root: Initialization failed: Initializing mail storage from mail_location setting failed: mkdir(/root/Maildir) failed: Permission denied (euid=65534(nobody) egid=65534(nogroup) missing +w perm: /root, dir owned by 0:0 mode=0755)
    Jul 8 14:20:07 mail2 dovecot: lda(root): Fatal: Invalid user settings. Refer to server log for more information.
    Jul 8 14:20:07 mail2 postfix/local[1013]: 6B33BFE86: to=, orig_to=
    , relay=local, delay=91701, delays=91697/3.2/0/0.3, dsn=4.3.0, status=deferred (temporary failure)
    Jul 8 14:20:07 mail2 dovecot: lda(root): Fatal: Invalid user settings. Refer to server log for more information.
    Jul 8 14:20:07 mail2 postfix/local[923]: 89CDBFE91: to=, orig_to=
    , relay=local, delay=91520, delays=91517/3.2/0/0.3, dsn=4.3.0, status=deferred (temporary failure)
    Jul 8 14:20:07 mail2 dovecot: lda(root): Error: user root: Initialization failed: Initializing mail storage from mail_location setting failed: mkdir(/root/Maildir) failed: Permission denied (euid=65534(nobody) egid=65534(nogroup) missing +w perm: /root, dir owned by 0:0 mode=0755)
    Jul 8 14:20:07 mail2 dovecot: lda(root): Fatal: Invalid user settings. Refer to server log for more information.
    Jul 8 14:20:07 mail2 postfix/local[975]: 817AFFE89: to=, orig_to=
    , relay=local, delay=91606, delays=91602/3.5/0/0.14, dsn=4.3.0, status=deferred (temporary failure)
    q^C

Viewing 7 posts - 1 through 7 (of 7 total)