Eternyt
Posts: 38
Joined: Tue Dec 19, 2017 4:23 pm

Some question of a newbie

Fri Dec 29, 2017 5:47 pm

Hi all,
as said in the title, I'm a complete newbie in the raspberry world. So, here are some questions that I'm still not able to answer after days of research.
1. I see in the main menu (top left corner) a "run" button immediately up the "shutdown" button. Is there a way to trigger it with a keyboard shortcut? Something like windows+r in Windows? I see that if I press windows and then windows+r works, but it's a bit tricky. Is it the only way?
2. Mounting problem. I followed many different tutorials on how to mount USB stick manually (via GUI all works fine), but I always encounter the same problem: I have no permission on the virtual folder where I mounted the drive (and yes, I put the right permission on the folder before mounting). So after mounting manually if I try to access the USB from the file manager, I encounter only errors and I'm not able to do anything. The only way is through CL using sudo.
3. After startx, if I want to shut down the GUI and keep only the CLI, what can I do for achieving this? No background, completely kill the x interface.
4. Without any drive insert, the raspberry shows a mysterious drive" 00000 (SETTINGS)" in the eject option and in the media directory. What is this?
5. Why, when automatically mounted, the USB virtual folder appear under /media/pi and not directly under /media? When I mount it manually I have to put under /media/pi or only under /media?
6. I recently put Google Assistant on my PI, following the official Google tutorial. But I've noticed that some commands that are available on my phone are not available in the PI version. Is normal?
7. I have attached to my PI an HDMI monitor with a built-in speaker and a separate speaker through the3.5 mm Jack. Now, I want the audio to exit from the jack port and exit from the HDMI only if there is nothing connected to the Jack. I tried to force the audio output via CLI tool preference, but when there is nothing attached to the audio Jack, the sound simply still exit from the jack instead of switching to the HDMI port.
8. What is the difference between "shutdown now" and the advertised "sudo shutdown -h now". They both work for me.
Many many thanks to all the people that have a bit of time for me!

EDIT: 5, 7 and 8 resolved.
Last edited by Eternyt on Sat Dec 30, 2017 2:52 pm, edited 2 times in total.

W. H. Heydt
Posts: 10341
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: Some question of a newbie

Fri Dec 29, 2017 8:02 pm

Eternyt wrote:
Fri Dec 29, 2017 5:47 pm
Hi all,
as said in the title, I'm a complete newbie in the raspberry world. So, here are some questions that I'm still not able to answer after days of research.
1. I see in the main menu (top left corner) a "run" button immediately up the "shutdown" button. Is there a way to trigger it with a keyboard shortcut? Something like windows+r in Windows? I see that if I press windows and then windows+r works, but it's a bit tricky. Is it the only way?
The menu icons are the shortcuts. The real cmmands are run from a "terminal" window as command line interface. If you want to stop the OS running, you can use the "shutdown'" command (check the man page for the options to use) or the short version, "halt".
3. After startx, if I want to shut down the GUI and keep only the CLI, what can I do for achieving this? No background, completely kill the x interface.
If you exit X, you'll be back at the CLI. The GUI (X) runs as a program. It is not embedded in the OS (this is the proper way to do it as it permits one to use a different GUI if you like.)
5. Why, when automatically mounted, the USB virtual folder appear under /media/pi and not directly under /media? When I mount it manually I have to put under /media/pi or only under /media?
That can be changed, but the idea is that the mount point is /media/<userID>. If you're not logged in as "pi", you want the mount point to reflect the user ID you are logged in as. Linux is intrinsically a multiuser system.
8. What is the difference between "shutdown now" and the advertised "sudo shutdown -h now". They both work for me.
Many many thanks to all the people that have a bit of time for me!
Prefixing a command with "sudo" runs that command as if it were run by the superuser account, root. Any command that works *without* "sudo" should be run without it. Running things as root is dangerous because root is able to do vastly more damage to the system (including completely wiping it off the boot media) than the much more limited user account. Some commands must be run by root and the sudo (with the associated sudoers file) allows one to do so without simply logging in to root and then--possibly--forgetting that's what you've done and doing something destructive without meaning to. Fortunately, if that does happen, it is far easier to recover a Pi than a typical system, providing you have backups.

AJB2K3
Posts: 215
Joined: Sun Aug 11, 2013 3:25 pm

Re: Some question of a newbie

Fri Dec 29, 2017 9:53 pm

In the old days....

Shutdown would not work unless issued as superuser due to unix security settings.

shutdown Sends the command to shut down the system but waits for all process to end their tasks.
shutdown -h same as above but halts all process before shutdown.
sudo shutdown -h now force shuts down the system however, if you have not saved your work, you will lose everything.
sudo shutdown -r tells the system to shut down and restart.
Back in the old days, we were smarter then the technology.
Nowadays technology makes us look like villages fools in front of the children!

