How To: Convert VSIDO to OpenRC and remove systemd

VastOne

I have successfully converted VSIDO test builds to OpenRC and wiped out systemd and systemd-sysv

In order to have a conversation and tests about this process and OpenRC, you must be able to first convert a VSIDO system like I did. This How To will show the steps needed and the files needed to make it work

I am also building test ISO's with these changes already in place and will put them up somewhere for those who want to assist in testing the builds with OpenRC

You will need 2 new files and to edit 2 files.

New vsido-exit

Replace the contents of /usr/bin/vsido-exit with this:

#!/usr/bin/python

import pygtk
pygtk.require('2.0')
import gtk
import os
import getpass

class cb_exit:
def disable_buttons(self):
self.cancel.set_sensitive(False)
self.logout.set_sensitive(False)
self.suspend.set_sensitive(False)
self.reboot.set_sensitive(False)
self.shutdown.set_sensitive(False)

def cancel_action(self,btn):
self.disable_buttons()
gtk.main_quit()

def logout_action(self,btn):
self.disable_buttons()
for line in os.popen("wmctrl -m"):
parts = line.split()
if parts[0] == "Name:":
wmName = parts[1].lower()
self.status.set_label("Exiting " + wmName + ", please standby...")
os.system("killall " + wmName)

def suspend_action(self,btn):
self.disable_buttons()
self.status.set_label("Suspending, please standby...")
os.system("cb-lock")
os.system("dbus-send --system --print-reply --dest=\"org.freedesktop.UPower\" /org/freedesktop/UPower org.freedesktop.UPower.Suspend")
gtk.main_quit()

def reboot_action(self,btn):
self.disable_buttons()
self.status.set_label("Rebooting, please standby...")
os.system("sudo reboot")

def shutdown_action(self,btn):
self.disable_buttons()
self.status.set_label("Shutting down, please standby...")
os.system("sudo shutdown -h now")

def create_window(self):
self.window = gtk.Window()
title = "Log out " + getpass.getuser() + "? Choose an option:"
self.window.set_title(title)
self.window.set_border_width(5)
self.window.set_size_request(500, 80)
self.window.set_resizable(False)
self.window.set_keep_above(True)
self.window.stick
self.window.set_position(1)
self.window.connect("delete_event", gtk.main_quit)
windowicon = self.window.render_icon(gtk.STOCK_QUIT, gtk.ICON_SIZE_MENU)
self.window.set_icon(windowicon)


#Create HBox for buttons
self.button_box = gtk.HBox()
self.button_box.show()

#Cancel button
self.cancel = gtk.Button(stock = gtk.STOCK_CANCEL)
self.cancel.set_border_width(4)
self.cancel.connect("clicked", self.cancel_action)
self.button_box.pack_start(self.cancel)
self.cancel.show()

#Logout button
self.logout = gtk.Button("_Log out")
self.logout.set_border_width(4)
self.logout.connect("clicked", self.logout_action)
self.button_box.pack_start(self.logout)
self.logout.show()

#Suspend button
self.suspend = gtk.Button("_Suspend")
self.suspend.set_border_width(4)
self.suspend.connect("clicked", self.suspend_action)
self.button_box.pack_start(self.suspend)
self.suspend.show()

#Reboot button
self.reboot = gtk.Button("_Reboot")
self.reboot.set_border_width(4)
self.reboot.connect("clicked", self.reboot_action)
self.button_box.pack_start(self.reboot)
self.reboot.show()

#Shutdown button
self.shutdown = gtk.Button("_Power off")
self.shutdown.set_border_width(4)
self.shutdown.connect("clicked", self.shutdown_action)
self.button_box.pack_start(self.shutdown)
self.shutdown.show()

#Create HBox for status label
self.label_box = gtk.HBox()
self.label_box.show()
self.status = gtk.Label()
self.status.show()
self.label_box.pack_start(self.status)

#Create VBox and pack the above HBox's
self.vbox = gtk.VBox()
self.vbox.pack_start(self.button_box)
self.vbox.pack_start(self.label_box)
self.vbox.show()

