Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

intro to PI

Status
Not open for further replies.

Dr_Doggy

Well-Known Member
I found a pi on a shelf and finally got it booted up, i kinda knew that it was different than windows , but wow, didnt think id need a script to create a shortcut. so I am hoping someone has some basic navigation skills for this thing,

first i wonder about any good tutorials , or maybe i should get pi for dummies?

so far i was able to change my root password.
also I created doggy account which is in root group.

I was trying to change name of root to doggy but not sure if thats even possible? , or at least give doggy acct root permissions?

anyway im in a fuddle where i got both accts and able to sign in to both of them but somewhere along the line VNC stopped working, saying I have credential errors, I also noticed that some my permission settings changed and also "Raspberry Pi Configuration" has stopped launching.

any idea how to get out of this hole?
and what are good resources that i can brush up on ?
 
Root is the superuser account and should not be changed. It WILL break things!

Normally you should create a standard user account then use "su" in front of any command that needs admin privilege, to avoid messing up the filesystem. Doing things as root can very easily be catastrophic.


You may be better off creating a new SD card from a downloaded image & start again.
(And then don't touch the root account until you are totally familiar with using linux).

Linux is based on the same concepts as Unix and file ownerships and access restrictions are built in to the most fundamental levels. It's designed so user accounts are all totally independent of each other and someone messing up their account has zero effect on the overall system. As long as you work from a normal user account, it's near enough indestructable.


I'd normally connect everything (video, keyboard, mouse etc.) direct to the Pi (or other linux machine) whilst setting it up, then once it's running and ssh is enabled, access over the network using an ssh client - PuTTY from a windows machine.

That pretty much gives you the same interface as a "terminal" (command prompt type interface) when connected direct to the machine & you can do everything you could if connected directly.

It's extremely rare I use VNC, the only thing I can think of is accessing Windows on my home automation server.. SSH is the usual method with headless Linux systems.


As a learner, I'd suggest creating two or three normal user accounts, then if one gets messed up you can use another account to delete the duff one and create another spare.


The Raspberry Pi linux releases are based on Ubuntu, which in turn is based on Debian linux.

Look for tutorials and info relating to those for when you are trying to find help to do things.

You can get help on individual commands by using "man " and the command name.

Have a look at things like this:

(I've been using it since Slackware was first released in the mid 90s, switching to Redhat when that came out & then the Centos etc. free releases of Redhat based OSs.
There was an early split between Redhat & Debian based versions, with the two using slightly different file paths and commands in various places - so I still get stuck occasionally with the Pi & similar Ubuntu type systems & have to do some online research, due to those differences).
 
Great! and feel free to include pointers!
so ya , i did flash it, and vnc is up again, i'm using this as a dvr for my old cameras so screen access would be nice.

which also brings me to my next questions about root.
when i check properties of an program for example, it says View:anyone, Change:eek:wner, Execute nobody. but i can actually click it and execute it? but i cant edit it?( ( i dont think i have admin status yet, but strange that it let me execute?)

and when i am in prompt it says doggy@doggy , and when i switch to root it says root @ doggy, so what does the second doggy mean?

and where is the os files, is it all this junk, in windows its all under c:\win\junk but here all i see \junk, only thing i find useful was an applications folder, is that it for exe's? also what are the exe files around here, so far i have found .desktop and .pi? any other files/folders that i should be snooping in?

and how does cmd work, is there a list of instruction tables somewhere? (ima keep that cheat sheet handy)
also is there anything you would recommend I read up on to be able to work with things better?

also can i control gpio from cmd?

also i envision lots of reinstall with this, i wonder what is the best way to do backup/restores? (maybe eject the sd and do it all on windows?) any recommended software?
 
Linux does not use (or rather not need) filename suffixes for executable files, any file or script can be executable if its attributes are set correctly - though obviously the file content must be appropriate.

The operating system files are partly in the boot partition; that's where the OS kernel, some drivers and ram filesystem image are kept.
Assuming ubuntu loads in the same way as redhat - the support files and drivers the kernel needs to boot are stored in a ramdisc, and the entire contents of that saved to a single file.
The bootloader sets up a ramdisc and loads that file so the kernel can access the hardware as it starts up.

The rest of the OS stuff & utilities is typically in /bin & /sbin, with the commands for non-privileged users in /usr/bin and /usr/sbin

On a small system they may be the same directories, with eg. /usr/sbin being a symlink to /sbin

That's another difference from windows - Unix type systems use filesystem links very heavily, so files or directories can appear in more than one location with only one actual file or directory.
Think of them a bit like Windows shortcuts, where several can point to the same item, but at much lower level in the filesystem itself rather than a script-type file like in windows.

The name you see at the prompt is the present user name plus the machine name - so you know what you are looking at when connecting to more than one machine. I'd suggest naming machines by function, eg. "rpi_dvr" or similar for that, from what you say it will be used for.


The windows "cmd" equivalent is the terminal in linux, and you have or can have multiple ones.
On a normal linux system, typically alt-F1 to alt-F6 selects the one you are using at any time, or you can connect more than once over SSH with each connection being a separate terminal.

ls is list directory, cd change directory, pwd shows the current directory, clear clears the terminal screen.
ls -l gives a long formal listing with attributes and ownership etc.
The entries that have two names and -> are symlinks to other files.

ls -a lists all, including hidden. ls -la long listing with hidden (those starting with a dot) etc.

If you look for linux command cheat sheet there are many, eg.


Not sure on the file properties stuff you mention - is that from a graphical interface?? I only use the command line tools - chmod & chown etc.

To add your own files or other stuff, the usual places are either under your home directory or make directories in /usr
Or for data that's changing regularly /var

If you are storing video, I'd suggest a separate device rather than the boot SD card. When you connect it, it will probably auto-mount, likely under /media

A storage device mounts to an existing directory, and the content appears as files or directories within the mount point. The mount point must be an empty directory; if you write anything to it without the device mounted, it cannot be remounted until the directory is emptied again.

I'd suggest you install "mc" - Midnight Commander. That's something like the original Xtree for dos & makes it easier to navigate the system from a terminal.

sudo apt install mc
then just mc to run it.

ps. It should be "sudo" in front of a privileged command to run it as a normal user; su changes the session totally to a different use.

Hope that's some help!
 
yes, it all helps thanks! Interesting about the mounting, ill keep an ear on that.

also i found the usr\bin folder with sudo, cut, date, tree, who and others, but cant open them to see what they do or whats inside?

btw i am using a ver of Debian if that helps anything.

For some reason I had less problems getting started this 5th time, and its going a little quicker this time.

but I think I am ready for some programming,

first and hopefully easiest, I am trying to install some cam software.
I have tried all 7 recommendations from this website:
with failure at some point or another. any chance you could select one for me to walk me through it?

Also I'd like to program some scripts, what software is best?
Also I'd like to program some GUI's , what software is best?
Also I'd like to program some c++(i think?), what software is best? It was said that i want python, and that it is included in system, but i cannot find it... closest i can find is "Thonny Python" but it is strange and missing punctuation that i dont trust.

ie:
def blink_LED():
count = 0
while count < 5:
myled.on()
sleep(1)
myled.off()
sleep(1)
count+=1

shouldn't there be more brackets in there or at least a wend statement and maybe an enddef or similar?

also i found a app called IDLE, but not sure how that works at all. (it looks more like a cmd window)?
 
the first one i went after is bluecherry v2,

but when i type in the link i get error: distro not supported?
sudo bash -c "$(wget -O - https://dl.bluecherrydvr.com/scripts/install)"
 
also there is something very strange, i searched how to compile gui, and it says use IDLE, and proceeds to have me fill in 3 lines.
In the tutorial it says then save and press f5 to run.

but in reality the each line is executing as I hit enter.???
 
Also I'd like to program some scripts, what software is best?
Also I'd like to program some GUI's , what software is best?
Also I'd like to program some c++(i think?), what software is best? It was said that i want python, and that it is included in system, but i cannot find it... closest i can find is "Thonny Python" but it is strange and missing punctuation that i dont trust.

Firstly, the Pi uses an ARM CPU like most phones and tablets, not an x86 / AMD64 CPU like PCs.
You can only use pre-built programs you can install via the "apt" manager from the Pi compatible repositories, or you have to compile them from source yourself and fix all the dependencies.

That's why you get the "Distro not supported" error, you are trying to run a PC program on ARM, that uses totally different machine code and file formats.

A lot of stuff will simply not work due to the differences and restrictions of the tiny system.

For scripts, all you need is a text editor. My favourite on linux is "nano" which it probably already installed.
if not, install it with apt:
sudo apt install nano

Put them in /usr/sbin or somewhere else in the path, then set the executable attribute.

GUIs - I'm not going there, I'd rather retain my sanity!
I'd guess you are supposed to create a new program file within the idle IDE, then execute it.

C++ - Nano for editing and GCC compiler which likewise probably installed.
You need to create the source files, header files and a Makefile to build it.
There are likely IDEs available that make it easier, but I've never used one on linux.

Try downloading the source for some small project of some sort and see how it all goes together.


Python should already be installed. You create the python program with a text editor then execute it; the operating system "knows" where the interpreter is, that's all that matters.

eg. I get this on one of mine:

pi@ntp-server:~ $ python --version
Python 2.7.16

So is GCC
pi@ntp-server:~ $ gcc --version
gcc (Raspbian 8.3.0-6+rpi1) 8.3.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Compiling large programs on a Pi is rather tedious; I have one running a customised Quake 2 server & each compile on that took something like ten to fifteen minutes, against seconds on a PC.
 
There is a DVR package for the Pi, called Motioneyes - it looks like you can use a ready-built SD card image dedicated to running that, or you can install it on your own Pi system.


This looks helpful for it, a system on a normal Pi, with external USB storage:
 
pi@ntp-server:~ $ python --version
pi@ntp-server:~ $ gcc --version
when i cmd those links i get file not found.

# ** Bluecherry stable (2.8.8) **
# Install Bluecherry on Ubuntu 18.04 LTS and Debian 9
sudo bash -c "$(wget -O - https://dl.bluecherrydvr.com/scripts/install)"

dont get that Distro not supported thing, it says on link support for debian 9, and i am running debian 11?
newer ver cant run older ver? Do i need Ubuntu too?

I tried running this code here, but error:imports not found, didnt see those files and not sure how to get them?

I found a hello world for running a gui window and is written line by line, so fun times there.

I will attempt at the MotionEye, but need another sd card if im going to flash it in, unless there is a way to backup the sd image i have now?
 
OK, I may have installed the tools or I could be using a different OS image.


Firstly, ensure everything is fully up to date:
sudo apt update
sudo apt upgrade

You should do that after starting from a new SD card system image, and then before installing new packages, just to make sure everything is fully updated to the latest versions.
Do that before installing python, and restart the Pi.

To install python:

sudo apt update
sudo apt install python3 idle3


Then also do:

sudo apt update
sudo apt install -y build-essential

That should install the GCC and its libraries.

Re. the unsupported distro, it's as I said previously - you are running a linux debian-based OS, but on a Raspberry Pi with an ARM based CPU; the packages you are trying to install are for linux on an x86 / AMD64 cpu.

They are functionally similar systems from a user point of view, but each is compiled for very different CPU instruction sets and architectures.

In other words ARM vs x86 or AMD64 CPUs use totally different machine code "languages" so any program compiled for one is just random junk to the other.

Any pre-built programs must be intended for a raspberry pi, or at least the ARM architecture.
That's why I said stick to stuff you can install with apt, as that automatically looks for stuff in the correct ARM repositories.

Programs or scripts in Python, Java and such are OK as those are interpreted or compiled when you run them, so are far more compatible across different types of computer & operating system.

For info, this is a partial list of the different CPU architectures there are Linux versions for:
ARC
ARM & ARM64
ia32
m68k
MIPS & MIPSEL
Nios
OpenRISC
PowerPC & PPC64
RISC-V
s390 & s390x
SuperH
Sparc
x32 & x64
Xtensa

Raspberry Pi's, most mobile phones and tablet computers are ARM or ARM64, depending on the age / version.
PCs are x32 or x64 (other names for x86 & AMD64).

All the others are different CPU type using different machine code languages & not compatible with each other.
 
great tutorial! alot of what Im prepareing for, but just wondering, how do i build for release?, can i run without the MicroPython app an how do i set it up to launch at boot?
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top