Eternyt
Posts: 38
Joined: Tue Dec 19, 2017 4:23 pm

Re: Some question of a newbie

Fri Dec 29, 2017 10:55 pm

The menu icons are the shortcuts. The real cmmands are run from a "terminal" window as command line interface. If you want to stop the OS running, you can use the "shutdown'" command (check the man page for the options to use) or the short version, "halt".
I imagine that the command is run in the CLI, but the question is if there is any keyboard shortcut for easy access that window, something equivalent at the windos+r combination on windows.
If you exit X, you'll be back at the CLI. The GUI (X) runs as a program. It is not embedded in the OS (this is the proper way to do it as it permits one to use a different GUI if you like.)
Nice to hear that! But how can I stop the GUI once started without turning off the entire system?
That can be changed, but the idea is that the mount point is /media/<userID>. If you're not logged in as "pi", you want the mount point to reflect the user ID you are logged in as. Linux is intrinsically a multiuser system
Thanks!
Prefixing a command with "sudo" runs that command as if it were run by the superuser account, root. Any command that works *without* "sudo" should be run without it. Running things as root is dangerous because root is able to do vastly more damage to the system (including completely wiping it off the boot media) than the much more limited user account. Some commands must be run by root and the sudo (with the associated sudoers file) allows one to do so without simply logging in to root and then--possibly--forgetting that's what you've done and doing something destructive without meaning to. Fortunately, if that does happen, it is far easier to recover a Pi than a typical system, providing you have backups.
Yes, I read something about sudo and now I know what is his purpose. But why all books and online reference say to use the "sudo shutdown" and not the "shutdown"?
shutdown Sends the command to shut down the system but waits for all process to end their tasks.
shutdown -h same as above but halts all process before shutdown.
sudo shutdown -h now force shuts down the system however, if you have not saved your work, you will lose everything.
sudo shutdown -r tells the system to shut down and restart.
Many thanks! So "shutdown now" is the most safe way to turn off my raspberry? Or there is something better?

Thanks!

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 11853
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: Some question of a newbie

Fri Dec 29, 2017 11:06 pm

sudo shutdown -h now
it ends all running processes before shutting down the operating system.
Wait until the activity led blinks a few times, then wait another ten seconds, so your SD-card can finish whatever it was doing (independent of the OS) then and only then you can remove power.

Eternyt
Posts: 38
Joined: Tue Dec 19, 2017 4:23 pm

Re: Some question of a newbie

Fri Dec 29, 2017 11:09 pm

mahjongg wrote:
Fri Dec 29, 2017 11:06 pm
sudo shutdown -h now
But why the sudo, if it works also without? And why the -h? For me "shutdown now" works

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 11853
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: Some question of a newbie

Fri Dec 29, 2017 11:13 pm

True, but...
If you learn the correct procedure, so it becomes ingrained, then it will also work with any other Linux (or unix) based OS.

W. H. Heydt
Posts: 10341
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: Some question of a newbie

Sat Dec 30, 2017 2:50 am

Eternyt wrote:
Fri Dec 29, 2017 11:09 pm
mahjongg wrote:
Fri Dec 29, 2017 11:06 pm
sudo shutdown -h now
But why the sudo, if it works also without? And why the -h? For me "shutdown now" works
Many years ago, in a programming shop I was working in, we had a system programmer who was the "go to" person when one had a question for which one couldn't find the answer. The first time a given person asked a question, he would show them where in the manuals the answer located and explain *why* that was the answer. The second time the same person asked the same question, he would just give them the answer and the manual reference. The third (and subsequent times), he would just give the manual reference.

Don't be the the person that asks the same question three times. Instead, learn *why* the answer is what it is so that you don't just know the answer, but actually understand it and can extend that knowledge to similar questions.

Eternyt
Posts: 38
Joined: Tue Dec 19, 2017 4:23 pm

Re: Some question of a newbie

Sat Dec 30, 2017 9:13 am

W. H. Heydt wrote:
Sat Dec 30, 2017 2:50 am
Eternyt wrote:
Fri Dec 29, 2017 11:09 pm
mahjongg wrote:
Fri Dec 29, 2017 11:06 pm
sudo shutdown -h now
But why the sudo, if it works also without? And why the -h? For me "shutdown now" works
Many years ago, in a programming shop I was working in, we had a system programmer who was the "go to" person when one had a question for which one couldn't find the answer. The first time a given person asked a question, he would show them where in the manuals the answer located and explain *why* that was the answer. The second time the same person asked the same question, he would just give them the answer and the manual reference. The third (and subsequent times), he would just give the manual reference.

