WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Config static IP in CLI so I can download TC.tcz? [utter novice]  (Read 4664 times)

Offline CoatHanger

  • Newbie
  • *
  • Posts: 6
Config static IP in CLI so I can download TC.tcz? [utter novice]
« on: September 19, 2017, 06:20:20 AM »
Hi,
I just got my RPi3B yesterday, and set about putting on piCore, but I got stuck at the prompt.
At first I thought something was broken, it didn't boot properly, or the image was corrupt - but no, that is the OS!

What I was looking for was a desktop environment, and have found that I need to download that package to have it available.

Problem:- I connected ethernet, but I kept getting errors indicating that I don't have a connection.

I have my home network setup with static IPs for each machine, and the RPi would be no different.  So what I need to do is to fill in the details for eth0 somehow, and then I can download the desktop package and get to fiddle with thing using a mouse!

Is there a not outdated image of piCore with the necessary desktop package(s) already included?
Is there a way I can add them from within Windows, to create an easier setup on the RPi?

My apologies if I seem helpless.  I did spend some time hammering away searching the net to find instructions, but I didn't have much luck.

piCore 9.0.3 image
Raspberry Pi 3 model B
SanDisk uSD 16GB
« Last Edit: September 19, 2017, 06:22:02 AM by CoatHanger »

Online polikuo

  • Hero Member
  • *****
  • Posts: 758
Re: Config static IP in CLI so I can download TC.tcz? [utter novice]
« Reply #1 on: September 19, 2017, 06:52:53 AM »
Is there a not outdated image of piCore with the necessary desktop package(s) already included?

There's no such image on the repo.

To setup a static IP, try
Code: [Select]
#!/bin/sh
pkill udhcpc
ifconfig eth0 ${YOUR_IP} netmask ${YOUR_NETMASK} broadcast ${YOUR_BROADCAST} up
route add default gw ${YOUR_GATEWAY}
echo nameserver ${YOUR_DNS1} > /etc/resolv.conf
echo nameserver ${YOUR_DNS2} >> /etc/resolv.conf

Save this script as /opt/eth0.sh

Append "/opt/eth0.sh &" to the end of your /opt/bootlocal.sh

Run "filetool.sh -bv" and you're good to go.

P.S. Make sure to resize your /dev/mmcblk0p2 before you download anything from the internet.
To install a Xserver, run tce-load -wi TC.

Offline CoatHanger

  • Newbie
  • *
  • Posts: 6
Re: Config static IP in CLI so I can download TC.tcz? [utter novice]
« Reply #2 on: September 19, 2017, 07:07:57 AM »
Thanks polikuo.
I think I have read these instructions before, but didn't understand how to create/save a text document - I am VERY new to Linux.
Code: [Select]
sudo nano /opt/eth0.shWould that do it, then ctrl-x to close, yes to save, and enter to accept location?
Editing docs in a terminal is a new experience indeed.

Code: [Select]
sudo nano /opt/eth0.shrinse and repeat after editing?




I think I might have found something else...

Am I right in thinking I can use ifconfig (like Windows ipconfig) to configure the eth0 and then I should be good to go?

something like
Code: [Select]
sudo ifconfig eth0 a.b.c.d netmask 255.255.255.0
route add default gw w.x.y.z
sudo ifconfig eth0 up

Where a.b.c.d is the IP address that the RPi will have.
Where w.x.y.z is the IP address of the router, the connection by which the RPi gets online.

Does this make sense?

Sorry for replying to my own question with a question, but it looks like I may have answered myself.  Will have to test it, but my uSD has Raspbian on as I'm testing that out!

Offline Misalf

  • Hero Member
  • *****
  • Posts: 1702
Re: Config static IP in CLI so I can download TC.tcz? [utter novice]
« Reply #3 on: September 19, 2017, 07:52:56 AM »
Am I right in thinking I can use ifconfig (like Windows ipconfig) to configure the eth0 and then I should be good to go?

Yes, see polikuo's reply. Also, broadcast might be necessary.
However, if you enter these commands directly in the terminal as opposed to using a script, the commands slightly differ due to the need of sudo:
Code: [Select]
sudo pkill udhcpc
sudo ifconfig eth0 ${YOUR_IP} netmask ${YOUR_NETMASK} broadcast ${YOUR_BROADCAST} up
sudo route add default gw ${YOUR_GATEWAY}
echo nameserver ${YOUR_DNS1} | sudo tee /etc/resolv.conf
echo nameserver ${YOUR_DNS2} | sudo tee -a /etc/resolv.conf
Download a copy and keep it handy: Core book ;)

Online polikuo

  • Hero Member
  • *****
  • Posts: 758
Re: Config static IP in CLI so I can download TC.tcz? [utter novice]
« Reply #4 on: September 19, 2017, 08:32:27 AM »
Code: [Select]
sudo nano /opt/eth0.shWould that do it, then ctrl-x to close, yes to save, and enter to accept location?
Editing docs in a terminal is a new experience indeed.

If you have nano installed, then yes, that will do.
Also, it's not really necessary to use sudo to create the file. (/opt/eth0.sh)
There's a GUI tool (named "network" in Xprogs.tcz) that generates /opt/eth0.sh

Quote
something like
Code: [Select]
sudo ifconfig eth0 a.b.c.d netmask 255.255.255.0
route add default gw w.x.y.z
sudo ifconfig eth0 up

Where a.b.c.d is the IP address that the RPi will have.
Where w.x.y.z is the IP address of the router, the connection by which the RPi gets online.

Does this make sense?

Yeah, that looks fine.

Also, broadcast might be necessary.

