Skip to content

Added ArchLinux support. - #2

Merged
TheKinrar merged 7 commits into
angristan:masterfrom
TheKinrar:master
Nov 26, 2016
Merged

Added ArchLinux support.#2
TheKinrar merged 7 commits into
angristan:masterfrom
TheKinrar:master

Conversation

@TheKinrar

Copy link
Copy Markdown
Contributor

No description provided.

Comment thread openvpn-install.sh Outdated
# Else, the distro is ArchLinux
echo ""
echo ""
echo "As you're using ArchLinux, I need to update the packages on your system to install whose I need."

@angristan angristan Nov 21, 2016

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With APT, when a package requires dependencies, and those dependencies are installed and have updates availble, they're updated when the package is installed. In the same way, when an update for the installed package example is available, doing apt install example will just update the package.

I assume it works the same way for pacman ? Correct me if I'm wrong.

Thus, I don't think that adding -u to the pacman command is needed. Not that this is not a good idea, but I don't want the script to be too intrusive for the user. The -y is a good idea, though.

Comment thread openvpn-install.sh Outdated
OS=arch
RCLOCAL='/etc/rc.local'
# Needed for rc.local support on ArchLinux
echo "[Unit]

@angristan angristan Nov 21, 2016

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You confirm that lines 51 to 62 this add a functionnal rc.local, and therefore resolving #1 ?

@TheKinrar

Copy link
Copy Markdown
Contributor Author

I assume it works the same way for pacman ? Correct me if I'm wrong.

When just using -S, pacman will only install specified packages, and won't update dependencies, unless a more recent version is needed by one of the specified packages.
To sum up, pacman will just do what's needed to have the dependencies fulfilled.

The problem is, we can't just do -S because if another version is out, the old one won't be available in the repositories and the install will fail.

The -y is a good idea, though.

Yes this is the solution to this problem, but it is highly discouraged to do -Sy, as of what I just explained. Archlinux is meant to kept up to date, packages have to be updated all the same time. Things may break even if the dependencies are still fulfilled.

Thus, I don't think that adding -u to the pacman command is needed.

So, even if I agree with you, it's a little bit intrusive, but Arch is meant that way.

You confirm that lines 51 to 62 this add a functionnal rc.local, and therefore resolving #1 ?

Absolutely.

@angristan

Copy link
Copy Markdown
Owner

You're right : https://wiki.archlinux.org/index.php/Pacman#Installing_packages

Warning: When installing packages in Arch, avoid refreshing the package list without upgrading the system (for example, when a package is no longer found in the official repositories). In practice, do not run pacman -Sy package_name instead of pacman -Syu package_name, as this could lead to dependency issues.

I can't argue with the Arch Documentation 🙄

@angristan

Copy link
Copy Markdown
Owner

So as for me, the installation works fine, and I can ping 10.8.0.2.

However, it seems to be an issue with the firewall, the server does not forward the traffic, so I can't access anyting outside the server.

@TheKinrar

Copy link
Copy Markdown
Contributor Author

It worked fine for me. Can you check the actual iptables rules ?

Openvpn log may be interesting too.

@angristan

Copy link
Copy Markdown
Owner

There is no iptables rules, that's the problem.

The OpenVPN logs don't say anything about this as it's not related to OpenVPN

@TheKinrar

Copy link
Copy Markdown
Contributor Author

Oh, I see.

I suppose iptables was installed by the script, and as it does not start nor enable it, it's not working. I'm writing a fix now.
Can you confirm this is the problem by running systemctl status iptables?

@angristan

Copy link
Copy Markdown
Owner

iptables is already present on my installation, but it is indeed not started. I'm not sure it's the problem though, because I just reinstalled the server and the installer shows me this at the end :

sed: can't read /etc/sysctl.conf: No such file or directory
grep: /etc/sysctl.conf: No such file or directory
iptables v1.6.0: can't initialize iptables table `nat': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.

However OpenVPN is sucsessfully installed

@angristan

Copy link
Copy Markdown
Owner

Okay so

iptables v1.6.0: can't initialize iptables table `nat': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.

is on me, I had to reinstall Linux from the Arch repo, which was not the case (thanks Online...)

@TheKinrar

Copy link
Copy Markdown
Contributor Author

So this is working now?

However the fix I just done was necessary as if iptables was not started, the changes done would have had no effect

@angristan

Copy link
Copy Markdown
Owner

It works, but the traffic is not forwarded after a reboot. The iptables rule is not set

@angristan angristan mentioned this pull request Nov 23, 2016
@TheKinrar

Copy link
Copy Markdown
Contributor Author

Can you show the contents of the file /etc/rc.local and the output of systemctl status rc-local please?

@angristan