self.window.add(self.vbox)
self.window.show()

def __init__(self):
self.create_window()


def main():
    gtk.main()

if __name__ == "__main__":
    go = cb_exit()
    main()


New sudoers file

Replace the contents of /etc/sudoers with this content:

#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset
Defaults mail_badpass
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root ALL=(ALL:ALL) ALL

# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL

# See sudoers(5) for more information on "#include" directives:

#includedir /etc/sudoers.d

ALL ALL=NOPASSWD:/sbin/reboot
ALL ALL=NOPASSWD:/sbin/shutdown


Create a new 10-network.rules file in /etc/udev/rules.d with this content:

SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="08:00:27:5a:67:5b", NAME="eth0"

NOTE Your ATTR{address} is your mac address and is completely different than this one above

In terminal do this:

ifconfig -a

Change the above ATTR{address}== to match yours

It will be after ether and look like this:

ether 00:24:1d:76:86:86

Edit your /etc/network/interfaces and make sure what ever network interface is there says eth0 ... change it to eth0

This is how it should look

/etc/network/interfaces

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
iface eth0 inet dhcp


In terminal:

get openrc

prg systemd systemd-sys

get sysvinit

reboot

Profit

Test and let me know if I missed anything
VSIDO      VSIDO Change Blog    

    I dev VSIDO

zephyr

@VastOne: Works! Instructions easy and complete, followed steps and Openrc is installed. Ran Ceni and have eth0 now as well. On bootup script stated Openrc so I would guess all is well and complete. 

This was on a fresh drive and most recent release, ran "vsido-welcome" screens, note that some of the the packages like "gvfs" for Thunar were no longer present, and reinstalled so far what I am missing. May just re-run welcome screens.   

Nice job, thanks - Z

CROWZ / STAR / Devuan / refracta / VSIDO

VastOne

^ thanks for testing and confirming Z!

I am also now testing ISO's I have created that are OpenRC only... If the installs tested go well I will release the location of these ISO's for anyone else to test
VSIDO      VSIDO Change Blog    

    I dev VSIDO

PackRat

Should make for an interesting build; well done.

Although, I think your replacement for vsido-exit will only log out of openbox. The other options should work.
I am tired of talk that comes to nothing.
-- Chief Joseph

...the sun, the darkness, the winds are all listening to what we have to say.
-- Geronimo

VastOne

^ They (reboot and shutdown) are working fine in FluxBox... perhaps you can edit to make it even better or syntax correct?

Not sure

My issue now is getting eth0 and wlan0 back as the default naming conventions... proving to be a pain in my arse
VSIDO      VSIDO Change Blog    

    I dev VSIDO

PackRat

#5
Just change the logout stanza:

<snip>

# comment out the openbox logout
# def logout_action(self,btn):
# self.disable_buttons()
# self.status.set_label("Exiting Openbox, please standby...")
# os.system("openbox --exit")

# add stanza to logout of any window manager - can this be more elegant coding?
#
def logout_action(self,btn):
self.disable_buttons()
for line in os.popen("wmctrl -m"):
parts = line.split()
if parts[0] == "Name:":
wmName = parts[1].lower()
self.status.set_label("Exiting " + wmName + ", please standby...")
os.system("killall " + wmName)

<snip>


that should allow the user to log out of most window managers - some tilers (dwm, spectrwm, others?) don't work with this method/syntax; I don't remember why.
I am tired of talk that comes to nothing.
-- Chief Joseph

...the sun, the darkness, the winds are all listening to what we have to say.
-- Geronimo

VastOne

^ thanks for that mate.. I had not even looked in depth at the file as I was happy that shutdown and reboot worked

Take a look at this... all of the 'ways and means' of changing back to eth0 and wan0 from every damned distro that uses systemd is failing.. I have used every solution I could find over the last 3 hours to no avail

SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="cat /sys/class/net/enp0s3/address", NAME="eth0"