FYI, broadcast can be calculated via
Code: [Select]
ipcalc -b ${IP} ${NETMASK} | cut -d = -f 2

Offline CoatHanger

  • Newbie
  • *
  • Posts: 6
Re: Config static IP in CLI so I can download TC.tcz? [utter novice]
« Reply #5 on: September 19, 2017, 08:46:07 AM »
Thanks folks, this is kind of making some sense.
I'll obviously have to try it to find out what works.

So I doubt nano is installed, but I wonder what editor is available, I recall something opening a text file in CLI when I followed an instruction somewhere, but panicked when I couldn't escape it.  Feeling more comfortable now.  Gonna give it another shot.

Thanks folks, really appreciate the quite replies!

My current situation: Off Topic
Swapping PSU in this PC to a new AMD Ryzen build I am starting tomorrow.
For now RPi was bought so I can get online, see how-to videos, get on the forums, trouble shoot etc.  It's also so I can check email, use my online bank and buy any extra bits to sort my build out.
I have Raspbian installed and working acceptably well on a class 4 SanDisk card, that I am backing up with Win32DiskImager.  Installing Raspbian on the Transcent uSD card that came with it, so I have a working and fairly secure RPi desktop whilst I play with piCore, as a "Live" distro is safer and not so hard on a uSD as Raspbian is.


Offline Misalf

  • Hero Member
  • *****
  • Posts: 1702
Re: Config static IP in CLI so I can download TC.tcz? [utter novice]
« Reply #6 on: September 19, 2017, 08:58:56 AM »
For editing text files, there is a built-in busybox version of  vi . It's not the most intuitive editor.
You have to change from "command mode" to "edit mode" by pressing the INSERT key, make your edits, then go back into "command mode" by pressing ESCAPE and enter  :w  to write the file to disk and  :q  to quit (or  :wq  in one step).
Download a copy and keep it handy: Core book ;)

Offline CoatHanger

  • Newbie
  • *
  • Posts: 6
Re: Config static IP in CLI so I can download TC.tcz? [utter novice]
« Reply #7 on: September 19, 2017, 04:39:51 PM »
@Misalf
Thank you for adding that info.
I found something where someone had :,q,w,enter and wondered just WTF.  It makes sense now of course, because I have been playing with Nano, just a different editor, different key strokes.
I will give this a go a in a day or two and report back.

Again, thanks folks for your help here.  Didn't expect such quick replies. Feeling rather optimistic.


Off Topic
Spent a chunk of today setting up Raspbian on the included Transcend uSD card, getting how I did it on the first uSD.  That's now functional and secure, sorted and usable.
If I want to be paranoid, I can always close all outgoing traffic and only permit IPs/URLs that I want to use.  UFW is installed, running and it all just works.

Looking forward to getting piCore up too.

Ya know, now I have spent a chunk of time having to do stuff in Linux (a VM with Mint was too easy to just close and carry on in Windows), I am beginning to think Windows may become a redundant OS on the new system!  I think Wine or PlayOnLinux may add a level of fiddling I don't need with a new build.  That said so will Windows 10 - huff.

Time for sleep, fresh start and first time system building tomorrow :D

Offline Greg Erskine

  • Sr. Member
  • ****
  • Posts: 404
Re: Config static IP in CLI so I can download TC.tcz? [utter novice]
« Reply #8 on: September 19, 2017, 05:32:31 PM »
hi CoatHanger,

Keep in mind piCore is not a "typical" Linux distribution. It will probably cause more confusion than be a helpful Linux learning tool.

I commend if you really a need static IP then use DHCP on your router to map MAC address to IP address. This allows you to maintain and backup all IP configurations in one place.

regards
Greg

Offline CoatHanger

  • Newbie
  • *
  • Posts: 6
Re: Config static IP in CLI so I can download TC.tcz? [utter novice]
« Reply #9 on: October 01, 2017, 05:13:52 PM »
Thanks folks, I got around to trying piCore 9.0.3 again, and success... sort of.

I have an internet connection at least! I can ping Google and my router.
However when I try to download the desktop
Code: [Select]
tce-load -wi TC.tcz
I get an error: not found!
"bad address 'repo.tinycorelinux.net' "
md5sum no file or directory.

If I understand this, it means the repository of the package is not where it thinks it is, and I need to somehow redirect.

Sorry, this may be too far of a new question to the thread title.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11694
Re: Config static IP in CLI so I can download TC.tcz? [utter novice]
« Reply #10 on: October 01, 2017, 07:29:57 PM »
Hi CoatHanger
Do you get the same result for this command:
Code: [Select]
tc@box:~$ cat /opt/tcemirror
http://repo.tinycorelinux.net/
tc@box:~$

Offline CoatHanger

  • Newbie
  • *
  • Posts: 6
Re: Config static IP in CLI so I can download TC.tcz? [utter novice]
« Reply #11 on: October 26, 2017, 03:45:54 PM »
Well, we have success.
I now have access to the desktop, and can work away at seeing how things work in this wonderfully small OS.

A big thanks to everyone here!

@Rich, no need to try your suggestion, it worked as it was supposed to (or how I've read).  I must have goofed a setting somewhere.  I had to double do some of the command because I didn't enter them correctly, but it lives now.


Sorry for the late reply, was trouble shooting Windows 7 issues on a netbook.  Turns out Google Chrome had 300+ MB of .TMP files in it's user profile dir.  System files are fine (SFC /scannow whilst booted from installation USB stick).  Also had to find out how to get group policy editor for Win 10 Home for a friend, so was playing with that in a Virtual Machine. But that's all Windings, Winders or Windoze problems.