Don't be the the person that asks the same question three times. Instead, learn *why* the answer is what it is so that you don't just know the answer, but actually understand it and can extend that knowledge to similar questions.
Sorry, it wasn't my intention. I will keep that in mind!
mahjongg wrote: True, but...
If you learn the correct procedure, so it becomes ingrained, then it will also work with any other Linux (or unix) based OS.
Thanks, I understand it now!

So, for now, 5 and 8 are answered!
Thanks!

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 11853
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: Some question of a newbie

Sat Dec 30, 2017 12:16 pm

that is exactly why you should not ask more than one question per thread, I doubt the other questions will be answered now.

for once I won't delete other posts from you as duplicates if you ask one of these questions in a separate post again (normally I will delete duplicate posts).

User avatar
davidcoton
Posts: 3795
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK

Re: Some question of a newbie

Sat Dec 30, 2017 12:21 pm

As for 7: that is normal. The Pi has no way of knowing that there is nothing connected to the jack. You have to switch manually.
Signature retired

hippy
Posts: 5367
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Some question of a newbie

Sat Dec 30, 2017 12:39 pm

Eternyt wrote:
Fri Dec 29, 2017 11:09 pm
But why the sudo, if it works also without? And why the -h? For me "shutdown now" works
mahjongg wrote:
Fri Dec 29, 2017 11:13 pm
True, but...
If you learn the correct procedure, so it becomes ingrained, then it will also work with any other Linux (or unix) based OS.
The hard part is knowing what the "correct procedure" is when others suggest doing it some other way and that's what the Pi accepts.

Perhaps the real questions are why does the Pi allow something which seemingly isn't the correct procedure, and why do Pi users recommend those ?

The entire situation with 'shutdown now', 'shutdown -h now', 'reboot', 'poweroff', 'halt' - with and without sudo - variations and more, and what each actually does, what consequence each has, has always mystified me, but I have never had the time to investigate fully.

n67
Posts: 939
Joined: Mon Oct 30, 2017 4:55 pm

Re: Some question of a newbie

Sat Dec 30, 2017 1:07 pm

The entire situation with 'shutdown now', 'shutdown -h now', 'reboot', 'poweroff', 'halt' - with and without sudo - variations and more, and what each actually does, what consequence each has, has always mystified me, but I have never had the time to investigate fully.
Such is the way of compatibility. Going forward, every possible interface that has ever been supported - must continue to be supported.

Also, re: the "does it or does it not require sudo" question. Anything you can do from the command line does indeed require root access. The only ways that work without root (sudo) access are:

1) Pulling the plug
2) Pressing Ctrl/Alt/Del (don't know if this still works - it did back in the pre-systemd days)
3) Choosing Shutdown off of a GUI menu.
"L'enfer, c'est les autres"

G fytc hsqr rum umpbq rm qyw rm rfc kmbq md rfgq dmpsk:

Epmu Sn!

J lnacjrw njbruh-carppnanm vxm rb mnuncrwp vh yxbcb!

User avatar
rpdom
Posts: 14472
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Some question of a newbie

Sat Dec 30, 2017 2:08 pm

n67 wrote:
Sat Dec 30, 2017 1:07 pm
Also, re: the "does it or does it not require sudo" question. Anything you can do from the command line does indeed require root access. The only ways that work without root (sudo) access are:
Not entirely true now. There are mechanisms (dbus?) related to the desktop that can give permissions to perform certain functions without the use of sudo. That is how the desktop does it and now it seems that the command line can do it too (this works in full raspbian, but not the lite version without desktop).

Eternyt
Posts: 38
Joined: Tue Dec 19, 2017 4:23 pm

Re: Some question of a newbie

Sat Dec 30, 2017 2:52 pm

for once I won't delete other posts from you as duplicates if you ask one of these questions in a separate post again (normally I will delete duplicate posts).
Thanks, my intention was to not full up the forum with my question.
As for 7: that is normal. The Pi has no way of knowing that there is nothing connected to the jack. You have to switch manually.
Many thanks, very clear.

hippy
Posts: 5367
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Some question of a newbie

Sat Dec 30, 2017 7:07 pm

W. H. Heydt wrote:
Fri Dec 29, 2017 8:02 pm
Eternyt wrote:
Fri Dec 29, 2017 5:47 pm
3. After startx, if I want to shut down the GUI and keep only the CLI, what can I do for achieving this? No background, completely kill the x interface.
If you exit X, you'll be back at the CLI. The GUI (X) runs as a program. It is not embedded in the OS (this is the proper way to do it as it permits one to use a different GUI if you like.)
Not entirely true. If the GUI is started from the CLI then yes. If set to auto-boot to GUI then there is no option for this. Can't remember the exact details but it's previously been discussed on forum.

Return to “General discussion”