cat /sys/class/net/enp0s3/address works from terminal, it should work from that /etc/udev/rules.d/10-network.rules file

having the mac address there is great on a one to one basis, but unless I can find a way to go back to eth0 and wlan0 a different way, this is a fruitless journey... every time on a new install the mac address is different ... so having a static mac in that file makes the network fail on a new boot

I am tired now and probably not making much sense ... try to deduce if you or anyone can

thanks
VSIDO      VSIDO Change Blog    

    I dev VSIDO

Snap

Thanks for this, VastOne. Gonna bork my Vsido install right now.  :P

misko_2083

Quote from: VastOne on January 07, 2016, 05:23:58 AM
^ thanks for that mate.. I had not even looked in depth at the file as I was happy that shutdown and reboot worked

Take a look at this... all of the 'ways and means' of changing back to eth0 and wan0 from every damned distro that uses systemd is failing.. I have used every solution I could find over the last 3 hours to no avail

SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="cat /sys/class/net/enp0s3/address", NAME="eth0"

cat /sys/class/net/enp0s3/address works from terminal, it should work from that /etc/udev/rules.d/10-network.rules file

having the mac address there is great on a one to one basis, but unless I can find a way to go back to eth0 and wlan0 a different way, this is a fruitless journey... every time on a new install the mac address is different ... so having a static mac in that file makes the network fail on a new boot

I am tired now and probably not making much sense ... try to deduce if you or anyone can

thanks
It could be the syntax :)
Try:
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="$(cat /sys/class/net/enp0s3/address)", NAME="eth0"

or
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}== "$(cat /sys/class/net/enp0s3/address)",ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
This smartphone is hard to type on. I miss my Nokia :D

PackRat

@vastone

I wonder if the network issues are related to udev being rolled into systemd. You may need to get eudev installed and working as well.

I know there is some documentation on the gentoo site for installing openrc; maybe a look at the denuvan packages would helo.
I am tired of talk that comes to nothing.
-- Chief Joseph

...the sun, the darkness, the winds are all listening to what we have to say.
-- Geronimo

VastOne

Quote from: PackRat on January 07, 2016, 03:39:18 AM
Just change the logout stanza:

snip...

that should allow the user to log out of most window managers - some tilers (dwm, spectrwm, others?) don't work with this method/syntax; I don't remember why.

made these changes to the code above

thanks
VSIDO      VSIDO Change Blog    

    I dev VSIDO

VastOne

As far as a build goes, I am halting the process for now.  uedev and vdev are a long long way from debian ways and packaging (or so it seems to me) and I have little patience to go through it now

Here is a detailed read about vdev and OpenRC

I have initiated a start here and a discussion and as RatMan first pointed out a How To

I am not against systemd, I am always looking at options...

udev is the culprit... It has hooks in many many things. We have proven you can take systemd out and run but you cannot totally remove systemd as long as udev is still involved
VSIDO      VSIDO Change Blog    

    I dev VSIDO

VastOne

Quote from: misko_2083 on January 07, 2016, 10:41:35 AM
It could be the syntax :)
Try:
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="$(cat /sys/class/net/enp0s3/address)", NAME="eth0"

or
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}== "$(cat /sys/class/net/enp0s3/address)",ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
This smartphone is hard to type on. I miss my Nokia :D

Tried this and several hundred (thousand???) different iterations of the syntax and variables and it all failed...

I am now going to test a way to get VSIDO with systemd to use the standard eth0 and wlan0... I think the issue is that systemd is gone and took with it some working solutions such as this one...

Will let you know how it goes

Thanks for the suggestions
VSIDO      VSIDO Change Blog    

    I dev VSIDO

PackRat

I am tired of talk that comes to nothing.
-- Chief Joseph

...the sun, the darkness, the winds are all listening to what we have to say.
-- Geronimo

VastOne

^ HA!  ... an hour ago I predicted this...  ::)

V-TOO-O?

V-GTOO-O?

V-GTO-O?

:D  8)
VSIDO      VSIDO Change Blog    

    I dev VSIDO