0

I am setting up a RPi Zero W with Adafruit's 3.5" PiTFT touchscreen and my only input to the Pi is either through ssh or by editing files from another system running Ubuntu.

On my latest run, in trying to set a graphical mode that I can program on (in Java), I set the Pi to auto-login to desktop via raspi-config. Upon boot now, the screen is black and the Pi is not connecting to the network (whereas it did previously in command line mode).

I looked through /var/log/messages and see IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready yet no connection is made. I have the correct settings configured in /etc/wpa_supplicant/wpa_supplicant.conf and do not have /etc/network/interfaces configured, which other answers seem to point to for fixing connectivity.

So, I need to return my Pi to runlevel 3 (multi-user.target) without being able to run commands on my Pi (so I can't use the usual systemctl or raspi-config approaches). This question suggests this could be done in older versions of Raspbian by editing /etc/inittab but this no longer exists with the switch to systemd.

How can I return my Pi to command-line mode from graphical mode by editing files directly?

I am running the 3/14/2018 Raspbian Stretch build.

  • @SDsolar In this case, I do not have access to the command line, only the filesystem, so I cannot run commands. – FThompson May 15 '18 at 3:48
  • @SDsolar It's a Raspberry Pi Zero W and I don't have a keyboard, mouse, or screen for it. I can only access it over SSH when it successfully connects to my wifi but in this case it was not successfully connecting when booting into graphical mode (which I had told it to do via raspi-config). Thus, without any way to interact with my Pi, I could only modify the files by placing the SD card in another computer, thus spawning this question. – FThompson May 15 '18 at 17:52
  • @SDsolar I can't start an SSH connection as the Pi isn't connecting to WiFi when it has been configured to boot in desktop mode. That's why I needed some way to return my Pi to command line mode by directly editing the SD card removed from the Pi. Ingo's answer does exactly that. – FThompson May 15 '18 at 22:51
1

The default unit systemd starts at bootup can be overridden with the systemd.unit= kernel command line option. So you can edit cmdline.txt (mounted on your Ubuntu system) and append the parameter

systemd.unit=multi-user.target

Then your raspi should start to this target. I don't know what's wrong with your system but there are much more targets you can boot in so you may find one that will give you the possibility to repair your system. Maybe

systemd.unit=emergency.target

Don't know if you have network running with this. Look at

Kernel command line parameters
Special systemd units

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.