-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Starting Up at Boot #114
Comments
I didn't follow the guide, so the way I'm doing it isn't really the "proper" way. What I did instead was create a crontab entry. Then down the bottom of the file on a new line I added I also created /home/pi/start.sh and ran
The command would need to be swapped with whatever you're currently running to start your panel, but otherwise it should work. |
Thank you @mcarr823. I barely understand this but I'll try it. Couple of follow-up questions (sorry to bug you):
|
*Note: you should be very careful about editing .bashrc.
and /lib/systemd/system-shutdown/image.sh
and of course the image ~/Pictures/sleep.png. So you could do the same thing, but have the .sh file upload your writing somehow instead. Personally I use syncthing for this https://syncthing.net/ As far as wifi goes, you should be able to do that from the command line.
|
Wow @mcarr823, as always, extremely thankful for all your help. This does look extremely intimidating, but will try over the next few days and will keep you posted on my progress. I barely even understand the concepts, but by
It means that when I do these changes, after I reboot, they will execute automatically, right? Even though I won't see the desktop environment because I will only use the eink screen, will it be active over HDMI? Should I force my Raspbian OS to start on terminal on some way? I'm just scared I might turn my RPi into a brick.
Thing is when I exit papertty I can see a mild ghosting on my eink screen, and I can actually see the screen gets darker and darker as the session goes on. The only thing that does clean it up completely is when starting up papertty, and it does stay clean, so there's nothing that seems to damage the screen. So I just scrub from time to time, but for me it just reaches 2/3s of the screen and I don't know why. Anyway, I wonder, if you just have a pic as a background whenever you shut down, if I'm just paranoid and it's okay to leave the screen with the small ghosting artifacts from typing. |
Ok @mcarr823 I got the crontab to run papertty on boot. Sorry, again, to bug you with a lot of questions:
Since I run Raspbian OS Desktop, by "ssh onto the pi in a new terminal session" you mean open a new terminal window? That should work? Just making sure before I start messing around with .bashrc
Thank you. |
@javierdepascual Ah, so you're using a GUI. I just assumed you were using it without one. I assume that raspberry pi OS has a "Startup Applications" program or something similar, like many linux distributions. That way you can specify programs the same way you would have from crontab. Let's say you have script /home/pi/tmux.sh which contains
That would run tmux in a session called "main" on tty 1. If you can get that command to run automatically in a GUI terminal window, then the "attach" would mean that terminal window would send text straight to the tmux session running on tty1. I think some desktop environments have a "run in terminal" checkbox when starting applications. Note that all of the above is only going to work if you have auto-login enabled.
Since you're using the desktop you won't need to modify bashrc. But fyi, changes to bashrc are immediate, no reboot needed. They'll happen as soon as you open a new terminal (but won't change any terminal sessions which are already open). Your desktop would still be active over HDMI though. So even if your changes to bashrc broke something, you'd be able to go onto the desktop and fix it from there.
A new terminal session starts whenever you open a new terminal, a new terminal tab, or change to a new tty, or SSH onto a device. The terminal environment stuff should run as long as it's in crontab or in your Startup Applications, as long as you've got automatic login turned on. Regarding Ctrl + Alt + F1 and using the terminal instead of the desktop, I think running a terminal window with tmux on the desktop would be the safest solution. |
I'm not sure if it's necessary. The shutdown script is something I copied from someone else. The image I use is just a fully white PNG file with black text of "SLEEP MODE" in the middle. |
Hi @mcarr823. I was hoping I could manage by myself the rest of the way, since you've been extremely helpful and I feel really bad bugging you again and again, but unfortunately it hasn't been the case. I can't crack a way to switch to tty1 and open vim automatically. Thing is, my Raspbian OS/Raspberry Pi OS doesn't have any Startup Applications feature like the one you described. So I tried doing the following:
I also changed the permissions with chmod as with the previous file.
When rebooting nothing happens one way or the other. When executing the script by itself my tty displays a "main: missing or unsuitable terminal" message. When choosing the "Execute in Terminal" option it actually works, though. So I guess there's something missing that I can't figure out. Also, since changing the .bashrc file now my terminal displays that it's bash, which I don't care, it's fine, but it also displays the time at the bottom. I got worried it might impact my refresh rate and I don't know how to hide it, but now it's appearing on every terminal session, I guess since I'm working through tmux? For the life of me I can't figure out if I have openvt installed. Normally it's pretty easy to Google how to install any utility but in this case I was completely lost. Maybe that's the issue. Right now my RPi is at the workshop since I just got my keyboard and I have someone making a "laptop" case for it. I'll have it finished by next week and will be able to try again. I was thinking maybe I could switch OS to something like Mint, the one you have installed, but if it impacts the work i've done so far I'd rather manage as it is. Anyway, thank you for all the help so far and feel free to ignore me if I'm asking too much. |
@javierdepascual It's no problem. I'd love to see what you end up with.
Alright, I've just set up Raspberry Pi OS on a device here.
Linux Mint doesn't have an ARM64 version, but other distros would work. Here's what I wound up doing from a fresh install of Raspberry Pi OS. Approach AInvolves using tmux to talk between tty1 and tty7. Approach BInvolves switching ttys. *In hindsight, approach "b" might actually work with crontab and the default raspberry pi desktop. Anyway, I'll list the process for both below. 1. Open a terminal2a. Install tmux
3a. Create a script for running tmuxJust copy and paste the whole block into a terminal.
Replace "echo testing" with the command you want to run. 4. Create a script for running paperttyAgain, just copy and paste the whole block into a terminal.
Replace the papertty command with one that matches your desired driver, font, etc. 5. Install xfceIn your terminal run 6. Update the login screen
Change "greeter-session" from "pi-greeter" to "lightdm-gtk-greeter"
Save the file. Commenting out the autologin-session should make it autologin to your last used session. lightdm-gtk-greeter is the default login screen for lightdm. 7. Restart lightdm
8. Select xfceUp the top right of the login screen there are now 3 icons. 9a. Focus stealing prevention (optional)Go to Applications -> Settings -> Window Manager Tweaks 10a. Run tmux on loginGo to Applications -> Settings -> Session and Startup
10b. Switch ttys on loginGo to Applications -> Settings -> Session and Startup
You MIGHT need to add a delay to this command so that papertty can run first. 11. Run papertty on loginSame as the previous step, click on Add and give it details like
And that should just about do it. |
I've been working on automating the above process (and the entire setup of papertty) and ultimately created a repository here: https://github.com/mcarr823/papertty-init They're a couple of scripts you can run from a fresh install of Raspberry Pi OS (or Lite) which try to automate everything from start to finish, including enabling SPI, installing papertty's dependencies, running papertty on startup, and so on. |
Hello @mcarr823 and, again, thank you for providing such a comprehensive and detailed solution. And happy new year! It's been a while since the last time I could work on this. I sent the RPi to a carpenter to work on a prototype case and he got delayed. Now I'm on vacation trying to finish everything so I can start writing! I must say I encountered a bunch of issues with what you suggested, mainly because of my lack of Linux knowledge. But I'm learning a bit 🤪 I even forgot my login credentials when switching to xfce and had to remount the drive and change the password... anyway. I tried both A and B methods. Here's my drawbacks:
So yeah, neither of them got it to work exactly as I expected, but I can't complain since I basically have it 95% done. I also started using syncthing (tremendous recommendation, thank you) so the file transfering to my main computers is solved. Finally, I tried using your solution for a shutdown screensaver but for some reason it doesn't work. I had to change the permissions of the system-shutdown folder, but I don't know what I'm doing wrong. Anyway, I also tried your papertty-init script to check how it works and it's pretty intuitive. The only thing that might generate issues is the problem with screen/terminal re-sizing that I mentioned for method A. |
@javierdepascual I haven't tried this on a raspberry pi, but for Method B you could try something like |
Unfortunately it doesn't work! I don't know why. It doesn't even switch to tty1. When I create a script to do the same commands it does switch to tty1 but it doesn't run the command to launch the index. |
Ok, when writing a script with those commands it does work but the input becomes scrambled, basically I get a very weird vim window and whenever I write on it letters appear on various places around the screen. Very difficult to explain. It works but it goes wrong. Asking ChatGPT (lol) it suggested using tmux for that input, but I'm completely lost. Another weird issue is happening when applying your shutdown service script. First of all, I tried placing it on the system-shutdown folder but it didn't work. Researching about systemd there's like 3 places where I can put my scripts, weirdly enough. I've decided placing them on the /lib/systemd/system folder. Then, I used the I know you already helped a lot @mcarr823, I'll keep researching and try to solve both issues. I'm also writing this down in case someone else runs into these same issues. |
Hmm, I see what you mean. It worked on my PC, but that's a rather different environment. I suspect it's because tty1 already exists, which is why the "-f" (force) in the openvt command is needed. Opening a new vt seems to work, but only from a different tty. Not from the desktop. I suspect the solution here might be to use a systemd script instead of using the desktop environment's autostart commands. Regarding the shutdown script, I believe running "systemctl enable" isn't required if it's in the system-shutdown directory. |
I'm having issues understanding how to configure and operate with papertty terminal at boot. Specifically, I configured properly the services file and the start.sh file but I struggle to understand what to do here:
Then (read the unit file more carefully and) do the following steps:
sudo cp papertty.service /etc/systemd/system
sudo systemctl daemon-reload
sudo systemctl enable papertty
To disable the service:
sudo systemctl disable papertty
sudo systemctl stop papertty
This will incorporate the service with systemd and enables it. Before rebooting and trying it out, you may want to stop any other instances of the papertty.py and then see if the service works:
I'm not experience on these matters so it definitely is an issue on my end, but I hope someone can help me. I'm really close with my setup.
The text was updated successfully, but these errors were encountered: