16 Replies Latest reply on Aug 5, 2018 2:55 PM by oghma

    What are the basics?

    oghma

      I feel like I've started reading a mystery novel from about half way through, and its should come as no surprise that I'm having trouble getting anything done.

       

      I'm not a complete novice when it comes to computers. I've built my own PCs, file servers (PC-DOS, MS-DOS, Windows, NT, Novel) I even used a PR1ME at Uni to run FORTRAN programs. But this Pi has me thinking I know nothing. It's taken me over a week to do the following:

      - Stop my mouse from crawling across the screen

      - Get rid of the big black border around the edge of my monitor

      - Install an mSATA rive in the Pi Desktop and partition it into three using gparted. (Still not sure I've done this right)

      - Ran update and upgrade on the OS

      - Stopped menu choices in Chrome from showing white on white when I hover over them

      - Installed Gimp 2.8

       

      However, all of the above was achieved by following a recipe like advice from a guru. I feel I've learned very little on my journey.

       

      What I've failed to do is:

      - Install Firefox (erm - Iceweasel) and set this as my default browser

      - Clone my mSD card onto my mSATA partition 1 so I can boot from it. (Why? : More room. mSATAs are more reliable, and yes - slower, USB2.0!. I can keep the mSD safe, should I need a recovery point.)

      - Refer to my mSATA partitions with something a little more easy to remember than an 8-digit hex code.

       

      I am working towards making this Pi into a simple file server with spool services over an IP intranet. I feel like I'm still so far away from my goal.

       

      Sorry for the rant. I think what I'm after is something that I can build on, not just another recipe. Thanks for reading this far.

        • Re: What are the basics?
          colporteur

          I can appreciate your frustration. I just retired after 37 years in technology from two disciplines electronics and computers. I have been working with Pi's and Ardunios for the past five years and still feel I am on the front side of the learning curve. Unable to coast going uphill.

           

          That being said, stay the course. You have accumulated knowledge and experience that can benefit this industry. What I have found most useful is a good understanding of installation and configuration of the Pi's operating system (O/S) provides the greatest benefit. I still stumble across what I call best practices that I wish I had of learned early. It can be as simple as sudo apt-get update being the go to command before mucking with the O/S.

           

          Beware of context when you read solutions. Most individuals that provide responses fail to set context. Comments like, it simple, that is easy to do or doesn't take long give hope. You soon discover it easy only if you have the knowledge to have their level of understanding. I never use these words when I write technical articles.

           

          Check dates on responses. Pi's change on what appears to be a daily basis especially the O/S. What worked yesterday might not work today. Recall the context. What O/S was used for the solution? Rarely mentioned in the responses. The problem may not exist today because the technology has been replaced. Ouch that hurts!

           

          I write tutorials for a UK computer magazine. Some articles involve Pi's. I provide a Bill of Materials first to establish a baseline. At least then we are all on the same page. I have read article in some magazines and posts online but can never get the project to work. I then discover I am not completely aligned with what the writers used in his project.

           

          I can see you are looking for some solutions in areas I have not delved in. I can't offer a solution. How about that should be easy. Feel any better? Persevere grasshopper (hopefully your age allows you to understand the pronoun) I have found it is challenging field that allows me to continue to learn. Just takes a lot more time than I thought it should.

          4 of 4 people found this helpful
          • Re: What are the basics?
            shabaz

            Hi Steven,

             

            The things you're doing are fairly advanced, many users probably won't do mSATA partitioning, booting from mSATA, set up a file server, etc. All of these things are kind of 'Linux admin' related. If you've not used Linux before, then it takes time, i.e. there is a learning curve. Personally I'd recommend also installing Linux on your PC too (in a virtual machine) so you can experiment and get used to Linux. Most servers out there nowadays are Linux based I think, so there will be lots of resources for Linux as well as specific ones for Pi. I was lucky I did an admin course (not on Linux, but another UNIX). But that is the area to search for, if you're interested in such stuff (e.g. search for books on Linux admin).

             

            Since most stuff is open source, there could be builds/executables ready-made for the Pi, or you may occasionally have to compile/build from the source code. I'd say the need for the latter is becoming more infrequent nowadays, since the Pi has been quite popular, and a lot of stuff has been compiled/built for it now. In the past it was not that common and you'd have to build apps the source. As a vague guess, perhaps 70% of the Linux stuff you may want could be already available compiled for the Pi.

             

            If you want to use the Pi as a file server, check out Samba, that may help. Or there may be more complete packages/scripts you can download and install.

            3 of 3 people found this helpful
            • Re: What are the basics?
              colporteur

              I am sorry folks, it appears my fat fingers resting over the touchpad below the keyboard made some edits I would have preferred to not have. Nothing was omitted in the post just repeat. My apologies again.

              • Re: What are the basics?
                oghma

                Sean Conway - Thank you for the encouragement. I've spent money so I'll persevere!! I *do* believe in the potential. I think I can put a server together for about 10% of the price of an MS version, so - no contest. The only thing missing is *my knowledge*.

                 

                (Yes, I did get the 1970s reference. Kung Fu - be the best you can be.)

                 

                shabaz - Thank you for the pointers to Linux Admin and Shamba. This will save me some time, I'm sure. This is what I needed - a direction.

                 

                Sometimes the wealth of information on the net is just an embarrassment of riches! I would love searches to be *AND* and NOT *OR*! If anyone would like to add or narrow the research further, please feel free to add your comment. Thank you.

                1 of 1 people found this helpful
                  • Re: What are the basics?
                    colporteur

                    For a windows file server, Shabaz suggestion of using SAMBA application is ideal. There are resources available for setting it up. I am not a windows guy so I will leave out any reference to a resource. I have done a setup with no access restriction on the shares available but I think you need a little more than that.

                     

                    How comfortable are you with the O/S installation? I can provide you some guidance.

                     

                    This project can be accomplished with the reduced version of Raspbian O/S to maximize space and reduce download size of the O/S.

                     

                    A fileserver using samba can be operated headless (i.e. no keyboard, video or mouse attached). Access to the Pi for configuration would be done over a network connection using SSH.

                     

                    My thought is to provide you the knowledge to build a stable O/S platform to begin your build. This also includes giving some thought to security.

                     

                    What is your level of O/S knowledge?

                    1 of 1 people found this helpful
                      • Re: What are the basics?
                        oghma

                        Its been a while, Sean. I've built a Windows NT/Novel 4.11 server pair with authentication via the Novell Server, (Windows NT set to Trust). I must admit, this was a while ago. Never got around to updating the NT Server to 2003 Server. Semi-retired now, so not a lot of cash to spend on the new kit to run it, hence the move to the Pi.

                         

                        My thoughts were to learn to build a workstation first (thats why I installed Gimp 2.8 for example). Then I could migrate everything to the mSATA to begin turning it into a server. I would then have a mSD card ready to go for a workstation later, once I had a few more funds.

                         

                        The kit I currently have is:

                        Pi-Desktop with Pi 3B+ and 16Gb mSD card pre-installed with Raspian. Oh, and a 2.5amp PSU.

                        10" monitor with a USB keyboard/mouse combo

                        Kingston 480Gb mSATA (3 partitions all FAT32: 58Gb, 200Gb, 200Gb) - the most expensive component!

                         

                        I wanted to have Firefox (Iceweasel) as I don't care for Chrome, before I did the migration.

                         

                        I appreciate any help you could point me to, in order to understand what I need to do from the ground - up.

                          • Re: What are the basics?
                            colporteur

                            Have a read and send me any questions before you start if needed. These instructions will enable you to install an operating system O/S on a Pi, have it reboot supporting wireless to enable a console ssh connection to finish the install. This enables to establish an O/S with out ever having to use a keyboard, monitor or mouse connected to the Pi.

                             

                            If you are successful with this, I can send some security hardening instructions.

                             

                            For this project we’ll use the Raspbian Stretch Lite operating system. All the bells and whistles that are offered in the full install (i.e. no GUI) of Raspbian aren’t required for this build. The project doesn’t need a GUI, so why load the software? Bear in mind that using the Lite version of the OS increases the likelihood of some additional software installs.
                             

                            The command for transferring the OS images to an SD card is dd . The images referred to here aren’t the images for the movie screen, but rather the bit-by-bit copy of OS software that can be put on an SD card. It’s important to get the command syntax correct for the dd command to function correctly.

                            An alternate solution is to use an open source tool that provides a GUI interface. The Etcher GUI application reduces the complexity of the image transfer process.
                             

                            The Etcher application eliminates the need to have all attributes in dd correctly aligned to enable a successful image transfer. For good measure Etcher is also able to verify the image after the transfer process.
                             

                            Grab the a version of Etcher from https://etcher.io. After installing the software on your loading host (such as the PC you’re using to transfer the image), use the Etcher GUI to transfer the uncompressed Lite version of Raspian Stretch (www.raspberrypi.org/downloads/raspbian) to the micro SD card.

                            When the Etcher indicates the process is complete, unplug and plug back in the device holding the micro SD card. This triggers the operating system to automount the directories of the image on the SD card so they become available for the next steps.
                             

                            To avoid requiring a keyboard, video and mouse (KVM) and a wired network attached to the Raspberry

                            Pi, the following changes will add a few files to the operating system to establish the Pi in headless

                            operation (in other words, without a keyboard, video and mouse) for the remainder of the configuration

                            process. The requirement for KVM and a network cable are eliminated by having the Pi establish a Wi-Fi connection and initiating the SSH daemon in the Raspbian operating system on boot up.
                             

                            Next, use a text editor to create a file with the

                            following contents:

                            network={

                            ssid=”SSID”

                            psk=”password”

                            key_mgmt=WPA-PSK

                            }
                             

                            Replace SSID with your Wi-Fi network identifier, and psk with your Wi-Fi password. Save the file using the name wpa_supplicant.conf in the bootfs directory of the Raspian operating system on the SD card. When the file wpa_supplicant.conf is discovered during the boot sequence, the OS makes the necessary modification to establish the wireless configuration as you’ve defined it.
                             

                            In the same bootfs directory create a blank file with the name ssh – note that no file extension is required. When the ssh file is discovered during the boot sequence, the OS make the necessary modification to enable the SSH daemon on boot up.
                             

                            Boot the Pi with the imaged SD card installed. Now, with the Wi-Fi network connection established on boot up, and the secure communication protocol SSH supported, a connection to the device can be made using the command ssh pi@<replace all with device IP> from the CLI using default Pi credentials.
                             

                            With a SSH connection established, let’s get the operating system up to date with an update and

                            upgrade command:

                            sudo apt-get update

                            sudo apt-get upgrade
                             

                            To aid users in making some common configuration operating system changes, the development team for the Pi maintains a tool called raspi-config. It’s a menu- driven application that steps through different configuration options, relieving the user of the burden of knowing all the commands. Using the raspi-config tool sudo raspi-config , cull the menu lines to establish the

                            following elements:

                            Change default password

                            Change hostname

                            Change localisation options to reflect the location

                            Expand the file system
                             

                            There’s no need to use the menu options for Wi-Fi and SSH because this was accomplished by placing

                            unique files in the boot file system. The menu options can still be used to make changes to these options if required. Depending on the options changed the OS may require a reboot. Indeed, it’s best practice to perform a reboot after carrying out any configuration changes to check that they’re still in place whenever you restart your system.

                            2 of 2 people found this helpful
                      • Re: What are the basics?
                        oghma

                        Currently having problems. Well no surprise there - but the severity will seem to be overwhelming. I'm stuck in Emergency mode, I'm offered the line, Press ENTER to continue. Doesn't work. Back to where I started! Don't even see a $ prompt.

                         

                        See above for H/W. What I did:

                        1. Downloaded the LITE raspian from RaspberryPi.org, Copied the image file to a 16Gb SanDisk Ultra. Booted the Pi.

                        2. Congigured LITE with a new hostname, checked all the country stuff for GB, etc. Worked fine.

                        3. Installed Samba [$ sudo apt-get install samba samba-common-bin], updated the pswd [$ sudo smbpasswd -a pi] Worked fine.

                        4. Mounted my mSATA partitions. [$ sudo mkdir /mnt/MYLABEL] and then [$ sudo mount /dev/sda9 /mnt/MYLABEL]  where 9=1, 2 or 3. Worked fine

                        5. Time to make them permanent. Checked the partition information with [$ sudo blkid /dev/sda9] where 9=1, 2 or 3, as I have three partitions.

                        6. Ran [$ sudo nano /etc/fstab] and made each line the same format:

                           [PARTUUID=5daf9610-09 /mnt/MYLABEL vfat defaults,auto,umask=000,users,rw 0 0] There are three lines where 9=1, 2 or 3.

                        7. I had been going all day, as I was reading and documenting as I went. It was dinner time, so I [Shutdown]. Worked fine - or so I thought...

                         

                        On checking the net for my problem I have tried the following:

                        Removed the SD card from the Pi, so I can edit the file [cmdline.txt] and add to the line [init=/bin/sh]. It now reads:

                           [dwc_otg.lpm_enable=0 console=tty1 root=PARTUUID=78400886-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait

                        init=/bin/sh] all on one line.

                         

                        I get the same problem. Both the ^D and ENTER keys send me in a loop to keep me in Emergency Mode. I don't have another Pi. I don't have a way of editing the fstab file. (Do I need to invest in a mSD card reader USB device?) I have a working O/S on another SD card, with the GUI that I was playing with originally.

                         

                        What I did notice while rebooting several times is that my partitions 1 and 2 are mounted [Okay], but there is no news that I can see about the third partition.

                         

                        Apart from starting from scratch, can anyone adise on a way out of this?

                        Thank you for reading this far.

                          • Re: What are the basics?
                            shabaz

                            Hi Steven,

                             

                            It's always frustrating having done a lot of work to get stuck like this : (

                            Without another card reader, it will he hard to do anything, but even if you had the card reader, I do not know what could be done at this stage, since file system partitions are very low-level and so either things work, or don't work at all : ( I'm not too familiar with procedures at the file system level : (

                            A couple of options you may prefer (if you plan to start again) is to (a) just have a single partition if possible - I'm not sure mSATA over USB will provide benefits from multiple partitions, and sometimes there is more inflexibility with partitions. It was always a pain running out of partition space in earlier times, and nowadays I'll just use a single one. I don't know if that is recommended practice for a server or not these days, but for a home system I think it should be fine.

                            The second thing you might want to do is not mount on startup using fstab. If you do that, then if the mSATA cable is disconnected, the startup hangs for a long time since it is trying to mount something that is non-existent, until  some timeout. It could be easier to have a script to perform the mount afterwards (and the script could be automated). That way, if the cable is disconnected, then the Pi will still start up fully.

                            2 of 2 people found this helpful
                              • Re: What are the basics?
                                oghma

                                Thank you, shabaz. Script? Like autoexec.bat in DOS? Okay, I'm on board. So, where does the script live?

                                  • Re: What are the basics?
                                    shabaz

                                    Hi Steven,

                                     

                                    I've just checked my Pi 3B, and my fstab file is a little different to yours. Mine has this entry:

                                    UUID=E408-3CDE /mnt/ssd vfat users,noatime,umask=0 0 2

                                     

                                    So, you could try it in the format as I have, it works for me. The entire file looks like this:

                                    proc            /proc           proc    defaults          0       0
                                    /dev/mmcblk0p1  /boot           vfat    defaults          0       2
                                    /dev/mmcblk0p2  /               ext4    defaults,noatime  0       1
                                    UUID=E408-3CDE /mnt/ssd vfat users,noatime,umask=0 0 2
                                    # a swapfile is not a swap partition, no line here
                                    #   use  dphys-swapfile swap[on|off]  for that

                                     

                                    First, find out what the SSD device file is called.. it should be /dev/sda1

                                    You can see them by typing:

                                    ls -ald /dev/sda*

                                     

                                    You can confirm the UUID value by typing:

                                    ls -l /dev/disk/by-uuid | grep sda1

                                     

                                    test it first using the mount command, like so (as root user, or prepend sudo):

                                    mount /dev/sda1 /mnt/ssd

                                     

                                    Only if that works, should the fstab modification be attempted.

                                     

                                    Otherwise, if you wish to try not using fstab and instead mount afterwards, test it first using the mount command, as above.

                                     

                                    If that works for you, then you can automate it as follows (all of this needs to be done as root user, or prepend the commands with sudo):

                                     

                                    Create a file in the folder /lib/systemd/system called mountssd.service

                                    Put the following content inside it (notice that it has the mount command on line 11):

                                     

                                    # systemd service file to mount SSD
                                    
                                    
                                    [Unit]
                                    Description=Mount SSD
                                    After=multi-user.target
                                    
                                    
                                    [Service]
                                    Type=simple
                                    ExecStart=/bin/mount /dev/sda1 /mnt/ssd
                                    SyslogIdentifier=mountssd
                                    StandardOutput=syslog
                                    
                                    
                                    [Install]
                                    WantedBy=multi-user.target
                                    
                                    

                                     

                                    Change the file permissions by typing:

                                    chmod 644 /lib/systemd/system/mountssd.service

                                     

                                    Then, enable the service:

                                    systemctl daemon-reload
                                    systemctl enable mountssd.service

                                     

                                    Finally, reboot the machine by typing reboot , and the SSD should be mounted.

                                    I've tested on my Pi, and that script worked for me. It could be improved, but I'm not a systemd expert. However, that script worked in my basic test.

                                    4 of 4 people found this helpful
                                      • Re: What are the basics?
                                        oghma

                                        Thank you, shabaz. This is very helpful. Some of the steps to test the mount I did to see that the drive was correctly connected. I will look into the scripts, as I think you have a point about the Pi booting up before anything is attempted.

                                         

                                        My problem stemmed from the fact that I only have one Pi. I've ordered a cheap USB mSD card reader. In the meantime I did the following:

                                        1. Downloaded linuxwin_trial.msi from https://www.paragon-software.com/home/linuxfs-windows/#

                                        This allowed me to see the ext4 partition of my mSD card. It meant that I had access to the fstab file from my Windows PC.

                                        2. Downloaded nano-git-0d9a7347243.exe from https://www.nano-editor.org/dist/win32-support/

                                        As Notepad likes a <CR><NewLine> combo, it's useless when editing Linux files. Nano does the job!

                                         

                                        I found that the line in fstab causing all the problems was:

                                        PARTUUID=5fad9610-03 /mnt/MYLABEL vfat defaults,auto,umask=000,users,rw 0 0

                                        as it should have read:

                                        PARTUUID=5daf9610-03 /mnt/MYLABEL vfat defaults,auto,umask=000,users,rw 0 0

                                         

                                        Dyslexia rules KO!

                                         

                                        That will teach me to do important stuff at the end of a long day.

                                         

                                        So, I'm back on track, and all I have to do is configure samba and get some user accounts up and running.

                                        I think I'll use the scripts for the rest of the configuration.

                                        Thanks again, shabaz

                                        1 of 1 people found this helpful