Copy link
Copy Markdown
Owner
[root@server ~]# cat /etc/rc.local
[root@server ~]# systemctl status rc-local
* rc-local.service - /etc/rc.local compatibility
   Loaded: loaded (/etc/systemd/system/rc-local.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Wed 2016-11-23 20:18:51 CET; 1h 55min ago
  Process: 318 ExecStart=/etc/rc.local (code=exited, status=203/EXEC)
 Main PID: 318 (code=exited, status=203/EXEC)

Nov 23 20:18:51 sd-80765 systemd[1]: Starting /etc/rc.local compatibility...
Nov 23 20:18:51 sd-80765 systemd[1]: rc-local.service: Main process exited, code=exited, status=203/EXEC
Nov 23 20:18:51 sd-80765 systemd[1]: Failed to start /etc/rc.local compatibility.
Nov 23 20:18:51 sd-80765 systemd[1]: rc-local.service: Unit entered failed state.
Nov 23 20:18:51 sd-80765 systemd[1]: rc-local.service: Failed with result 'exit-code'.
[root@sd-80765 stan]#

@TheKinrar

Copy link
Copy Markdown
Contributor Author

New fix, working on my server even after a reboot now.

@angristan

Copy link
Copy Markdown
Owner

Does not work for me, but to be sure I'm gonna reinstall the server from scratch.

I checked the use of sysctl for Arch and it seems that the file is not located in the right folder : https://wiki.archlinux.org/index.php/Sysctl (does not affect the current issue tough)

Also, I think the script should add the rc.local file after it ask them if they want to continue. If the user cancel the installation, the script should not have touched anything on the system

@TheKinrar

TheKinrar commented Nov 24, 2016

Copy link
Copy Markdown
Contributor Author

My bad, it was working on my server because of an old weird thing I've done to support this path..

Fixing this now, with the suggestion you have juste done.

@TheKinrar

Copy link
Copy Markdown
Contributor Author

Still working for me, starting from scratch, with these new changes.

@angristan

Copy link
Copy Markdown
Owner

Ok I'll test asap

@angristan

Copy link
Copy Markdown
Owner

Same problem after a reboot.

[root@server ~]# iptables -t nat -L
Chain PREROUTING (policy ACCEPT)
target     prot opt source               destination

Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

Chain POSTROUTING (policy ACCEPT)
target     prot opt source               destination

@angristan

Copy link
Copy Markdown
Owner

rc-local is not working :

[root@server ~]# systemctl status rc-local.service -l
* rc-local.service - /etc/rc.local compatibility
   Loaded: loaded (/etc/systemd/system/rc-local.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Fri 2016-11-25 16:37:06 CET; 10s ago
  Process: 484 ExecStart=/etc/rc.local (code=exited, status=203/EXEC)
 Main PID: 484 (code=exited, status=203/EXEC)

Nov 25 16:37:06 sd-80765 systemd[1]: Starting /etc/rc.local compatibility...
Nov 25 16:37:06 sd-80765 systemd[1]: rc-local.service: Main process exited, code=exited, status=203/EXEC
Nov 25 16:37:06 sd-80765 systemd[1]: Failed to start /etc/rc.local compatibility.
Nov 25 16:37:06 sd-80765 systemd[1]: rc-local.service: Unit entered failed state.
Nov 25 16:37:06 sd-80765 systemd[1]: rc-local.service: Failed with result 'exit-code'.

@TheKinrar

Copy link
Copy Markdown
Contributor Author

What's inside rc.local file and systemd unit file?

@angristan

Copy link
Copy Markdown
Owner
[root@server ~]# cat /etc/rc.local
#!/bin/bash
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -j SNAT --to 123.123.123.123

[root@server ~]# cat /etc/systemd/system/rc-local.service
[Unit]
Description=/etc/rc.local compatibility

[Service]
Type=oneshot
ExecStart=/etc/rc.local
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target


@TheKinrar

Copy link
Copy Markdown
Contributor Author

This is an old version of the script, not fixed.

Either remove it and start from scratch the install, or just replace ExecStart=/etc/rc.local by ExecStart=/bin/bash /etc/rc.local

@angristan

Copy link
Copy Markdown
Owner

@TheKinrar

Copy link
Copy Markdown
Contributor Author

Fixed...

Avoid starting from stratch by executing chmod +x /etc/rc.local if you want.

@angristan

Copy link
Copy Markdown
Owner

Works too thanks.

I'll make some more tests, and then I'll fix the conflicts for the merge

@TheKinrar
TheKinrar merged commit c659a47 into angristan:master Nov 26, 2016
@angristan

Copy link
Copy Markdown
Owner

Thanks 🤗

timbo2k referenced this pull request in timbo2k/openvpn-install Mar 5, 2021
HumbleSpirit pushed a commit to HumbleSpirit/openvpn-install that referenced this pull request Aug 21, 2022
manish-blueed pushed a commit to manish-blueed/openvpn-install that referenced this pull request Apr 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants